Scenario
I have JSON files that describe a series of tasks to be carried out, where each task can refer to other tasks and objects in the JSON file.
{
"tasks": [
{ "id": "first", "action": "doSomething()", "result": {} },
{ "id": "second", "action": "doSomething(${id:first.result})", "result": {} },
]
}
I'd like to have both JSON schema validation and custom language text effects like keyword coloring and even "Go to definition" support within strings in the JSON.
What I can do
I can create an extension that specifies a JSON schema for a file extension "*.foo.json". This gives schema validation and code completion in the editor if vscode recognizes the file as a JSON file.
I can also create a new "foo" language in the extension for "*.foo.json" files that has custom keyword coloring within the JSON strings. I do this by creating a TextMate (*.tmLanguage.json) file copied from the JSON.tmLanguage.json, and then modifying the "stringcontent" definition.
Problem
The problem is that the schema validation and hints only work if I have "JSON" chosen in the status bar as the file type, and the custom text coloring only works if I have "foo" chosen in the status bar as the file type.
Is there any way to have both at once? Can I somehow extend the JSON language handling within vscode?