Skip to content

Commit 50b1bcc

Browse files
authored
Remove inlineCompletionsNew proposal. Fixes microsoft#164856 (microsoft#165044)
1 parent 9059a3b commit 50b1bcc

File tree

7 files changed

+5
-338
lines changed

7 files changed

+5
-338
lines changed

extensions/emmet/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
],
1010
"include": [
1111
"src/**/*",
12-
"../../src/vscode-dts/vscode.d.ts",
13-
"../../src/vscode-dts/vscode.proposed.inlineCompletionsNew.d.ts",
12+
"../../src/vscode-dts/vscode.d.ts"
1413
]
1514
}

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
550550
}
551551
return extHostLanguageFeatures.registerInlineCompletionsProvider(extension, checkSelector(selector), provider);
552552
},
553-
registerInlineCompletionItemProviderNew(selector: vscode.DocumentSelector, provider: vscode.InlineCompletionItemProviderNew): vscode.Disposable {
554-
checkProposedApiEnabled(extension, 'inlineCompletionsNew');
555-
if (provider.handleDidShowCompletionItem && !isProposedApiEnabled(extension, 'inlineCompletionsAdditions')) {
556-
throw new Error(`When the method "handleDidShowCompletionItem" is implemented on a provider, the usage of the proposed api 'inlineCompletionsAdditions' must be declared!`);
557-
}
558-
return extHostLanguageFeatures.registerInlineCompletionsProviderNew(extension, checkSelector(selector), provider);
559-
},
560553
registerDocumentLinkProvider(selector: vscode.DocumentSelector, provider: vscode.DocumentLinkProvider): vscode.Disposable {
561554
return extHostLanguageFeatures.registerDocumentLinkProvider(extension, checkSelector(selector), provider);
562555
},
@@ -1259,7 +1252,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
12591252
InlineValueVariableLookup: extHostTypes.InlineValueVariableLookup,
12601253
InlineValueEvaluatableExpression: extHostTypes.InlineValueEvaluatableExpression,
12611254
InlineCompletionTriggerKind: extHostTypes.InlineCompletionTriggerKind,
1262-
InlineCompletionTriggerKindNew: extHostTypes.InlineCompletionTriggerKindNew,
12631255
EventEmitter: Emitter,
12641256
ExtensionKind: extHostTypes.ExtensionKind,
12651257
ExtensionMode: extHostTypes.ExtensionMode,
@@ -1273,9 +1265,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
12731265
FoldingRangeKind: extHostTypes.FoldingRangeKind,
12741266
FunctionBreakpoint: extHostTypes.FunctionBreakpoint,
12751267
InlineCompletionItem: extHostTypes.InlineSuggestion,
1276-
InlineCompletionItemNew: extHostTypes.InlineSuggestionNew,
12771268
InlineCompletionList: extHostTypes.InlineSuggestionList,
1278-
InlineCompletionListNew: extHostTypes.InlineSuggestionsNew,
12791269
Hover: extHostTypes.Hover,
12801270
IndentAction: languageConfiguration.IndentAction,
12811271
Location: extHostTypes.Location,

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

Lines changed: 2 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
77
import { mixin } from 'vs/base/common/objects';
88
import type * as vscode from 'vscode';
99
import * as typeConvert from 'vs/workbench/api/common/extHostTypeConverters';
10-
import { Range, Disposable, CompletionList, SnippetString, CodeActionKind, SymbolInformation, DocumentSymbol, SemanticTokensEdits, SemanticTokens, SemanticTokensEdit, Location, InlineCompletionTriggerKindNew, InlineCompletionTriggerKind } from 'vs/workbench/api/common/extHostTypes';
10+
import { Range, Disposable, CompletionList, SnippetString, CodeActionKind, SymbolInformation, DocumentSymbol, SemanticTokensEdits, SemanticTokens, SemanticTokensEdit, Location, InlineCompletionTriggerKind } from 'vs/workbench/api/common/extHostTypes';
1111
import { ISingleEditOperation } from 'vs/editor/common/core/editOperation';
1212
import * as languages from 'vs/editor/common/languages';
1313
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
@@ -1184,110 +1184,6 @@ class InlineCompletionAdapter extends InlineCompletionAdapterBase {
11841184
}
11851185
}
11861186

1187-
class InlineCompletionAdapterNew extends InlineCompletionAdapterBase {
1188-
private readonly _references = new ReferenceMap<{
1189-
dispose(): void;
1190-
items: readonly vscode.InlineCompletionItemNew[];
1191-
}>();
1192-
1193-
private readonly isAdditionProposedApiEnabled = isProposedApiEnabled(this.extension, 'inlineCompletionsAdditions');
1194-
1195-
constructor(
1196-
private readonly extension: IExtensionDescription,
1197-
private readonly _documents: ExtHostDocuments,
1198-
private readonly _provider: vscode.InlineCompletionItemProviderNew,
1199-
private readonly _commands: CommandsConverter,
1200-
) {
1201-
super();
1202-
}
1203-
1204-
private readonly languageTriggerKindToVSCodeTriggerKind: Record<languages.InlineCompletionTriggerKind, vscode.InlineCompletionTriggerKindNew> = {
1205-
[languages.InlineCompletionTriggerKind.Automatic]: InlineCompletionTriggerKindNew.Automatic,
1206-
[languages.InlineCompletionTriggerKind.Explicit]: InlineCompletionTriggerKindNew.Invoke,
1207-
};
1208-
1209-
override async provideInlineCompletions(resource: URI, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
1210-
const doc = this._documents.getDocument(resource);
1211-
const pos = typeConvert.Position.to(position);
1212-
1213-
const result = await this._provider.provideInlineCompletionItems(doc, pos, {
1214-
selectedCompletionInfo:
1215-
context.selectedSuggestionInfo
1216-
? {
1217-
range: typeConvert.Range.to(context.selectedSuggestionInfo.range),
1218-
text: context.selectedSuggestionInfo.text
1219-
}
1220-
: undefined,
1221-
triggerKind: this.languageTriggerKindToVSCodeTriggerKind[context.triggerKind]
1222-
}, token);
1223-
1224-
if (!result) {
1225-
// undefined and null are valid results
1226-
return undefined;
1227-
}
1228-
1229-
if (token.isCancellationRequested) {
1230-
// cancelled -> return without further ado, esp no caching
1231-
// of results as they will leak
1232-
return undefined;
1233-
}
1234-
1235-
const normalizedResult = Array.isArray(result) ? result : result.items;
1236-
const commands = Array.isArray(result) ? [] : result.commands || [];
1237-
1238-
let disposableStore: DisposableStore | undefined = undefined;
1239-
const pid = this._references.createReferenceId({
1240-
dispose() {
1241-
disposableStore?.dispose();
1242-
},
1243-
items: normalizedResult
1244-
});
1245-
1246-
return {
1247-
pid,
1248-
items: normalizedResult.map<extHostProtocol.IdentifiableInlineCompletion>((item, idx) => {
1249-
let command: languages.Command | undefined = undefined;
1250-
if (item.command) {
1251-
if (!disposableStore) {
1252-
disposableStore = new DisposableStore();
1253-
}
1254-
command = this._commands.toInternal(item.command, disposableStore);
1255-
}
1256-
1257-
const insertText = item.insertText;
1258-
return ({
1259-
insertText: typeof insertText === 'string' ? insertText : { snippet: insertText.value },
1260-
filterText: item.filterText,
1261-
range: item.range ? typeConvert.Range.from(item.range) : undefined,
1262-
command,
1263-
idx: idx,
1264-
completeBracketPairs: this.isAdditionProposedApiEnabled ? item.completeBracketPairs : false
1265-
});
1266-
}),
1267-
commands: commands.map(c => {
1268-
if (!disposableStore) {
1269-
disposableStore = new DisposableStore();
1270-
}
1271-
return this._commands.toInternal(c, disposableStore);
1272-
})
1273-
};
1274-
}
1275-
1276-
override disposeCompletions(pid: number) {
1277-
const data = this._references.disposeReferenceId(pid);
1278-
data?.dispose();
1279-
}
1280-
1281-
override handleDidShowCompletionItem(pid: number, idx: number): void {
1282-
const completionItem = this._references.get(pid)?.items[idx];
1283-
if (completionItem) {
1284-
if (this._provider.handleDidShowCompletionItem && this.isAdditionProposedApiEnabled) {
1285-
this._provider.handleDidShowCompletionItem(completionItem);
1286-
}
1287-
}
1288-
}
1289-
}
1290-
12911187
class ReferenceMap<T> {
12921188
private readonly _references = new Map<number, T>();
12931189
private _idPool = 1;
@@ -1821,7 +1717,7 @@ type Adapter = DocumentSymbolAdapter | CodeLensAdapter | DefinitionAdapter | Hov
18211717
| SelectionRangeAdapter | CallHierarchyAdapter | TypeHierarchyAdapter
18221718
| DocumentSemanticTokensAdapter | DocumentRangeSemanticTokensAdapter
18231719
| EvaluatableExpressionAdapter | InlineValuesAdapter
1824-
| LinkedEditingRangeAdapter | InlayHintsAdapter | InlineCompletionAdapter | InlineCompletionAdapterNew
1720+
| LinkedEditingRangeAdapter | InlayHintsAdapter | InlineCompletionAdapter
18251721
| DocumentOnDropEditAdapter;
18261722

18271723
class AdapterData {
@@ -2253,12 +2149,6 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF
22532149
return this._createDisposable(handle);
22542150
}
22552151

2256-
registerInlineCompletionsProviderNew(extension: IExtensionDescription, selector: vscode.DocumentSelector, provider: vscode.InlineCompletionItemProviderNew): vscode.Disposable {
2257-
const handle = this._addNewAdapter(new InlineCompletionAdapterNew(extension, this._documents, provider, this._commands.converter), extension);
2258-
this._proxy.$registerInlineCompletionsSupport(handle, this._transformDocumentSelector(selector), true);
2259-
return this._createDisposable(handle);
2260-
}
2261-
22622152
$provideInlineCompletions(handle: number, resource: UriComponents, position: IPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineCompletions | undefined> {
22632153
return this._withAdapter(handle, InlineCompletionAdapterBase, adapter => adapter.provideInlineCompletions(URI.revive(resource), position, context, token), undefined, token);
22642154
}

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

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,40 +1719,15 @@ export class InlineSuggestion implements vscode.InlineCompletionItem {
17191719

17201720
@es5ClassCompat
17211721
export class InlineSuggestionList implements vscode.InlineCompletionList {
1722-
items: vscode.InlineCompletionItemNew[];
1722+
items: vscode.InlineCompletionItem[];
17231723

17241724
commands: vscode.Command[] | undefined = undefined;
17251725

1726-
constructor(items: vscode.InlineCompletionItemNew[]) {
1726+
constructor(items: vscode.InlineCompletionItem[]) {
17271727
this.items = items;
17281728
}
17291729
}
17301730

1731-
@es5ClassCompat
1732-
export class InlineSuggestionNew implements vscode.InlineCompletionItemNew {
1733-
insertText: string;
1734-
range?: Range;
1735-
command?: vscode.Command;
1736-
1737-
constructor(insertText: string, range?: Range, command?: vscode.Command) {
1738-
this.insertText = insertText;
1739-
this.range = range;
1740-
this.command = command;
1741-
}
1742-
}
1743-
1744-
@es5ClassCompat
1745-
export class InlineSuggestionsNew implements vscode.InlineCompletionListNew {
1746-
items: vscode.InlineCompletionItemNew[];
1747-
1748-
commands: vscode.Command[] | undefined;
1749-
1750-
constructor(items: vscode.InlineCompletionItemNew[], commands?: vscode.Command[]) {
1751-
this.items = items;
1752-
this.commands = commands;
1753-
}
1754-
}
1755-
17561731
export enum ViewColumn {
17571732
Active = -1,
17581733
Beside = -2,
@@ -2881,11 +2856,6 @@ export enum InlineCompletionTriggerKind {
28812856
Automatic = 1,
28822857
}
28832858

2884-
export enum InlineCompletionTriggerKindNew {
2885-
Invoke = 0,
2886-
Automatic = 1,
2887-
}
2888-
28892859
@es5ClassCompat
28902860
export class InlineValueText implements vscode.InlineValueText {
28912861
readonly range: Range;

src/vs/workbench/services/extensions/common/extensionsApiProposals.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const allApiProposals = Object.freeze({
3737
fsChunks: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts',
3838
idToken: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.idToken.d.ts',
3939
inlineCompletionsAdditions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts',
40-
inlineCompletionsNew: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletionsNew.d.ts',
4140
interactiveWindow: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.interactiveWindow.d.ts',
4241
ipc: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts',
4342
notebookCellExecutionState: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts',

src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,6 @@ declare module 'vscode' {
77

88
// https://github.com/microsoft/vscode/issues/124024 @hediet @alexdima
99

10-
export interface InlineCompletionItemNew {
11-
/**
12-
* If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.
13-
* Defaults to `false`.
14-
*/
15-
completeBracketPairs?: boolean;
16-
}
17-
18-
export interface InlineCompletionItemProviderNew {
19-
// eslint-disable-next-line local/vscode-dts-provider-naming
20-
handleDidShowCompletionItem?(completionItem: InlineCompletionItemNew): void;
21-
}
22-
2310
export interface InlineCompletionItem {
2411
/**
2512
* If set to `true`, unopened closing brackets are removed and unclosed opening brackets are closed.

0 commit comments

Comments
 (0)