Skip to content

Feature Request: Support more options for space_around_table_field_list for style-checking: #2876

@4lph4-Ph4un

Description

@4lph4-Ph4un

How are you using the lua-language-server?

Other

Which OS are you using?

Windows

What is the issue affecting?

Diagnostics/Syntax Checking, Formatting, Other

Expected Behaviour

The ability to have different spacing rules for an array and a "map"-type of table.

I would like to be able to write tables in this manner and it to give me feedback. I personally use space between curlies in map-type of tables, and no space in arrays. I think it would also be nice if an user would define the rule other way around if they want that, since this is just a personal preference. For the time being I can just disable the checking for that rule:

-- The correct way for me:
local map = { foo = 1 }
local arr = {1, 2, 3, 4}

-- I would like this to give me style-check error:
local map = {foo = 1}
local arr = { 1, 2, 3, 4 }

Actual Behaviour

Currently you can only have a space or no space between the curly and the first element in a table regardless if the table is an array or a map.

Reproduction steps

  1. Set space_around_table_field_list to either false/true in your .editorconfig.
  2. Write an array and a map-type of table in differing styles.
  3. Get yelled at by the style-check.

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions