Skip to content

Add "Anonymous only" to SpaceAfterFunctionNames #1154

Description

@dgxo

I've always included a space after function with anonymous functions, it's just a habit now.

pcall(function ()
end)

task.spawn(function ()
end)

const empty = function () end

const function runThis()
end

But this isn't supported by StyLua - only all function definitions or none, and I think all definitions just looks odd.
It would be nice to have "Anonymous only" so a space is only added for anonymous functions.

I've looked through the code but I'm not too familiar with Rust and am unsure how you would want to implement this (in create_function_definition_trivia or a new function or something else) so I haven't submitted a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions