|
| 1 | +//===----------------------------------------------------------------------===// |
| 2 | +// |
| 3 | +// This source file is part of the Swift.org open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors |
| 6 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +// |
| 8 | +// See https://swift.org/LICENSE.txt for license information |
| 9 | +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +#include "SourceKit/Core/LangSupport.h" |
| 14 | + |
| 15 | +namespace SourceKit { |
| 16 | + |
| 17 | +class NullEditorConsumer : public EditorConsumer { |
| 18 | + bool needsSemanticInfo() override { return needsSema; } |
| 19 | + |
| 20 | + void handleRequestError(const char *Description) override { |
| 21 | + llvm_unreachable("unexpected error"); |
| 22 | + } |
| 23 | + |
| 24 | + bool syntaxMapEnabled() override { return true; } |
| 25 | + |
| 26 | + void handleSyntaxMap(unsigned Offset, unsigned Length, UIdent Kind) override { |
| 27 | + } |
| 28 | + |
| 29 | + void handleSemanticAnnotation(unsigned Offset, unsigned Length, UIdent Kind, |
| 30 | + bool isSystem) override {} |
| 31 | + |
| 32 | + bool documentStructureEnabled() override { return false; } |
| 33 | + |
| 34 | + void beginDocumentSubStructure( |
| 35 | + unsigned Offset, unsigned Length, UIdent Kind, UIdent AccessLevel, |
| 36 | + UIdent SetterAccessLevel, unsigned NameOffset, unsigned NameLength, |
| 37 | + unsigned BodyOffset, unsigned BodyLength, unsigned DocOffset, |
| 38 | + unsigned DocLength, StringRef DisplayName, StringRef TypeName, |
| 39 | + StringRef RuntimeName, StringRef SelectorName, |
| 40 | + ArrayRef<StringRef> InheritedTypes, |
| 41 | + ArrayRef<std::tuple<UIdent, unsigned, unsigned>> Attrs) override {} |
| 42 | + |
| 43 | + void endDocumentSubStructure() override {} |
| 44 | + |
| 45 | + void handleDocumentSubStructureElement(UIdent Kind, unsigned Offset, |
| 46 | + unsigned Length) override {} |
| 47 | + |
| 48 | + void recordAffectedRange(unsigned Offset, unsigned Length) override {} |
| 49 | + |
| 50 | + void recordAffectedLineRange(unsigned Line, unsigned Length) override {} |
| 51 | + |
| 52 | + bool diagnosticsEnabled() override { return false; } |
| 53 | + |
| 54 | + void handleDiagnostics(ArrayRef<DiagnosticEntryInfo> DiagInfos, |
| 55 | + UIdent DiagStage) override {} |
| 56 | + void recordFormattedText(StringRef Text) override {} |
| 57 | + |
| 58 | + void handleSourceText(StringRef Text) override {} |
| 59 | + |
| 60 | +public: |
| 61 | + bool needsSema = false; |
| 62 | +}; |
| 63 | + |
| 64 | +} // end namespace SourceKit |
0 commit comments