TextMateSharp icon indicating copy to clipboard operation
TextMateSharp copied to clipboard

Yaml highlighting issue with nested multi line strings

Open IvanJosipovic opened this issue 1 year ago • 4 comments

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):

  • OS: Windows 11
  • TextMateSharp Version="1.0.56"
  • Avalonia.AvaloniaEdit Version="11.0.6"
  • AvaloniaEdit.TextMate Version="11.0.6"

IvanJosipovic avatar Apr 23 '24 01:04 IvanJosipovic

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

danipen avatar Apr 26 '24 19:04 danipen

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

IvanJosipovic avatar Apr 26 '24 19:04 IvanJosipovic

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.

danipen avatar Apr 26 '24 20:04 danipen

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

IvanJosipovic avatar Apr 27 '24 00:04 IvanJosipovic

Looks like VSCode switched to new grammar https://github.com/microsoft/vscode/commit/9255a27d883c812feae2473d7af428267c875030 There were a lot of issues with the old

aikawayataro avatar Aug 15 '24 08:08 aikawayataro

We can replace our shipped grammar with the new one.

danipen avatar Aug 15 '24 09:08 danipen

I've tried new grammar and the YAML highlight just got more broken. I will need some time to find the bug

aikawayataro avatar Aug 19 '24 08:08 aikawayataro