Reputation: 1572
I have a multi-root project in VSCode. I work with R
and have the R LSP Client
extension installed. I am on MacOS.
My workspace file looks like this:
{
"folders": [
{
"path": "."
"name": "myproject"
},
{
"path": "../otherfolder"
"name": "another_project"
}
],
"settings": {}
}
I use bash terminal and R terminal. I want these two to open always with current working directory .
and not ../otherfolder
or having to chose.
Ideally this should be a user setting, not of the workspace.
Upvotes: 2
Views: 717
Reputation: 1572
After a bit of practicing, I realised something that is probably quite obvious to more experienced users. The terminal current working directory (cwd) is chosen accordingly to the file that is opened in the editor. If no file is opened, than the last cwd is used.
So, in the example of the question, if I open a file belonging to 'myproject' and open a terminal, this will have ./
as cwd.
If the file in the editor belongs to 'another_project', the cwdof the terminal will be ../otherfolder
.
This does not address exactly the question (having a fixed terminal folder) but it fixes my workflow.
Looking at the settings, the parameter "terminal.integrated.cwd":"./somefolder"
would seem to do the job to have a fixed cwd for the terminal as it is described as following:
An explicit start path where the terminal will be launched, this is used as the current working directory (cwd) for the shell process. This may be particularly useful in workspace settings if the root directory is not a convenient cwd.
But I might misunderstand the description, because I tried to set it to some local folder and it had no effect for me.
Upvotes: 3