'VS Code custom grammar injection doesn't work

I am trying to inject custom grammar's into an existing language, but I can't seem to get it to work.

package.json:

{
  "name": "custom-grammar",
  "displayName": "custom-grammar",
  "version": "0.0.1",
  "engines": {
    "vscode": "^1.64.0"
  },
  "contributes": {
    "grammars": [
      {
        "path": "./ruby.has_many.json",
        "scopeName": "ruby.has_many.injection",
        "injectTo": [ "source.ruby" ]
      }
    ]
  }
}

ruby.has_many.json:

{
  "scopeName": "ruby.has_many.injection",
  "injectionSelector": "L:variable.other.ruby",
  "patterns": [
    {
      "include": "#has_many"
    }
  ],
  "repository": {
    "has_many": {
      "match": "has_many",
      "name": "keyword.other.has_many.rails.ruby"
    }
  }
}

enter image description here

Could someone, please, point out what is wrong here? I am not sure if this is a bug or i am just doing something wrong.

I even copy/pasted the CREATING A BASIC INJECTION GRAMMAR example from the official guide: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#injection-grammars).

But that also did not work.

I'm posting here for more exposure to the issue. I created VS Code support ticket as well: https://github.com/microsoft/vscode/issues/143155

Here is a zip of the example, for a quick test: https://github.com/microsoft/vscode/files/8078854/custom-grammar.zip

VS Code version:

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source