Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Incorrect highlighting for YAML multiline string (block scalars) #15273

Closed
1 task done
theonlypwner opened this issue Jun 12, 2024 · 3 comments
Closed
1 task done

Comments

@theonlypwner
Copy link

theonlypwner commented Jun 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

This YAML example is highlighted incorrectly in Notepad++ but works in VS Code:

a: |
    this is the first line in the string

    # this is not a comment
    b: false
    c: 0
    fail: this is the last line
otherProperty: this is correctly highlighted

That example corresponds to this JSON (which can be confirmed by copying the example to https://yaml-online-parser.appspot.com):

{
  "a": "this is the first line in the string\n\n# this is not a comment\nb: false\nc: 0\nfail: this is the last line\n", 
  "otherProperty": "this is correctly highlighted"
}

VS Code correctly highlights it.

image

Notepad++ fails to highlight it correctly.

image

At the time of posting, GitHub also has the same issue!

image

Steps To Reproduce

  1. Copy the example to Notepad++.
  2. Set the language to YAML.
  3. Look at the incorrect highlighting.

Current Behavior

The highlighting is incorrect.

Expected Behavior

The highlighting is correct, as shown in the VS Code example screenshot.

Debug Information

Notepad++ v8.6.7   (64-bit)
Build time : May 12 2024 - 20:04:00
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : 
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : OFF
OS Name : Windows 11 Pro for Workstations (64-bit)
OS Version : 23H2
OS Build : 22631.3672
Current ANSI codepage : 1252
Plugins : 
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)

Anything else?

I use YAML block scalars to define multiline strings for shell scripts in build pipelines (GitHub Actions workflows and Azure DevOps pipelines), which break the syntax highlighting in Notepad++.

@theonlypwner
Copy link
Author

theonlypwner commented Jun 12, 2024

The original post shows parts of the string that were incorrectly highlighted as if they were not part of the string.

Here is an example where parts outside of the string are incorrectly highlighted as if they were part of the string.

- run: |
    # first line of shell script
    # last line of shell script
  if: condition for running step
[
  {
    "run": "# first line of shell script\n# last line of shell script\n", 
    "if": "condition for running step"
  }
]

Notepad++ fails to highlight it correctly.

image

VS Code correctly highlights it.

image

GitHub actually highlights this correctly.

image

@rdipardo
Copy link
Contributor

Duplicate of #9038 (which is itself a cross-post of Lexilla/Scintilla bug #2218).

@theonlypwner
Copy link
Author

I agree that the example in the first post is a duplicate, but the example in my second post is not a duplicate.

I will close the issue here and repost in the other issue.

@theonlypwner theonlypwner closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants