Skip to content

Use yaml grammar from tree-sitter-grammars/tree-sitter-yaml#1137

Closed
hectorhon wants to merge 2 commits intoemacs-tree-sitter:masterfrom
hectorhon:master
Closed

Use yaml grammar from tree-sitter-grammars/tree-sitter-yaml#1137
hectorhon wants to merge 2 commits intoemacs-tree-sitter:masterfrom
hectorhon:master

Conversation

@hectorhon
Copy link

I found this, a more recent and maintained version for the yaml language. It fixes a bug I encountered.

I encountered a bug in the current version from ikatyang, where if the yaml key length is too long (more than 126 characters), the corresponding value for the yaml entry is dropped from the parse tree.

How to reproduce the bug without emacs:

  1. Visit https://ikatyang.github.io/tree-sitter-yaml/ (link provided in the About section)
  2. Enter the following text: a23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456: sometext
  3. Observe that the tree is correct, with a key and value field.
  4. Update the text to: a234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567: sometext. Note the extra 7 before the colon.
  5. Observe that the tree is incorrect, where the value field is missing.

This bug does not appear in the new repository. I tested this locally in my emacs and the parsing works correctly.

@hectorhon
Copy link
Author

The build is failing, I have opened a PR upstream to fix the error.

It was working locally earlier because I used the checked-in src/grammar.json instead of grammar.js.

@jcs090218
Copy link
Member

Added in c164b68.

@jcs090218 jcs090218 closed this Dec 23, 2025
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