Skip to content

Bug: Missing indentation rule for anonymous functions (function_definition) #14

@JustBarnt

Description

@JustBarnt

The indents.scm file is missing a rule for anonymous functions, which is causing incorrect auto-indentation when writing callbacks inside functions.

Example Gif:
Image

Example:

lines[i] = lines:gsub(pattern, function(m)
  if true then
    return m
  end
  end) -- <-- This `end)` call will get indented like so inline with
       -- the if statements `end` when inserting a new line above it

Fix:
Add (function_definition "end" @end) @indent to indents.scm

I having issues getting it the extensions to load into Zed on windows... but I did manually change the current indents.scm file from the current extension version downloaded able from Zed and it works as expected. When I get to load as a Dev Extension to confirm it works still, I will create a PR with the change.

Edit: Attached is a gif of the behavior as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions