Skip to content

Commit e18e797

Browse files
committed
Fixes a bug that prevented new proposed inline completion API from working.
1 parent dc2f5d8 commit e18e797

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/vs/workbench/api/common/extHostLanguageFeatures.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,17 +1024,25 @@ class SuggestAdapter {
10241024
}
10251025
}
10261026

1027-
class InlineCompletionAdapter {
1027+
class InlineCompletionAdapterBase {
1028+
public async provideInlineCompletions(resource: URI, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
1029+
return undefined;
1030+
}
1031+
}
1032+
1033+
class InlineCompletionAdapter extends InlineCompletionAdapterBase {
10281034
private readonly _cache = new Cache<vscode.InlineCompletionItem>('InlineCompletionItem');
10291035
private readonly _disposables = new Map<number, DisposableStore>();
10301036

10311037
constructor(
10321038
private readonly _documents: ExtHostDocuments,
10331039
private readonly _provider: vscode.InlineCompletionItemProvider,
10341040
private readonly _commands: CommandsConverter,
1035-
) { }
1041+
) {
1042+
super();
1043+
}
10361044

1037-
public async provideInlineCompletions(resource: URI, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
1045+
public override async provideInlineCompletions(resource: URI, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
10381046
const doc = this._documents.getDocument(resource);
10391047
const pos = typeConvert.Position.to(position);
10401048

@@ -1113,7 +1121,7 @@ class InlineCompletionAdapter {
11131121
}
11141122
}
11151123

1116-
class InlineCompletionAdapterNew {
1124+
class InlineCompletionAdapterNew extends InlineCompletionAdapterBase {
11171125
private readonly _cache = new Cache<vscode.InlineCompletionItemNew>('InlineCompletionItemNew');
11181126
private readonly _disposables = new Map<number, DisposableStore>();
11191127

@@ -1124,14 +1132,16 @@ class InlineCompletionAdapterNew {
11241132
private readonly _documents: ExtHostDocuments,
11251133
private readonly _provider: vscode.InlineCompletionItemProviderNew,
11261134
private readonly _commands: CommandsConverter,
1127-
) { }
1135+
) {
1136+
super();
1137+
}
11281138

11291139
private readonly languageTriggerKindToVSCodeTriggerKind: Record<languages.InlineCompletionTriggerKind, vscode.InlineCompletionTriggerKindNew> = {
11301140
[languages.InlineCompletionTriggerKind.Automatic]: InlineCompletionTriggerKindNew.Automatic,
11311141
[languages.InlineCompletionTriggerKind.Explicit]: InlineCompletionTriggerKindNew.Invoke,
11321142
};
11331143

1134-
public async provideInlineCompletions(resource: URI, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
1144+
public override async provideInlineCompletions(resource: URI, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
11351145
const doc = this._documents.getDocument(resource);
11361146
const pos = typeConvert.Position.to(position);
11371147

@@ -2156,7 +2166,7 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF
21562166
}
21572167

21582168
$provideInlineCompletions(handle: number, resource: UriComponents, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
2159-
return this._withAdapter(handle, InlineCompletionAdapter, adapter => adapter.provideInlineCompletions(URI.revive(resource), position, context, token), undefined, token);
2169+
return this._withAdapter(handle, InlineCompletionAdapterBase, adapter => adapter.provideInlineCompletions(URI.revive(resource), position, context, token), undefined, token);
21602170
}
21612171

21622172
$handleInlineCompletionDidShow(handle: number, pid: number, idx: number): void {

0 commit comments

Comments
 (0)