提交 a4bed896 编写于 作者: M Matt Bierner

💄

上级 98f23687
......@@ -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));
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册