alfonsogarciacaro / vscode-template-fsharp-highlight

Highlight F# template strings in VS Code
MIT License
26 stars 2 forks source link

customization of the tagged language strings #4

Open baronfel opened 3 years ago

baronfel commented 3 years ago

I wonder if it would be possible to define some kind of mechanism that lets a user define what the language of the embeddedLanguages should map to. I ask because there are existing VSCode tooling extensions around the postgresql language for example that might be able to be lit up if the text was tagged as postgres language instead of just sql. Are you aware of any ways to do this?

alfonsogarciacaro commented 3 years ago

For what I've seen, the way to "customize" this is to have different patterns in a comment preceding the literal, like (* sql *) or (* postgresql *). I used the function to make it less verbose, but we could check for a comment for extra fine-tuning. Like this extension that I was using at the beginning (but had to uninstall because it was messing with other code many times).

BTW, about embeddedLanguages, they don't really seem to work. The highlighting is just activated when defining the content of the match as text.html.derivative or source.sql.

texastoland commented 1 year ago

I'm not sure to what extent embedded languages could work with interpolated strings anyway. Their tooling wouldn't know how to deal with the holes. Perhaps worth investigating for HTML first.

As for custom languages would let postgresql = sql work? Unfortunately due to a limitation of TextMate language grammars postgresql would still need added to the syntax definition though. Close?