From 0e299ebf75591b262d659704e84e3d5e7fc2aed9 Mon Sep 17 00:00:00 2001 From: JD <46619169+rudiejd@users.noreply.github.com> Date: Tue, 3 Dec 2024 06:41:37 -0500 Subject: [PATCH] fix(decorator): noisy errors from decoration provider #31418 Problem: A broken decoration provider can cause endless errors. #27235 Solution: Don't show decorator errors when they exceed `DP_MAX_ERROR`. --- src/nvim/decoration_provider.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nvim/decoration_provider.c b/src/nvim/decoration_provider.c index 74f444d8e8..805e9877b6 100644 --- a/src/nvim/decoration_provider.c +++ b/src/nvim/decoration_provider.c @@ -55,14 +55,13 @@ static bool decor_provider_invoke(int provider_idx, const char *name, LuaRef ref // We get the provider here via an index in case the above call to nlua_call_ref causes // decor_providers to be reallocated. DecorProvider *provider = &kv_A(decor_providers, provider_idx); - if (!ERROR_SET(&err) && api_object_to_bool(ret, "provider %s retval", default_true, &err)) { provider->error_count = 0; return true; } - if (ERROR_SET(&err)) { + if (ERROR_SET(&err) && provider->error_count < DP_MAX_ERROR) { decor_provider_error(provider, name, err.msg); provider->error_count++;