File tree Expand file tree Collapse file tree 4 files changed +42
-11
lines changed Expand file tree Collapse file tree 4 files changed +42
-11
lines changed Original file line number Diff line number Diff line change @@ -300,17 +300,15 @@ rustaceanvim.lsp.ClientOpts *rustaceanvim.lsp.ClientOpts*
300300 Whether to search (upward from the buffer) for rust-analyzer settings in .vscode/settings json.
301301 If found, loaded settings will override configured options.
302302 Default: true
303-
304- See: ~
305- | vim.lsp.ClientConfig |
303+ {status_notify_level?} (rustaceanvim.server.status_notify_level)
304+ Server status warning level to notify at.
305+ Default: 'error'
306306
307307
308- rustaceanvim.dap.Opts *rustaceanvim.dap.Opts *
308+ rustaceanvim.server.status_notify_level *rustaceanvim.server.status_notify_level *
309309
310- Fields: ~
311- {autoload_configurations} (boolean)
312- Whether to autoload nvim-dap configurations when rust-analyzer has attached?
313- Default: `true` .
310+ Type: ~
311+ "error"|"warning"|rustaceanvim.disable
314312
315313
316314rustaceanvim.disable *rustaceanvim.disable*
@@ -319,6 +317,14 @@ rustaceanvim.disable *rustaceanvim.disable*
319317 false
320318
321319
320+ rustaceanvim.dap.Opts *rustaceanvim.dap.Opts*
321+
322+ Fields: ~
323+ {autoload_configurations} (boolean)
324+ Whether to autoload nvim-dap configurations when rust-analyzer has attached?
325+ Default: `true` .
326+
327+
322328rustaceanvim.dap.Command *rustaceanvim.dap.Command*
323329
324330 Type: ~
Original file line number Diff line number Diff line change @@ -191,8 +191,17 @@ vim.g.rustaceanvim = vim.g.rustaceanvim
191191--- If found, loaded settings will override configured options.
192192--- Default: true
193193--- @field load_vscode_settings ? boolean
194+ ---
195+ --- Server status warning level to notify at.
196+ --- Default: 'error'
197+ --- @field status_notify_level ? rustaceanvim.server.status_notify_level
198+ ---
194199--- @see vim.lsp.ClientConfig
195200
201+ --- @alias rustaceanvim.server.status_notify_level ' error' | ' warning' | rustaceanvim.disable
202+
203+ --- @alias rustaceanvim.disable false
204+
196205--- @class rustaceanvim.dap.Opts
197206---
198207--- Whether to autoload nvim-dap configurations when rust-analyzer has attached?
@@ -220,8 +229,6 @@ vim.g.rustaceanvim = vim.g.rustaceanvim
220229--- Default: `true`.
221230--- @field load_rust_types ? fun (): boolean | boolean
222231
223- --- @alias rustaceanvim.disable false
224-
225232--- @alias rustaceanvim.dap.Command string
226233
227234--- @class rustaceanvim.dap.executable.Config
Original file line number Diff line number Diff line change @@ -295,6 +295,8 @@ local RustaceanDefaultConfig = {
295295 },
296296 --- @type boolean Whether to search (upward from the buffer ) for rust-analyzer settings in .vscode /settings json.
297297 load_vscode_settings = true ,
298+ --- @type rustaceanvim.server.status_notify_level
299+ status_notify_level = ' error' ,
298300 },
299301
300302 --- debugging stuff
Original file line number Diff line number Diff line change @@ -5,14 +5,30 @@ local M = {}
55--- @type { [integer] : boolean }
66local _ran_once = {}
77
8+ --- @param health rustaceanvim.lsp_server_health_status
9+ --- @return boolean
10+ local function is_notify_enabled_for (health )
11+ if health and health == ' ok' then
12+ return false
13+ end
14+ local notify_level = config .server .status_notify_level
15+ if not notify_level then
16+ return false
17+ end
18+ if notify_level == ' error' then
19+ return health == ' error'
20+ end
21+ return true
22+ end
23+
824--- @param result rustaceanvim.internal.RAInitializedStatus
925function M .handler (_ , result , ctx , _ )
1026 -- quiescent means the full set of results is ready.
1127 if not result or not result .quiescent then
1228 return
1329 end
1430 -- notify of LSP errors/warnings
15- if result .health and result . health ~= ' ok ' then
31+ if is_notify_enabled_for ( result .health ) then
1632 local message = ([[
1733rust-analyzer health status is [%s]:
1834%s
You can’t perform that action at this time.
0 commit comments