VS Code (Visual Studio Code)

1 概要

Visual Studio Code (VS Code) は Microsoft が提供する無料・オープンソースのコードエディタです。豊富な拡張機能によって C/C++・C#・Python など多様な言語に対応し、Git 統合・デバッガ・タスクランナーなどの機能を持ちます。軽量でありながら IDE に近い機能を持つため、クロスプラットフォーム開発に広く使われています。

このリポジトリの開発環境として VS Code を使用することで、C ソースコードのインテリセンス (補完・定義ジャンプ)、デバッグ、makefile タスクの実行、Git 操作をひとつのエディタで行えます。Windows 環境では Start-VSCode-With-Env.ps1 スクリプトが MinGW / VSBT の環境変数を設定した状態で VS Code を起動するため、ターミナルから直接 gccmake コマンドを利用できます。

.vscode/ ディレクトリに settings.jsontasks.jsonlaunch.jsonc_cpp_properties.json を配置することで、チームで共通の開発環境設定を共有できます。

2 習得目標

3 学習マテリアル

3.1 公式ドキュメント

4 このリポジトリとの関連

4.1 使用箇所 (具体的なファイル・コマンド)

VS Code のタスク設定例 (.vscode/tasks.json):

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "make all",
      "type": "shell",
      "command": "make",
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "presentation": {
        "reveal": "always"
      }
    },
    {
      "label": "make clean",
      "type": "shell",
      "command": "make clean"
    }
  ]
}

C/C++ インテリセンス設定 (.vscode/c_cpp_properties.json):

{
  "configurations": [
    {
      "name": "Linux",
      "includePath": [
        "${workspaceFolder}/prod/calc/include",
        "${workspaceFolder}/testfw/include"
      ],
      "compilerPath": "/usr/bin/gcc",
      "cStandard": "c11"
    }
  ],
  "version": 4
}

Windows での VS Code 起動 (環境変数設定込み):

.\Start-VSCode-With-Env.ps1

4.2 関連ドキュメント