-
Notifications
You must be signed in to change notification settings - Fork 306
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
References to vim positions can't handle non-ASCII chars #425
Comments
|
Sorry, wrote too soon. Something is different between the merged version and the one I tested. It's fixed on the @machakann's https://github.com/machakann/vim-lsp/tree/issue425 branch, but not on vim-lsp master. It seems that not all changes made it from that branch to the one the actually merged PR was based on. I'll see if I can extract the missing changes and open a fixup PR. |
@machakann It seems that you're still working on that branch -- do you plan on merging it soon, or should I cherry-pick your fix that didn't make it into the PR? |
Hi @clason, yes I'm working on it. I inserted character-byte index interconversion at the places necessary (maybe). Currently, I'm searching for a language server for testing some features; my language server won't work with rename command... At least, it seems I will open a new PR soon, I would be glad if you could help to test the branch. |
@machakann Great, thank you! I tested your branch, and EDIT: Yes, |
@machakann If you wish, I can make a PR on top of master based on your branch now so we can get the fixes in, and you can continue on top of that? |
@machakann No need to apologize! I really appreciate your kind help! I can confirm that #490 fixes my issues (including |
* Multibyte character support for lsp#get_position() * Multibyte character support for "textDocument/documentHighlight" * Fix `lsp#utils#byteindex()` would fails if a file is not yet loaded * Add tests * Rename lsp#utils#byteindex() and lsp#utils#charindex() lsp#utils#byteindex() -> lsp#utils#to_col() lsp#utils#charindex() -> lsp#utils#to_char() * Multibyte character support for textEdit * Remove unused line * Multibyte character support for "textDocument/rangeFormatting" * Multibyte character support for "textDocument/publishDiagnostics"
#490 has been merged. please try again. |
Yep, still works! Thank you! |
The issue is that the encoding of non-English characters (cue UTF-16 rant) breaks position information in vim-lsp, leading to all sorts of issues. Consider the following minimal example using the
pyls
language server for Python (I use neovim HEAD for this):nvim test.py
var1
on the first line, which should correctly highlightvar1
on the second line as well (cursor is on character after|
, highlight indicated by[...]
):var2
tovär2
, move cursor back to first line:Note how the highlight is shifted left by one character. This is not just a cosmetic problem; the location of the symbol
var1
on the second line is calculated incorrectly, which means that, e.g.,hover
(which triggers on the same -- incorrect -- characters as are highlighted) and identification of completion triggers for candidate selection and replacement do not work.EDIT It seems that the issue is with the
range_to_position
function inreferences.vim
; it's not clear to me how to change it to account for non-ASCII chars outside the given range.vär2
tovör2
, go back tovar1
, and get the error messageThe text was updated successfully, but these errors were encountered: