danipen / TextMateSharp

A port of tm4e to bring TextMate grammars to dotnet ecosystem
MIT License
87 stars 15 forks source link

Yaml highlighting issue with nested multi line strings #60

Open IvanJosipovic opened 2 months ago

IvanJosipovic commented 2 months ago

Describe the bug Syntax Highlighting appears to be broken after nested multi line strings

one: |-
  this is fine
two:
  two: |-
    this is fine
  shouldnt-be-highlighted:
    test:

one: |
  this is fine
two:
  two: |
    this is fine
  shouldnt-be-highlighted:
    test:

one: >
  this is fine
two:
  two: >
    this is fine
  shouldnt-be-highlighted:
    test:

one: >-
  this is fine
two:
  two: >-
    this is fine
  shouldnt-be-highlighted:
    test:

To Reproduce Steps to reproduce the behavior:

  1. Load the Yaml above

Expected behavior Lines following a nested multi line string should be highlighted correctly

Screenshots Left is VS Code, right is AvaloniaEdit image

Desktop (please complete the following information):

danipen commented 2 months ago

Yepp. We should try to update to the latest version of the grammar from VSCode repository to see if this fixes the issue.

IvanJosipovic commented 2 months ago

It appears that the yaml settings are pointing to the latest commit, https://github.com/danipen/TextMateSharp/blob/69616c19b39f458658c81570ab8cae6d61777e84/src/TextMateSharp.Grammars/Resources/Grammars/yaml/syntaxes/yaml.tmLanguage.json#L7 https://github.com/textmate/yaml.tmbundle/commit/e54ceae3b719506dba7e481a77cea4a8b576ae46

danipen commented 2 months ago

Yeah, you're right. We're using the same version as VSCode (the latest).

So I guess then the problem might be in the parsing engine. To fix it, we'll need to do some debugging to figure out what's wrong with the tokens.

It could also be helpful to test if the code from eclipse/tm4e is functioning correctly. If it is, we can compare it with our code to help pinpoint the issue. I'm quite swamped these days, so I'm not certain if I'll be able to address this soon.

IvanJosipovic commented 2 months ago

I tested it in netbeans which uses tm4e and it renders the yaml correctly. I will keep digging. image