1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ワークスペースごとにスニペットを設定する方法

Posted at

設定ファイルの作成

ワークスペースに.vscodeフォルダを作成したあとその中に***.code-snippetsというファイルを作成します。
***の部分はわかりやすいように言語に応じた名前にします。
(C++のスニペットの場合、cpp.code-snippetsなど)

mkdir .vscode
touch .vscode/***.code-snippets

ディレクトリ構造

.vscode
├── cpp.code-snippets

ファイルができたらその中にスニペットを書く

cpp.code-snippets
{
  "Hello World": {
      "prefix": "hello",
      "body": [
          "#include <iostream>",
          "",
          "int main() {",
          "    std::cout << \"Hello, World!\" << std::endl;",
          "    return 0;",
          "}"
      ],
  }
}

これで完成
snippet.gif

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?