Skip to content

Commit 8b0b3ee

Browse files
authored
Remove notebook editor decoration type (microsoft#151574)
* Remove the notebookEditorDecorationType API proposal Fixes microsoft#146838 * Remove all the infastructure around the now removed notebookEditorDecorationType api
1 parent 32ba8bc commit 8b0b3ee

File tree

17 files changed

+4
-427
lines changed

17 files changed

+4
-427
lines changed

extensions/vscode-api-tests/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"notebookControllerKind",
2525
"notebookDebugOptions",
2626
"notebookDeprecated",
27-
"notebookEditorDecorationType",
2827
"notebookEditorEdit",
2928
"notebookLiveShare",
3029
"notebookMessaging",

extensions/vscode-api-tests/src/singlefolder-tests/rpc.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ suite('vscode', function () {
9393
assertNoRpcFromEntry([item, 'TreeView']);
9494
});
9595

96-
test('no rpc, createNotebookEditorDecorationType(...)', function () {
97-
const item = vscode.notebooks.createNotebookEditorDecorationType({ top: {} });
98-
dispo.push(item);
99-
assertNoRpcFromEntry([item, 'NotebookEditorDecorationType']);
100-
});
10196

10297
test('no rpc, createNotebookController(...)', function () {
10398
const ctrl = vscode.notebooks.createNotebookController('foo', 'bar', '');

extensions/vscode-notebook-tests/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"notebookControllerKind",
1616
"notebookDebugOptions",
1717
"notebookDeprecated",
18-
"notebookEditorDecorationType",
1918
"notebookLiveShare",
2019
"notebookMessaging",
2120
"notebookMime"

src/vs/workbench/api/browser/mainThreadNotebookEditors.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { DisposableStore, dispose } from 'vs/base/common/lifecycle';
77
import { getNotebookEditorFromEditorPane, INotebookEditor, INotebookEditorOptions } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
88
import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/notebookEditorService';
99
import { ExtHostContext, ExtHostNotebookEditorsShape, ICellEditOperationDto, INotebookDocumentShowOptions, INotebookEditorViewColumnInfo, MainThreadNotebookEditorsShape, NotebookEditorRevealType } from '../common/extHost.protocol';
10-
import { INotebookDecorationRenderOptions } from 'vs/workbench/contrib/notebook/common/notebookCommon';
1110
import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange';
1211
import { ILogService } from 'vs/platform/log/common/log';
1312
import { URI, UriComponents } from 'vs/base/common/uri';
@@ -165,22 +164,6 @@ export class MainThreadNotebookEditors implements MainThreadNotebookEditorsShape
165164
}
166165
}
167166

168-
$registerNotebookEditorDecorationType(key: string, options: INotebookDecorationRenderOptions): void {
169-
this._notebookEditorService.registerEditorDecorationType(key, options);
170-
}
171-
172-
$removeNotebookEditorDecorationType(key: string): void {
173-
this._notebookEditorService.removeEditorDecorationType(key);
174-
}
175-
176-
$trySetDecorations(id: string, range: ICellRange, key: string): void {
177-
const editor = this._notebookEditorService.getNotebookEditor(id);
178-
if (editor) {
179-
const notebookEditor = editor as INotebookEditor;
180-
notebookEditor.setEditorDecorations(key, range);
181-
}
182-
}
183-
184167
$trySetSelections(id: string, ranges: ICellRange[]): void {
185168
const editor = this._notebookEditorService.getNotebookEditor(id);
186169
if (!editor) {

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
158158
const extHostDocumentSaveParticipant = rpcProtocol.set(ExtHostContext.ExtHostDocumentSaveParticipant, new ExtHostDocumentSaveParticipant(extHostLogService, extHostDocuments, rpcProtocol.getProxy(MainContext.MainThreadBulkEdits)));
159159
const extHostNotebook = rpcProtocol.set(ExtHostContext.ExtHostNotebook, new ExtHostNotebookController(rpcProtocol, extHostCommands, extHostDocumentsAndEditors, extHostDocuments, extensionStoragePaths));
160160
const extHostNotebookDocuments = rpcProtocol.set(ExtHostContext.ExtHostNotebookDocuments, new ExtHostNotebookDocuments(extHostNotebook));
161-
const extHostNotebookEditors = rpcProtocol.set(ExtHostContext.ExtHostNotebookEditors, new ExtHostNotebookEditors(extHostLogService, rpcProtocol, extHostNotebook));
161+
const extHostNotebookEditors = rpcProtocol.set(ExtHostContext.ExtHostNotebookEditors, new ExtHostNotebookEditors(extHostLogService, extHostNotebook));
162162
const extHostNotebookKernels = rpcProtocol.set(ExtHostContext.ExtHostNotebookKernels, new ExtHostNotebookKernels(rpcProtocol, initData, extHostNotebook, extHostCommands, extHostLogService));
163163
const extHostNotebookRenderers = rpcProtocol.set(ExtHostContext.ExtHostNotebookRenderers, new ExtHostNotebookRenderers(rpcProtocol, extHostNotebook));
164164
const extHostEditors = rpcProtocol.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(rpcProtocol, extHostDocumentsAndEditors));
@@ -1146,10 +1146,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
11461146
registerNotebookCellStatusBarItemProvider: (notebookType: string, provider: vscode.NotebookCellStatusBarItemProvider) => {
11471147
return extHostNotebook.registerNotebookCellStatusBarItemProvider(extension, notebookType, provider);
11481148
},
1149-
createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType {
1150-
checkProposedApiEnabled(extension, 'notebookEditorDecorationType');
1151-
return extHostNotebookEditors.createNotebookEditorDecorationType(options);
1152-
},
11531149
createRendererMessaging(rendererId) {
11541150
return extHostNotebookRenderers.createRendererMessaging(extension, rendererId);
11551151
},

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -959,10 +959,7 @@ export interface MainThreadNotebookShape extends IDisposable {
959959
export interface MainThreadNotebookEditorsShape extends IDisposable {
960960
$tryShowNotebookDocument(uriComponents: UriComponents, viewType: string, options: INotebookDocumentShowOptions): Promise<string>;
961961
$tryRevealRange(id: string, range: ICellRange, revealType: NotebookEditorRevealType): Promise<void>;
962-
$registerNotebookEditorDecorationType(key: string, options: notebookCommon.INotebookDecorationRenderOptions): void;
963-
$removeNotebookEditorDecorationType(key: string): void;
964962
$trySetSelections(id: string, range: ICellRange[]): void;
965-
$trySetDecorations(id: string, range: ICellRange, decorationKey: string): void;
966963
$tryApplyEdits(editorId: string, modelVersionId: number, cellEdits: ICellEditOperationDto[]): Promise<boolean>;
967964
}
968965

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ export class ExtHostNotebookEditor {
8181
private _viewColumn?: vscode.ViewColumn;
8282

8383
private _visible: boolean = false;
84-
private readonly _hasDecorationsForKey = new Set<string>();
8584

8685
private _editor?: vscode.NotebookEditor;
8786

@@ -142,9 +141,6 @@ export class ExtHostNotebookEditor {
142141
callback(edit);
143142
return that._applyEdit(edit.finalize());
144143
},
145-
setDecorations(decorationType, range) {
146-
return that.setDecorations(decorationType, range);
147-
}
148144
};
149145

150146
ExtHostNotebookEditor.apiEditorsToExtHost.set(this._editor, this);
@@ -211,22 +207,4 @@ export class ExtHostNotebookEditor {
211207

212208
return this._proxy.$tryApplyEdits(this.id, editData.documentVersionId, compressedEdits);
213209
}
214-
215-
setDecorations(decorationType: vscode.NotebookEditorDecorationType, range: vscode.NotebookRange): void {
216-
if (range.isEmpty && !this._hasDecorationsForKey.has(decorationType.key)) {
217-
// avoid no-op call to the renderer
218-
return;
219-
}
220-
if (range.isEmpty) {
221-
this._hasDecorationsForKey.delete(decorationType.key);
222-
} else {
223-
this._hasDecorationsForKey.add(decorationType.key);
224-
}
225-
226-
return this._proxy.$trySetDecorations(
227-
this.id,
228-
extHostConverter.NotebookRange.from(range),
229-
decorationType.key
230-
);
231-
}
232210
}

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

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,12 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { Emitter } from 'vs/base/common/event';
7-
import { IdGenerator } from 'vs/base/common/idGenerator';
87
import { ILogService } from 'vs/platform/log/common/log';
9-
import { ExtHostNotebookEditorsShape, INotebookEditorPropertiesChangeData, INotebookEditorViewColumnInfo, MainContext, MainThreadNotebookEditorsShape } from 'vs/workbench/api/common/extHost.protocol';
8+
import { ExtHostNotebookEditorsShape, INotebookEditorPropertiesChangeData, INotebookEditorViewColumnInfo } from 'vs/workbench/api/common/extHost.protocol';
109
import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
11-
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
1210
import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters';
1311
import type * as vscode from 'vscode';
1412

15-
class NotebookEditorDecorationType {
16-
17-
private static readonly _Keys = new IdGenerator('NotebookEditorDecorationType');
18-
19-
readonly value: vscode.NotebookEditorDecorationType;
20-
21-
constructor(proxy: MainThreadNotebookEditorsShape, options: vscode.NotebookDecorationRenderOptions) {
22-
const key = NotebookEditorDecorationType._Keys.nextId();
23-
proxy.$registerNotebookEditorDecorationType(key, typeConverters.NotebookDecorationRenderOptions.from(options));
24-
25-
this.value = {
26-
key,
27-
dispose() {
28-
proxy.$removeNotebookEditorDecorationType(key);
29-
}
30-
};
31-
}
32-
}
33-
3413

3514
export class ExtHostNotebookEditors implements ExtHostNotebookEditorsShape {
3615

@@ -42,16 +21,8 @@ export class ExtHostNotebookEditors implements ExtHostNotebookEditorsShape {
4221

4322
constructor(
4423
@ILogService private readonly _logService: ILogService,
45-
@IExtHostRpcService private readonly _extHostRpc: IExtHostRpcService,
4624
private readonly _notebooksAndEditors: ExtHostNotebookController,
47-
) {
48-
49-
}
50-
51-
52-
createNotebookEditorDecorationType(options: vscode.NotebookDecorationRenderOptions): vscode.NotebookEditorDecorationType {
53-
return new NotebookEditorDecorationType(this._extHostRpc.getProxy(MainContext.MainThreadNotebookEditors), options).value;
54-
}
25+
) { }
5526

5627
$acceptEditorPropertiesChanged(id: string, data: INotebookEditorPropertiesChangeData): void {
5728
this._logService.debug('ExtHostNotebook#$acceptEditorPropertiesChanged', id, data);

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,16 +1675,6 @@ export namespace NotebookExclusiveDocumentPattern {
16751675
}
16761676
}
16771677

1678-
export namespace NotebookDecorationRenderOptions {
1679-
export function from(options: vscode.NotebookDecorationRenderOptions): notebooks.INotebookDecorationRenderOptions {
1680-
return {
1681-
backgroundColor: <string | types.ThemeColor>options.backgroundColor,
1682-
borderColor: <string | types.ThemeColor>options.borderColor,
1683-
top: options.top ? ThemableDecorationAttachmentRenderOptions.from(options.top) : undefined
1684-
};
1685-
}
1686-
}
1687-
16881678
export namespace NotebookStatusBarItem {
16891679
export function from(item: vscode.NotebookCellStatusBarItem, commandsConverter: Command.ICommandsConverter, disposables: DisposableStore): notebooks.INotebookCellStatusBarItem {
16901680
const command = typeof item.command === 'string' ? { title: '', command: item.command } : item.command;

src/vs/workbench/contrib/notebook/browser/notebookBrowser.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,6 @@ export interface INotebookEditor {
591591
*/
592592
changeModelDecorations<T>(callback: (changeAccessor: IModelDecorationsChangeAccessor) => T): T | null;
593593

594-
/**
595-
* Set decoration key on cells in the range
596-
*/
597-
setEditorDecorations(key: string, range: ICellRange): void;
598-
599-
/**
600-
* Remove decoration key from the notebook editor
601-
*/
602-
removeEditorDecorations(key: string): void;
603-
604594
/**
605595
* Get a contribution of this editor.
606596
* @id Unique identifier of the contribution.

0 commit comments

Comments
 (0)