StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Stylua prints the comment amid a return statement to stdout

Open Futarimiti opened this issue 1 year ago • 2 comments

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

Futarimiti avatar Jul 26 '24 04:07 Futarimiti

https://github.com/JohnnyMorganz/StyLua/blob/main/src/formatters/block.rs#L157

eihqnh avatar Jul 26 '24 05:07 eihqnh

@qwqawawow Thanks, now we just need to know if this is intentional

Futarimiti avatar Jul 26 '24 05:07 Futarimiti

Not intentional, sorry, not sure how that stayed there. Will remove this.

JohnnyMorganz avatar Oct 26 '24 20:10 JohnnyMorganz