TL;DR
-
.config/fish/config.fish
に以下の処理を足す(ゴリゴリ)
string match -q "$TERM_PROGRAM" "vscode"
and . (code --locate-shell-integration-path fish | sed -e "s|shellIntegration.fish|fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish|g")
vscodeのshell integration
- https://code.visualstudio.com/docs/terminal/shell-integration
- https://dev.classmethod.jp/articles/vs-code-command-decorations-by-terminal-shell-integration-is-convenient/
環境
- wsl2
- ubuntu 22.04
- fish, version 3.6.1
- vscode 1.79.1
事象
https://code.visualstudio.com/docs/terminal/shell-integration
に書かれている通りやってみるが、なんか有効化されない
code --locate-shell-integration-path fish
を実行すると、、以下の結果
~ $ code --locate-shell-integration-path fish (base)
/home/XXXX/.vscode-server/bin/4cb974a7aed77a74c7813bdccd99ee0d04901215/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish
~ $ cat /home/XXXX/.vscode-server/bin/4cb974a7aed77a74c7813bdccd99ee0d04901215/out/vs/workbench/contrib/terminal/browser/media/shellI
ntegration.fish
cat: /home/XXXX/.vscode-server/bin/4cb974a7aed77a74c7813bdccd99ee0d04901215/out/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish: No such file or directory
調査
ディレクトリを見てみると、、ファイルが無い+なんかフォルダがある
~ $ ll /home/XXXX/.vscode-server/bin/4cb974a7aed77a74c7813bdccd99ee0d04901215/out/vs/workbench/contrib/terminal/browser/media/(base)
total 44K
drwxr-xr-x 3 XXXX XXXX 4.0K Jun 13 01:17 fish_xdg_data/
-rwxr-xr-x 1 XXXX XXXX 8.2K Jun 13 00:54 shellIntegration-bash.sh*
-rw-r--r-- 1 XXXX XXXX 592 Jun 13 00:54 shellIntegration-env.zsh
-rw-r--r-- 1 XXXX XXXX 472 Jun 13 00:54 shellIntegration-login.zsh
-rw-r--r-- 1 XXXX XXXX 700 Jun 13 00:54 shellIntegration-profile.zsh
-rw-r--r-- 1 XXXX XXXX 5.2K Jun 13 00:54 shellIntegration-rc.zsh
-rw-r--r-- 1 XXXX XXXX 6.9K Jun 13 00:54 shellIntegration.ps1
このフォルダの奥に、スクリプトを発見
~ $ ll /home/XXXX/.vscode-server/bin/4cb974a7aed77a74c7813bdccd99ee0d04901215/out/vs/workbench/contrib/terminal/browser/media/fish_xd
g_data/fish/vendor_conf.d/shellIntegration.fish
-rw-r--r-- 1 XXXX XXXX 4.6K Jun 13 00:54 /home/XXXX/.vscode-server/bin/4cb974a7aed77a74c7813bdccd99ee0d04901215/out/vs/workbench/contrib/terminal/browser/media/fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish
.config/fish/config.fish
でこのスクリプトを実行するようにして見ると、動作することを確認しました
対応方法(暫定)
ここのスクリプトを少しいじる。
4cb974a7aed77a74c7813bdccd99ee0d04901215
の部分はアップデートなどで変わってしまうので、とりあえずshellIntegration.fish部分をsedする
string match -q "$TERM_PROGRAM" "vscode"
and . (code --locate-shell-integration-path fish | sed -e "s|shellIntegration.fish|fish_xdg_data/fish/vendor_conf.d/shellIntegration.fish|g")
恒久対応
すでにIssueも出て、PRもマージされていますね。リリースを待ちましょう
https://github.com/microsoft/vscode/issues/184659
https://github.com/microsoft/vscode/pull/185056