grafana / vscode-jsonnet

Full code support (formatting, highlighting, navigation, etc) for Jsonnet
Apache License 2.0
65 stars 7 forks source link

fix: correctly highlight text verbatim #28

Closed mochja closed 1 year ago

mochja commented 1 year ago

I have updated the language grammar to correctly highlight ||| text block.

Text block, beginning with |||, followed by optional whitespace and a new-line. The next non-empty line must be prefixed with some non-zero length whitespace W. The block ends at the first subsequent line that is non-empty and does not begin with W, and it is an error if this line does not contain some optional whitespace followed by |||. The content of the string is the concatenation of all the lines between the two |||, which either begin with W (in which case that prefix is stripped) or they are empty lines (in which case they remain as empty lines). The line ending style in the file is preserved in the string. This form cannot be used in import statements.

https://jsonnet.org/ref/spec.html

I looked into yaml definition and made couple changes to it.

https://github.com/microsoft/vscode/blob/eef30e7165e19b33daa1e15e92fa34ff4a5df0d3/extensions/yaml/syntaxes/yaml.tmLanguage.json#L120-L155

Before: image

After: image image

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

julienduchesne commented 1 year ago

Thanks @mochja. LGTM!