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

Structure Query #70

Merged
merged 1 commit into from
Mar 25, 2022
Merged

Structure Query #70

merged 1 commit into from
Mar 25, 2022

Conversation

mattmassicotte
Copy link
Contributor

This introduces a "structure.scm" query definition.

I use this for two things: highlighting of related syntactic elements and indentation. The first implementation was for the highlighting only. But, as I began working on tree-sitter-backed indentation, I realized that they were almost the same underlying problem.

The query defines the following labels:

  • structure.anchor: the beginning of a structural element
  • structure.open: the opening of a scope
  • structure.close: the closing of a scope
  • structure.separator: a separator within a scope
  • structure.limit: the closing of scope that isn't itself part of the parent structure

I'm not sure how you might feel about something like this. But, I figured I'm using it with great success, so I might as well let you have a look. Absolutely no worries if you don't think this belongs in the parser repo. And, if you have any feedback, that would be great too!

Checklist:

  • All tests pass in CI.
  • There are sufficient tests for the new fix/feature.
  • Grammar rules have not been renamed unless absolutely necessary.
  • The conflicts section hasn't grown too much.
  • The parser size hasn't grown too much (check the value of STATE_COUNT in src/parser.c).

@aryx aryx merged commit 420ee79 into tree-sitter:master Mar 25, 2022
@mattmassicotte
Copy link
Contributor Author

Thank you so much!

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.

2 participants