aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/package.json4
-rw-r--r--code/src/extension.ts12
2 files changed, 15 insertions, 1 deletions
diff --git a/code/package.json b/code/package.json
index 00604efcc..282e533af 100644
--- a/code/package.json
+++ b/code/package.json
@@ -52,6 +52,10 @@
52 ], 52 ],
53 "commands": [ 53 "commands": [
54 { 54 {
55 "command": "libsyntax-rust.createFile",
56 "title": "Show Rust syntax tree"
57 },
58 {
55 "command": "libsyntax-rust.syntaxTree", 59 "command": "libsyntax-rust.syntaxTree",
56 "title": "Show Rust syntax tree" 60 "title": "Show Rust syntax tree"
57 }, 61 },
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) {
81 let e = await vscode.window.showTextDocument(doc) 81 let e = await vscode.window.showTextDocument(doc)
82 e.revealRange(range, vscode.TextEditorRevealType.InCenter) 82 e.revealRange(range, vscode.TextEditorRevealType.InCenter)
83 }) 83 })
84 console.log("ping") 84
85 registerCommand('libsyntax-rust.run', async (cmd: ProcessSpec) => { 85 registerCommand('libsyntax-rust.run', async (cmd: ProcessSpec) => {
86 let task = createTask(cmd) 86 let task = createTask(cmd)
87 await vscode.tasks.executeTask(task) 87 await vscode.tasks.executeTask(task)
88 }) 88 })
89 registerCommand('libsyntax-rust.createFile', async (uri_: string) => {
90 console.log(`uri: ${uri_}`)
91 let uri = vscode.Uri.parse(uri_)
92 let edit = new vscode.WorkspaceEdit()
93 edit.createFile(uri)
94 await vscode.workspace.applyEdit(edit)
95 let doc = await vscode.workspace.openTextDocument(uri)
96 await vscode.window.showTextDocument(doc)
97 console.log("Done")
98 })
89 99
90 dispose(vscode.workspace.registerTextDocumentContentProvider( 100 dispose(vscode.workspace.registerTextDocumentContentProvider(
91 'libsyntax-rust', 101 'libsyntax-rust',