MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / openNewNotebookEditor

Function openNewNotebookEditor

src/test/openNewEditor.ts:27–50  ·  view source on GitHub ↗
(
  cellContents: string[],
  language: string = "plaintext"
)

Source from the content-addressed store, hash-verified

25 * @returns notebook
26 */
27export async function openNewNotebookEditor(
28 cellContents: string[],
29 language: string = "plaintext"
30) {
31 await vscode.commands.executeCommand("workbench.action.closeAllEditors");
32
33 const document = await vscode.workspace.openNotebookDocument(
34 "jupyter-notebook",
35 new vscode.NotebookData(
36 cellContents.map(
37 (contents) =>
38 new vscode.NotebookCellData(
39 vscode.NotebookCellKind.Code,
40 contents,
41 language
42 )
43 )
44 )
45 );
46
47 await (await getParseTreeApi()).loadLanguage(language);
48
49 return document;
50}

Callers 1

runTestFunction · 0.90

Calls 1

getParseTreeApiFunction · 0.90

Tested by 1

runTestFunction · 0.72