mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	fix(lsp): ensure bufstate when calling vim.lsp.document_color.is_enabled
				
					
				
			This commit is contained in:
		 Maria José Solano
					Maria José Solano
				
			
				
					committed by
					
						 Christian Clason
						Christian Clason
					
				
			
			
				
	
			
			
			 Christian Clason
						Christian Clason
					
				
			
						parent
						
							9ff1239634
						
					
				
				
					commit
					8495d96238
				
			| @@ -238,7 +238,13 @@ end | ||||
| function M.is_enabled(bufnr) | ||||
|   vim.validate('bufnr', bufnr, 'number', true) | ||||
|  | ||||
|   return bufstates[vim._resolve_bufnr(bufnr)].enabled | ||||
|   bufnr = vim._resolve_bufnr(bufnr) | ||||
|  | ||||
|   if not bufstates[bufnr] then | ||||
|     reset_bufstate(bufnr, false) | ||||
|   end | ||||
|  | ||||
|   return bufstates[bufnr].enabled | ||||
| end | ||||
|  | ||||
| --- Enables document highlighting from the given language client in the given buffer. | ||||
|   | ||||
| @@ -159,6 +159,15 @@ body { | ||||
|         end) | ||||
|       ) | ||||
|     end) | ||||
|  | ||||
|     it('does not error when called on a new unattached buffer', function() | ||||
|       eq( | ||||
|         false, | ||||
|         exec_lua(function() | ||||
|           return vim.lsp.document_color.is_enabled(vim.api.nvim_create_buf(false, true)) | ||||
|         end) | ||||
|       ) | ||||
|     end) | ||||
|   end) | ||||
|  | ||||
|   describe('enable()', function() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user