Closed kra-mo closed 8 months ago
For the record, this does also happen with the default pylsp
config.
invalid table: mixed or invalid key types
Oh this is interesting. Could you get a log with verbose = true
in the server config?
Sat Jan 27 18:14:02 2024 [INFO] [LSP/pylsp]: Adding request textDocument/formatting
at /var/home/kramo/.config/lite-xl/plugins/lsp/init.lua:761
Sat Jan 27 18:14:02 2024 [ERROR] /var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:87: invalid table: mixed or invalid key types at /var/home/kramo/.local/share/lite-xl/core/init.lua:1227
stack traceback:
[C]: in function 'error'
/var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:87: in function </var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:73>
(...tail calls...)
/var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:111: in function </var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:73>
(...tail calls...)
/var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:111: in function </var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:73>
(...tail calls...)
/var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:111: in function </var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:73>
(...tail calls...)
/var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:111: in function </var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:73>
(...tail calls...)
/var/home/kramo/.config/lite-xl/plugins/lsp/json.lua:163: in function 'plugins.lsp.json.encode'
/var/home/kramo/.config/lite-xl/plugins/lsp/server.lua:648: in function 'plugins.lsp.server.process_requests'
/var/home/kramo/.config/lite-xl/plugins/lsp/init.lua:2073: in function </var/home/kramo/.config/lite-xl/plugins/lsp/init.lua:2048>
[C]: in function 'xpcall'
/var/home/kramo/.local/share/lite-xl/core/init.lua:1226: in function 'core.try'
(...tail calls...)
Oh wait, I totally just posted the same logs. Yeah, it doesn't seem to give me anything else even if verbose is set to true.
Try replacing this line
https://github.com/lite-xl/lite-xl-lsp/blob/9f7ff8220ac1b0f95a05f69a9cc50faa9a74590e/init.lua#L1926
with just trimTrailingWhitespace = true
.
That fixes it! Thanks.
If you want to, feel free to PR that. Otherwise I'll PR it when I can.
Do you think this should be configurable?
I'm not even sure what that does 😅 so I think I'd leave it up to you.
But if it is just whether whitespace should be trimmed, it should probably follow the plugin.
I think I'd leave it up to you.
Sure, no worries.
But if it is just whether whitespace should be trimmed, it should probably follow the plugin.
Yeah, basically that. I guess I'll make it do that then, and maybe allow for an override (for example I don't use that plugin, but I would like for whitespace trimming on format).
config.plugins.trimwhitespace.enabled
does seem to work, that is probably what was intended there.
Yeah, but it needs at least a check to see if the plugin is fully disabled (config.plugins.trimwhitespace = false
).
The following error is displayed: