|
1 | | -import { basename, dirname, join } from 'path'; |
| 1 | +import { basename, join } from 'path'; |
2 | 2 | import { ExtensionContext, commands, Uri, window, workspace } from 'vscode'; |
3 | | -// import { state } from './extension'; |
4 | | - |
5 | | -// const sketchNumber = 0; |
6 | 3 |
|
7 | 4 | export function setupCommands(context: ExtensionContext) { |
8 | | - // const runSketch = commands.registerCommand('processing.sketch.run', (resource: Uri) => { |
9 | | - // // TODO: Use VScode contexts to highlight run button when sketch is running, blocked until we do not run the sketch in a terminal |
10 | | - // // https://code.visualstudio.com/api/references/when-clause-contexts |
11 | | - |
12 | | - // const autosave = workspace |
13 | | - // .getConfiguration('processing') |
14 | | - // .get<boolean>('autosave'); |
15 | | - // if (autosave === true) { |
16 | | - // // Save all files before running the sketch |
17 | | - // commands.executeCommand('workbench.action.files.saveAll'); |
18 | | - // } |
19 | | - // if (resource == undefined) { |
20 | | - // const editor = window.activeTextEditor; |
21 | | - // if (editor) { |
22 | | - // resource = editor.document.uri; |
23 | | - // } |
24 | | - // } |
25 | | - |
26 | | - // if (!resource) { |
27 | | - // return; |
28 | | - // } |
29 | | - |
30 | | - // return; |
31 | | - |
32 | | - // let terminal = state.terminal; |
33 | | - // // Create a new terminal |
34 | | - // if (terminal === undefined || terminal.exitStatus) { |
35 | | - // window.terminals.forEach(t => { |
36 | | - // if (t.name === "Sketch") { |
37 | | - // t.dispose(); |
38 | | - // } |
39 | | - // }); |
40 | | - // state.terminal = window.createTerminal("Sketch"); |
41 | | - // terminal = state.terminal; |
42 | | - // // Show the terminal panel the first time |
43 | | - // terminal.show(true); |
44 | | - // } else { |
45 | | - // // Send the command to the terminal |
46 | | - // terminal.sendText('\x03', false); |
47 | | - // } |
48 | | - |
49 | | - // // clear the terminal |
50 | | - // terminal.sendText("clear", true); |
51 | | - |
52 | | - // let path = state.selectedVersion.path; |
53 | | - // if (process.platform === "win32") { |
54 | | - // // on windows we need to escape spaces |
55 | | - // path = `& "${path}"`; |
56 | | - // } |
57 | | - |
58 | | - // let cmd = `${path} cli --sketch="${dirname(resource.fsPath)}" --run`; |
59 | | - // if (process.platform === "win32") { |
60 | | - // // on windows we need to pipe stderr to stdout and convert to string |
61 | | - // cmd += ` 2>&1`; |
62 | | - // } |
63 | | - |
64 | | - // terminal.sendText(cmd, true); |
65 | | - // }); |
66 | | - |
67 | | - // const stopSketch = commands.registerCommand('processing.sketch.stop', () => { |
68 | | - // if (state.terminal === undefined) { |
69 | | - // return; |
70 | | - // } |
71 | | - |
72 | | - // // Send the command to the terminal |
73 | | - // state.terminal.sendText('\x03', false); |
74 | | - // }); |
75 | | - |
76 | 5 | const openSketch = commands.registerCommand('processing.sketch.open', async (folder: string, isReadOnly: boolean) => { |
77 | 6 | if (!folder) { |
78 | 7 | window.showErrorMessage("No sketch folder provided."); |
|
0 commit comments