Analysis server not sending requests when `onlyAnalyzeProjectsWithOpenFiles` is enabled
See original GitHub issueHey!
Describe the bug
I’ve recently been working in a monorepo, and have noticed that enabling onlyAnalyzeProjectsWithOpenFiles
drastically improves performance using Neovim. On VSCode, textDocument/publishDiagnostics
is called for packages adjacent to the currently opened one, resulting in duplicate code actions, auto-completion items etc.
On enabling onlyAnalyzeProjectsWithOpenFiles
in the analyzer LSP, I don’t get any textDocument/publishDiagnostics
or textDocument/didOpen
etc as expected; despite the analyzer being initialized.
Any advice on how to resolve this is appreciated - I’m happy to continue developing on my fork and will push when fixed.
To Reproduce Steps to reproduce the behavior:
- Set
onlyAnalyzeProjectsWithOpenFiles
totrue
ininitializationOptions
- Open a Dart project
Expected behavior LSP should send requests for project folders of open files in VSC.
Logs
Here’s my instrumentation log:
1635396407949:Req:{"jsonrpc"::"2.0","id"::0,"method"::"initialize","params"::{"processId"::6416,"clientInfo"::{"name"::"Visual Studio Code","version"::"1.61.2"},"locale"::"en-gb","rootPath"::"/Users/rjm/Coding/Tutero/app","rootUri"::"file::///Users/rjm/Coding/Tutero/app","capabilities"::{"workspace"::{"applyEdit"::true,"workspaceEdit"::{"documentChanges"::true,"resourceOperations"::["create","rename","delete"],"failureHandling"::"textOnlyTransactional","normalizesLineEndings"::true,"changeAnnotationSupport"::{"groupsOnLabel"::true}},"didChangeConfiguration"::{"dynamicRegistration"::true},"didChangeWatchedFiles"::{"dynamicRegistration"::true},"symbol"::{"dynamicRegistration"::true,"symbolKind"::{"valueSet"::[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport"::{"valueSet"::[1]}},"codeLens"::{"refreshSupport"::true},"executeCommand"::{"dynamicRegistration"::true},"configuration"::true,"workspaceFolders"::true,"semanticTokens"::{"refreshSupport"::true},"fileOperations"::{"dynamicRegistration"::true,"didCreate"::true,"didRename"::true,"didDelete"::true,"willCreate"::true,"willRename"::true,"willDelete"::true}},"textDocument"::{"publishDiagnostics"::{"relatedInformation"::true,"versionSupport"::false,"tagSupport"::{"valueSet"::[1,2]},"codeDescriptionSupport"::true,"dataSupport"::true},"synchronization"::{"dynamicRegistration"::true,"willSave"::true,"willSaveWaitUntil"::true,"didSave"::true},"completion"::{"dynamicRegistration"::true,"contextSupport"::true,"completionItem"::{"snippetSupport"::true,"commitCharactersSupport"::true,"documentationFormat"::["markdown","plaintext"],"deprecatedSupport"::true,"preselectSupport"::true,"tagSupport"::{"valueSet"::[1]},"insertReplaceSupport"::true,"resolveSupport"::{"properties"::["documentation","detail","additionalTextEdits"]},"insertTextModeSupport"::{"valueSet"::[1,2]}},"completionItemKind"::{"valueSet"::[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover"::{"dynamicRegistration"::true,"contentFormat"::["markdown","plaintext"]},"signatureHelp"::{"dynamicRegistration"::true,"signatureInformation"::{"documentationFormat"::["markdown","plaintext"],"parameterInformation"::{"labelOffsetSupport"::true},"activeParameterSupport"::true},"contextSupport"::true},"definition"::{"dynamicRegistration"::true,"linkSupport"::true},"references"::{"dynamicRegistration"::true},"documentHighlight"::{"dynamicRegistration"::true},"documentSymbol"::{"dynamicRegistration"::true,"symbolKind"::{"valueSet"::[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport"::true,"tagSupport"::{"valueSet"::[1]},"labelSupport"::true},"codeAction"::{"dynamicRegistration"::true,"isPreferredSupport"::true,"disabledSupport"::true,"dataSupport"::true,"resolveSupport"::{"properties"::["edit"]},"codeActionLiteralSupport"::{"codeActionKind"::{"valueSet"::["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations"::false},"codeLens"::{"dynamicRegistration"::true},"formatting"::{"dynamicRegistration"::true},"rangeFormatting"::{"dynamicRegistration"::true},"onTypeFormatting"::{"dynamicRegistration"::true},"rename"::{"dynamicRegistration"::true,"prepareSupport"::true,"prepareSupportDefaultBehavior"::1,"honorsChangeAnnotations"::true},"documentLink"::{"dynamicRegistration"::true,"tooltipSupport"::true},"typeDefinition"::{"dynamicRegistration"::true,"linkSupport"::true},"implementation"::{"dynamicRegistration"::true,"linkSupport"::true},"colorProvider"::{"dynamicRegistration"::true},"foldingRange"::{"dynamicRegistration"::true,"rangeLimit"::5000,"lineFoldingOnly"::true},"declaration"::{"dynamicRegistration"::true,"linkSupport"::true},"selectionRange"::{"dynamicRegistration"::true},"callHierarchy"::{"dynamicRegistration"::true},"semanticTokens"::{"dynamicRegistration"::true,"tokenTypes"::["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers"::["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats"::["relative"],"requests"::{"range"::true,"full"::{"delta"::true}},"multilineTokenSupport"::false,"overlappingTokenSupport"::false},"linkedEditingRange"::{"dynamicRegistration"::true}},"window"::{"showMessage"::{"messageActionItem"::{"additionalPropertiesSupport"::true}},"showDocument"::{"support"::true},"workDoneProgress"::true},"general"::{"regularExpressions"::{"engine"::"ECMAScript","version"::"ES2020"},"markdown"::{"parser"::"marked","version"::"1.1.0"}},"experimental"::{"snippetTextEdit"::true}},"initializationOptions"::{"onlyAnalyzeProjectsWithOpenFiles"::true,"closingLabels"::true,"flutterOutline"::true,"outline"::true,"suggestFromUnimportedLibraries"::true},"trace"::"off","workspaceFolders"::[{"uri"::"file::///Users/rjm/Coding/Tutero/app","name"::"app"}]}}
1635396408134:Res:{"id"::0,"jsonrpc"::"2.0","result"::{"capabilities"::{"executeCommandProvider"::{"commands"::["edit.sortMembers","edit.organizeImports","edit.fixAll","edit.sendWorkspaceEdit","refactor.perform"],"workDoneProgress"::true},"workspaceSymbolProvider"::true,"workspace"::{"workspaceFolders"::{"supported"::true,"changeNotifications"::true}}},"serverInfo"::{"name"::"Dart SDK LSP Analysis Server","version"::"2.14.3"}}}
1635396408154:Req:{"jsonrpc"::"2.0","method"::"initialized","params"::{}}
I should note that this is the full log; and that I attempted to load multiple Dart files in a valid workspace.
Versions (please complete the following information):
- VS Code version: 1.61.2
- Dart extension version: master
- Dart/Flutter SDK version: 2.5.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
The change above has landed in the SDK (and will be included in a future release).
I’ve a fix open at https://dart-review.googlesource.com/c/sdk/+/218441/. It’s an SDK change, so after merging will require an updated SDK to take effect unfortunately.