mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
Finalize definition link (#54424)
Finalize the definition link api - Gives fields more explicit names (target and origin) - Moves api to vscode.d.ts - Makes other definition providers (such as type definition provider and implementation provider) also return definition links Fixes #54101
This commit is contained in:
@@ -17,12 +17,7 @@ export default class TypeScriptDefinitionProvider extends DefinitionProviderBase
|
||||
super(client);
|
||||
}
|
||||
|
||||
public async provideDefinition() {
|
||||
// Implemented by provideDefinition2
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public async provideDefinition2(
|
||||
public async provideDefinition(
|
||||
document: vscode.TextDocument,
|
||||
position: vscode.Position,
|
||||
token: vscode.CancellationToken | boolean
|
||||
@@ -44,10 +39,11 @@ export default class TypeScriptDefinitionProvider extends DefinitionProviderBase
|
||||
const span = response.body.textSpan ? typeConverters.Range.fromTextSpan(response.body.textSpan) : undefined;
|
||||
return locations
|
||||
.map(location => {
|
||||
const loc = typeConverters.Location.fromTextSpan(this.client.toResource(location.file), location);
|
||||
return {
|
||||
origin: span,
|
||||
...loc,
|
||||
const target = typeConverters.Location.fromTextSpan(this.client.toResource(location.file), location);
|
||||
return <vscode.DefinitionLink>{
|
||||
originSelectionRange: span,
|
||||
targetRange: target.range,
|
||||
targetUri: target.uri,
|
||||
};
|
||||
});
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user