harrydowning / vscode-yaml-embedded-languages

A VS Code syntax extension for embedded language highlighting in YAML
https://marketplace.visualstudio.com/items?itemName=harrydowning.yaml-embedded-languages
MIT License
32 stars 6 forks source link

Apply syntax highlighting based on file extension #36

Closed devkeydet closed 1 month ago

devkeydet commented 2 months ago

Have you considered providing syntax highlighting based on file extension? For example, if I wanted all *.pa.yaml files to have formatting everywhere without manually having to add # powerfx within every property.

harrydowning commented 2 months ago

I have thought about doing something like this. Not exactly as you suggest, but maybe something like having comments to turn on/off highlighting within properties for the rest of the file or until the next comment. For your case you could specify the language once at the top of the file. Maybe it would looke something like

# yaml-embedded-languages: powerfx <- turns on powerfx highlighting until EOF or next comment
example:
  ...
# yaml-embedded-languages: off/none <- turns off highlighting
example:
  ...
# yaml-embedded-languages: python <- turns on python highlighting
example:
  ...

I'm not sure how hard this would be.

harrydowning commented 1 month ago

This comment feature is in pre release (v1.1.0) if you want to try it out. image

devkeydet commented 1 month ago

This is a really nice enhancement! Thank you.