-
Notifications
You must be signed in to change notification settings - Fork 39
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,23 +57,21 @@ | |
| } | ||
|
|
||
| window.addEventListener("ide-ready", () => { | ||
| class rebuildAction extends window.ide.workbench.action { | ||
| run() { | ||
| rebuild() | ||
| } | ||
| } | ||
|
|
||
| window.ide.workbench.actionsRegistry.registerWorkbenchAction(new window.ide.workbench.syncActionDescriptor(rebuildAction, "sail.rebuild", "Rebuild sail container", { | ||
| primary: ((1 << 11) >>> 0) | 48 // That's cmd + R. See vscode source for the magic numbers. | ||
| }), "sail: Rebuild", "sail"); | ||
|
|
||
| const statusBarService = window.ide.workbench.statusbarService | ||
| statusBarService.addEntry({ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we want to only show this when we detect a change to the Dockerfile? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can just leave it there. |
||
| text: "rebuild", | ||
| tooltip: "press super+alt+r to rebuild", | ||
| command: "rebuild-sail-container" | ||
| tooltip: "press super+r to rebuild", | ||
|
||
| command: "sail.rebuild" | ||
| }, 0) | ||
|
|
||
| const commandRegistry = window.ide.workbench.commandRegistry | ||
| commandRegistry.registerCommand({ | ||
| id: "rebuild-sail-container", | ||
| handler: (accessor, args) => { | ||
| rebuild() | ||
| }, | ||
| description: { | ||
| description: "Rebuild sail container", | ||
| args: [] | ||
| } | ||
| }) | ||
| }) | ||
| }()) | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package main | ||
|
|
||
| //go:generate go run sail.js_gen.go | ||
| const sailJS = "(function() {\n function startReloadUI() {\n const div = document.createElement(\"div\")\n div.className = \"msgbox-overlay\"\n div.style.opacity = 1\n div.style.textAlign = \"center\"\n div.innerHTML = `<div class=\"msgbox\">\n <div class=\"msg\">Reloading container</div>\n </div>`\n document.querySelector(\".monaco-workbench\").appendChild(div)\n }\n\n function removeElementsByClass(className) {\n let elements = document.getElementsByClassName(className);\n for (let e of elements) {\n e.parentNode.removeChild(e)\n }\n }\n\n function stopReloadUI() {\n removeElementsByClass(\"msgbox-overlay\")\n }\n\n let tty\n function rebuild() {\n const tsrv = window.ide.workbench.terminalService\n\n if (tty == null) {\n tty = tsrv.createTerminal({\n name: \"sail\",\n isRendererOnly: true,\n }, false)\n } else {\n tty.clear()\n }\n let oldTTY = tsrv.getActiveInstance()\n tsrv.setActiveInstance(tty)\n // Show the panel and focus it to prevent the user from editing the Dockerfile.\n tsrv.showPanel(true)\n\n startReloadUI()\n\n const ws = new WebSocket(\"ws://\" + location.host + \"/sail/api/v1/reload\")\n ws.onmessage = (ev) => {\n const msg = JSON.parse(ev.data)\n const out = atob(msg.v).replace(/\\n/g, \"\\n\\r\")\n tty.write(out)\n }\n ws.onclose = (ev) => {\n if (ev.code === 1000) {\n tsrv.setActiveInstance(oldTTY)\n } else {\n alert(\"reload failed; please see logs in sail terminal\")\n }\n stopReloadUI()\n }\n }\n\n window.addEventListener(\"ide-ready\", () => {\n const statusBarService = window.ide.workbench.statusbarService\n statusBarService.addEntry({\n text: \"rebuild\",\n tooltip: \"press super+alt+r to rebuild\",\n command: \"rebuild-sail-container\"\n }, 0)\n\n const commandRegistry = window.ide.workbench.commandRegistry\n commandRegistry.registerCommand({\n id: \"rebuild-sail-container\",\n handler: (accessor, args) => {\n rebuild()\n },\n description: {\n description: \"Rebuild sail container\",\n args: []\n }\n })\n })\n}())" | ||
| const sailJS = "(function() {\n function startReloadUI() {\n const div = document.createElement(\"div\")\n div.className = \"msgbox-overlay\"\n div.style.opacity = 1\n div.style.textAlign = \"center\"\n div.innerHTML = `<div class=\"msgbox\">\n <div class=\"msg\">Reloading container</div>\n </div>`\n document.querySelector(\".monaco-workbench\").appendChild(div)\n }\n\n function removeElementsByClass(className) {\n let elements = document.getElementsByClassName(className);\n for (let e of elements) {\n e.parentNode.removeChild(e)\n }\n }\n\n function stopReloadUI() {\n removeElementsByClass(\"msgbox-overlay\")\n }\n\n let tty\n function rebuild() {\n const tsrv = window.ide.workbench.terminalService\n\n if (tty == null) {\n tty = tsrv.createTerminal({\n name: \"sail\",\n isRendererOnly: true,\n }, false)\n } else {\n tty.clear()\n }\n let oldTTY = tsrv.getActiveInstance()\n tsrv.setActiveInstance(tty)\n // Show the panel and focus it to prevent the user from editing the Dockerfile.\n tsrv.showPanel(true)\n\n startReloadUI()\n\n const ws = new WebSocket(\"ws://\" + location.host + \"/sail/api/v1/reload\")\n ws.onmessage = (ev) => {\n const msg = JSON.parse(ev.data)\n const out = atob(msg.v).replace(/\\n/g, \"\\n\\r\")\n tty.write(out)\n }\n ws.onclose = (ev) => {\n if (ev.code === 1000) {\n tsrv.setActiveInstance(oldTTY)\n } else {\n alert(\"reload failed; please see logs in sail terminal\")\n }\n stopReloadUI()\n }\n }\n\n window.addEventListener(\"ide-ready\", () => {\n class rebuildAction extends window.ide.workbench.action {\n run() {\n rebuild()\n }\n }\n\n window.ide.workbench.actionsRegistry.registerWorkbenchAction(new window.ide.workbench.syncActionDescriptor(rebuildAction, \"sail.rebuild\", \"Rebuild sail container\", {\n primary: ((1 << 11) >>> 0) | ((1 << 10) >>> 0) | 48 // That's cmd + shift + R. See vscode source.\n }), \"sail: Rebuild\", \"sail\");\n\n const statusBarService = window.ide.workbench.statusbarService\n statusBarService.addEntry({\n text: \"rebuild\",\n tooltip: \"press super+alt+r to rebuild\",\n command: \"sail.rebuild\"\n }, 0)\n })\n}())" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the changes are.