Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the textDocumentNotebook API proposal #149277

Merged
merged 2 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion extensions/vscode-api-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"terminalNameChangeEvent",
"testCoverage",
"testObserver",
"textDocumentNotebook",
"textSearchProvider",
"timeline",
"tokenInformation",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/vs/workbench/api/common/extHostDocumentData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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; },
Expand Down
8 changes: 0 additions & 8 deletions src/vs/workbench/api/test/browser/extHostNotebook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
26 changes: 0 additions & 26 deletions src/vscode-dts/vscode.proposed.textDocumentNotebook.d.ts

This file was deleted.