diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c237a0..0f2c47b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Maybe your next idea? +## [0.3.1] - 2022-04-04 + +### Changed + +- Updated to reflect the VS Code binary location change from `~/.vscode-server/bin//bin/code` to +`~/.vscode-server/bin//bin/remote-cli/code` in [commit +f4ba7dd12b684b144457c6fc6ccc9f4fe71bde3c](microsoft/vscode@f4ba7dd), +which was released in [March 2022 (version +1.66)](https://github.com/microsoft/vscode/releases/tag/1.66.0). +- Updated to support Python 3.5 and up. +- Silence the `which` command's stderr stream, because the GNU `which` v2.21 command found on CentOS Stream 8 produces unnecessary error messages when we test for a locally installed VS Code binary. +- Fixed a small formatting bug with an `if` statement in code.fish. + ## [0.3.0] - 2021-02-18 ### Added diff --git a/README.md b/README.md index 9bb1c2b..882c99a 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The aim of this project is to make the `code` cli available to _any_ terminal, n > Macs could also support everything out of the box, confirmation needed. Please don't hesitate to come into contact if you have any information to share. - **Python 3** - > Tested under Python 3.8, but slightly older versions should work fine + > Tested under Python 3.6 and Python 3.8, but should work fine in Python 3.5 or newer. - **socat** - used for pinging UNIX sockets ```bash apt-get install socat @@ -85,7 +85,7 @@ Deletes the aliases from `~/.bashrc` and removes the folder `~/.code-connect` Use `code` as you would normally! -If you have VS Code installed on your remote machine as well (i.e. a `code` executable already exists), you can use `code` for your local instance and `code-connect` for a IPC connected instance. +If you have VS Code installed on your remote machine as well (i.e. a `code` executable already exists), you can use `code` for your local instance and `code-connect` for an IPC connected instance. ``` Usage: code [options][paths...] @@ -118,7 +118,7 @@ VS Code uses datagram sockets to communicate between a terminal and the renderin The integrated terminal as well as the WSL terminal spawn an IPC socket. You also create one when connecting through a remote SSH session. These sockets can be found in the folders of VS Code Server. -Each time you connect remotely, the VS Code client instructs the server to fetch the newest version of itself. All versions are stored by commit id in `~/.vscode-server/bin`. `code-connect` uses the version that has been most recently accessed. The corresponding `code` executable can be found in `~/.vscode-server/bin//bin/code`. +Each time you connect remotely, the VS Code client instructs the server to fetch the newest version of itself. All versions are stored by commit id in `~/.vscode-server/bin`. `code-connect` uses the version that has been most recently accessed. The corresponding `code` executable can be found in `~/.vscode-server/bin//bin/remote-cli/code`. A similar method is used to list all of VS Code's IPC sockets, which are located under `/run/user//vscode-ipc-.sock`, where `` is the [current user's UID](https://en.wikipedia.org/wiki/User_identifier) and `` is a unique ID. VS Code does not seem to clean up all stale connections, so some of these sockets are active, some are not. diff --git a/VERSION b/VERSION index 0d91a54..9e11b32 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.0 +0.3.1 diff --git a/bash/code.sh b/bash/code.sh index 7581864..f120b82 100755 --- a/bash/code.sh +++ b/bash/code.sh @@ -5,7 +5,7 @@ # Use this script through an alias # alias code="/path/to/code.sh" -local_code_executable="$(which code)" +local_code_executable="$(which code 2>/dev/null)" if test -n "$local_code_executable"; then # code is in the PATH, use that binary instead of the code-connect $local_code_executable $@ diff --git a/bin/code_connect.py b/bin/code_connect.py index c2b0af3..368691d 100755 --- a/bin/code_connect.py +++ b/bin/code_connect.py @@ -29,7 +29,8 @@ def is_socket_open(path: Path) -> bool: # https://unix.stackexchange.com/a/556790/106406 proc = sp.run( ["socat", "-u", "OPEN:/dev/null", f"UNIX-CONNECT:{path.resolve()}"], - capture_output=True, + stdout=sp.PIPE, + stderr=sp.PIPE, ) return proc.returncode == 0 except FileNotFoundError: @@ -77,7 +78,7 @@ def get_code_binary() -> Path: ) _, code_repo = code_repos[0] - return code_repo / "bin" / "code" + return code_repo / "bin" / "remote-cli" / "code" def get_ipc_socket(max_idle_time: int = DEFAULT_MAX_IDLE_TIME) -> Path: diff --git a/functions/code.fish b/functions/code.fish old mode 100644 new mode 100755 index 0fd06a5..aba04ed --- a/functions/code.fish +++ b/functions/code.fish @@ -3,8 +3,8 @@ # https://github.com/chvolkmann/code-connect function code --description 'Run local code exectuable if installed, run code-connect otherwise' - set -l local_code_executable (which code) - if test -n "$local_code_executable": + set -l local_code_executable (which code 2>/dev/null) + if test -n "$local_code_executable" # code is in the PATH, use that binary instead of the code-connect $local_code_executable $argv else