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 dune subdir stanza syntax highlighting #870

Merged
merged 6 commits into from
Feb 17, 2022

Conversation

SaySayo
Copy link
Contributor

@SaySayo SaySayo commented Feb 14, 2022

Fixes (#864)

@tmattio
Copy link
Collaborator

tmattio commented Feb 14, 2022

Thanks @SaySayo 🙂

The subdir stanza works by evaluating the dune stanza in a subdirectory. So it should support every dune stanza, not only the rule one. To do this I think we can extract all the patterns in a scope, and include this in the subdir patterns (assuming the textmate grammar support recursivity).

@SaySayo
Copy link
Contributor Author

SaySayo commented Feb 14, 2022

That's a great idea! I'll do that now

1 similar comment
@SaySayo
Copy link
Contributor Author

SaySayo commented Feb 14, 2022

That's a great idea! I'll do that now

syntaxes/dune.json Outdated Show resolved Hide resolved
@mnxn
Copy link
Collaborator

mnxn commented Feb 15, 2022

The subdir stanza works by evaluating the dune stanza in a subdirectory. So it should support every dune stanza, not only the rule one. To do this I think we can extract all the patterns in a scope, and include this in the subdir patterns (assuming the textmate grammar support recursivity).

I think extracting all of the patterns into a new scope is actually unnecessary. You can make the patterns of subdir include $self and that should highlight everything

I believe this should work:

"comment": "subdir",
"begin": "\\([[:space:]]*(subdir)\\b",
"end": "\\)",
"beginCaptures": {
  "1": {
    "name": "keyword.language.dune"
  }
},
"patterns": [{ "include": "$self" }]

@mnxn mnxn changed the title Rule stanza highlighted properly in dune syntax Fix dune subdir stanza syntax highlighting Feb 17, 2022
@mnxn mnxn merged commit 2ed3f00 into ocamllabs:master Feb 17, 2022
@mnxn
Copy link
Collaborator

mnxn commented Feb 17, 2022

Thanks!

@mnxn mnxn linked an issue Feb 18, 2022 that may be closed by this pull request
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.

Dune's rule stanza in subdir is not highlighted properly
3 participants