ikatyang / tree-sitter-yaml

YAML grammar for tree-sitter
https://ikatyang.github.io/tree-sitter-yaml/
MIT License
95 stars 40 forks source link

Issue: highlighting breaks with long object lines #59

Open rejdeboer opened 6 months ago

rejdeboer commented 6 months ago

What is the issue?

Whenever you have lines that contain a lot of logic, like if-statements and variables, the syntax highlighting below that logic line breaks. This problem is triggered when writing logic lines that are longer than 128 characters

Steps to reproduce

Working example

example: 
 teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest:
    test: test
    other_test: test

nvim screenshot: image

Broken example (add one more e)

example:
  teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest:
    test: test
    other_test: test

nvim screenshot: image

What behavior is expected?

The syntax highlighting doesn't break when using lines that are longer than 128 characters

What have I already tried?

char0n commented 5 months ago

Yeah,

I'm seeing the same on this fixture:

swagger: "2.0"
paths:
  /pet/adding-new-pets/testing-thelong-size-path-name/testing-thepath/testingthepathnameggggggggggggggggggggggggglllllllllllllla: {}

The worst thing is that the lexical analysis stops on long line and doesn't continue any further. block mapping pair of test: 3 is just skipped.

openapi: 3.1.0
paths:
  /pet/adding-new-pets/testing-thelong-size-path-name/testing-thepath/testingthepathnamegggggggggggggggggggggggggllllllllllllll: {}
test: 3