Skip to content

Indentation (tabs vs. spaces) with lsp-format-buffer and lua-mode #3979

@AndreasMatthias

Description

@AndreasMatthias

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

lua-mode in default configuration uses spaces for indentation, but (lsp-format-buffer) uses tabs.

Steps to reproduce

Take this example:

function foo()
print('foo')
end

With point at line 2, (indent-for-tab-command) indents this line by 3 spaces, because lua-indent-level is set to 3. This verifies that lua-mode is using spaces and not tabs (in the default configuration).

But if I let lua-language-server format the buffer with (lsp-format-buffer), the second line gets indented by one tab and not by 3 spaces.

If I understand correctly lua-language-server does not decide by itself whether to use spaces or tabs for indentation, but gets this information from the client.

Expected behavior

Indentation of lua-mode and (lsp-format-buffer) should be the same.

Which Language Server did you use?

lua-language-server

OS

Linux

Error callstack

No response

Anything else?

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