mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	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`.
This commit is contained in:
		@@ -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
 | 
					  // We get the provider here via an index in case the above call to nlua_call_ref causes
 | 
				
			||||||
  // decor_providers to be reallocated.
 | 
					  // decor_providers to be reallocated.
 | 
				
			||||||
  DecorProvider *provider = &kv_A(decor_providers, provider_idx);
 | 
					  DecorProvider *provider = &kv_A(decor_providers, provider_idx);
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (!ERROR_SET(&err)
 | 
					  if (!ERROR_SET(&err)
 | 
				
			||||||
      && api_object_to_bool(ret, "provider %s retval", default_true, &err)) {
 | 
					      && api_object_to_bool(ret, "provider %s retval", default_true, &err)) {
 | 
				
			||||||
    provider->error_count = 0;
 | 
					    provider->error_count = 0;
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (ERROR_SET(&err)) {
 | 
					  if (ERROR_SET(&err) && provider->error_count < DP_MAX_ERROR) {
 | 
				
			||||||
    decor_provider_error(provider, name, err.msg);
 | 
					    decor_provider_error(provider, name, err.msg);
 | 
				
			||||||
    provider->error_count++;
 | 
					    provider->error_count++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user