-
-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hey, I started my adventure with elixir like this week and I'm crazy enough to install new merged official LSP, which I assume is in very early stages, so please bear with me 🥺
Versions used
erlang/elixir stack:
Erlang/OTP 26 [erts-14.2.5.11] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]
Elixir 1.18.4 (compiled with Erlang/OTP 25)
neovim: v0.11.4
autocomplete/snippet plugin: https://github.com/Saghen/blink.nvim
expert compiled from source: https://github.com/elixir-lang/expert/tree/555b6b669dd348fc20cd643fef2cd3a43f7133b4
Expert log stack
** (ArgumentError) errors were found at the given arguments:
* 3rd argument: out of range
(erts 15.2.7) :erlang.binary_part("", 0, 2)
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:377: XPForge.Document.utf8_prefix/2
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:358: XPForge.Document.edit_action/4
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:334: anonymous fn/5 in XPForge.Document.apply_valid_edits/4
(elixir 1.17.3) lib/enum.ex:4415: Enum.reduce_range/5
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:278: XPForge.Document.apply_change/3
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:202: anonymous fn/2 in XPForge.Document.apply_content_changes/3
(elixir 1.17.3) lib/enum.ex:4858: Enumerable.List.reduce/3
Last message (from #PID<0.303.0>): {:get_and_update, "file:///home/afterlook/projects/learning-elixir/hello/case_cond_if.exs", #Function<2.26744718/1 in XPExpert.State.apply/2>}
State: %XPForge.Document.Store.State{open: %{"file:///home/afterlook/projects/learning-elixir/hello/case_cond_if.exs" => {:open_doc, #XPForge.Document<path: "/home/afterlook/projects/learning-elixir/hello/case_cond_if.exs", version: 40, dirty?: true, lines: %Lines<"case {1, 2, 3} do..."(12 lines)>, ...>, %{analysis: %XPForge.Ast.Analysis{ast: nil, document: #XPForge.Document<path: "/home/afterlook/projects/learning-elixir/hello/case_cond_if.exs", version: 40, dirty?: true, lines: %Lines<"case {1, 2, 3} do..."(12 lines)>, ...>, parse_error: {:error, {[line: 12, column: 5], "syntax error before: ", "'->'"}}, scopes: [], comments_by_line: %{}, valid?: false}}}}, temporary_open_refs: %{}, derivation_funs: %{analysis: &XPForge.Ast.analyze/1}}
Client #PID<0.303.0> is alive
(stdlib 6.2.2.1) gen.erl:260: :gen.do_call/4
(elixir 1.17.3) lib/gen_server.ex:1125: GenServer.call/3
(xp_expert 0.1.0-555b6b6) lib/expert/state.ex:108: XPExpert.State.apply/2
(xp_expert 0.1.0-555b6b6) lib/expert.ex:200: XPExpert.apply_to_state/2
(xp_expert 0.1.0-555b6b6) lib/expert.ex:139: XPExpert.handle_notification/2
(xp_gen_lsp 0.11.1) lib/gen_lsp.ex:519: anonymous fn/2 in XPGenLSP.loop/3
(xp_telemetry 1.3.0) /home/runner/work/expert/expert/apps/expert/deps/telemetry/src/telemetry.erl:324: :xp_telemetry.span/3
(xp_gen_lsp 0.11.1) lib/gen_lsp.ex:515: anonymous fn/4 in XPGenLSP.loop/3
20:33:40.327 [error] Process #PID<0.159.0> terminating
** (ArgumentError) errors were found at the given arguments:
* 3rd argument: out of range
(erts 15.2.7) :erlang.binary_part("", 0, 2)
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:377: XPForge.Document.utf8_prefix/2
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:358: XPForge.Document.edit_action/4
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:334: anonymous fn/5 in XPForge.Document.apply_valid_edits/4
(elixir 1.17.3) lib/enum.ex:4415: Enum.reduce_range/5
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:278: XPForge.Document.apply_change/3
(xp_forge 0.1.0-555b6b6) lib/forge/document.ex:202: anonymous fn/2 in XPForge.Document.apply_content_changes/3
(elixir 1.17.3) lib/enum.ex:4858: Enumerable.List.reduce/3
Initial Call: XPForge.Document.Store.init/1
Ancestors: [XPExpert.Supervisor, #PID<0.157.0>]
Message Queue Length: 0
Messages: []
Links: [#PID<0.158.0>]
Dictionary: []
Trapping Exits: false
Status: :running
Heap Size: 17731
Stack Size: 29
Reductions: 331975
I created a patch that just makes sure binary_part can't get out of bounds, recompiled expert and the issue went away, on a first glance without any side effect - of course I can't be sure of that. I have no clue how the rest of the forge module is written and maybe there's a reason why utf_prefix should never get an empty line and there is a bug upstream in regards to dealing with snippet expansion in neovim.