-
Notifications
You must be signed in to change notification settings - Fork 200
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
Applying TextEdits fails when line contains tabs #158
Comments
Does it mean that for the LSP server a TAB character counts as one column? Always and per the spec?
|
@joaotavora I was just starting to wonder why identifier highlighting got all weird lately, and it's the same bug (and your suggestion 1 does indeed fix it) |
Yes, that works, but it doesn't work if you insert a control character such as |
That's a page break, it usually comes on a line of its own. If it doesn't it's kinda lame. I say "wontfix" for that. |
@mkcms unless you can find more crazy cases go ahead and commit the fix 1 if you can. |
You can put those characters anywhere you want in code. Sure, you should probably always escape them, but the current behavior will be annoying for users who don't or can't (because they work with some legacy or bad code bases). |
I didn't say you couldn't . I said it "usually" comes in a line of its own.
There not nearly as pervasive as TAB. Every ^L I've ever seen came on a line of its own, or at the very least at the end of a line. I won't needlessly complicate eglot for some super-remote corner case. So unless you can convince me it's not remote at all, I'm going with 1. |
Done.
I don't think that the solutions I provided in 1st post were very complicated. They wouldn't even increase the line count of |
It't not about line count, it's about complexity and readability. This makes it clearer, IMO, that in LSP, a character is really a character, not a column. |
Of course, I have end-user experience in mind, you're thinking about code readability. |
I don't understand. Both fixes improve the end-user experience (modulo the ^L case) I just happen to believe my fix is more readable. That said, if you think yours is more readable, and given that the way things are going you will probably become the Eglot maintainer eventually, go ahead and use your version. I agree it's not much worse (but it the |
Yes, sorry. I just remember the times without LSP, when I had to configure language features in Emacs manually (rtags, elpy, irony-mode...). Now I'm kind of paranoid about tiny issues like that, because I remember how it can annoy someone (although in this case the fix is trivial).
I will wait a bit, perhaps we can add a comment explaining why the fix is necessary and maybe add a TODO. |
Fixes joaotavora/eglot#158. * eglot.el (eglot--pos-to-lsp-position): Call eglot-current-column-function with tab-width bound to 1. (eglot--lsp-position-to-point): Call eglot-move-to-column-function with tab-width bound to 1.
Fixes joaotavora/eglot#158. * eglot.el (eglot--pos-to-lsp-position): Call eglot-current-column-function with tab-width bound to 1. (eglot--lsp-position-to-point): Call eglot-move-to-column-function with tab-width bound to 1.
Fixes #158. * eglot.el (eglot--pos-to-lsp-position): Call eglot-current-column-function with tab-width bound to 1. (eglot--lsp-position-to-point): Call eglot-move-to-column-function with tab-width bound to 1. #158: joaotavora/eglot#158
Fixes joaotavora/eglot#158. * eglot.el (eglot--pos-to-lsp-position): Call eglot-current-column-function with tab-width bound to 1. (eglot--lsp-position-to-point): Call eglot-move-to-column-function with tab-width bound to 1.
The recent commits that fixed issue #124 introduced a bug which is triggered when tab characters are present in buffer.
In this file
When I execute the code action for the error (missing
;
), I end up with:But in this file, executing the code action is correct:
This is because
move-to-column
andcurrent-column
count each tab character astab-width
chars.The text was updated successfully, but these errors were encountered: