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

【VSCode】スニペットを簡単に作成できるようにする方法

Posted at

Snippet Generatorという拡張機能を使用すると簡単にスニペットを作成できます。

スクリーンショット 2024-06-22 23.57.06.png

スニペットを作成したいコードを選択してコマンドパレットからGenerate Snippetを実行し、必要事項を入力するとスニペットを設定するためのオブジェクトがクリップボードに保存されます。

Snippets Configure User Snippetsを実行します。

スクリーンショット 2024-06-23 0.01.28.png

開いた設定ファイルにクリップボードの内容を貼り付けるとスニペットを使用できるようになります。

以下のようにショートカットキーを設定するとGenerate Snippetの必要事項を入力した後にSnippets Configure User Snippetsが実行されファイル選択できるようになり、より簡単に作成できます。

keybindings.json
{
  {
    "key": "任意のキー",
    "command": "runCommands",
    "args": {
      "commands": [
        "snippet-generator.generate-snippet",
        "workbench.action.openSnippets"
      ]
    }
  }
}

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