JohnnyMorganz/StyLua

Formatting does not work when there is the '\z' escape sequence in a string.

DasOhmoff opened this issue ยท 4 comments

Hey ๐Ÿ‘‹, thank your for your nice work!

When using this nice formatter, I noticed that there is an issue when using the \z escape sequence in strings. This is a feature since lua 5.2. From Lua 5.2 Reference Manual:

The escape sequence '\z' skips the following span of white-space characters, including line breaks; it is particularly useful to break and indent a long literal string into multiple lines without adding the newlines and spaces into the string contents.

When I try to format the following code:

  use({
    "nvim-telescope/telescope-fzf-native.nvim",
    run = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && \z
           cmake --build build --config Release && \z
           cmake --install build --prefix build",
  })

I get the following error:

error: could not format file C:\Users\Adam\VimFiles\lua/packages.lua: error parsing: error occurred while tokenizing: unclosed string at line 29, column 11

It would be nice to fix this issue.
Thank you for your help :)

This looks like a bug in the parser crate that we use: https://github.com/Kampfkarren/full-moon

Ah ok I see. Will you raise an issue there or so?

Ah, perfect thanks :) ๐Ÿ‘