Remove the textDocumentNotebook API proposal (#149277)
* Remove the textDocumentNotebook API proposal All consumers have now been migrated off of this proposal, so it is safe to remove from our code * Remove deprecated api usage from testpull/149277/merge
parent
624bbc4fb9
commit
67014adc30
|
@ -42,7 +42,6 @@
|
|||
"terminalNameChangeEvent",
|
||||
"testCoverage",
|
||||
"testObserver",
|
||||
"textDocumentNotebook",
|
||||
"textSearchProvider",
|
||||
"timeline",
|
||||
"tokenInformation",
|
||||
|
|
|
@ -128,7 +128,6 @@ suite.skip('Notebook Document', function () {
|
|||
|
||||
const doc = vscode.workspace.textDocuments.find(doc => doc.uri.toString() === cell.document.uri.toString());
|
||||
assert.ok(doc);
|
||||
assert.strictEqual(doc.notebook === notebook, true);
|
||||
assert.strictEqual(doc === cell.document, true);
|
||||
assert.strictEqual(doc?.languageId, cell.document.languageId);
|
||||
assert.strictEqual(doc?.isDirty, false);
|
||||
|
|
|
@ -453,7 +453,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
|||
return extHostLanguages.changeLanguage(document.uri, languageId);
|
||||
},
|
||||
match(selector: vscode.DocumentSelector, document: vscode.TextDocument): number {
|
||||
return score(typeConverters.LanguageSelector.from(selector), document.uri, document.languageId, true, document.notebook?.notebookType);
|
||||
const notebookType = extHostDocuments.getDocumentData(document.uri)?.notebook?.notebookType;
|
||||
return score(typeConverters.LanguageSelector.from(selector), document.uri, document.languageId, true, notebookType);
|
||||
},
|
||||
registerCodeActionsProvider(selector: vscode.DocumentSelector, provider: vscode.CodeActionProvider, metadata?: vscode.CodeActionProviderMetadata): vscode.Disposable {
|
||||
return extHostLanguageFeatures.registerCodeActionProvider(extension, checkSelector(selector), provider, metadata);
|
||||
|
|
|
@ -37,7 +37,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
|||
uri: URI, lines: string[], eol: string, versionId: number,
|
||||
private _languageId: string,
|
||||
private _isDirty: boolean,
|
||||
private readonly _notebook?: vscode.NotebookDocument | undefined
|
||||
public readonly notebook?: vscode.NotebookDocument | undefined
|
||||
) {
|
||||
super(uri, lines, eol, versionId);
|
||||
}
|
||||
|
@ -66,7 +66,6 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
|||
get version() { return that._versionId; },
|
||||
get isClosed() { return that._isDisposed; },
|
||||
get isDirty() { return that._isDirty; },
|
||||
get notebook() { return that._notebook; },
|
||||
save() { return that._save(); },
|
||||
getText(range?) { return range ? that._getTextInRange(range) : that.getText(); },
|
||||
get eol() { return that._eol === '\n' ? EndOfLine.LF : EndOfLine.CRLF; },
|
||||
|
|
|
@ -115,13 +115,11 @@ suite('NotebookCell#Document', function () {
|
|||
assert.ok(d1);
|
||||
assert.strictEqual(d1.languageId, c1.document.languageId);
|
||||
assert.strictEqual(d1.version, 1);
|
||||
assert.ok(d1.notebook === notebook.apiNotebook);
|
||||
|
||||
const d2 = extHostDocuments.getDocument(c2.document.uri);
|
||||
assert.ok(d2);
|
||||
assert.strictEqual(d2.languageId, c2.document.languageId);
|
||||
assert.strictEqual(d2.version, 1);
|
||||
assert.ok(d2.notebook === notebook.apiNotebook);
|
||||
});
|
||||
|
||||
test('cell document goes when notebook closes', async function () {
|
||||
|
@ -264,12 +262,6 @@ suite('NotebookCell#Document', function () {
|
|||
assert.throws(() => extHostDocuments.getDocument(cell1.document.uri));
|
||||
});
|
||||
|
||||
test('cell document knows notebook', function () {
|
||||
for (let cells of notebook.apiNotebook.getCells()) {
|
||||
assert.strictEqual(cells.document.notebook === notebook.apiNotebook, true);
|
||||
}
|
||||
});
|
||||
|
||||
test('cell#index', function () {
|
||||
|
||||
assert.strictEqual(notebook.apiNotebook.cellCount, 2);
|
||||
|
|
|
@ -55,7 +55,6 @@ export const allApiProposals = Object.freeze({
|
|||
terminalNameChangeEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalNameChangeEvent.d.ts',
|
||||
testCoverage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testCoverage.d.ts',
|
||||
testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',
|
||||
textDocumentNotebook: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textDocumentNotebook.d.ts',
|
||||
textEditorDrop: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textEditorDrop.d.ts',
|
||||
textSearchProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',
|
||||
timeline: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts',
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'vscode' {
|
||||
|
||||
// https://github.com/microsoft/vscode/issues/102091
|
||||
|
||||
export interface TextDocument {
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* This proposal won't be finalized like this, see https://github.com/microsoft/vscode/issues/102091#issuecomment-865050645.
|
||||
* Already today you can use
|
||||
*
|
||||
* ```ts
|
||||
* vscode.workspace.notebookDocuments.find(notebook => notebook.getCells().some(cell => cell.document === myTextDocument))
|
||||
* ```
|
||||
*
|
||||
*
|
||||
*/
|
||||
notebook: NotebookDocument | undefined;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue