3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

vscodeのshell integrationがfishだと動作しない

Posted at

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

環境

  • 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

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?