Skip to content

Support js/ts.workspaceSymbols.scope and extra textDocument param on workspace/symbol request - #4805

Open
jakebailey wants to merge 2 commits into
mainfrom
jabaile/fix-4802
Open

Support js/ts.workspaceSymbols.scope and extra textDocument param on workspace/symbol request#4805
jakebailey wants to merge 2 commits into
mainfrom
jabaile/fix-4802

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Fixes #4802

Strada allowed workspace symbol requests to include the current doc, then optionally filter the workspace symbol request to just the projects the current doc is a part of. Add that back. VS Code defaults this to allOpenProjects, so this is a noop for anyone who hasn't opted into the filtering.

This is the second LSP extension we've slapped onto an incoming request (expandible hover before this). Starting to wish we had named these extra props with an _ prefix or something like _vs_ does.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurable workspace-symbol scoping to match the classic TypeScript service behavior.

Changes:

  • Adds textDocument context to workspace symbol requests.
  • Supports allOpenProjects and currentProject scopes.
  • Adds server tests, preference parsing, and extension middleware.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
testdata/baselines/reference/fourslash/state/codeLensAcrossProjects.baseline Updates default preference baseline.
internal/project/session.go Adds document-scoped snapshot access.
internal/lsp/server.go Selects projects according to symbol scope.
internal/lsp/server_workspace_symbol_test.go Tests both scope modes.
internal/lsp/lsproto/lsp_generated.go Adds the optional document parameter.
internal/lsp/lsproto/_generate/generate.mts Generates the protocol extension.
internal/ls/lsutil/userpreferences.go Defines and defaults the scope preference.
internal/ls/lsutil/userpreferences_test.go Tests preference parsing.
_extension/src/workspaceSymbolMiddleware.ts Adds document context to requests.
_extension/src/client.ts Registers the request middleware.
Files not reviewed (1)
  • internal/lsp/lsproto/lsp_generated.go: Generated file
Suppressed comments (1)

_extension/src/workspaceSymbolMiddleware.ts:16

  • The fallback has the same selector mismatch: it may choose a TypeScript notebook/custom-scheme document that this client never sent to the server, causing currentProject searches to target an unrelated or empty project. Filter fallback documents to the client’s file/untitled schemes.
        document => isSupportedLanguageMode(document) && !disabledSchemes.has(document.uri.scheme),

Comment thread _extension/src/workspaceSymbolMiddleware.ts Outdated
Comment thread internal/lsp/server_workspace_symbol_test.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

workspace/symbol returns results from projects outside the workspace folder

3 participants