mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[sourcekit] Response "edit" immediately if client needs nothing
If the client doesn't want anything as the response of 'editor.replacetext' requests, we don't even need parsing. rdar://problem/74984613
This commit is contained in:
@@ -2016,7 +2016,8 @@ void SwiftEditorDocument::readSyntaxInfo(EditorConsumer &Consumer, bool ReportDi
|
||||
"same time is not supported. Use the syntax tree to compute the "
|
||||
"document structure.");
|
||||
}
|
||||
} else {
|
||||
} else if (Consumer.documentStructureEnabled() ||
|
||||
Consumer.syntaxMapEnabled()) {
|
||||
ide::SyntaxModelContext ModelContext(Impl.SyntaxInfo->getSourceFile());
|
||||
|
||||
SwiftEditorSyntaxWalker SyntaxWalker(
|
||||
@@ -2500,6 +2501,14 @@ void SwiftLangSupport::editorReplaceText(StringRef Name,
|
||||
SyntaxCache->addEdit(Offset, Offset + Length, Buf->getBufferSize());
|
||||
}
|
||||
|
||||
// If client doesn't need any information, we doen't need to parse it.
|
||||
if (!Consumer.documentStructureEnabled() &&
|
||||
!Consumer.syntaxMapEnabled() &&
|
||||
!Consumer.diagnosticsEnabled() &&
|
||||
!Consumer.syntaxTreeEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SyntaxParsingCache *SyntaxCachePtr = nullptr;
|
||||
if (SyntaxCache.hasValue()) {
|
||||
SyntaxCachePtr = SyntaxCache.getPointer();
|
||||
|
||||
Reference in New Issue
Block a user