vscode-textmate icon indicating copy to clipboard operation
vscode-textmate copied to clipboard

`include` grammars don't load within `captures`

Open RedCMD opened this issue 1 year ago • 0 comments

Embedded grammars are not loaded from disk when inside a captures rule

If the embedded grammar was pre-loaded by another include in the same grammar OR loaded via another grammar in another language in another file then it works as expected

  1. Don't open a file that loads the C grammar
  2. Open a file with the following grammar loaded
  3. notice no syntax highlighting. test(5);

image

  1. Close the file
  2. Reload VSCode
  3. Open a C file
  4. Reopen the file with the following grammar loaded
  5. notice syntax highlighting now working

image

{
	"scopeName": "source.capture.load",
	"patterns": [
		{
			"match": ".+",
			"captures": { "0": { "patterns": [ { "include": "source.c" } ] } }
		}
	]
}

from my testing getExternalGrammar() is never run when directly inside captures

related:

  • https://github.com/microsoft/vscode-textmate/issues/141
  • https://github.com/microsoft/vscode-textmate/issues/173
  • https://github.com/microsoft/vscode-textmate/issues/174

RedCMD avatar Oct 05 '24 23:10 RedCMD