Skip to content

Conversation

@fvclaus
Copy link
Contributor

@fvclaus fvclaus commented Nov 11, 2021

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

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.

2 participants