Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): allow the user to disable default filters by setting the… #776

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lua/noice/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,28 @@ function M.is_running()
return M._running
end

function M.setup_filters(config, new_config, key)
if type(config) ~= "table" or type(new_config) ~= "table" then
return
end
if key == "filter" then
if new_config.clear_filters then
new_config.clear_filters = nil
-- Can't use `config = {}` because that would create a new array (instead of modifying the caller's `config`)
for k, _ in pairs(config) do
config[k] = nil
end
for k, v in pairs(new_config) do
config[k] = v
end
end
return
end
for k, _ in pairs(new_config) do
M.setup_filters(config[k], new_config[k], k)
end
end

function M.setup(options)
options = options or {}

Expand All @@ -246,6 +268,7 @@ function M.setup(options)
local routes = M.options.routes
M.options = vim.tbl_deep_extend("force", M.options, options)
vim.list_extend(M.options.routes, routes)
M.setup_filters(M.options, options)

if M.options.popupmenu.kind_icons == false then
M.options.popupmenu.kind_icons = {}
Expand Down
2 changes: 1 addition & 1 deletion lua/noice/lsp/progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ M._running = false
---@param data {client_id: integer, params: lsp.ProgressParams}
function M.progress(data)
local client_id = data.client_id
local params = data.params or data.result -- TODO: Remove data.result after nvim 0.10 release
local params = data.params or data.result -- TODO: Remove data.result after nvim 0.10 release
local id = client_id .. "." .. params.token

local message = M._progress[id]
Expand Down
Loading