Skip to content
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

Programatically Set Folder to Open #816

Closed
abubakar-bilal opened this issue Jun 28, 2019 · 13 comments · Fixed by #857
Closed

Programatically Set Folder to Open #816

abubakar-bilal opened this issue Jun 28, 2019 · 13 comments · Fixed by #857

Comments

@abubakar-bilal
Copy link

Here is my case. I'm on mysite.com and I wanna redirect my user to code-server URL in new tab but I want that user to be landed on a particular directory. This is the same as we do with file > Open folder. but I need it to be done programatically.

Is there any way to achieve this?

CC: @deansheather

@abubakar-bilal
Copy link
Author

@code-asher @nhooyr @kylecarbs @sr229 Any kind words on this issue would be appreciated.

@abubakar-bilal
Copy link
Author

Or can you people please add some functionality to pass required directory path in query parameters. And by using those parameters code-server automatically change opened folder.

@abubakar-bilal
Copy link
Author

When should I expect any response on this?

@deansheather
Copy link
Member

At the moment I don't think we support changing the project directory programmatically. You might be able to write an extension for this or create a proxy that relaunches code-server in the correct directory.

@abubakar-bilal
Copy link
Author

abubakar-bilal commented Jul 1, 2019

Any idea on how proxy would work in my scenario would be really helpful. But actually I don't wanna relaunch code-server everytime.

@deansheather
Copy link
Member

deansheather commented Jul 1, 2019

This isn't a very robust solution, but the proxy would just look at the URL query parameters to check which folder it should be using, then just relaunch code-server when the query parameters change.

@abubakar-bilal
Copy link
Author

Isn't it a good and quick feature to add in code-server to read query parameter let's say path and set the landing directory.

@sujianfeng-vip
Copy link

@abubakar-bilal hi, how to set default folder for landing ? That will meet my needs.

@sr229
Copy link
Contributor

sr229 commented Jul 15, 2019

@xmpilot there is no such coded feature yet in code-server.

@sujianfeng-vip
Copy link

@sr229 thanks your feedback, i got the solution by vs code.

@SoundYeti
Copy link

@xmpilot - Can you past here the solution? Need a similar thing!

@sujianfeng-vip
Copy link

@xmpilot - Can you past here the solution? Need a similar thing!
i changed the vs code as below file,that is no good solution,but it is meed my need only,
1.set default open file:
./lib/vscode/src/vs/platform/workspace/common/workspace.ts (line.186)
change return value of getFolder function.
2.set default open folder:
./lib/vscode/src/vs/workbench/browser/parts/editor/editorGroupView.ts(line.135)
from.editors = [editor];

@code-asher
Copy link
Member

Once #857 is merged you can have a folder query parameter which will make code-server open in that directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants