Skip to content

Commit f096f59

Browse files
committed
refine test for #106657 and document issue with fragments and the editor opener
1 parent 98ee376 commit f096f59

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

extensions/vscode-notebook-tests/src/notebook.test.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,10 +1240,29 @@ suite('regression', () => {
12401240
assert.strictEqual(vscode.notebook.activeNotebookEditor, undefined);
12411241

12421242
// opening a cell-uri opens a notebook editor
1243-
await vscode.commands.executeCommand('vscode.open', cell.uri);
1243+
await vscode.commands.executeCommand('vscode.open', cell.uri, vscode.ViewColumn.Active);
12441244

12451245
assert.strictEqual(!!vscode.notebook.activeNotebookEditor, true);
1246-
// assert.strictEqual(vscode.notebook.activeNotebookEditor?.document.uri.toString(), resource.toString());
1246+
assert.strictEqual(vscode.notebook.activeNotebookEditor?.document.uri.toString(), resource.toString());
1247+
});
1248+
1249+
test('Cannot open notebook from cell-uri with vscode.open-command', async function () {
1250+
this.skip();
1251+
assertInitalState();
1252+
const resource = await createRandomFile('', undefined, 'first', '.vsctestnb');
1253+
await vscode.commands.executeCommand('vscode.openWith', resource, 'notebookCoreTest');
1254+
1255+
const document = vscode.notebook.activeNotebookEditor?.document!;
1256+
const [cell] = document.cells;
1257+
1258+
await saveAllFilesAndCloseAll(document.uri);
1259+
assert.strictEqual(vscode.notebook.activeNotebookEditor, undefined);
1260+
1261+
// BUG is that the editor opener (https://github.com/microsoft/vscode/blob/8e7877bdc442f1e83a7fec51920d82b696139129/src/vs/editor/browser/services/openerService.ts#L69)
1262+
// removes the fragment if it matches something numeric. For notebooks that's not wanted...
1263+
await vscode.commands.executeCommand('vscode.open', cell.uri);
1264+
1265+
assert.strictEqual(vscode.notebook.activeNotebookEditor?.document.uri.toString(), resource.toString());
12471266
});
12481267

12491268
test('#97830, #97764. Support switch to other editor types', async function () {

0 commit comments

Comments
 (0)