6
4

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 5 years have passed since last update.

Visual Studio Code で作成した User Snippets を削除する方法

Last updated at Posted at 2018-12-11

Visual Studio Code の方でスニペットを削除するような機能は提供されていないようなので、スニペットファイルを直接削除します。

削除作業は設定ファイルのバックアップを作成し、Visual Studio Code を終了してから行うことを推奨します。

設定ファイルの場所

上のドキュメントの "Settings file locations" によると、VS Code の設定ファイルは各プラットフォームごとに次の場所に保存されているようです。

  • Windows %APPDATA%\Code\User\settings.json
  • macOS $HOME/Library/Application Support/Code/User/settings.json
  • Linux $HOME/.config/Code/User/settings.json

settings.json の近所にスニペット定義ファイルも保存されているはずです。

具体的な削除方法

macOS の場合であれば、

$ ls -1F "$HOME/Library/Application Support/Code/User"
keybindings.json
settings.json
snippets/
syncLocalSettings.json
workspaceStorage/

snippets/ が見つかったので中身を見てみます。

$ ls -1F "$HOME/Library/Application Support/Code/User/snippets"
global.code-snippets
markdown.json
python.json
shellscript.json

.code-snippets の拡張子を持つファイルが scope を指定できるタイプのユーザー定義スニペットファイルです。あとは rm global.code-snippets とかすれば普通に消えます。

ちなみに Settings Sync を使っている場合も問題なく削除が Gist に反映されました。

6
4
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
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?