LanguageServer.jl
LanguageServer.jl copied to clipboard
Crash when formatting on 4.3.0
#1111 does not solve this crash instance
LS.jl 4.3.0 Neovim 0.7.2
┌ Info: Running language server
│ VERSION = v"1.7.3"
│ pwd() = "/home/mfiano/projects/Julia/Practice"
│ project_path = "/home/mfiano/projects/Julia/Practice"
└ depot_path = "/home/mfiano/.data/julia"
[ Info: All cache files downloaded.
[ Info: Loading StaticArrays from cache...
[ Info: Loading Statistics from cache... (0%)
[ Info: Loading LinearAlgebra from cache... (0%)
┌ Warning: libblastrampoline_jll not stored on disc
└ @ SymbolServer ~/.data/julia/packages/SymbolServer/LMSFX/src/SymbolServer.jl:247
[ Info: Loading Libdl from cache... (0%)
[ Info: Loading SparseArrays from cache... (0%)
[ Info: Loading Random from cache... (0%)
[ Info: Loading Serialization from cache... (0%)
[ Info: Loading SHA from cache... (0%)
[ Info: Loading StaticArraysCore from cache... (0%)
[ Info: Received new data from Julia Symbol Server.
ERROR: index_at crashed. More diagnostics:
line=57
line_indices='[1, 17, 18, 42, 43, 75, 76, 106, 107, 122, 133, 137, 138, 144, 145, 173, 174, 198, 219, 220, 249, 297, 334, 371, 372, 395, 446, 496, 497, 520, 584, 619, 673, 727, 781, 828, 829, 852, 929, 967, 1047, 1123, 1203, 1275, 1331, 1387, 1429, 1430, 1467, 1489, 1513, 1514, 1551, 1593, 1634, 1635, 1639]'
Stacktrace:
[1] index_at(doc::LanguageServer.TextDocument, p::LanguageServer.Position, forgiving_mode::Bool)
@ LanguageServer ~/.data/julia/packages/LanguageServer/EZiaS/src/textdocument.jl:46
[2] index_at
@ ~/.data/julia/packages/LanguageServer/EZiaS/src/textdocument.jl:39 [inlined]
[3] _convert_lsrange_to_jlrange
@ ~/.data/julia/packages/LanguageServer/EZiaS/src/textdocument.jl:99 [inlined]
[4] apply_text_edits(doc::LanguageServer.TextDocument, edits::Vector{LanguageServer.TextDocumentContentChangeEvent}, new_version::Int64)
@ LanguageServer ~/.data/julia/packages/LanguageServer/EZiaS/src/textdocument.jl:85
[5] textDocument_didChange_notification(params::LanguageServer.DidChangeTextDocumentParams, server::LanguageServerInstance, conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint})
@ LanguageServer ~/.data/julia/packages/LanguageServer/EZiaS/src/requests/textdocument.jl:82
[6] (::LanguageServer.var"#98#99"{typeof(LanguageServer.textDocument_didChange_notification), LanguageServerInstance})(conn::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::LanguageServer.DidChangeTextDocumentParams)
@ LanguageServer ~/.data/julia/packages/LanguageServer/EZiaS/src/languageserverinstance.jl:262
[7] dispatch_msg(x::JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::JSONRPC.MsgDispatcher, msg::Dict{String, Any})
@ JSONRPC ~/.data/julia/packages/JSONRPC/P0G1p/src/typed.jl:67
[8] run(server::LanguageServerInstance)
@ LanguageServer ~/.data/julia/packages/LanguageServer/EZiaS/src/languageserverinstance.jl:382
[9] top-level scope
@ none:31
Also forgot to mention that this crash does not occur on ddcbc1a
This seems to be introduced by 329c8662697544f6674868f2dae52b69bcda958e
Likely an issue with incremental sync being broken in nvim. We may need to make it opt-in when constructing the LanguageServerInstance.
This issue only occurs when manually calling JuliaFormatter.jl and rewriting the buffer contents in Neovim. I am not sure if this is a server or client bug, but as it doesn't affect me anymore now that I use LS.jl's builtin formatting, feel free to close this if you deem that it should.
This sounds like the client isn't sending any didChange events when a third party modifies the buffer content. Not sure how feasible that is to implement on their end though.
You can configure your hotkey to send that event after running the formatter.