-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Modify default directory/workspace behavior #1132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Using last opened workspace/directory, in other words, ignoring a path which a user specified explicitly is quite strange and frustrating at least to me. This prevents me to use code-server as an alternative for vscode because Although we could open a specific directory by passing query parameters, I don't think it's a solution for this problem:
The port methods you proposed might work for the use-cases like #1123 , but not for the others. The most simple way I think is to make persistent behavior an opt-in feature, like this: # sorry for messy naming...
code-server ./dirA # opens ./dirA
code-server ./dirB # opens ./dirB
code-server ./dirC --prefer-last-opened # opens ./dirB With this strategy, you can both 1) specify which directory to open and 2) use the last opened directory if it exists, though I'm not sure this could be implemented. |
Yeah I was similarly frustrated when I was testing code-server locally but I wasn't sure it was a common thing because usually you would run code-server persistently on a remote machine, right? Is there a compelling use-case for spawning new instances of code-server on demand? Soon we want to support opening things in existing code-server instances. That will use a flag so it'll be something like So I'm not sure yet if we should modify the default behavior since it means we'd have to make everyone aware they need to pass an extra flag (it's been my limited experience that users expect code-server to remember the last directory). We could also go the other route with a |
I'm not sure too that launching instances on demand instead of persisting a single instance. My use-case is using code-server to "Run VS Code on a remote server" as the repo's description says. Start vscode on a certain directory by typing
To keep backward-compatibility, an opt-out flag you proposed ( |
Ahhhh I hadn't considered that type of workflow. That makes a lot of sense. If we had the But yeah, that's not a solution to forcing the directory on the command line to be opened. Maybe Or maybe we should just bite the bullet and always open what's on the command line. To be honest that feels like the better behavior to me but I don't want to break a bunch of people's workflow. We could have a |
I agree we should keep the current behavior not to break existing workflows 👍 I tried some text editors and see how they treat the input paths FYI (tested on Windows10).
|
Thanks for testing that out! Sublime Text's behavior is interesting. :P
I'm leaning toward just making code-server prefer the explicit
command-line directory tbh since that feels more correct to me. Although
it's a breaking change I think the impact is fairly small.
One other possibility would be to try to detect if running in an
interactive setting and if so prefer the directory on the command line,
but I don't know how possible or reliable that is and it seems like
it could result in unexpected behavior.
|
I'd argue that if they wanted it to always open the last directory they should just remove the dir parameter from their service file. |
I think you're right about that. I'll swap the order real quick.
|
The current behavior uses this order:
Proposed behavior:
The only remaining problem I can think of is that currently if you explicitly call code-server it'll favor the last directory instead of whatever you passed on the command line. It feels unexpected to me but we can't easily change that since if you run this in systemd for example you'd probably expect the opposite behavior when the service restarts (favor the last directory instead of what's passed to code-server).
The text was updated successfully, but these errors were encountered: