Skip to content

Commit

Permalink
propose CompletionList#isDetailsResolved, #39441
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jan 9, 2020
1 parent 816064e commit c40b607
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/vs/editor/common/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ export interface CompletionItem {
export interface CompletionList {
suggestions: CompletionItem[];
incomplete?: boolean;
isDetailsResolved?: boolean;
dispose?(): void;
}

Expand Down
5 changes: 5 additions & 0 deletions src/vs/editor/contrib/suggest/suggest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class CompletionItem {
idx?: number;
word?: string;

//
readonly isDetailsResolved: boolean;

constructor(
readonly position: IPosition,
readonly completion: modes.CompletionItem,
Expand All @@ -70,6 +73,8 @@ export class CompletionItem {
this.editReplaceEnd = new Position(completion.range.replace.endLineNumber, completion.range.replace.endColumn);
}

this.isDetailsResolved = container.isDetailsResolved || typeof provider.resolveCompletionItem === 'undefined';

// create the suggestion resolver
const { resolveCompletionItem } = provider;
if (typeof resolveCompletionItem !== 'function') {
Expand Down
1 change: 1 addition & 0 deletions src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4854,6 +4854,7 @@ declare namespace monaco.languages {
export interface CompletionList {
suggestions: CompletionItem[];
incomplete?: boolean;
isDetailsResolved?: boolean;
dispose?(): void;
}

Expand Down
11 changes: 11 additions & 0 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1504,4 +1504,15 @@ declare module 'vscode' {
export const onDidChangeActiveColorTheme: Event<ColorTheme>;
}

//#endregion


//#region https://github.com/microsoft/vscode/issues/39441

export interface CompletionList {
isDetailsResolved?: boolean;
}

//#endregion

}
1 change: 1 addition & 0 deletions src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
return {
suggestions: result.b.map(d => MainThreadLanguageFeatures._inflateSuggestDto(result.a, d)),
incomplete: result.c,
isDetailsResolved: result.d,
dispose: () => typeof result.x === 'number' && this._proxy.$releaseCompletionItems(handle, result.x)
};
});
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/api/common/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ export interface ISuggestResultDto {
a: { insert: IRange, replace: IRange; };
b: ISuggestDataDto[];
c?: boolean;
d?: boolean;
}

export interface ISignatureHelpDto {
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/api/common/extHostLanguageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,8 @@ class SuggestAdapter {
x: pid,
b: [],
a: { replace: typeConvert.Range.from(replaceRange), insert: typeConvert.Range.from(insertRange) },
c: list.isIncomplete || undefined
c: list.isIncomplete || undefined,
d: list.isDetailsResolved || undefined
};

for (let i = 0; i < list.items.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ export class CompletionItem implements vscode.CompletionItem {
export class CompletionList {

isIncomplete?: boolean;

isDetailsResolved?: boolean;
items: vscode.CompletionItem[];

constructor(items: vscode.CompletionItem[] = [], isIncomplete: boolean = false) {
Expand Down

0 comments on commit c40b607

Please sign in to comment.