[json] colorize string literals based on language information coming from schemas
#224.581 geöffnet am 2. Aug. 2024
Repository-Metriken
- Stars
- (74.848 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 11h 43m) (1.000 gemergte PRs in 30 T)
Beschreibung
The built in json-language-features extension provides plenty of nice features for JSON Schemas, such as markdownDescription and defaultSnippets.
I would love for it to also enable indicating that the value of a property is an embedded language.
Specifically I would love for the built in npm extension to be able to indicate that values within the "scripts" property of package.json files are shellscript values.
Would make it easier to interpret and author complex npm-scripts setup such as this:
Implementation brainstorming
The current schema that the npm extension uses is json.schemastore.org/package:
It actually already contains something similar that's aimed at IntelliJ – "x-intellij-language-injection": "Shell Script", which IntelliJ added in https://github.com/JetBrains/intellij-community/commit/2e490cee9ea05967ebaa5084ae42fe58ffc5800a
Here's how it looks in the package.json schema:
"scriptsInstallAfter": {
"description": "Run AFTER the package is installed.",
"type": "string",
"x-intellij-language-injection": "Shell Script"
},
Maybe something similar, such as "x-vscode-language-injection": "shellscript" could work? Or, considering that Shell Script is an alias of shellscript, consume x-intellij-language-injection wherever it is available?
Related discussions
Mostly stumbled upon people requesting this for yaml:
- Desire for embedded languages in GitHub Action workflow files: https://github.com/github/vscode-github-actions/issues/266
- Desire for embedded languages at large in yaml files: https://github.com/redhat-developer/vscode-yaml/issues/943