Skip to content

Conversation

@jamessan
Copy link

@jamessan jamessan commented Jul 5, 2025

Allow the optional "trim", as documented in ":help :lua-heredoc".

This removes the need for try_lex_heredoc_marker()'s is_let_heredoc
parameter since both script and let heredocs can have a parameter.

@clason
Copy link
Collaborator

clason commented Jul 6, 2025

Worth it for the scanner simplifications alone. (Be advised that this parser is not in a great shape and in sore need of a massive rework -- especially the scanner -- before you put more work into it.)

Needs a rebase now -- and if this affects queries, please make the appropriate changes in the same PR so I can cherry-pick them for nvim-treesitter (and then Neovim).

@jamessan jamessan force-pushed the script-heredoc-parameter branch from 6ca9daf to 506bca6 Compare July 6, 2025 15:02
@clason
Copy link
Collaborator

clason commented Jul 6, 2025

Meaning, should the trim be highlighted?

@jamessan
Copy link
Author

jamessan commented Jul 6, 2025

I don't think it affects queries. There's a new child node for script if trim is used, but it doesn't change anything else in the tree.

@clason
Copy link
Collaborator

clason commented Jul 6, 2025

It's not breaking, but you presumably added it to give it syntax highlighting?

@jamessan
Copy link
Author

jamessan commented Jul 6, 2025

I added it so the parsing didn't break and cause the rest of my vim file to go un-highlighted. :)

I'll look into having it highlighted the same way as the let-heredoc trim is.

@clason
Copy link
Collaborator

clason commented Jul 6, 2025

If in doubt, @keyword.operator (the exact capture is not as important as having coverage to catch breaking changes).

Allow the optional "trim", as documented in ":help :lua-heredoc".

This removes the need for try_lex_heredoc_marker()'s `is_let_heredoc`
parameter since both script and let heredocs can have a parameter.
@jamessan
Copy link
Author

jamessan commented Jul 6, 2025

I used @keyword to match the let highlighting. Would you rather they be changed to @keyword.operator?

@clason
Copy link
Collaborator

clason commented Jul 6, 2025

Hmm, good question. I don't even know what this does.

@clason
Copy link
Collaborator

clason commented Jul 6, 2025

Yeah, probably should be @keyword.operator. But it doesn't matter here; these are just reference queries where only the patterns are important.

@clason clason merged commit b39821f into tree-sitter-grammars:master Jul 6, 2025
3 checks passed
@jamessan jamessan deleted the script-heredoc-parameter branch July 6, 2025 16:04
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