-
Notifications
You must be signed in to change notification settings - Fork 6.3k
-
I can start code-server and specify startup folder. Can I start by passing workspace file?
Beta Was this translation helpful? Give feedback.
All reactions
I recommend reading the FAQ as it answers a lot of questions people typically ask. As for what you mentioned, How does code-server decide what workspace or folder to open?. So you can use a query parameter in the url or from the command line when launching code-server.
Replies: 3 comments 7 replies
-
Beta Was this translation helpful? Give feedback.
All reactions
-
in such case I'll open everything from single folder. I can have different folders from different locations in the same workspace and I can save these settings to the file and then open at any time. Additionally I can have separate settings for each of such workspaces. I can open workspace file in VS Code and it will open all needed folders for me and apply all needed settings. Can I open workspace file with code-server
?
Beta Was this translation helpful? Give feedback.
All reactions
-
If you are talking about Multi-Root Workspaces then yes, you can save the workspace file in your code-server machine and can access it from the url:
https://codeserver-url.com?workspace=/path/to/workspace.code-workspace-file
Beta Was this translation helpful? Give feedback.
All reactions
-
How can I start the code-server with workspace? I want to have the dockerfile that I would build/run and it would created new container that I'll open with specific workspace on the first launch
Beta Was this translation helpful? Give feedback.
All reactions
-
I recommend reading the FAQ as it answers a lot of questions people typically ask. As for what you mentioned, How does code-server decide what workspace or folder to open?. So you can use a query parameter in the url or from the command line when launching code-server.
Beta Was this translation helpful? Give feedback.
All reactions
-
I saw the workspace
query param mentioning there, however didn't find any mention on what the query param is. I tried to do --workspace
but it didn't work. I also tried to pass the path to the workspace file, that didn't help either.
Beta Was this translation helpful? Give feedback.
All reactions
-
You can try it for yourself. Open code-server, open a folder, right click in the explorer and choose "Add folder to workspace" and select a different folder. You should be redirected to a url such as https://example.com/?workspace=/home/coder/.local/share/code-server/User/Workspaces/Untitled-1623868353702.code-workspace
. If you click File in the menubar, you can click "Save workspace as" and choose a path to save the workspace file to. Then, instead of pointing to a temp file under /home/coder/.local/share/code-server/User/Workspaces/
, you could point the query param to the workspace file directly.
Beta Was this translation helpful? Give feedback.
All reactions
-
The docs could use another run through. workspace
query param means the query param in the browser URL. Here is an example:
http://localhost:8080/?workspace=/Users/jp/.local/share/code-server/User/test.workspace.code-workspace
from the command line when launching code-server
Using the same workspace as above, you can do it like this:
code-server /Users/jp/.local/share/code-server/User/test.workspace.code-workspace
If you think this should be in the docs (either new entry or updated), please feel free to open a PR!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
I just tried it on my server and it worked successfully, I guess you might've done something wrong.In my case, the url was: https://codeserver987.herokuapp.com/?workspace=/app/.data/User/Workspaces/w1.code-workspace
and my workspace was:
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
(削除) code-server /path/to/file.workspace
should work (third option in the linked docs). Otherwise you can use the query param as mentioned above. (削除ここまで)
Edit: oops @jsjoeio also mentioned passing on the command line! Ignore me. :)
If doing code-server file.workspace
doesn't open the workspace then that's a bug because it's supposed to!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2