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

Function openNewEditor

src/test/openNewEditor.ts:4–18  ·  view source on GitHub ↗
(
  content: string,
  language: string = "plaintext"
)

Source from the content-addressed store, hash-verified

2import { getParseTreeApi } from "../util/getExtensionApi";
3
4export async function openNewEditor(
5 content: string,
6 language: string = "plaintext"
7) {
8 await vscode.commands.executeCommand("workbench.action.closeAllEditors");
9
10 const document = await vscode.workspace.openTextDocument({
11 language,
12 content,
13 });
14
15 await (await getParseTreeApi()).loadLanguage(language);
16
17 return await vscode.window.showTextDocument(document);
18}
19
20/**
21 * Open a new notebook editor with the given cells

Callers 4

runTestFunction · 0.90
runTestFunction · 0.90
runTestFunction · 0.90
runTestFunction · 0.90

Calls 1

getParseTreeApiFunction · 0.90

Tested by 4

runTestFunction · 0.72
runTestFunction · 0.72
runTestFunction · 0.72
runTestFunction · 0.72