Skip to content

Add option to add spaces in function definitions #832

@alerque

Description

@alerque

One style choice I've made extensively across many projects that clashes with stylua is to add spaces in function definitions between the function name and arguments.

-- like this
local function foo (arg) end
foo(6)

-- or like this
local foo = function (arg) end
foo(6)

-- not this
local function(arg) end
foo(6)

-- and not this
local foo = function(arg) end
foo(6)

This style gives some visual differentiation between function definitions and function calls. In these simple examples it is relatively obvious, but it is possible for closures to get a bit confusing. Obviously this is an opinionated choice, but I'm not the only one to make this choice. I got it from other projects and just thought it was valuable enough to continue.

I can understand if people don't want this to be the default (as I would set it) but at least an option would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrequires optionThis feature request would require option configuration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions