From: Andreas Louv Date: Tue, 14 Mar 2023 07:53:49 +0000 (+0100) Subject: Add breaking Unicode character offset test X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=56deb0bb3506268ab58fc8f0cf573cc7fe101a86;p=vim-lsp.git Add breaking Unicode character offset test The reason for this test to fail is that the language protocol requires offsets to be send based on UTF-16 strings, but currently they are computed based on another encoding. --- diff --git a/test/clangd_tests.vim b/test/clangd_tests.vim index 5800158..1ce4cd6 100644 --- a/test/clangd_tests.vim +++ b/test/clangd_tests.vim @@ -272,6 +272,40 @@ def g:Test_LspDiag() :%bw! enddef +# Test that the client have been able to configure the server to speak utf-32 +def g:Test_UnicodeColumnCalc() + :silent! edit Xtest.c + sleep 200m + var lines: list =<< trim END + int count; + int fn(int a) + { + int 😊😊😊😊; + 😊😊😊😊 = a; + + int b; + b = a; + return count + 1; + } + END + setline(1, lines) + :redraw! + + cursor(5, 1) # 😊😊😊😊 = a; + search('a') + assert_equal([], + execute('LspGotoDefinition')->split("\n")) + assert_equal([2, 12], [line('.'), col('.')]) + + cursor(8, 1) # b = a; + search('a') + assert_equal([], + execute('LspGotoDefinition')->split("\n")) + assert_equal([2, 12], [line('.'), col('.')]) + + bw! +enddef + # Test for multiple LSP diagnostics on the same line def g:Test_LspDiag_Multi() :silent! edit Xtest.c