Location of SymbolInformation gets lost when range is not defined by fvclaus · Pull Request #849 · microsoft/vscode-languageserver-node (original) (raw)
This is a follow-up of microsoft/vscode#136618
location
of SymbolInformation
is lost in the deprecated vscode.SymbolInformation
constructor that is used here:
let result = new code.SymbolInformation( |
---|
item.name, asSymbolKind(item.kind), |
asRange(item.location.range), |
item.location.uri ? _uriConverter(item.location.uri) : uri); |
This is only a problem if range
is not defined in which case vscode will not display the symbol in the symbol picker. The range
needs to be falsy in order to use resolveWorkspaceSymbol
To override resolveWorkspaceSymbol
, I used the following code:
const feature = this.languageClient.getFeature('workspace/symbol');
const provider: WorkspaceSymbolProvider = feature.getProviders()[0];
provider.resolveWorkspaceSymbol = (symbol, token) => {
return new SymbolInformation(symbol.name, symbol.kind, "foo", new Location(Uri.parse("/foo"), new Position(120, 20)))
}
The updated constructor invocation should create exactly the same object as before: https://github.com/microsoft/vscode/blob/042a6e36a495db9830029d87c12dd9b65c7e3b47/src/vs/workbench/api/common/extHostTypes.ts#L1094-L1110