mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 10:40:41 +00:00
💄
This commit is contained in:
parent
98f236872e
commit
a4bed89652
|
@ -4,7 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as Proto from '../protocol';
|
||||
import { ITypeScriptServiceClient } from '../typescriptService';
|
||||
import * as typeConverters from '../utils/typeConverters';
|
||||
|
||||
|
@ -20,20 +19,18 @@ export default class TypeScriptDefinitionProviderBase {
|
|||
position: vscode.Position,
|
||||
token: vscode.CancellationToken
|
||||
): Promise<vscode.Location[] | undefined> {
|
||||
const filepath = this.client.toOpenedFilePath(document);
|
||||
if (!filepath) {
|
||||
const file = this.client.toOpenedFilePath(document);
|
||||
if (!file) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const args = typeConverters.Position.toFileLocationRequestArgs(filepath, position);
|
||||
|
||||
const args = typeConverters.Position.toFileLocationRequestArgs(file, position);
|
||||
const response = await this.client.execute(definitionType, args, token);
|
||||
if (response.type !== 'response') {
|
||||
if (response.type !== 'response' || !response.body) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const locations: Proto.FileSpan[] = (response && response.body) || [];
|
||||
return locations.map(location =>
|
||||
return response.body.map(location =>
|
||||
typeConverters.Location.fromTextSpan(this.client.toResource(location.file), location));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue