mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
reduce amount of data the _executeCompletionItemProvider-commands sends
This commit is contained in:
@@ -336,21 +336,16 @@ class ExtHostApiCommands {
|
||||
});
|
||||
}
|
||||
|
||||
private _executeCompletionItemProvider(resource: URI, position: types.Position, triggerCharacter: string): Thenable<types.CompletionItem[] | types.CompletionList> {
|
||||
private _executeCompletionItemProvider(resource: URI, position: types.Position, triggerCharacter: string): Thenable<types.CompletionList> {
|
||||
const args = {
|
||||
resource,
|
||||
position: position && typeConverters.fromPosition(position),
|
||||
triggerCharacter
|
||||
};
|
||||
return this._commands.executeCommand<{ suggestion: modes.ISuggestion; container: modes.ISuggestResult }[]>('_executeCompletionItemProvider', args).then(values => {
|
||||
if (values) {
|
||||
let items: types.CompletionItem[] = [];
|
||||
let incomplete: boolean;
|
||||
for (let item of values) {
|
||||
incomplete = item.container.incomplete || incomplete;
|
||||
items.push(typeConverters.Suggest.to(item.container, position, item.suggestion));
|
||||
}
|
||||
return new types.CompletionList(items, incomplete);
|
||||
return this._commands.executeCommand<modes.ISuggestResult>('_executeCompletionItemProvider', args).then(result => {
|
||||
if (result) {
|
||||
const items = result.suggestions.map(suggestion => typeConverters.Suggest.to(position, suggestion));
|
||||
return new types.CompletionList(items, result.incomplete);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user