Skip to content

Neovim macros can use control characters, which are detected as invalid utf8 #494

Description

@matu3ba

As example, take minifile.lua

-- stylua: ignore start
-- convert
--   QFETCH(std::string>("received_message");
-- to
--   QFETCH(std::string, received_message);
--f(f(xxhr,a �ü�C$hhx^j
-- stylua: ignore end

Running stylua minifile.lua, in my case with stylua.toml, but this should not be essential

# use default column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
# remove parenthesis around function arguments, if possible
no_call_parentheses = true

yields in error: failed to read lua/my_cmds.lua: stream did not contain valid UTF-8.

I would expect that stylua does not try to touch the content in between stylua: ignore start and stylua: ignore end.

If you disagree and think that the user must conform utf-8, can you provide or link a brief example/guideline how to load file content on a by-line base to associate it to another table and brief reasoning?

Thanks a lot for your work.

UPDATE: the thing after a is <80> and after ü is ^D. Unfortunately is github unable or unwilling to render those properly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions