Skip to content

Block ignore is not applied to all back-to-back blocks #421

@echasnovski

Description

@echasnovski

When --stylua: ignore start/end comments are applied back-to-back, they take effect on every second ignored block. This might be considered as a non-issue because they can be merged into one single ignored block, but it might be inconvenient when they are separated with large comment block.

My understanding is that "this comment must be preceding a statement (same as -- stylua: ignore), and cannot cross block scope boundaries" holds here, although I am not sure about it.

Steps to reproduce:

  • Create file tmp.lua with the following contents:
--stylua: ignore start
local a   =   1
--stylua: ignore end

--stylua: ignore start
local b   =   2
--stylua: ignore end

--stylua: ignore start
local c   =   3
--stylua: ignore end

-- Some very large comment

--stylua: ignore start
local d   =   4
--stylua: ignore end
  • Run stylua tmp.lua.

Currently observed output:

--stylua: ignore start
local a   =   1
--stylua: ignore end

--stylua: ignore start
local b = 2
--stylua: ignore end

--stylua: ignore start
local c   =   3
--stylua: ignore end

-- Some very large comment

--stylua: ignore start
local d = 4
--stylua: ignore end

Details:

  • Version of StyLua: 0.12.5
  • OS: Xubuntu 20.04.

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