@@ -21,6 +21,13 @@ return {
2121 ' hrsh7th/cmp-nvim-lsp' ,
2222 },
2323 config = function ()
24+ -- Set default position encoding to prevent warnings
25+ local original_make_position_params = vim .lsp .util .make_position_params
26+ vim .lsp .util .make_position_params = function (win , offset_encoding )
27+ offset_encoding = offset_encoding or ' utf-16'
28+ return original_make_position_params (win , offset_encoding )
29+ end
30+
2431 vim .api .nvim_create_autocmd (' LspAttach' , {
2532 group = vim .api .nvim_create_augroup (' kickstart-lsp-attach' , { clear = true }),
2633 callback = function (event )
@@ -29,7 +36,7 @@ return {
2936 vim .keymap .set (mode , keys , func , { buffer = event .buf , desc = ' LSP: ' .. desc })
3037 end
3138
32- map (' gd' , require ( ' telescope.builtin ' ). lsp_definitions , ' [G]oto [D]efinition' )
39+ map (' gd' , vim . lsp . buf . definition , ' [G]oto [D]efinition' )
3340 map (' gr' , require (' telescope.builtin' ).lsp_references , ' [G]oto [R]eferences' )
3441 map (' gI' , require (' telescope.builtin' ).lsp_implementations , ' [G]oto [I]mplementation' )
3542 map (' <leader>D' , require (' telescope.builtin' ).lsp_type_definitions , ' Type [D]efinition' )
@@ -71,8 +78,16 @@ return {
7178 end ,
7279 })
7380
81+ -- Set global position encoding preference
82+ vim .lsp .protocol .PositionEncodingKind = vim .lsp .protocol .PositionEncodingKind or {}
83+ vim .lsp .protocol .PositionEncodingKind .UTF16 = ' utf-16'
84+
7485 local capabilities = vim .lsp .protocol .make_client_capabilities ()
7586 capabilities = vim .tbl_deep_extend (' force' , capabilities , require (' cmp_nvim_lsp' ).default_capabilities ())
87+
88+ -- Set position encoding to utf-16 (widely supported) to avoid warnings
89+ capabilities .general = capabilities .general or {}
90+ capabilities .general .positionEncodings = { ' utf-16' }
7691
7792 local servers = {
7893 omnisharp = {
@@ -110,6 +125,7 @@ return {
110125
111126 -- Setup Gleam LSP separately (not managed by Mason)
112127 require (' lspconfig' ).gleam .setup ({})
128+
113129 end ,
114130 },
115131}
0 commit comments