Help us understand the problem. What is going on with this article?

VSCode 用 SystemVerilogの拡張を作る(#2)

More than 1 year has passed since last update.

拡張機能と言語を紐付ける

package.json の

  • activationEvents
  • languages

の設定が絡んでいます。
languagesが言語の定義となっており、

  • id
  • aliases
  • extensions
  • configuration

を設定します。

    "languages": [
      {
        "id": "sv",
        "aliases": [
          "SystemVerilog",
          "Verilog",
          "sv"
        ],
        "extensions": [
          "v",
          "vh",
          "sv",
          "svh"
        ],
        "configuration": "./language-configuration.json"
      }
    ],

上記だと、idが識別子でなんでも良いです。aliasesも、適当でいいです。
extensionsが重要で、この拡張子を持つファイルはすべてid:svとカテゴライズされることになります。
configurationは言語の括弧やコメントの種類を指示します。
configurationの意図は括弧の自動補完機能と、対応括弧のサーチのためだと思われますので、無くても大丈夫です。

この言語定義によるid:svをactivationEvents側で設定すると、extensionsで指定した拡張子ファイルを開くと対応した拡張機能が起動する仕組みとなっているようです。

  "activationEvents": [
    "onLanguage:sv"
  ],
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away