feat(nvim): add LSP noise filtering for log and diagnostic handlers
This commit is contained in:
@@ -2,6 +2,7 @@ require("olinpin.set")
|
|||||||
require("olinpin.lazy")
|
require("olinpin.lazy")
|
||||||
require("olinpin.remap")
|
require("olinpin.remap")
|
||||||
require("olinpin.commands")
|
require("olinpin.commands")
|
||||||
|
require("olinpin.lsp-config")
|
||||||
|
|
||||||
-- this needs to be set after lazy
|
-- this needs to be set after lazy
|
||||||
vim.o.timeoutlen = 0
|
vim.o.timeoutlen = 0
|
||||||
|
|||||||
27
nvim/lua/olinpin/lsp-config.lua
Normal file
27
nvim/lua/olinpin/lsp-config.lua
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-- LSP error filtering and configuration
|
||||||
|
|
||||||
|
-- Filter out noise from LSP logs
|
||||||
|
local original_handler = vim.lsp.handlers["window/logMessage"]
|
||||||
|
vim.lsp.handlers["window/logMessage"] = function(err, result, ctx, config)
|
||||||
|
-- Suppress harper-ls didSave warnings (harmless)
|
||||||
|
if result and result.message and result.message:match("didSave.*not implemented") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- Call original handler for other messages
|
||||||
|
if original_handler then
|
||||||
|
return original_handler(err, result, ctx, config)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Filter publish_diagnostics to exclude minio temp file errors
|
||||||
|
local original_diagnostics = vim.lsp.handlers["textDocument/publishDiagnostics"]
|
||||||
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = function(err, result, ctx, config)
|
||||||
|
if result and result.uri then
|
||||||
|
if result.uri:match("minio%-data") or result.uri:match("%.minio%.sys") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if original_diagnostics then
|
||||||
|
return original_diagnostics(err, result, ctx, config)
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user