lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

vscode formatOnType doesnt work

Open achidipothu opened this issue 3 years ago • 1 comments

Describe the bug vscode has a handy feature which formats the code as we type, it doesnt seem to work with Lua.

To Reproduce Steps to reproduce the behavior:

  1. Write any unformatted code in a line
i=0
  1. press "return" key
  2. Code is still unformatted.
i=0

Expected behavior Code should be formatted on a "return" key like below, just as it formats with the format(I mean format code manully by selecting it editor.action.formatSelection) option.

i = 0

Environment (please complete the following information):

  • OS: Fedora 35
  • Client: VSCode
  • VSCode Settings:
    "editor.formatOnType": true,
    "[lua]": {
        "editor.defaultFormatter": "sumneko.lua"
    },

Additional context

  • the same option works with C/C++ code.
  • can this be enabled with any other setting? I didnt find any.
  • Also None of the Lua formatters out there seem to support this, is there any inherent problem with lua in supporting this?

achidipothu avatar Jul 13 '22 07:07 achidipothu

in sumneko_lua, type-on-format uses sumneko's own function. but the formatter of sumneko lua used, supports type format

CppCXY avatar Jul 13 '22 08:07 CppCXY

Should be supported.

sumneko avatar Sep 19 '22 09:09 sumneko