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

Wrong :character position is reported by eglot's text sync functions when narrowing is in effect #54

Closed
mkcms opened this issue Jul 28, 2018 · 0 comments

Comments

@mkcms
Copy link
Collaborator

mkcms commented Jul 28, 2018

When I use clangd and have a buffer with these contents:

int main()
{
    return;
}

and I narrow to the word return, and then insert 0 (space + 0) at the end of of the buffer, eglot sends the following notification to the server:

(:jsonrpc "2.0" :method "textDocument/didChange" :params
	  (:textDocument
	   (:uri "file:///tmp/proj/src/main.c" :version 4)
	   :contentChanges
	   [(:range
	     (:start
	      (:line 2 :character 6)
	      :end
	      (:line 2 :character 6))
	     :rangeLength 0 :text " ")
	    (:range
	     (:start
	      (:line 2 :character 7)
	      :end
	      (:line 2 :character 7))
	     :rangeLength 0 :text "0")]))

which is wrong, because the range of characters where the buffer changed is line 2, characters 10-11.
Eglot treats point-min as beginning of line in that case.

bhankas pushed a commit to bhankas/emacs that referenced this issue Sep 18, 2022
…uffers

* eglot.el (eglot--pos-to-lsp-position): Fix return value when
  narrowing is in effect.
bhankas pushed a commit to bhankas/emacs that referenced this issue Sep 19, 2022
…uffers

* eglot.el (eglot--pos-to-lsp-position): Fix return value when
  narrowing is in effect.
bhankas pushed a commit to bhankas/emacs that referenced this issue Sep 19, 2022
* eglot.el (eglot--pos-to-lsp-position): Fix return value when
  narrowing is in effect.
#54: joaotavora/eglot#54
jollaitbot pushed a commit to sailfishos-mirror/emacs that referenced this issue Oct 12, 2022
* eglot.el (eglot--pos-to-lsp-position): Fix return value when
  narrowing is in effect.

GitHub-reference: close joaotavora/eglot#54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant