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

Extract toSymbolInformation

上级 f0625569
......@@ -53,18 +53,12 @@ class TypeScriptWorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvide
return [];
}
const result: vscode.SymbolInformation[] = [];
for (const item of response.body) {
if (!item.containerName && item.kind === 'alias') {
continue;
}
const label = TypeScriptWorkspaceSymbolProvider.getLabel(item);
result.push(new vscode.SymbolInformation(label, getSymbolKind(item), item.containerName || '',
typeConverters.Location.fromTextSpan(this.client.toResource(item.file), item)));
}
return result;
return response.body
.filter(item => item.containerName && item.kind !== 'alias')
.map(item => this.toSymbolInformation(item));
}
private async toOpenedFiledPath(document: vscode.TextDocument) {
if (document.uri.scheme === fileSchemes.git) {
try {
......@@ -80,6 +74,15 @@ class TypeScriptWorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvide
return this.client.toOpenedFilePath(document);
}
private toSymbolInformation(item: Proto.NavtoItem) {
const label = TypeScriptWorkspaceSymbolProvider.getLabel(item);
return new vscode.SymbolInformation(
label,
getSymbolKind(item),
item.containerName || '',
typeConverters.Location.fromTextSpan(this.client.toResource(item.file), item));
}
private static getLabel(item: Proto.NavtoItem) {
const label = item.name;
if (item.kind === 'method' || item.kind === 'function') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册