Skip to content

Commit 0a76bc3

Browse files
author
Christian Volkmann
committed
Merge branch 'dev'
2 parents 7158716 + b232e05 commit 0a76bc3

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
Maybe your next idea?
1111

12+
## [0.3.1] - 2022-04-04
13+
14+
### Changed
15+
16+
- Updated to reflect the VS Code binary location change from `~/.vscode-server/bin/<commit-id>/bin/code` to
17+
`~/.vscode-server/bin/<commit-id>/bin/remote-cli/code` in [commit
18+
f4ba7dd12b684b144457c6fc6ccc9f4fe71bde3c](microsoft/vscode@f4ba7dd),
19+
which was released in [March 2022 (version
20+
1.66)](https://github.com/microsoft/vscode/releases/tag/1.66.0).
21+
- Updated to support Python 3.5 and up.
22+
- 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.
23+
- Fixed a small formatting bug with an `if` statement in code.fish.
24+
1225
## [0.3.0] - 2021-02-18
1326

1427
### Added

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The aim of this project is to make the `code` cli available to _any_ terminal, n
1919
> 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.
2020
2121
- **Python 3**
22-
> Tested under Python 3.8, but slightly older versions should work fine
22+
> Tested under Python 3.6 and Python 3.8, but should work fine in Python 3.5 or newer.
2323
- **socat** - used for pinging UNIX sockets
2424
```bash
2525
apt-get install socat
@@ -85,7 +85,7 @@ Deletes the aliases from `~/.bashrc` and removes the folder `~/.code-connect`
8585

8686
Use `code` as you would normally!
8787

88-
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.
88+
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.
8989

9090
```
9191
Usage: code [options][paths...]
@@ -118,7 +118,7 @@ VS Code uses datagram sockets to communicate between a terminal and the renderin
118118

119119
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.
120120

121-
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/<commid-id>/bin/code`.
121+
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/<commit-id>/bin/remote-cli/code`.
122122

123123
A similar method is used to list all of VS Code's IPC sockets, which are located under `/run/user/<userid>/vscode-ipc-<UUID>.sock`, where `<userid>` is the [current user's UID](https://en.wikipedia.org/wiki/User_identifier) and `<UUID>` 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.
124124

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.0
1+
0.3.1

bash/code.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Use this script through an alias
66
# alias code="/path/to/code.sh"
77

8-
local_code_executable="$(which code)"
8+
local_code_executable="$(which code 2>/dev/null)"
99
if test -n "$local_code_executable"; then
1010
# code is in the PATH, use that binary instead of the code-connect
1111
$local_code_executable $@

bin/code_connect.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def is_socket_open(path: Path) -> bool:
2929
# https://unix.stackexchange.com/a/556790/106406
3030
proc = sp.run(
3131
["socat", "-u", "OPEN:/dev/null", f"UNIX-CONNECT:{path.resolve()}"],
32-
capture_output=True,
32+
stdout=sp.PIPE,
33+
stderr=sp.PIPE,
3334
)
3435
return proc.returncode == 0
3536
except FileNotFoundError:
@@ -77,7 +78,7 @@ def get_code_binary() -> Path:
7778
)
7879

7980
_, code_repo = code_repos[0]
80-
return code_repo / "bin" / "code"
81+
return code_repo / "bin" / "remote-cli" / "code"
8182

8283

8384
def get_ipc_socket(max_idle_time: int = DEFAULT_MAX_IDLE_TIME) -> Path:

functions/code.fish

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# https://github.com/chvolkmann/code-connect
44

55
function code --description 'Run local code exectuable if installed, run code-connect otherwise'
6-
set -l local_code_executable (which code)
7-
if test -n "$local_code_executable":
6+
set -l local_code_executable (which code 2>/dev/null)
7+
if test -n "$local_code_executable"
88
# code is in the PATH, use that binary instead of the code-connect
99
$local_code_executable $argv
1010
else

0 commit comments

Comments
 (0)