同じウィンドウ VS コードで統合された WSL ターミナルを使用してファイルを開く

同じウィンドウ VS コードで統合された WSL ターミナルを使用してファイルを開く

統合ターミナルを使用して VS コードでファイルを開こうとしています。ファイルは同じインスタンスではなく、新しいウィンドウで開き続けます。すべてのウィンドウ設定を同じインスタンスの新しいタブで開くように設定していますが、ターミナル経由でファイルを開こうとするとこのように動作します。

答え1

-r オプションを使用できます:

$ code -r your.file

コードの --help から取得しました:

$ code --help
code 1.61.0

Usage: code [options][paths...]

To read from stdin, append '-' (e.g. 'ps aux | grep code | code -')

Options
  -d --diff <file> <file>           Compare two files with each other.
  -a --add <folder>                 Add folder(s) to the last active window.
  -g --goto <file:line[:character]> Open a file at the path on the specified line and character position.
  -n --new-window                   Force to open a new window.
  -r --reuse-window                 Force to open a file or folder in an already opened window.
  -w --wait                         Wait for the files to be closed before returning.
  -h --help                         Print usage.

Extensions Management
  --list-extensions                                           List the installed extensions.
  --show-versions                                             Show versions of installed extensions, when using --list-extensions.
  --category <category>                                       Filters installed extensions by provided category, when using --list-extensions.
  --install-extension <extension-id[@version] | path-to-vsix> Installs or updates the extension. The identifier of an extension is always
                                                          
`${publisher}.${name}`. Use `--force` argument to update to latest version. To install a specific version provide `@${version}`. For example: '[email protected]'.
  --uninstall-extension <extension-id>                        Uninstalls an extension.

Troubleshooting
  -v --version Print version.
  -s --status  Print process usage and diagnostics information.

関連情報