Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace symbol picker is empty on a Dart project #4910

Closed
lukepighetti opened this issue Nov 27, 2022 · 3 comments · Fixed by #5055
Closed

Workspace symbol picker is empty on a Dart project #4910

lukepighetti opened this issue Nov 27, 2022 · 3 comments · Fixed by #5055
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@lukepighetti
Copy link

lukepighetti commented Nov 27, 2022

Repro

  • brew install dart
  • cd /tmp
  • dart create foo
  • hx foo

If you open lib/foo.dart and type <space> s you'll see the local symbol picker is working

Screen Shot 2022-11-27 at 11 53 01 AM

But if you type <space> S then you'll see the global symbol picker is empty

Screen Shot 2022-11-27 at 11 53 06 AM

Dart's language server appears to support workspace/symbol, as workspace symbols seem to resolve in VSCode, and there appears to be some breadcrumbs in dart-lang/sdk to confirm support https://github.com/dart-lang/sdk/blob/086727ee6f66abdcc7050ee53504ba58e200ce40/pkg/analysis_server/tool/lsp_spec/lsp_meta_model.json#L1385-L1438

Logs

2022-11-27T17:06:34.293 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":false},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"publishDiagnostics":{},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":false},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"executeCommand":{"dynamicRegistration":false},"symbol":{"dynamicRegistration":false},"workspaceFolders":true}},"processId":56163,"rootPath":"/private/tmp/foo","rootUri":"file:///private/tmp/foo","workspaceFolders":[{"name":"foo","uri":"file:///private/tmp/foo"}]},"id":0}
2022-11-27T17:06:34.778 helix_lsp::transport [INFO] <- {"id":0,"jsonrpc":"2.0","result":{"capabilities":{"codeActionProvider":{"codeActionKinds":["source","source.organizeImports","source.fixAll","source.sortMembers","quickfix","refactor"]},"colorProvider":{"documentSelector":[{"language":"dart","scheme":"file"}]},"completionProvider":{"resolveProvider":true,"triggerCharacters":[".","=","(","$","\"","'","{","/",":"]},"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[";"]},"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["edit.sortMembers","edit.organizeImports","edit.fixAll","edit.sendWorkspaceEdit","refactor.perform"],"workDoneProgress":true},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":false},"legend":{"tokenModifiers":["documentation","constructor","declaration","importPrefix","instance","static","escape","annotation","control","label","interpolation","void"],"tokenTypes":["annotation","keyword","class","comment","method","variable","parameter","enum","enumMember","type","source","property","namespace","boolean","number","string","function","typeParameter"]},"range":true},"signatureHelpProvider":{"retriggerCharacters":[","],"triggerCharacters":["("]},"textDocumentSync":{"change":2,"openClose":true,"willSave":false,"willSaveWaitUntil":false},"workspace":{"fileOperations":{"willRename":{"filters":[{"pattern":{"glob":"**/*.dart","matches":"file"},"scheme":"file"},{"pattern":{"glob":"**/","matches":"folder"},"scheme":"file"}]}},"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true},"serverInfo":{"name":"Dart SDK LSP Analysis Server","version":"2.18.5"}}}
2022-11-27T17:06:34.779 helix_lsp::transport [INFO] <- {"capabilities":{"codeActionProvider":{"codeActionKinds":["source","source.organizeImports","source.fixAll","source.sortMembers","quickfix","refactor"]},"colorProvider":{"documentSelector":[{"language":"dart","scheme":"file"}]},"completionProvider":{"resolveProvider":true,"triggerCharacters":[".","=","(","$","\"","'","{","/",":"]},"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[";"]},"documentRangeFormattingProvider":true,"documentSymbolProvider":true,"executeCommandProvider":{"commands":["edit.sortMembers","edit.organizeImports","edit.fixAll","edit.sendWorkspaceEdit","refactor.perform"],"workDoneProgress":true},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"referencesProvider":true,"renameProvider":true,"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":false},"legend":{"tokenModifiers":["documentation","constructor","declaration","importPrefix","instance","static","escape","annotation","control","label","interpolation","void"],"tokenTypes":["annotation","keyword","class","comment","method","variable","parameter","enum","enumMember","type","source","property","namespace","boolean","number","string","function","typeParameter"]},"range":true},"signatureHelpProvider":{"retriggerCharacters":[","],"triggerCharacters":["("]},"textDocumentSync":{"change":2,"openClose":true,"willSave":false,"willSaveWaitUntil":false},"workspace":{"fileOperations":{"willRename":{"filters":[{"pattern":{"glob":"**/*.dart","matches":"file"},"scheme":"file"},{"pattern":{"glob":"**/","matches":"folder"},"scheme":"file"}]}},"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true},"serverInfo":{"name":"Dart SDK LSP Analysis Server","version":"2.18.5"}}
2022-11-27T17:06:34.779 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialized","params":{}}
2022-11-27T17:06:34.779 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"dart","text":"int calculate() {\n  return 6 * 7;\n}\n","uri":"file:///private/tmp/foo/lib/foo.dart","version":0}}}
2022-11-27T17:06:34.802 helix_lsp::transport [INFO] <- {"id":1,"jsonrpc":"2.0","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///private/tmp/foo","section":"dart"},{"section":"dart"}]}}
2022-11-27T17:06:34.802 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":[null,null],"id":1}
2022-11-27T17:06:35.324 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///private/tmp/foo/analysis_options.yaml"}}
2022-11-27T17:06:35.324 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///private/tmp/foo/pubspec.yaml"}}
2022-11-27T17:06:35.328 helix_lsp::transport [INFO] <- {"id":2,"jsonrpc":"2.0","method":"window/workDoneProgress/create","params":{"token":"ANALYZING"}}
2022-11-27T17:06:35.328 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":2}
2022-11-27T17:06:35.329 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///private/tmp/foo/lib/foo.dart"}}
2022-11-27T17:06:35.329 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"ANALYZING","value":{"kind":"begin","title":"Analyzing…"}}}
2022-11-27T17:06:35.486 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///private/tmp/foo/test/foo_test.dart"}}
2022-11-27T17:06:35.488 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///private/tmp/foo/bin/foo.dart"}}
2022-11-27T17:06:35.488 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"ANALYZING","value":{"kind":"end"}}}
2022-11-27T17:06:50.231 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///private/tmp/foo/lib/foo.dart"}},"id":1}
2022-11-27T17:06:50.252 helix_lsp::transport [INFO] <- {"id":1,"jsonrpc":"2.0","result":[{"deprecated":false,"kind":12,"location":{"range":{"end":{"character":13,"line":0},"start":{"character":4,"line":0}},"uri":"file:///private/tmp/foo/lib/foo.dart"},"name":"calculate"}]}
2022-11-27T17:06:50.253 helix_lsp::transport [INFO] <- [{"deprecated":false,"kind":12,"location":{"range":{"end":{"character":13,"line":0},"start":{"character":4,"line":0}},"uri":"file:///private/tmp/foo/lib/foo.dart"},"name":"calculate"}]
2022-11-27T17:06:52.686 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"workspace/symbol","params":{"query":""},"id":2}
2022-11-27T17:06:52.694 helix_lsp::transport [INFO] <- {"id":2,"jsonrpc":"2.0","result":[]}
2022-11-27T17:06:52.695 helix_lsp::transport [INFO] <- []
2022-11-27T17:06:57.063 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"shutdown","params":null,"id":3}
2022-11-27T17:06:57.067 helix_lsp::transport [INFO] <- {"id":3,"jsonrpc":"2.0","result":null}
2022-11-27T17:06:57.067 helix_lsp::transport [INFO] <- null
2022-11-27T17:06:57.067 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"exit","params":null}

Platform

macOS 12.6 (21G115)

Terminal Emulator

iTerm2 Build 3.5.0beta7

Helix Version

helix 22.08.1 (eada6d5)

@the-mikedavis
Copy link
Member

What does the log say in verbose mode when you hit <space>S? And what version are you on?

Please use the bug template in the future.

@lukepighetti
Copy link
Author

Updated the original issue with logs and environment info

@the-mikedavis
Copy link
Member

It looks like the dart LSP has the same behavior as intelephense #3619: when the query is the empty string it sends an empty array to avoid doing a lot of work and sending everything.

https://github.com/dart-lang/sdk/blob/ba097c6b7c91992af9ca28daa89ad6a11f599bc1/pkg/analysis_server/lib/src/lsp/handlers/handler_workspace_symbols.dart#L29-L38

This will be fixed by #3110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
2 participants