[SourceKit] Allow passing cancel_on_subsequent_request: 0 for all requests that use a OncePerASTToken

We need this option for `collectVariableType` (aka inlay type hints) but since I’m at it, I’m adding an option to disable the implicit request cancellation for all requests that have it since we don’t want it in LSP at all.

Prerequisite to fixing https://github.com/swiftlang/sourcekit-lsp/issues/2021 / rdar://145871554, need to adopt this option in SourceKit-LSP.
This commit is contained in:
Alex Hoppen
2025-05-14 18:42:19 +02:00
parent eac419b8ca
commit 9d30958066
6 changed files with 56 additions and 14 deletions

View File

@@ -619,6 +619,7 @@ public:
void editorOpenSwiftSourceInterface(
StringRef Name, StringRef SourceName, ArrayRef<const char *> Args,
bool CancelOnSubsequentRequest,
SourceKitCancellationToken CancellationToken,
std::shared_ptr<EditorConsumer> Consumer) override;
@@ -708,6 +709,7 @@ public:
void findLocalRenameRanges(StringRef Filename, unsigned Line, unsigned Column,
unsigned Length, ArrayRef<const char *> Args,
bool CancelOnSubsequentRequest,
SourceKitCancellationToken CancellationToken,
CategorizedRenameRangesReceiver Receiver) override;
@@ -723,6 +725,7 @@ public:
StringRef PrimaryFilePath, StringRef InputBufferName,
ArrayRef<const char *> Args, std::optional<unsigned> Offset,
std::optional<unsigned> Length, bool FullyQualified,
bool CancelOnSubsequentRequest,
SourceKitCancellationToken CancellationToken,
std::function<void(const RequestResult<VariableTypesInFile> &)> Receiver)
override;
@@ -730,6 +733,7 @@ public:
void semanticRefactoring(StringRef PrimaryFilePath,
SemanticRefactoringInfo Info,
ArrayRef<const char *> Args,
bool CancelOnSubsequentRequest,
SourceKitCancellationToken CancellationToken,
CategorizedEditsReceiver Receiver) override;