Closed dragon-archer closed 5 months ago
assigning the same scopeName
to two different languages will not go well
each language should have its own globally unique scopeName
instead of injecting
it's prob way easier to just "include": "source.base"
from within a.tmLanguage.json
as long as you have the base scopeName
under grammars
{
"scopeName": "source.base",
"path": "./syntaxes/base.tmLanguage.json"
}
assigning the same
scopeName
to two different languages will not go well each language should have its own globally uniquescopeName
instead of injecting it's prob way easier to just
"include": "source.base"
from withina.tmLanguage.json
as long as you have the basescopeName
undergrammars
@RedCMD Thank you very much, I succesfully did this with an overall "include": "source.base"
and several "injections"
to add dialect specifics
P.S. I've searched the Internet for the scheme of tmLanguage.json
files for several times, but all I could find is just a few duplicates of the official VS Code Docs, and there is nothing about the useful injection
section.
Actually the only reference I found about it is the syntax file from your extension. Perhaps you'd like to make an issue about it to the VS Code Docs so that newcomers can be less frustrating about similar tricky problems?
Finally, I'd like to say that your extension really helps me a lot.
here's my schema for VSCode json TextMate https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/main/vscode.tmLanguage.schema.json I still need to finalize a bunch of things and I'm waiting for vscode to support unofficial json files
and some wip docs https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/tree/main/documentation
Hi everyone! I'm writing an vscode extension to support several Domain Specific Languages, which share a common base structure and each has a few additional rules.
As to avoid duplicating the common base rule, I created a
base.tmLanguage.json
under scopesource.base
. Then, I createda.tmLanguage.json
andb.tmLanguage.json
for DSLa
andb
respectively, with scopesource.base.a
,source.base.b
, and inject them usinginjectSelector
into specific scopes defined insource.base
.In the
package.json
I wrote as following:My problem is:
scope.base
andbase.tmLanguage.json
for languagea
andb
(I've also tried to use the file with different scope likescope.base.a
, but it just won't work)a
andb
are all defined undersource.base
, the vscode actually treata
andb
as SAME LANGUAGE ( the only difference is the display name), which means, the specific rules defined ina.tmLanguage.json
andb.tmLanguage.json
are MUTUALLY VISIBLE to each otherSo, I'd like to know if there is something I can do to correctly derive
a
andb
frombase
, or perhaps I have to duplicatebase.tmLanguage.json
toa
andb
?