Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly highlight text verbatim #28

Merged
merged 3 commits into from
May 29, 2023
Merged

fix: correctly highlight text verbatim #28

merged 3 commits into from
May 29, 2023

Conversation

mochja
Copy link
Contributor

@mochja mochja commented May 28, 2023

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
Copy link

CLAassistant commented May 28, 2023

CLA assistant check
All committers have signed the CLA.

@mochja mochja marked this pull request as draft May 28, 2023 03:11
correctly handle following:

```jsonnet
|||
 |
 ||
 |||
|||
```
@mochja mochja marked this pull request as ready for review May 28, 2023 03:24
@julienduchesne
Copy link
Member

Thanks @mochja. LGTM!

@julienduchesne julienduchesne merged commit 5d9bbbd into grafana:main May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants