Skip to content

Stylua prints the comment amid a return statement to stdout #879

@Futarimiti

Description

@Futarimiti

MWE example.lua:

return
-- insert whatever here
1
% stylua example.lua
-- insert whatever here
% cat example.lua
return
	-- insert whatever here
	1

Which could blend into the formatted result, say when you pipe in the file via stdin through some editor integration

% stylua - < example.lua
-- insert whatever here
return
	-- insert whatever here
	1

Is this intended behaviour? If so, any way to disable it?

Some additional info (tell me if you need more)

% stylua --version
stylua 0.20.0
% stylua --verbose example.lua
debug: config: starting config search from <$HOME> - recursively searching parents: false
debug: config: looking for config in <$HOME>
debug: config: no configuration file found
debug: config: falling back to default config
debug: config: Config {
    column_width: 120,
    line_endings: Unix,
    indent_type: Tabs,
    indent_width: 4,
    quote_style: AutoPreferDouble,
    no_call_parentheses: false,
    call_parentheses: Always,
    collapse_simple_statement: Never,
    sort_requires: SortRequiresConfig {
        enabled: false,
    },
}
debug: creating a pool with 8 threads
debug: built glob set; 0 literals, 2 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
-- insert whatever here
debug: formatted example.lua in 11.662958ms

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