85
85
--- @param new_config lspconfig.Config
86
86
--- @param root_dir string
87
87
--- @param single_file boolean
88
- function M :_start_client (bufnr , new_config , root_dir , single_file )
88
+ --- @param silent boolean
89
+ function M :_start_client (bufnr , new_config , root_dir , single_file , silent )
89
90
-- do nothing if the client is not enabled
90
91
if new_config .enabled == false then
91
92
return
@@ -129,6 +130,7 @@ function M:_start_client(bufnr, new_config, root_dir, single_file)
129
130
130
131
local client_id = lsp .start (new_config , {
131
132
bufnr = bufnr ,
133
+ silent = silent ,
132
134
reuse_client = function (existing_client )
133
135
if vim .tbl_isempty (self ._clients ) then
134
136
return false
163
165
--- @param root_dir string
164
166
--- @param single_file boolean
165
167
--- @param bufnr integer
168
+ --- @param silent boolean
169
+ function M :add (root_dir , single_file , bufnr , silent )
166
170
root_dir = util .path .sanitize (root_dir )
167
171
local new_config = self .make_config (root_dir )
168
- self :_start_client (bufnr , new_config , root_dir , single_file )
172
+ self :_start_client (bufnr , new_config , root_dir , single_file , silent )
169
173
end
170
174
171
175
--- @return vim.lsp.Client[]
183
187
--- a new client if one doesn't already exist for `bufnr`.
184
188
--- @param bufnr integer
185
189
--- @param project_root ? string
186
- function M :try_add (bufnr , project_root )
190
+ --- @param silent boolean
191
+ function M :try_add (bufnr , project_root , silent )
187
192
bufnr = bufnr or api .nvim_get_current_buf ()
188
193
189
194
if vim .bo [bufnr ].buftype == ' nofile' then
@@ -200,7 +205,7 @@ function M:try_add(bufnr, project_root)
200
205
end
201
206
202
207
if project_root then
203
- self :add (project_root , false , bufnr )
208
+ self :add (project_root , false , bufnr , silent )
204
209
return
205
210
end
206
211
@@ -223,10 +228,10 @@ function M:try_add(bufnr, project_root)
223
228
end
224
229
225
230
if root_dir then
226
- self :add (root_dir , false , bufnr )
231
+ self :add (root_dir , false , bufnr , silent )
227
232
elseif self .config .single_file_support then
228
233
local pseudo_root = # bufname == 0 and pwd or util .path .dirname (buf_path )
229
- self :add (pseudo_root , true , bufnr )
234
+ self :add (pseudo_root , true , bufnr , silent )
230
235
end
231
236
end )
232
237
end
@@ -239,7 +244,7 @@ function M:try_add_wrapper(bufnr, project_root)
239
244
local config = self .config
240
245
-- `config.filetypes = nil` means all filetypes are valid.
241
246
if not config .filetypes or vim .tbl_contains (config .filetypes , vim .bo [bufnr ].filetype ) then
242
- self :try_add (bufnr , project_root )
247
+ self :try_add (bufnr , project_root , config . silent )
243
248
end
244
249
end
245
250
0 commit comments