From aaca7d003bd969785be53d8f312b67bfa26f6272 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 27 Aug 2018 20:58:38 +0300 Subject: move scopes to file --- code/package.json | 4 ++++ code/src/extension.ts | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'code') diff --git a/code/package.json b/code/package.json index 00604efcc..282e533af 100644 --- a/code/package.json +++ b/code/package.json @@ -51,6 +51,10 @@ } ], "commands": [ + { + "command": "libsyntax-rust.createFile", + "title": "Show Rust syntax tree" + }, { "command": "libsyntax-rust.syntaxTree", "title": "Show Rust syntax tree" diff --git a/code/src/extension.ts b/code/src/extension.ts index c25e8cb61..b9d009776 100644 --- a/code/src/extension.ts +++ b/code/src/extension.ts @@ -81,11 +81,21 @@ export function activate(context: vscode.ExtensionContext) { let e = await vscode.window.showTextDocument(doc) e.revealRange(range, vscode.TextEditorRevealType.InCenter) }) - console.log("ping") + registerCommand('libsyntax-rust.run', async (cmd: ProcessSpec) => { let task = createTask(cmd) await vscode.tasks.executeTask(task) }) + registerCommand('libsyntax-rust.createFile', async (uri_: string) => { + console.log(`uri: ${uri_}`) + let uri = vscode.Uri.parse(uri_) + let edit = new vscode.WorkspaceEdit() + edit.createFile(uri) + await vscode.workspace.applyEdit(edit) + let doc = await vscode.workspace.openTextDocument(uri) + await vscode.window.showTextDocument(doc) + console.log("Done") + }) dispose(vscode.workspace.registerTextDocumentContentProvider( 'libsyntax-rust', -- cgit v1.2.3