14
14
#define LLVM_SOURCEKIT_CORE_LANGSUPPORT_H
15
15
16
16
#include " SourceKit/Core/LLVM.h"
17
+ #include " SourceKit/Support/CancellationToken.h"
17
18
#include " SourceKit/Support/UIdent.h"
18
- #include " llvm/Support/VersionTuple .h"
19
+ #include " swift/AST/Type .h"
19
20
#include " llvm/ADT/ArrayRef.h"
20
21
#include " llvm/ADT/IntrusiveRefCntPtr.h"
21
22
#include " llvm/ADT/Optional.h"
22
23
#include " llvm/ADT/SmallString.h"
23
- #include " swift/AST/Type .h"
24
+ #include " llvm/Support/VersionTuple .h"
24
25
#include " llvm/Support/VirtualFileSystem.h"
25
26
#include < functional>
26
27
#include < memory>
@@ -737,6 +738,8 @@ class LangSupport {
737
738
738
739
virtual void dependencyUpdated () {}
739
740
741
+ virtual void cancelRequest (SourceKitCancellationToken CancellationToken) = 0;
742
+
740
743
virtual void indexSource (StringRef Filename,
741
744
IndexingConsumer &Consumer,
742
745
ArrayRef<const char *> Args) = 0;
@@ -794,10 +797,11 @@ class LangSupport {
794
797
bool SynthesizedExtensions,
795
798
StringRef swiftVersion) = 0;
796
799
797
- virtual void editorOpenSwiftSourceInterface (StringRef Name,
798
- StringRef SourceName,
799
- ArrayRef<const char *> Args,
800
- std::shared_ptr<EditorConsumer> Consumer) = 0;
800
+ virtual void
801
+ editorOpenSwiftSourceInterface (StringRef Name, StringRef SourceName,
802
+ ArrayRef<const char *> Args,
803
+ SourceKitCancellationToken CancellationToken,
804
+ std::shared_ptr<EditorConsumer> Consumer) = 0 ;
801
805
802
806
virtual void editorClose (StringRef Name, bool RemoveCache) = 0;
803
807
@@ -821,33 +825,37 @@ class LangSupport {
821
825
unsigned Length,
822
826
EditorConsumer &Consumer) = 0;
823
827
828
+ virtual void getCursorInfo (
829
+ StringRef Filename, unsigned Offset, unsigned Length, bool Actionables,
830
+ bool SymbolGraph, bool CancelOnSubsequentRequest,
831
+ ArrayRef<const char *> Args, Optional<VFSOptions> vfsOptions,
832
+ SourceKitCancellationToken CancellationToken,
833
+ std::function<void (const RequestResult<CursorInfoData> &)> Receiver) = 0;
834
+
824
835
virtual void
825
- getCursorInfo (StringRef Filename, unsigned Offset, unsigned Length,
826
- bool Actionables, bool SymbolGraph,
827
- bool CancelOnSubsequentRequest, ArrayRef<const char *> Args,
828
- Optional<VFSOptions> vfsOptions,
829
- std::function<void (const RequestResult<CursorInfoData> &)> Receiver) = 0 ;
830
-
831
- virtual void getNameInfo (StringRef Filename, unsigned Offset,
832
- NameTranslatingInfo &Input,
833
- ArrayRef<const char *> Args,
834
- std::function<void (const RequestResult<NameTranslatingInfo> &)> Receiver) = 0;
835
-
836
- virtual void getRangeInfo (StringRef Filename, unsigned Offset, unsigned Length,
837
- bool CancelOnSubsequentRequest,
838
- ArrayRef<const char *> Args,
839
- std::function<void (const RequestResult<RangeInfo> &)> Receiver) = 0;
836
+ getNameInfo (StringRef Filename, unsigned Offset, NameTranslatingInfo &Input,
837
+ ArrayRef<const char *> Args,
838
+ SourceKitCancellationToken CancellationToken,
839
+ std::function<void (const RequestResult<NameTranslatingInfo> &)>
840
+ Receiver) = 0 ;
841
+
842
+ virtual void getRangeInfo (
843
+ StringRef Filename, unsigned Offset, unsigned Length,
844
+ bool CancelOnSubsequentRequest, ArrayRef<const char *> Args,
845
+ SourceKitCancellationToken CancellationToken,
846
+ std::function<void (const RequestResult<RangeInfo> &)> Receiver) = 0;
840
847
841
848
virtual void getCursorInfoFromUSR (
842
849
StringRef Filename, StringRef USR, bool CancelOnSubsequentRequest,
843
850
ArrayRef<const char *> Args, Optional<VFSOptions> vfsOptions,
851
+ SourceKitCancellationToken CancellationToken,
844
852
std::function<void (const RequestResult<CursorInfoData> &)> Receiver) = 0;
845
853
846
- virtual void findRelatedIdentifiersInFile (StringRef Filename,
847
- unsigned Offset,
848
- bool CancelOnSubsequentRequest ,
849
- ArrayRef< const char *> Args,
850
- std::function< void ( const RequestResult<RelatedIdentsInfo> &)> Receiver) = 0;
854
+ virtual void findRelatedIdentifiersInFile (
855
+ StringRef Filename, unsigned Offset, bool CancelOnSubsequentRequest ,
856
+ ArrayRef< const char *> Args, SourceKitCancellationToken CancellationToken ,
857
+ std::function< void ( const RequestResult<RelatedIdentsInfo> &)>
858
+ Receiver) = 0;
851
859
852
860
virtual llvm::Optional<std::pair<unsigned , unsigned >>
853
861
findUSRRange (StringRef DocumentName, StringRef USR) = 0 ;
@@ -872,25 +880,29 @@ class LangSupport {
872
880
virtual void
873
881
findLocalRenameRanges (StringRef Filename, unsigned Line, unsigned Column,
874
882
unsigned Length, ArrayRef<const char *> Args,
883
+ SourceKitCancellationToken CancellationToken,
875
884
CategorizedRenameRangesReceiver Receiver) = 0 ;
876
885
877
- virtual void semanticRefactoring (StringRef Filename, SemanticRefactoringInfo Info,
878
- ArrayRef<const char *> Args,
886
+ virtual void semanticRefactoring (StringRef Filename,
887
+ SemanticRefactoringInfo Info,
888
+ ArrayRef<const char *> Args,
889
+ SourceKitCancellationToken CancellationToken,
879
890
CategorizedEditsReceiver Receiver) = 0;
880
891
881
- virtual void collectExpressionTypes (StringRef FileName,
882
- ArrayRef<const char *> Args,
883
- ArrayRef<const char *> ExpectedProtocols,
884
- bool CanonicalType ,
885
- std::function<void (const
886
- RequestResult<ExpressionTypesInFile> &)> Receiver) = 0;
892
+ virtual void collectExpressionTypes (
893
+ StringRef FileName, ArrayRef<const char *> Args,
894
+ ArrayRef<const char *> ExpectedProtocols, bool CanonicalType ,
895
+ SourceKitCancellationToken CancellationToken ,
896
+ std::function<void (const RequestResult<ExpressionTypesInFile> &)>
897
+ Receiver) = 0;
887
898
888
899
// / Collects variable types for a range defined by `Offset` and `Length` in
889
900
// / the source file. If `Offset` or `Length` are empty, variable types for
890
901
// / the entire document are collected.
891
902
virtual void collectVariableTypes (
892
903
StringRef FileName, ArrayRef<const char *> Args,
893
904
Optional<unsigned > Offset, Optional<unsigned > Length,
905
+ SourceKitCancellationToken CancellationToken,
894
906
std::function<void (const RequestResult<VariableTypesInFile> &)>
895
907
Receiver) = 0;
896
908
0 commit comments