LSP workspaceSymbol returns no results with SourceKit-LSP (empty query parameter)
Description
The LSP workspaceSymbol operation always returns 0 results when used with SourceKit-LSP (Swift). This is because Claude Code sends an empty query parameter to the LSP server.
Environment
- Claude Code version: 2.1.15 (native binary)
- Platform: macOS (Darwin 25.2.0, arm64)
- LSP Server: SourceKit-LSP (Swift)
Steps to Reproduce
- Open a Swift project with SourceKit-LSP configured
- Use the LSP tool with
workspaceSymboloperation on any Swift file - Observe: "No symbols found in workspace"
Expected Behavior
Should return symbols matching the file or a reasonable default query.
Actual Behavior
Returns no symbols because the request sends:
params: { query: "" }
SourceKit-LSP requires a non-empty query string to return results.
Root Cause
In the Claude Code source, the workspaceSymbol case builds the LSP request with an empty query:
case "workspaceSymbol": return { method: "workspace/symbol", params: { query: "" } }
Suggested Fix
Use the filename (without extension) as a default query when no explicit query is provided:
case "workspaceSymbol": return {
method: "workspace/symbol",
params: { query: filePath.split("/").pop().replace(/\.[^.]+$/, "") }
}
This would convert:
Astro001App.swift→ query:"Astro001App"LocationViewModel.swift→ query:"LocationViewModel"
Workaround
Currently using documentSymbol for single-file symbol lookup, but this doesn't support workspace-wide symbol search.
Additional Context
This issue affects all LSP servers that require a non-empty query for workspace/symbol. The LSP specification allows servers to return all symbols for an empty query, but SourceKit-LSP (and possibly other servers) require at least a partial match string.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗