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

Cannot for the life of me configure formatting

Open jubishop opened this issue 2 years ago • 5 comments

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

MacOS

What is the issue affecting?

Formatting

Expected Behaviour

Formatting adds 6 spaces for indentation.

Actual Behaviour

Formatting adds the default 2.

Reproduction steps

I have it set as the default formatter in my settings.json:

  "[lua]": {
    "editor.quickSuggestions": {
      "other": true,
      "comments": true,
      "strings": true
    },
    "editor.tabCompletion": "on",
    "editor.quickSuggestionsDelay": 1,
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.defaultFormatter": "sumneko.lua",
  },

I put in .luarc.json in my workspace:

{
  "Lua.format.defaultConfig": {
    "indent_style": "space",
    "indent_size": "6"
  }
}

But no luck,

I put in .vscode/settings.json in my workspace:

{
  "Lua.format.defaultConfig": {
    "indent_style": "space",
    "indent_size": "6"
  }
}

I try various ways of adding this to the core settings.json used by VSCode, either adding it under the [lua] entry, or as a top level entry, but no luck.

What am I missing?!

thanks!

Additional Notes

No response

Log File

No response

jubishop avatar Apr 01 '23 02:04 jubishop

sumneko requires that formatting follows the Language Server Protocol, so indentation will not use the configuration here but will instead follow the editor's configuration.

CppCXY avatar Apr 03 '23 08:04 CppCXY

sumneko requires that formatting follows the Language Server Protocol, so indentation will not use the configuration here but will instead follow the editor's configuration.

Sorry for interrupting the conversation here.

But how do I prevent line breaks from being added when a line is quite long? I don't want to have this behavior, but no configuration seems to work, neither local nor global.

MillhioreBT avatar Apr 12 '23 16:04 MillhioreBT

sumneko requires that formatting follows the Language Server Protocol, so indentation will not use the configuration here but will instead follow the editor's configuration.

Sorry for interrupting the conversation here.

But how do I prevent line breaks from being added when a line is quite long? I don't want to have this behavior, but no configuration seems to work, neither local nor global.

set max_line_length=unset

CppCXY avatar Apr 13 '23 02:04 CppCXY

Same problem. Nothing I do on VSCode works when the documentation states it's possible..

Also, VSCode autocompletes with CamelCase instead of snake_case, which is also different from the documentation: image

andradei avatar Jun 23 '23 17:06 andradei