1
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?

Finderから選択したフォルダをVSCodeで開く

Posted at

はじめに

Finderでファイルを右クリックして「このアプリケーションで開く」からエディタを起動するみたいなことがありますが,IDEではフォルダ単位で開きたいことが多いですよね.
フォルダを右クリックしたときに指定したアプリケーションで開くクイックアクションを作成します.

本編

  1. Automatorで新規クイックアクションを作成
  2. 入力:フォルダとファイル 検索対象:Finder
  3. アクション「Applescriptを実行」を追加
  4. 以下をコピペ
    on run {input, parameters}
    	(* VSCodeでフォルダを開く *)
    	set folderPath to POSIX path of (item 1 of input)
    	do shell script "open -a 'Visual Studio Code' " & quoted form of folderPath
    	return input
    end run
    
  5. ~/Library/Services/Open in VScode.workflow として保存

以上で,Finderでフォルダを右クリックすると,コンテキストメニューの下の方にある「クイックアクション」に「Open in VScode」が追加されています.

さらに,Servicesに保存されたワークフローにはキーボードショートカットを割り当てることができます.
スクリーンショット 2025-09-25 14.30.48.png
システム環境設定>キーボードショートカット> サービス>ファイルとフォルダ 内に先ほど作成した"Open in VSCode"が追加されているのがわかります.
私は以前github desktopで同じ操作をしていたので,ショートカットキーは合わせてcmd + shift + Aにしています.
ショートカットを割り当てた場合は,FinderからVSCodeで開きたいフォルダを選択した状態でキーを押すだけでVSCodeが起動します.

人から「今あれってどうなってる?」みたいな声がけがあった時にその場でパッと開けるので結構重宝しています.

1
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
1
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?