code-server
code-server copied to clipboard
`--wait` command-line option
If you are working in the terminal, the suggested way of using VS Code itself as your editor for commit messages and such is to set
export EDITOR="code --wait"
This does not work within code-server obviously. You can set EDITOR
to code-server
but it does not have a --wait
option, so git (or whatever) will not wait for you to close the window.
The --wait
option, together with one or more files, should make the code-server
binary only exit when these files are closed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.
This is a legitimate feature request, please don't close it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no activity occurs in the next 5 days.
Repeating myself: please do not close this legitimate feature request.
Is this something that vanilla VS Code supports already?
Yes, it does, with code --wait
.
Interesting! Well if that's the case, I wonder if we could just pass it through and it would just work 🤔
How does this work in practice?
- change
EDITOR
-
git add .
stage changes -
git commit
start commit
Then it opens VS Code, you edit message, then it exits VS Code?
Understanding how this works in practice would help us find time to investigate this faster.
Vscode has the '--wait' option exactly like Sublime and Atom before it. (Notepad++ and most other multi-tab editors have a similar but differently named switch). They basically tell the editor to open the specified file in a separate thread and that there is a process waiting for that thread to exit.
In git you typically configure your editor with: 'git config --global core.editor "code --wait"' So every time git tries to edit the "hidden" COMMIT_MESSAGE file it does that with the '--wait' switch.
It would be very useful to have the same feature available in the server version of VSCode.
Ah okay, thank you @JKrag! If it's supported in VS Code, then it does seem like something we should be able to support in code-server without too much work. But that's me guessing. We'd have to investigate as well.
I guess the question might be whether it is "ok" for code-server to be spawning new processes on the host it is running on. I don't know if this is a challenge or security risk or anything, but the the thought did come to mind.
Not only VS Code supports it, but also their "remote" implementation (i.e. Codespaces/Containers) and even Gitpod's OpenVSCode Server.
In my opinion, this is a huge feature which is missing in the code-server
CLI, which essentially makes me unable to use code-server's VS Code to edit git commit messages, or to edit anything else which is spawned on the command line.
@code-asher how difficult would this be to implement?
Thinking out loud:
- add CLI flag
- when passed, open code-server with git commit message
- when commit message is finished and file is closed, close code-server and stop process
Screenshots


If we can get their script working we might not need to implement anything. I think all we have to do is update the Node path.