mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Introduces the new DeclarationsArrayBuilder and adds it to the EditorConsumer. Declaration info always includes a kind, offset, and length, and includes a USR where applicable. As the USR is already available for editor.open.interface type requests, this doesn't compute any new information, it just exposes more of what's there already.
68 lines
2.4 KiB
C++
68 lines
2.4 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "SourceKit/Core/LangSupport.h"
|
|
|
|
namespace SourceKit {
|
|
|
|
class NullEditorConsumer : public EditorConsumer {
|
|
bool needsSemanticInfo() override { return needsSema; }
|
|
|
|
void handleRequestError(const char *Description) override {
|
|
llvm_unreachable("unexpected error");
|
|
}
|
|
|
|
bool syntaxMapEnabled() override { return false; }
|
|
|
|
void handleSyntaxMap(unsigned Offset, unsigned Length, UIdent Kind) override {
|
|
}
|
|
|
|
void handleSemanticAnnotation(unsigned Offset, unsigned Length, UIdent Kind,
|
|
bool isSystem) override {}
|
|
|
|
void handleDeclaration(unsigned Offset, unsigned Length, UIdent Kind,
|
|
StringRef USR) override {}
|
|
|
|
bool documentStructureEnabled() override { return false; }
|
|
|
|
void beginDocumentSubStructure(
|
|
unsigned Offset, unsigned Length, UIdent Kind, UIdent AccessLevel,
|
|
UIdent SetterAccessLevel, unsigned NameOffset, unsigned NameLength,
|
|
unsigned BodyOffset, unsigned BodyLength, unsigned DocOffset,
|
|
unsigned DocLength, StringRef DisplayName, StringRef TypeName,
|
|
StringRef RuntimeName, StringRef SelectorName,
|
|
ArrayRef<StringRef> InheritedTypes,
|
|
ArrayRef<std::tuple<UIdent, unsigned, unsigned>> Attrs) override {}
|
|
|
|
void endDocumentSubStructure() override {}
|
|
|
|
void handleDocumentSubStructureElement(UIdent Kind, unsigned Offset,
|
|
unsigned Length) override {}
|
|
|
|
void recordAffectedRange(unsigned Offset, unsigned Length) override {}
|
|
|
|
void recordAffectedLineRange(unsigned Line, unsigned Length) override {}
|
|
|
|
bool diagnosticsEnabled() override { return false; }
|
|
|
|
void handleDiagnostics(ArrayRef<DiagnosticEntryInfo> DiagInfos,
|
|
UIdent DiagStage) override {}
|
|
void recordFormattedText(StringRef Text) override {}
|
|
|
|
void handleSourceText(StringRef Text) override {}
|
|
|
|
public:
|
|
bool needsSema = false;
|
|
};
|
|
|
|
} // end namespace SourceKit
|