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

Switch to StyLua?

Open janie314 opened this issue 1 year ago • 2 comments

StyLua is easy to install, well-maintained, and seems to be a very popular Lua formatter in general.

I have a bare-bones Neovim LSP setup- and am having some very basic issues with the default lua-language-server's formatter-- it won't seem to respect any single-quote or double-quote preferences, for example. See related issues below.

It's easy enough to configure StyLua as a formatter manually-- but should we consider using StyLua as our default formatter?

  • https://github.com/LuaLS/lua-language-server/issues/2191
  • https://github.com/LuaLS/lua-language-server/issues/2046
  • https://github.com/LuaLS/lua-language-server/issues/1907

janie314 avatar Jan 01 '24 03:01 janie314

you are free to use any formatter you want, but that doesn't mean we have to change the default formatter for it. luals has a formatter because of me, not because it needs one! so any other formatter won't be an option.

I don't want to compare it to other formatters here, because it doesn't make much sense, I just want to say that my formatter is really not known to most people because it's too young, of course there were a lot of bugs in the beginning. but it seems that because it's the default formatter, quite a few people are using it(this includes vscode and intellij platforms, as well as the number of issues I've received).

it is true that some people have reported that formatters do not respect to formatting configurations, and in fact the vast majority of cases this is because the luals follow the editor's indentation configurations first rather than the values that you actually configure which is what the LSP specifies, and as a formatter implemented on a language server it must respect to that. later neovim default support editorconfig configuration, this situation is basically relieved!

as for your question, maybe you didn't read my configuration notes carefully, my quote configuration is qoute_style=single not qoute_type=single. qoute_type is not a major part of the editorconfig specification, editorconfig only mentions it in the possible options, and I don't really need to follow all of editorconfig's specification.

CppCXY avatar Jan 01 '24 16:01 CppCXY