@@ -40,26 +40,6 @@ local function store_client_id(id)
40
40
M .id = id
41
41
end
42
42
43
- local lsp_start = vim .lsp .start
44
- if not lsp_start then
45
- local function reuse_client (client , conf )
46
- return client .config .root_dir == conf .root_dir and client .name == conf .name
47
- end
48
-
49
- -- shim for neovim < 0.8.2
50
- lsp_start = function (lsp_config )
51
- local bufnr = vim .api .nvim_get_current_buf ()
52
- local client = M .get ()
53
- if client and reuse_client (client , lsp_config ) then
54
- vim .lsp .buf_attach_client (bufnr , client .id )
55
- return client .id
56
- end
57
- local client_id = vim .lsp .start_client (lsp_config ) --[[ @as number]]
58
- vim .lsp .buf_attach_client (bufnr , client_id )
59
- return client_id
60
- end
61
- end
62
-
63
43
function M .buf_is_attached (bufnr )
64
44
return M .id and vim .lsp .buf_is_attached (bufnr or 0 , M .id )
65
45
end
@@ -92,7 +72,7 @@ function M.buf_attach(force)
92
72
-- In case it has changed, we update it
93
73
M .config .root_dir = config .get_root_dir ()
94
74
95
- local ok , client_id_or_err = pcall (lsp_start , M .config )
75
+ local ok , client_id_or_err = pcall (vim . lsp . start , M .config )
96
76
if not ok then
97
77
logger .error (string.format (" failed to start LSP client: %s" , client_id_or_err ))
98
78
return
@@ -111,6 +91,7 @@ function M.buf_detach()
111
91
end
112
92
end
113
93
94
+ --- @return nil | vim.lsp.Client
114
95
function M .get ()
115
96
return vim .lsp .get_client_by_id (M .id )
116
97
end
@@ -134,7 +115,7 @@ function M.use_client(callback)
134
115
return
135
116
end
136
117
137
- local client_id , err = vim .lsp .start_client (M .config )
118
+ local client_id , err = vim .lsp .start (M .config )
138
119
139
120
if not client_id then
140
121
logger .error (string.format (" error starting LSP client: %s" , err ))
@@ -434,7 +415,7 @@ function M.add_workspace_folder(folder_path)
434
415
435
416
local client = M .get ()
436
417
if client and client .initialized then
437
- client .notify (" workspace/didChangeWorkspaceFolders" , {
418
+ api .notify (client , " workspace/didChangeWorkspaceFolders" , {
438
419
event = {
439
420
added = { workspace_folder },
440
421
removed = {},
0 commit comments