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

doesn't respect -- stylua: ignore start when it is in a multiline bracket #705

Closed
juiceDeLemon opened this issue Jun 6, 2023 · 2 comments · Fixed by #707
Closed

doesn't respect -- stylua: ignore start when it is in a multiline bracket #705

juiceDeLemon opened this issue Jun 6, 2023 · 2 comments · Fixed by #707
Labels
enhancement New feature or request

Comments

@juiceDeLemon
Copy link

juiceDeLemon commented Jun 6, 2023

for example this won't work:

require("foo").bar {
    -- stylua: ignore start
    baz      =0
    -- stylua: ignore end
}

but this won't too

-- stylua: ignore start
require("foo").bar {
    baz=0, -- <- this will not get formatted
    -- stylua: ignore end
    hello    ="world" -- <- this will not get formatted too because the ignore end is not detected?
}

I will not be able to not format something only in that {} bracket

@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Jun 6, 2023
@JohnnyMorganz
Copy link
Owner

For the second code snippet, mutliline ignores do not traverse across different "scopes", i.e., the ignore end must be at the same level as the ignore start. So that is not a bug here.

Technically ignore start/end only work at the statement level, but I think it is valid to support your first code snippet. But again, the ignore start/end will only work within the table fields, so the following snippet won't work

require("foo").bar {
    -- stylua: ignore start
    baz      =0 -- < this will be ignored
}

local   x      = 1 -- this will get formatted
-- stylua: ignore end

@JohnnyMorganz JohnnyMorganz added enhancement New feature or request and removed bug Something isn't working labels Jun 7, 2023
@juiceDeLemon
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants