提交 9f533655 编写于 作者: S SteVen Batten

Merge branch 'master' of https://github.com/Microsoft/vscode

...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
interface ApiV0 { interface ApiV0 {
readonly onCompletionAccepted: vscode.Event<vscode.CompletionItem>; readonly onCompletionAccepted: vscode.Event<vscode.CompletionItem & { metadata?: any }>;
} }
export interface Api { export interface Api {
......
...@@ -36,7 +36,8 @@ class MyCompletionItem extends vscode.CompletionItem { ...@@ -36,7 +36,8 @@ class MyCompletionItem extends vscode.CompletionItem {
line: string, line: string,
public readonly tsEntry: Proto.CompletionEntry, public readonly tsEntry: Proto.CompletionEntry,
useCodeSnippetsOnMethodSuggest: boolean, useCodeSnippetsOnMethodSuggest: boolean,
public readonly commitCharactersSettings: CommitCharactersSettings public readonly commitCharactersSettings: CommitCharactersSettings,
public readonly metadata: any | undefined,
) { ) {
super(tsEntry.name, MyCompletionItem.convertKind(tsEntry.kind)); super(tsEntry.name, MyCompletionItem.convertKind(tsEntry.kind));
...@@ -362,7 +363,8 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider ...@@ -362,7 +363,8 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
let isNewIdentifierLocation = true; let isNewIdentifierLocation = true;
let isIncomplete = false; let isIncomplete = false;
let msg: ReadonlyArray<Proto.CompletionEntry>; let entries: ReadonlyArray<Proto.CompletionEntry>;
let metadata: any | undefined;
if (this.client.apiVersion.gte(API.v300)) { if (this.client.apiVersion.gte(API.v300)) {
const response = await this.client.interuptGetErr(() => this.client.execute('completionInfo', args, token)); const response = await this.client.interuptGetErr(() => this.client.execute('completionInfo', args, token));
if (response.type !== 'response' || !response.body) { if (response.type !== 'response' || !response.body) {
...@@ -370,24 +372,26 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider ...@@ -370,24 +372,26 @@ class TypeScriptCompletionItemProvider implements vscode.CompletionItemProvider
} }
isNewIdentifierLocation = response.body.isNewIdentifierLocation; isNewIdentifierLocation = response.body.isNewIdentifierLocation;
isIncomplete = (response as any).metadata && (response as any).metadata.isIncomplete; isIncomplete = (response as any).metadata && (response as any).metadata.isIncomplete;
msg = response.body.entries; entries = response.body.entries;
metadata = response.metadata;
} else { } else {
const response = await this.client.interuptGetErr(() => this.client.execute('completions', args, token)); const response = await this.client.interuptGetErr(() => this.client.execute('completions', args, token));
if (response.type !== 'response' || !response.body) { if (response.type !== 'response' || !response.body) {
return null; return null;
} }
msg = response.body; entries = response.body;
metadata = response.metadata;
} }
const isInValidCommitCharacterContext = this.isInValidCommitCharacterContext(document, position); const isInValidCommitCharacterContext = this.isInValidCommitCharacterContext(document, position);
const items = msg const items = entries
.filter(entry => !shouldExcludeCompletionEntry(entry, completionConfiguration)) .filter(entry => !shouldExcludeCompletionEntry(entry, completionConfiguration))
.map(entry => new MyCompletionItem(position, document, line.text, entry, completionConfiguration.useCodeSnippetsOnMethodSuggest, { .map(entry => new MyCompletionItem(position, document, line.text, entry, completionConfiguration.useCodeSnippetsOnMethodSuggest, {
isNewIdentifierLocation, isNewIdentifierLocation,
isInValidCommitCharacterContext, isInValidCommitCharacterContext,
enableCallCompletions: !completionConfiguration.useCodeSnippetsOnMethodSuggest enableCallCompletions: !completionConfiguration.useCodeSnippetsOnMethodSuggest
})); }, metadata));
return new vscode.CompletionList(items, isIncomplete); return new vscode.CompletionList(items, isIncomplete);
} }
......
...@@ -268,9 +268,11 @@ export class DeclarationAction extends DefinitionAction { ...@@ -268,9 +268,11 @@ export class DeclarationAction extends DefinitionAction {
export class GoToDeclarationAction extends DeclarationAction { export class GoToDeclarationAction extends DeclarationAction {
public static readonly ID = 'editor.action.goToRealDeclaration';
constructor() { constructor() {
super(new DefinitionActionConfig(), { super(new DefinitionActionConfig(), {
id: 'editor.action.goToDeclaration', id: GoToDeclarationAction.ID,
label: nls.localize('actions.goToDeclaration.label', "Go to Declaration"), label: nls.localize('actions.goToDeclaration.label', "Go to Declaration"),
alias: 'Go to Declaration', alias: 'Go to Declaration',
precondition: ContextKeyExpr.and( precondition: ContextKeyExpr.and(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册