mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
Merge #8877
8877: feat: allow clients to feature detect symbol filtering r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
f4afffc7e9
2 changed files with 17 additions and 12 deletions
|
@ -122,6 +122,7 @@ pub fn server_capabilities(client_caps: &ClientCapabilities) -> ServerCapabiliti
|
||||||
"runnables": {
|
"runnables": {
|
||||||
"kinds": [ "cargo" ],
|
"kinds": [ "cargo" ],
|
||||||
},
|
},
|
||||||
|
"workspaceSymbolScopeKindFiltering": true,
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,32 +651,36 @@ export const enum Direction {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Lookup workspace symbol search scope and kind
|
## Workspace Symbols Filtering
|
||||||
|
|
||||||
**Issue:** https://github.com/rust-analyzer/rust-analyzer/pull/7698
|
**Issue:** https://github.com/rust-analyzer/rust-analyzer/pull/7698
|
||||||
|
|
||||||
This request is sent from client to server to search for workspace symbols filtered by an
|
**Experimental Server Capability:** `{ "workspaceSymbolScopeKindFiltering": boolean }`
|
||||||
optional search scope and / or an optional symbol kind.
|
|
||||||
|
|
||||||
**Method:** `workspace/symbol`
|
Extends the existing `workspace/symbol` request with ability to filter symbols by broad scope and kind of symbol.
|
||||||
|
If this capability is set, `workspace/symbol` parameter gains two new optional fields:
|
||||||
|
|
||||||
**Request:** `WorkspaceSymbolParams`
|
|
||||||
|
|
||||||
**Response:** `SymbolInformation[] | null`
|
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
interface lsp_ext.WorkspaceSymbolParams extends WorkspaceSymbolParams {
|
interface WorkspaceSymbolParams {
|
||||||
|
/**
|
||||||
|
* Return only the symbols defined in the specified scope.
|
||||||
|
*/
|
||||||
searchScope?: WorkspaceSymbolSearchScope;
|
searchScope?: WorkspaceSymbolSearchScope;
|
||||||
|
/**
|
||||||
|
* Return only the symbols of specified kinds.
|
||||||
|
*/
|
||||||
searchKind?: WorkspaceSymbolSearchKind;
|
searchKind?: WorkspaceSymbolSearchKind;
|
||||||
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum WorkspaceSymbolSearchScope {
|
const enum WorkspaceSymbolSearchScope {
|
||||||
Workspace = "Workspace",
|
Workspace = "workspace",
|
||||||
WorkspaceAndDependencies = "WorkspaceAndDependencies"
|
WorkspaceAndDependencies = "workspaceAndDependencies"
|
||||||
}
|
}
|
||||||
|
|
||||||
const enum WorkspaceSymbolSearchKind {
|
const enum WorkspaceSymbolSearchKind {
|
||||||
OnlyTypes = "OnlyTypes",
|
OnlyTypes = "onlyTypes",
|
||||||
AllSymbols = "AllSymbols"
|
AllSymbols = "allSymbols"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue