-
Notifications
You must be signed in to change notification settings - Fork 27
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
Update to work with newer VSCode Server folder structure + dual installation fix #17
base: main
Are you sure you want to change the base?
Conversation
+ removing redundant and invalid (by typing) code
bin/code_connect.py
Outdated
@@ -68,17 +66,17 @@ def get_code_binary() -> Path: | |||
|
|||
# Every entry in ~/.vscode-server/bin corresponds to a commit id | |||
# Pick the most recent one | |||
code_repos = sort_by_access_timestamp(Path.home().glob(".vscode-server/bin/*")) | |||
code_repos = sort_by_access_timestamp(Path.home().glob(".vscode-server/cli/servers/*")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry, I'm just a random passer-by, not the author)
Maybe we can put a more concrete condition for repo candidates, otherwise:
$ code
Traceback (most recent call last):
File "/home/USER/.code-connect/bin/code_connect.py", line 120, in <module>
main()
File "/home/USER/.code-connect/bin/code_connect.py", line 113, in main
proc = sp.run(args)
^^^^^^^^^^^^
File "/home/USER/.asdf/installs/python/3.11.9/lib/python3.11/subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/USER/.asdf/installs/python/3.11.9/lib/python3.11/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/USER/.asdf/installs/python/3.11.9/lib/python3.11/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
NotADirectoryError: [Errno 20] Not a directory: '/home/USER/.vscode-server/cli/servers/lru.json/server/bin/remote-cli/code'
$ l ~/.vscode-server/cli/servers
total 12K
drwxr-xr-x 3 USER USER 4.0K May 6 08:46 Stable-b58957e67ee1e712cebf466b995adf4c5307b2bd
drwxr-xr-x 3 USER USER 4.0K Apr 25 16:32 Stable-e170252f762678dec6ca2cc69aba1570769a5d39
-rw-r--r-- 1 USER USER 101 May 6 08:46 lru.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, no apologies necessary. I very much like more robust solutions, and this is certainly the way to go. I'll probably dig into this tomorrow a little.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kissge I rewrote the cli executable search code to be a lot more broad but also check against the output to make sure we're only manipulating the right code binaries. It seems to work, though I don't have access to my non-local system to properly test at the moment, nor do I have multiple versions installed to confirm it selects the most up-to-date executable.
Let me know how it works for you!
As an aside, I do have an idea to check against the code binary that's in the path to verify the right hash to use, but that'd be a bit more work than I think is really necessary.
Hey! Shame this never got merged. I had to make some changes to get it working in fish, but it works, so thank you! |
This PR fixes the detection to work with the newer VSCode Remote Server file structure. Not sure when it changed, but it works again with this.
I also included a fix I made for cases where the remote system might also have a local installation of VSCode, where code-connect might conflict.