feat(lsp)!: symbol_to_item requires offset_encoding

This commit is contained in:
Yi Ming
2025-02-11 17:19:44 +08:00
parent 6722149776
commit e8b5dd1e89
5 changed files with 42 additions and 14 deletions

View File

@@ -2930,6 +2930,8 @@ describe('LSP', function()
local expected = {
{
col = 1,
end_col = 1,
end_lnum = 2,
filename = '',
kind = 'File',
lnum = 2,
@@ -2937,6 +2939,8 @@ describe('LSP', function()
},
{
col = 1,
end_col = 1,
end_lnum = 4,
filename = '',
kind = 'Module',
lnum = 4,
@@ -2944,6 +2948,8 @@ describe('LSP', function()
},
{
col = 1,
end_col = 1,
end_lnum = 6,
filename = '',
kind = 'Namespace',
lnum = 6,
@@ -3036,7 +3042,7 @@ describe('LSP', function()
},
},
}
return vim.lsp.util.symbols_to_items(doc_syms, nil)
return vim.lsp.util.symbols_to_items(doc_syms, nil, 'utf-16')
end)
)
end)
@@ -3045,6 +3051,8 @@ describe('LSP', function()
local expected = {
{
col = 1,
end_col = 1,
end_lnum = 2,
filename = '',
kind = 'File',
lnum = 2,
@@ -3052,6 +3060,8 @@ describe('LSP', function()
},
{
col = 1,
end_col = 1,
end_lnum = 6,
filename = '',
kind = 'Namespace',
lnum = 6,
@@ -3115,7 +3125,7 @@ describe('LSP', function()
},
},
}
return vim.lsp.util.symbols_to_items(doc_syms, nil)
return vim.lsp.util.symbols_to_items(doc_syms, nil, 'utf-16')
end)
)
end)
@@ -3125,6 +3135,8 @@ describe('LSP', function()
local expected = {
{
col = 1,
end_col = 1,
end_lnum = 3,
filename = '/test_a',
kind = 'File',
lnum = 2,
@@ -3132,6 +3144,8 @@ describe('LSP', function()
},
{
col = 1,
end_col = 1,
end_lnum = 5,
filename = '/test_b',
kind = 'Module',
lnum = 4,
@@ -3181,7 +3195,7 @@ describe('LSP', function()
containerName = 'TestBContainer',
},
}
return vim.lsp.util.symbols_to_items(sym_info, nil)
return vim.lsp.util.symbols_to_items(sym_info, nil, 'utf-16')
end)
)
end)