Default Folder for VSCode
I would like to set the default (start) folder for VSCode to
/home/coder/my-project
(rather than the default /home/coder
. Or as alternative I would like to start a my-project.code-workspace
file. How can I accomplish this?17 Replies
<#1374825130030792754>
Category
Help needed
Product
Coder (v2)
Platform
macOS
Logs
Please post any relevant logs/error messages.
That does not really work. My
project.code-workspace
is a file not a folder. It can not be (and must not be) the default folder for everything.
For the code-server it works perfectly with the folder
property:
I am looking for a similar way to tell VSCode Desktop: what to open first (mainly which workspace to open).
It would be possible to provide the workspace file as a parameter to code
. But this is something the Coder UI is controlling... When I click on the VS Code Desktop
button VS Code Desktop is starting and asks me which agent I want to connect to. That's strange... When I click on the button in the UI agent I would have expected to connect to the UI agent. When I click on the button on the DB agent I should be connected to the DB agent. So it would be nice if we could control the behaviour of that VS Code Desktop button in the UI.Hi @Dirk Schiffner try using the VSCode Desktop module. And setting the folder to your workspace file
It will open the right workspace directory
https://registry.coder.com/modules/coder/vscode-desktop
you have to use the VSCode Desktop module as Atif pointed out because the built-in one doesn't support setting the folder
We are getting closer... First: Thank you - I was not aware of the module registry and this
vscode-desktop
module. It works and I can jump right into the correct folder.But: I still need to select the agent:

Why? The button is already placed in an agent.
Both agents are connected to different containers. But regardless which agent I choose - I always end up in the
ui
agent (container).
Hmmm... Maybe the containers are configured in a wrong way. Regardless which agent I connect to (in the VSCode editor - see above), I always end up in a random container, sometimes in the ui container, sometimes in the db container. This happens for the original VSCode Desktop button too.
My container configurations:
So the only link to the agent is the entry point...This looks like a bug report. Could you file a bug on coder/coder GitHub?
Please include as many details as you can.
I found a related issue.
1. https://github.com/coder/coder/issues/13358
Thanks
GitHub
Problems with adding a coder_app to a coder_agent when there are mu...
I'm having some issues with setting a coder_app for a single coder_agent in a template. When I do, I get a "internal provisionerserver error" (no other errors can be seen) Here's ...
Taking a quick look at the module source:
The agent name never gets inserted into the URL, so it makes sense this is the case
Presumably this was never noticed because multi-agent workspaces aren't very popular, and neither is this module
the
agent_id
field on the coder_app
just makes sure the app button appears in the right place in the web UI (so #13358 is unrelated here), the name of the agent must appear in the url
in order for the VSCode extension to know which you're connecting to.
We'd need to add an (optional?) agent_name
field to the module, we're not going to be able to figure it out from the agent ID alone. The provisioners just don't support doing anything like that
Actually we could also update the vscode extension to handle &agent=<agent_name>
and &agent=<agent_id>
(and also update the modle), but we'd be doing so just for this module, so I'm not sure if that's a great idea
Same deal with the jetbrains gateway module - we never pass the agent name in
The UX of this isn't great too because when we say agent_name
, we mean the name of the coder_agent
resource, and there's no way to describe that name in Terraform. i.e. you can't do something like coder_agent.main.name
to produce main
because name
isn't a field on the resource - you have to supply "main"
.
The default vscode button in the web ui (from display_apps) doesnβt have this problem because the frontend creates the link itself, instead if it being defined in Terraform. It does so after itβs fetched all the agent info, including the name.You are spot on Ethan.
The reason we removed agent name from gateway plugin and started supporting agent_id is because it's difficult to get in terraform.
So if we can handle agent
_id in VSCode plugin as we do in JetBrains plugins that's a more suitable solution
as we do in JetBrains pluginsIf we do handle
agent_id
in the JetBrains gateway plugin, we're still not passing it in anywhere in the module. the agent_id
field on coder_app
isn't passed through to the URL.
We will fix that. Its very rare to have workspace with multiple agents and for a single agent workspace it just works
Sorry for being quite - I'm just back from the hospital - almost fit again... Still interested in a solution. I am going to file a bug report.
However I am wondering why multi agents are not very popular... May be I am doing something wrong? As I have understood multiple containers means multiple agents - correct? I have an UI project (angular) and a demo database / demo API. I do not want to bring them to the same container. So I have to use multiple agents - right?
yes, you do have to use multi agents in that case
the usual use-case when you want separate containers for the same workspaces though is to allow the workspace to run its own Docker instance through Docker in Docker/Kubernetes
Docker in Workspaces | Coder Docs
Use Docker in your workspaces