mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
remove old notebook events from API proposal and implementation
This commit is contained in:
@@ -60,7 +60,7 @@ suite('NotebookCell#Document', function () {
|
||||
}
|
||||
};
|
||||
extHostNotebooks = new ExtHostNotebookController(rpcProtocol, new ExtHostCommands(rpcProtocol, new NullLogService()), extHostDocumentsAndEditors, extHostDocuments, extHostStoragePaths);
|
||||
extHostNotebookDocuments = new ExtHostNotebookDocuments(new NullLogService(), extHostNotebooks);
|
||||
extHostNotebookDocuments = new ExtHostNotebookDocuments(extHostNotebooks);
|
||||
|
||||
let reg = extHostNotebooks.registerNotebookContentProvider(nullExtensionDescription, 'test', new class extends mock<vscode.NotebookContentProvider>() {
|
||||
// async openNotebook() { }
|
||||
@@ -146,12 +146,13 @@ suite('NotebookCell#Document', function () {
|
||||
test('cell document is vscode.TextDocument after changing it', async function () {
|
||||
|
||||
const p = new Promise<void>((resolve, reject) => {
|
||||
extHostNotebooks.onDidChangeNotebookCells(e => {
|
||||
try {
|
||||
assert.strictEqual(e.changes.length, 1);
|
||||
assert.strictEqual(e.changes[0].items.length, 2);
|
||||
|
||||
const [first, second] = e.changes[0].items;
|
||||
extHostNotebookDocuments.onDidChangeNotebookDocument(e => {
|
||||
try {
|
||||
assert.strictEqual(e.contentChanges.length, 1);
|
||||
assert.strictEqual(e.contentChanges[0].addedCells.length, 2);
|
||||
|
||||
const [first, second] = e.contentChanges[0].addedCells;
|
||||
|
||||
const doc1 = extHostDocuments.getAllDocumentData().find(data => isEqual(data.document.uri, first.document.uri));
|
||||
assert.ok(doc1);
|
||||
@@ -167,6 +168,7 @@ suite('NotebookCell#Document', function () {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
extHostNotebookDocuments.$acceptModelChanged(notebookUri, new SerializableObjectWithBuffers({
|
||||
@@ -317,7 +319,7 @@ suite('NotebookCell#Document', function () {
|
||||
|
||||
test('ERR MISSING extHostDocument for notebook cell: #116711', async function () {
|
||||
|
||||
const p = Event.toPromise(extHostNotebooks.onDidChangeNotebookCells);
|
||||
const p = Event.toPromise(extHostNotebookDocuments.onDidChangeNotebookDocument);
|
||||
|
||||
// DON'T call this, make sure the cell-documents have not been created yet
|
||||
// assert.strictEqual(notebook.notebookDocument.cellCount, 2);
|
||||
@@ -350,14 +352,14 @@ suite('NotebookCell#Document', function () {
|
||||
|
||||
const event = await p;
|
||||
|
||||
assert.strictEqual(event.document === notebook.apiNotebook, true);
|
||||
assert.strictEqual(event.changes.length, 1);
|
||||
assert.strictEqual(event.changes[0].deletedCount, 2);
|
||||
assert.strictEqual(event.changes[0].deletedItems[0].document.isClosed, true);
|
||||
assert.strictEqual(event.changes[0].deletedItems[1].document.isClosed, true);
|
||||
assert.strictEqual(event.changes[0].items.length, 2);
|
||||
assert.strictEqual(event.changes[0].items[0].document.isClosed, false);
|
||||
assert.strictEqual(event.changes[0].items[1].document.isClosed, false);
|
||||
assert.strictEqual(event.notebook === notebook.apiNotebook, true);
|
||||
assert.strictEqual(event.contentChanges.length, 1);
|
||||
assert.strictEqual(event.contentChanges[0].range.end - event.contentChanges[0].range.start, 2);
|
||||
assert.strictEqual(event.contentChanges[0].removedCells[0].document.isClosed, true);
|
||||
assert.strictEqual(event.contentChanges[0].removedCells[1].document.isClosed, true);
|
||||
assert.strictEqual(event.contentChanges[0].addedCells.length, 2);
|
||||
assert.strictEqual(event.contentChanges[0].addedCells[0].document.isClosed, false);
|
||||
assert.strictEqual(event.contentChanges[0].addedCells[1].document.isClosed, false);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ suite('NotebookConcatDocument', function () {
|
||||
}
|
||||
};
|
||||
extHostNotebooks = new ExtHostNotebookController(rpcProtocol, new ExtHostCommands(rpcProtocol, new NullLogService()), extHostDocumentsAndEditors, extHostDocuments, extHostStoragePaths);
|
||||
extHostNotebookDocuments = new ExtHostNotebookDocuments(new NullLogService(), extHostNotebooks);
|
||||
extHostNotebookDocuments = new ExtHostNotebookDocuments(extHostNotebooks);
|
||||
|
||||
let reg = extHostNotebooks.registerNotebookContentProvider(nullExtensionDescription, 'test', new class extends mock<vscode.NotebookContentProvider>() {
|
||||
// async openNotebook() { }
|
||||
@@ -93,7 +93,7 @@ suite('NotebookConcatDocument', function () {
|
||||
});
|
||||
|
||||
test('empty', function () {
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
assert.strictEqual(doc.getText(), '');
|
||||
assert.strictEqual(doc.version, 0);
|
||||
|
||||
@@ -156,7 +156,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
assert.strictEqual(notebook.apiNotebook.cellCount, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
|
||||
assert.strictEqual(doc.contains(cellUri1), true);
|
||||
assert.strictEqual(doc.contains(cellUri2), true);
|
||||
@@ -194,7 +194,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
assert.strictEqual(notebook.apiNotebook.cellCount, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
|
||||
assertLocation(doc, new Position(0, 0), new Location(notebook.apiNotebook.cellAt(0).document.uri, new Position(0, 0)));
|
||||
@@ -207,7 +207,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
test('location, position mapping, cell changes', function () {
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
|
||||
// UPDATE 1
|
||||
extHostNotebookDocuments.$acceptModelChanged(notebookUri, new SerializableObjectWithBuffers({
|
||||
@@ -284,7 +284,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
test('location, position mapping, cell-document changes', function () {
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
|
||||
// UPDATE 1
|
||||
extHostNotebookDocuments.$acceptModelChanged(notebookUri, new SerializableObjectWithBuffers({
|
||||
@@ -374,9 +374,9 @@ suite('NotebookConcatDocument', function () {
|
||||
]
|
||||
}), false);
|
||||
|
||||
const mixedDoc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
const fooLangDoc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, 'fooLang');
|
||||
const barLangDoc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, 'barLang');
|
||||
const mixedDoc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
const fooLangDoc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, 'fooLang');
|
||||
const barLangDoc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, 'barLang');
|
||||
|
||||
assertLines(mixedDoc, 'fooLang-document', 'barLang-document');
|
||||
assertLines(fooLangDoc, 'fooLang-document');
|
||||
@@ -448,7 +448,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
assert.strictEqual(notebook.apiNotebook.cellCount, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
|
||||
assertOffsetAtPosition(doc, 0, { line: 0, character: 0 });
|
||||
@@ -505,7 +505,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
assert.strictEqual(notebook.apiNotebook.cellCount, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
|
||||
assertLocationAtPosition(doc, { line: 0, character: 0 }, { uri: notebook.apiNotebook.cellAt(0).document.uri, line: 0, character: 0 });
|
||||
@@ -554,7 +554,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
assert.strictEqual(notebook.apiNotebook.cellCount, 1 + 3); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!', 'Three', 'Drei', 'Drüü');
|
||||
|
||||
assert.strictEqual(doc.getText(new Range(0, 0, 0, 0)), '');
|
||||
@@ -593,7 +593,7 @@ suite('NotebookConcatDocument', function () {
|
||||
|
||||
assert.strictEqual(notebook.apiNotebook.cellCount, 1 + 2); // markdown and code
|
||||
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebooks, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
let doc = new ExtHostNotebookConcatDocument(extHostNotebookDocuments, extHostDocuments, notebook.apiNotebook, undefined);
|
||||
assertLines(doc, 'Hello', 'World', 'Hello World!', 'Hallo', 'Welt', 'Hallo Welt!');
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ suite('NotebookKernel', function () {
|
||||
extHostCommands = new ExtHostCommands(rpcProtocol, new NullLogService());
|
||||
extHostNotebooks = new ExtHostNotebookController(rpcProtocol, extHostCommands, extHostDocumentsAndEditors, extHostDocuments, extHostStoragePaths);
|
||||
|
||||
extHostNotebookDocuments = new ExtHostNotebookDocuments(new NullLogService(), extHostNotebooks);
|
||||
extHostNotebookDocuments = new ExtHostNotebookDocuments(extHostNotebooks);
|
||||
|
||||
extHostNotebooks.$acceptDocumentAndEditorsDelta(new SerializableObjectWithBuffers({
|
||||
addedDocuments: [{
|
||||
|
||||
Reference in New Issue
Block a user