Comments (21)
Ahh yes, compiled latest version of the sumneko lua language server and got the crash :), will further investigate...
from lite-xl-lsp.
I actually never got to properly investigate what was causing the crash but after compiling latest commit c876e0da1c0c2d01db9cb0c6f2914659318e0460 from sumneko repo seems that what caused this plugin to crash was fixed on the lua-language-server it self so closing this issue for now.
from lite-xl-lsp.
Thanks a lot @leafi for investigating this. Divided the label and list functions into separate functions for both item kinds and symbol kinds to reduce future issues, it seems the commit closed this issue because I added the word fix
, in any case let me know if the change really fixes the issue and if not feel free to report to reopen the issue.
from lite-xl-lsp.
You don't have to overwrite the autocomplete plugin, just placing the autocomplete.lua file on this repository on the users plugins directory will be enough to override the default autocomplete plugin. Lite-XL has the ability to detect duplicated plugins on your user directory and overwrite the default ones.
from lite-xl-lsp.
The same bug happens when placing autocomplete.lua as a plugin, however, I tried the Lua LSP and it works, so it may be the other LSP I'm using that is causing the crash.
I'm closing the issue since it seems not directly related to lite-xl-lsp
from lite-xl-lsp.
Hello, I'm reopening the issue, this crash also happened on sumneko_lsp with lite-xl-lsp
as a project.
It's strange... I got it working, but now it crashes with the same error.
I'm have been using this call to use sumneko_lua.
lsp.add_server {
name = "sumneko_lua",
language = "lua",
file_patterns = { "%.lua$" },
command = {
"/home/dreunix/Downloads/programas/lua-language-server/bin/Linux/lua-language-server",
"/home/dreunix/Downloads/programas/lua-language-server/main.lua"
},
verbose = true,
}
from lite-xl-lsp.
that's really strange... does the autocomplete plugin you are using has these lines: https://github.com/jgmdev/lite-xl-lsp/blob/master/autocomplete.lua#L39 ?
from lite-xl-lsp.
that happen when lsp not fully init... wait for 30s before type it will solve
then with lazy load when you leave editor for some time it need init again then again issue come back
from lite-xl-lsp.
I haven't been able to reproduce this issue some step by step instructions would help
from lite-xl-lsp.
Can confirm, same exact issue, with the same message in error.txt
.
the lsp section in my config:
----------------------------------- LSP ---------------------------------------
local lsp = require "plugins.lsp"
local lspconfig = require "plugins.lsp.config"
-- Define the command to launch sumneko lsp and disable diagnostics
lspconfig.sumneko_lua.setup {
command = {
"/home/dvl/Repos/lua-language-server/bin/Linux/lua-language-server",
"-E",
"/home/dvl/Repos/lua-language-server/main.lua"
},
settings = {
Lua = {
diagnostics = {
enable = false
}
}
}
}
--------------------------------- LSP Settings --------------------------------
---Set to a file path to log all json
---@type string
config.plugins.lsp.log_file = "/home/dvl/.config/lite-xl/plugins/lsp/log.log"
---Setting to true prettyfies json for more readability on the log
---but this setting will impact performance so only enable it when
---in need of easy to read json output when developing the plugin.
---@type boolean
config.plugins.lsp.prettify_json = false
---Show diagnostic messages
---@type boolean
config.plugins.lsp.show_diagnostics = true
---Stop servers that aren't needed by any of the open files
---@type boolean
config.plugins.lsp.stop_unneeded_servers = true
---Send a server stderr output to lite log
---@type boolean
config.plugins.lsp.log_server_stderr = false
---Force verbosity off even if a server is configured with verbosity on
---@type boolean
config.plugins.lsp.force_verbosity_off = false
from lite-xl-lsp.
@jgmdev
step when issue will come
- open file with language that have config. like @Standecco
- look below bar it will show lsp init then quick type something on file
- then boom issue will arise
i'm unsure issue will arise but with my system is it
System
MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports)
memory 8 GB 2133 MHz LPDDR3
from lite-xl-lsp.
Sorry for the late response, the steps is really just opening a file, typing something and after typing .
, the autocomplete crash.
My system is Pop!_OS 21.04
, x86_64
.
These are the version of each required plugin:
- lite-xl-lsp: c4d4f95
- lite-xl-widgets: lite-xl/lite-xl-widgets@03a712a
- lite-xl: lite-xl/lite-xl@9e5d404
Note: Even waiting like 30 seconds doesn't resolves the issue here.
I also removed all non-required plugins just to be.
Edit: I accidentally submit an older gif here, now is the right one, sorry
from lite-xl-lsp.
@Andre-LA i can see lua is still initialize in below button bar, first open log and see if
[lua-language-server] Do you need to configure your work environment as LÖVE
is show on log in [Core Open Log] then try to typing again.
if my solution work so something wrong with autocomplete.lua or lsp init.lua
maybe how to solve this issue we can make flags that lsp server is all setup and we can switch to use lsp,
before lsp setup success we can still use normal suggestion.
Edit: I look in you config verbose = true try verbose = false
from lite-xl-lsp.
Edit: I look in you config verbose = true try verbose = false
Did now.
I've been opening the Log to see if there is any helpful messages, and noticed these messages about config not set, is this unexpected?
Also, autocomplete crashes when typing .
even waiting the Initialized
from log, however using Show Symbol Info
shows that:
Curiously, in one of my attempts, the show info worked, and then the autocompleted worked, but I really don't know why it worked, I'm trying to replicate this again.
from lite-xl-lsp.
Sorry guys, haven't been able to reproduce this yet, this issue has left me scratching my head. This is all I get:
testing.mp4
Edit:
All I can think is that the sumneko version you are using is having issues, this is the one I seem to be using:
commit 5dae895f67bf0f75278d25b0d412e00705386fce (HEAD -> master, origin/master, origin/HEAD)
Author: 最萌小汐 <[email protected]>
Date: Wed Jun 23 21:47:21 2021 +0800
fix some dialog boxes block the initialization
from lite-xl-lsp.
@jgmdev after i check changelog.md from sumneko in tag version 2.2.0 it seem to have change telemetry with CHG telemetry: sends version of this extension
from lite-xl-lsp.
I got same issue
from lite-xl-lsp.
I still have this issue with lua language server 2.6.0 (installed from the Arch User Repository):
Error: /home/quinten/.config/lite-xl/plugins/autocomplete.lua:235: bad argument #1 to 'get_width' (string expected, got table)
stack traceback:
[C]: in function 'get_width'
/home/quinten/.config/lite-xl/plugins/autocomplete.lua:235: in function 'get_suggestions_rect'
/home/quinten/.config/lite-xl/plugins/autocomplete.lua:383: in function 'fn'
/home/quinten/.local/share/lite-xl/core/rootview.lua:1168: in function 'root_view_draw'
/home/quinten/.local/share/lite-xl/plugins/treeview.lua:400: in function 'draw'
/home/quinten/.config/lite-xl/plugins/autocomplete.lua:512: in function 'root_view_draw'
/home/quinten/.config/lite-xl/plugins/lsp/listbox.lua:289: in function 'root_view_draw'
/home/quinten/.local/share/lite-xl/plugins/contextmenu.lua:31: in function 'draw'
/home/quinten/.local/share/lite-xl/core/init.lua:1302: in function 'step'
/home/quinten/.local/share/lite-xl/core/init.lua:1345: in function </home/quinten/.local/share/lite-xl/core/init.lua:1341>
(...tail calls...)
[string "local core..."]:9: in function <[string "local core..."]:2>
[C]: in function 'xpcall'
[string "local core..."]:2: in main chunk
Maybe a workaround would be adding some pcall
s to autocomplete's drawing so that it just doesn't draw on an error? I could also try to look into this some myself.
from lite-xl-lsp.
Which version of lite-xl are you using?
from lite-xl-lsp.
I am using v2.0.4 (self-built from Git, git checkout v2.0.4
). One quick workaround (that I have not really tested, but looking at the error should work at least) is something like changing the parts where s.info
is used like this:
diff --git a/autocomplete.lua b/autocomplete.lua
index 7ee0f9b..dd56f9b 100644
--- a/autocomplete.lua
+++ b/autocomplete.lua
@@ -231,8 +231,22 @@ local function get_suggestions_rect(av)
local max_width = 0
for _, s in ipairs(suggestions) do
local w = font:get_width(s.text)
- if s.info then
+ if type(s.info) == "string" then
w = w + style.font:get_width(s.info) + style.padding.x
+ elseif type(s.info) == "table" then
+ local str = "Autocomplete: table suggestion: "
+ for k,v in pairs(s.info) do
+ str = str .. tostring(k) .. " = " .. tostring(v) .. "; "
+ end
+ local opt = {
+ { font = style.font, text = "Phew!" , default_yes = true }
+ }
+ core.nag_view:show("Autocomplete: suggestion was table", str, opt)
+ elseif s.info then
+ local opt = {
+ { font = style.font, text = "Phew!" , default_yes = true }
+ }
+ core.nag_view:show("Autocomplete", "suggestion was unexpected type: " .. type(s.info), opt)
end
max_width = math.max(max_width, w)
end
@@ -397,7 +411,7 @@ local function draw_suggestions_box(av)
local s = suggestions[i]
local color = (i == suggestions_idx) and style.accent or style.text
common.draw_text(font, color, s.text, "left", rx + style.padding.x, y, rw, lh)
- if s.info then
+ if type(s.info) == "string" then
color = (i == suggestions_idx) and style.text or style.dim
common.draw_text(style.font, color, s.info, "right", rx, y, rw - style.padding.x, lh)
end
although I have not really tested this yet.
I'll keep this change in my working directory for a while. Hopefully this will turn up some useful information in order to get to the bottom of this. (Plus, if it works reliably, maybe just remove the nagview. I could have used log but that seemed a bit too easy to miss).
Unfortunately the error occurs quite randomly, so I don't quite know yet if it will work.
from lite-xl-lsp.
One cause of this bug is when the returned symbols from the LSP don't have a .kind
field.
e.g. Logged communication from https://github.com/codehz/nelua-lsp :
Output:
{
"params": {
"context": {
"triggerCharacter": ".",
"triggerKind": 2
},
"position": {
"line": 28,
"character": 11
},
"textDocument": {
"uri": "file:///home/leaf/work/tael/src/logbuf.nelua"
}
},
"method": "textDocument/completion",
"jsonrpc": "2.0",
"id": 2
}
Output:
{
"result": [
{
"detail": "type",
"label": "C.timespec"
},
{
"detail": "type",
"label": "C.clock_t"
},
{
"detail": "function(time1: ctime_t, time0: ctime_t): float64",
"label": "C.difftime"
},
{
"detail": "function(ts: pointer(C.timespec), base: cint): cint",
"label": "C.timespec_get"
}
],
"jsonrpc": "2.0",
"id": 2
}
In autocomplete.lua, the symbol's .info ends up being a table at crashing line 235.
This occurs because of lsp/init.lua line 1116 (in the textDocument/completion
handler):
local info = server.get_completion_items_kind(symbol.kind) or ""
This calls lsp/server.lua get_completion_items_kind, which returns a simple string e.g. 'Module' if the kind
value is a valid index in the Server.symbol_kind table...
...but, if it isn't (like here where the kind id is nil), get_completion_items_kind builds a table of (almost) all symbol kinds and returns that.
That's why autocomplete.lua ends up with s.info being a table. Autocomplete.lua appears completely unprepared for this.
Patching lsp/server.lua get_completion_items_kind to just return "" if id is nil seems to work OK, i.e.
function Server.get_completion_items_kind(id)
if id then
return Server.completion_item_kind[id]
end
return ""
end
Note that kind: is an optional field in the LSP spec, so we need to cope with this case.
from lite-xl-lsp.
Related Issues (20)
- No feedback when definition doesn't exist. HOT 2
- Rendering issues for inline diagnostics HOT 7
- Julia support HOT 3
- [Bug] Error windows cover right click context menu with no way to make the context menu visible again.
- [Bug] Autocomplete insertions randomly happen twice
- [Bug] Autocomplete insertions don't work for multiple cursors
- [BUG] Cannot see LSP Tooltip because warning/error tooltip covers it.
- [BUG] LSP Sees completely different input than what's being shown in the editor. HOT 1
- check is always failing HOT 8
- Applying autocomplete can lead to extra chars
- feature: labelDetails support
- [Bug] High CPU usage when moving mouse around HOT 9
- [Bug] High CPU usage after closing file, with "stop_unneeded_servers" set to "true" HOT 9
- [Error] Attempted to index a nil value (field 'proc') HOT 22
- [Bug] Wrong line number gets sent to the LSP server, resulting in errors HOT 16
- Click to Goto Definition? HOT 2
- Autocomplete entries need to be truncated HOT 1
- allow overriding PATH HOT 3
- Formatting fails with pylsp HOT 12
- [Request] Easier configuring LSP server after initialization HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lite-xl-lsp.