mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -853,6 +853,7 @@ public:
|
||||
|
||||
void SwiftLangSupport::editorOpenSwiftSourceInterface(
|
||||
StringRef Name, StringRef SourceName, ArrayRef<const char *> Args,
|
||||
bool CancelOnSubsequentRequest,
|
||||
SourceKitCancellationToken CancellationToken,
|
||||
std::shared_ptr<EditorConsumer> Consumer) {
|
||||
std::string Error;
|
||||
@@ -864,7 +865,8 @@ void SwiftLangSupport::editorOpenSwiftSourceInterface(
|
||||
auto AstConsumer = std::make_shared<PrimaryFileInterfaceConsumer>(Name,
|
||||
SourceName, IFaceGenContexts, Consumer, Invocation);
|
||||
static const char OncePerASTToken = 0;
|
||||
getASTManager()->processASTAsync(Invocation, AstConsumer, &OncePerASTToken,
|
||||
const void *Once = CancelOnSubsequentRequest ? &OncePerASTToken : nullptr;
|
||||
getASTManager()->processASTAsync(Invocation, AstConsumer, Once,
|
||||
CancellationToken,
|
||||
llvm::vfs::getRealFileSystem());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user