diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ac5ca86..0eb9b659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +- LSP: Add more information to rust-analyzer unhealthy notifications + ## [5.6.0] - 2024-09-18 ### Added diff --git a/lua/rustaceanvim/config/internal.lua b/lua/rustaceanvim/config/internal.lua index 198e3bef..50108071 100644 --- a/lua/rustaceanvim/config/internal.lua +++ b/lua/rustaceanvim/config/internal.lua @@ -10,6 +10,7 @@ local RustaceanConfig ---@class rustaceanvim.internal.RAInitializedStatus : rustaceanvim.RAInitializedStatus ---@field health rustaceanvim.lsp_server_health_status ---@field quiescent boolean inactive? +---@field message string --- ---@param dap_adapter rustaceanvim.dap.executable.Config | rustaceanvim.dap.server.Config | rustaceanvim.disable ---@return boolean diff --git a/lua/rustaceanvim/server_status.lua b/lua/rustaceanvim/server_status.lua index 14a8ef28..9a923068 100644 --- a/lua/rustaceanvim/server_status.lua +++ b/lua/rustaceanvim/server_status.lua @@ -7,8 +7,13 @@ local _ran_once = {} ---@param result rustaceanvim.internal.RAInitializedStatus function M.handler(_, result, ctx, _) - if result and result.health and result.health ~= 'ok' then - vim.notify_once("rust-analyzer health is not OK. Run 'RustLsp logFile' for details", vim.log.levels.WARN) + if result and result.health and result.health ~= 'ok' and result.quiescent then + local message = "rust-analyzer health is not OK. Run 'RustLsp logFile' for details: " .. (result.message or "empty message") + local severity = vim.log.levels.WARN + if result.health ~= 'warning' then + severity = vim.log.levels.ERROR + end + vim.notify(message, severity) end -- quiescent means the full set of results is ready. if not result.quiescent or _ran_once[ctx.client_id] then