Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when pasting more than 2 lines using Eglot #1427

Closed
cfclavijo opened this issue Mar 6, 2023 · 0 comments · Fixed by #1478
Closed

Error when pasting more than 2 lines using Eglot #1427

cfclavijo opened this issue Mar 6, 2023 · 0 comments · Fixed by #1478
Labels
bug Something isn't working

Comments

@cfclavijo
Copy link

cfclavijo commented Mar 6, 2023

Describe the bug
When pasting multiple lines (more than 2), erlang_ls server fails to process the request and as a result, the editor and the server end up out of sync.

To Reproduce
Emacs configured with Eglot as lsp client, erlang_ls.config configured with incremental_sync=true, paste a block of code with more than 2 lines.

I captured a failing request and narrowed the call so the problem can be replicated with:
els_text:apply_edits(<<"-module(rgoto_v1_http).\n-export([ get/2]).\n\nget([<<\"account\">>] = _Path, Req) ->\n ct:pal(\"wooooooooooo\"),\n {200, #{<<\"content-type\">> => <<\"text/plain\">>}, <<\"REST Hello World as text!\">>, Req};\n\nget([Value], Req) ->\n {200, #{<<\"content-type\">> => <<\"text/plain\">>}, <<\"REST Hello \",Value/binary,\" as text!\">>, Req}.\n">>, [{#{from => {6,0},to => {6,0}}, "get([<<\"ACCOUNT\">>] = _Path, Req) ->\n ct:pal(\"WOOOOOOOOOOO\"),\n {200, #{<<\"CONTENT-TYPE\">> => <<\"text/plain\">>}, <<\"REST HELLO WORLD AS TEXT!\">>, Req};"}, {#{from => {6,0},to => {8,89}}, "get([<<\"ACCOUNT\">>] = _Path, Req) ->\n ct:pal(\"WOOOOOOOOOOO\"),\n {200, #{<<\"CONTENT-TYPE\">> => <<\"text/plain\">>}, <<\"REST HELLO WORLD AS TEXT!\">>, Req};"}]).

Expected behavior
Server should be able to process the request so it keeps in sync with the client

Actual behavior
Eglot Client sends a textDocument/didChange with 2 or 3 contentChanges when pasting a block of code with more than 2 lines, the server process the first contentChange* but fails to process the subsequent ones, as a consequence, the internal representation of the document on the server side is not altered, but it is in the editor (emacs).

Context

  • erlang_ls version : 0.46.2
  • Editor used: Emacs 29.0.60 (or any version configured with Eglot)
  • LSP client used: Eglot 1.11
@cfclavijo cfclavijo added the bug Something isn't working label Mar 6, 2023
plux added a commit that referenced this issue Jan 9, 2024
This is not really a proper fix since it will make text editing
less efficient, but finding the root cause is tricky.

A follow up chagne could be made to fix the root cause.

Fixes #1427.
plux added a commit that referenced this issue Jan 9, 2024
This is not really a proper fix since it will make text editing
less efficient, but finding the root cause is tricky.

A follow up chagne could be made to fix the root cause.

Fixes #1427.
@plux plux closed this as completed in #1478 Jan 9, 2024
plux added a commit that referenced this issue Jan 9, 2024
This is not really a proper fix since it will make text editing
less efficient, but finding the root cause is tricky.

A follow up chagne could be made to fix the root cause.

Fixes #1427.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant