@@ -49,7 +49,6 @@ function lsp:get_clients_with_capability(capability, filter)
49
49
end
50
50
51
51
function lsp :get_completions (context , callback )
52
- -- TODO: offset encoding is global but should be per-client
53
52
-- TODO: should make separate LSP requests to return results earlier, in the case of slow LSPs
54
53
55
54
-- no providers with completion support
@@ -58,8 +57,12 @@ function lsp:get_completions(context, callback)
58
57
return function () end
59
58
end
60
59
60
+ -- TODO: offset encoding is global but should be per-client
61
+ local first_client = vim .lsp .get_clients ({ bufnr = 0 })[1 ]
62
+ local offset_encoding = first_client and first_client .offset_encoding or ' utf-16'
63
+
61
64
-- completion context with additional info about how it was triggered
62
- local params = vim .lsp .util .make_position_params ()
65
+ local params = vim .lsp .util .make_position_params (nil , offset_encoding )
63
66
params .context = {
64
67
triggerKind = context .trigger .kind ,
65
68
}
@@ -214,7 +217,11 @@ function lsp:get_signature_help(context, callback)
214
217
return function () end
215
218
end
216
219
217
- local params = vim .lsp .util .make_position_params ()
220
+ -- TODO: offset encoding is global but should be per-client
221
+ local first_client = vim .lsp .get_clients ({ bufnr = 0 })[1 ]
222
+ local offset_encoding = first_client and first_client .offset_encoding or ' utf-16'
223
+
224
+ local params = vim .lsp .util .make_position_params (nil , offset_encoding )
218
225
params .context = {
219
226
triggerKind = context .trigger .kind ,
220
227
triggerCharacter = context .trigger .character ,
0 commit comments