-
Notifications
You must be signed in to change notification settings - Fork 37
Add rebuild button and command #123
Conversation
} else { | ||
alert("reload failed; please see logs in sail terminal") | ||
} | ||
stopReloadUI() | ||
} | ||
} | ||
|
||
window.addEventListener("ide-ready", () => { |
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.
sail.js
Outdated
text: "rebuild", | ||
tooltip: "press super+alt+r to rebuild", | ||
command: "rebuild-sail-container" | ||
// showBeak: true <- what does this do? |
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.
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.
It adds a little arrow above the item. For example if you click the notification bell it will show up.
let elements = document.getElementsByClassName(className); | ||
for (let e of elements) { | ||
e.parentNode.removeChild(e) | ||
(function() { |
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.
Why wrap this all in a function?
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.
The global variables become scoped to the file. This is what Webpack and other module loaders due for the browser to isolate modules.
@code-asher, any ideas why the command doesn't show up in the command palette? |
I don't think adding something to the command registry adds it to the palette. IIRC there is a workbench registry and registering actions on that is what adds them to the palette (as well as letting you define keybindings). |
Actually just ran into code that makes it look like you can manually append to the command palette as well:
We expose the menu registry so that might work. |
For keybindings there is the keybinding registry we could expose. I'm not sure what the practical difference is between using the workspace registry vs command + keybinding + menu registry combo. Edit: nvm, looked at the code, the workspace registry just uses the command, keybinding, and menu registries, so no practical difference. |
If it uses the command registry, why doesn't the rebuild command show up? |
I think I want |
I get the following when doing
|
Seems to be a code-server issue @kylecarbs |
That only adds it as a command, the menu registry is what adds it to the palette. |
Then what did you mean by
What is the workspace registry for? |
As far as I can tell, when you call So you could call all three manually, or call |
Sounds good, I think we need to expose it though. |
Yup, and |
What does that do? |
My bad, edited my response but the workbench registry takes a |
Might not be a bad idea to just expose the service collection in its entirety. I think we discussed doing that at one point. |
nvm on my previous comment, I got service collections and the registries mixed up. I don't think the registries exist on the service collection. |
Yea, I'm working on it. Just going to import the global registry and expose it. |
@code-asher PR updated |
Should be good now, key bind is cmd+r and it shows up in command palette so a user can rebind if they want. |
(ctrl+r on linux/windows) |
This PR is just waiting for a new release of code-server to include the actions registry API. |
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.
LGTM.
sail.js
Outdated
const statusBarService = window.ide.workbench.statusbarService | ||
statusBarService.addEntry({ | ||
text: "rebuild", | ||
tooltip: "press super+r to rebuild", |
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.
ctrl
or cmd
now, but since the user can customize keybindings it might be better not to display this text at all. There is probably a way to get the current keybinding but I'm not sure off the top of my head how you'd access that.
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.
good point
sail.js
Outdated
}) | ||
}) | ||
}()) |
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.
Not really any of my business, but I am curious about the loss of the newline.
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.
fixed
}), "sail: Rebuild container", "sail"); | ||
|
||
const statusBarService = window.ide.workbench.statusbarService | ||
statusBarService.addEntry({ |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just leave it there.
Also prevent rebuild while rebuild is in progress, just in case.
Unfortunately the command is not coming up in the command palette, not sure why.
@kylecarbs
And no key bind yet, doesn't seem to be exposed in code-server.
This should be good enough for release though.