The language server protocol supports specifying offsets in text documents using UTF-8 or UTF-16 or UTF-32 code units.
The UTF-16 code unit is the default.
Different language servers have different levels of support for using the different code units. Vim uses the UTF-32
code units for the offsets. This makes it difficult to support different language servers from a Vim LSP plugin.
Port the strutfindex() and strbyteindex() functions from Neovim to support this.
Co-authored-by: bfredl bjorn...@gmail.com
https://github.com/vim/vim/pull/12216
(8 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Merging #12216 (efb120a) into master (39c9ec1) will decrease coverage by
0.83%.
The diff coverage is89.70%.
@@ Coverage Diff @@ ## master #12216 +/- ## ========================================== - Coverage 81.94% 81.12% -0.83% ========================================== Files 164 154 -10 Lines 194103 183711 -10392 Branches 43830 41417 -2413 ========================================== - Hits 159067 149032 -10035 + Misses 22197 21714 -483 - Partials 12839 12965 +126
| Flag | Coverage Δ | |
|---|---|---|
| huge-clang-none | 82.63% <91.04%> (-0.01%) |
⬇️ |
| huge-gcc-none | ? |
|
| huge-gcc-testgui | ? |
|
| huge-gcc-unittests | 0.29% <0.00%> (-0.01%) |
⬇️ |
| linux | 81.12% <89.70%> (-1.28%) |
⬇️ |
| mingw-x64-HUGE | ? |
|
| mingw-x86-HUGE | ? |
|
| windows | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/evalfunc.c | 87.73% <ø> (-2.66%) |
⬇️ |
| src/mbyte.c | 74.29% <88.46%> (+1.93%) |
⬆️ |
| src/strings.c | 91.79% <90.47%> (-0.97%) |
⬇️ |
... and 145 files with indirect coverage changes
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@yegappan pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This feature looks related to one of my ealier post at https://groups.google.com/g/vim_dev/c/AVpp8DT2_Vc/m/L_p6gzATBQAJ
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@DominiquePelle-TomTom commented on this pull request.
> @@ -604,6 +606,7 @@ strptime({format}, {timestring})
strridx({haystack}, {needle} [, {start}])
Number last index of {needle} in {haystack}
strtrans({expr}) String translate string to make it printable
+strutfindex({expr} [, {index}]) List byte index to utf-32 and ut-16 indices
ut-16? I assume you meant utf-16.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
> @@ -8975,8 +8978,22 @@ str2nr({string} [, {base} [, {quoted}]]) *str2nr()*
Can also be used as a |method|: >
GetText()->str2nr()
+<
+strbyteindex({string} [, {index} [, {use_utf16}]) *strbyteindex()*
+ Convert a UTF-32 or UTF-16 {index} to a byte index. If
Sometimes the doc in the PR uses "UTF-16" and sometimes "utf-16".
Let's be consistent (the capitalized one is better IMO).
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This feature looks related to one of my earlier post at https://groups.google.com/g/vim_dev/c/AVpp8DT2_Vc/m/L_p6gzATBQAJ
this is for LSP impl, the default encoding of lsp server is utf-16, hence some e.g non-utf32 chars symbol maybe located incorrectly at client if no such funcs (e.g from this pr) from vim itself.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@yegappan pushed 2 commits.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()