alfonsogarciacaro / vscode-template-fsharp-highlight

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

Syntax highlighting for template strings in F

VS Code extension that highlights HTML/SVG/CSS/SQL/JS/Python F# triple quoted strings (interpolated or not) preceded by a function named html/svg/css/sql/js/python.

html """<h1>Hello World!</h1>"""

You need to declare the functions by yourself in a module with RequireQualifiedAccess attribute. If you need to do some transformation, make the function accept FormattableString:

let sql (s: FormattableString) = ...

If you just want to trigger highlighting, use an identity function:

let css (s: string) = s

The extension will also accept functions ending with _html/_sql/etc.

For HTML/CSS/JS templates, the extension will forward completion and hover requests to the built-in language providers in VS Code.

Example