mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 04:17:01 +00:00 
			
		
		
		
	fix(lsp): resize hover window for concealed lines
Problem:  Height of a (markdown) `vim.lsp.util.open_floating_preview()`
          window can be reduced to account for concealed lines (after #31324).
Solution: Set the window height to the text height of the preview window.
          Set 'concealcursor' to avoid unconcealing the cursorline when
          entering the hover window.
			
			
This commit is contained in:
		 Luuk van Baal
					Luuk van Baal
				
			
				
					committed by
					
						 Christian Clason
						Christian Clason
					
				
			
			
				
	
			
			
			 Christian Clason
						Christian Clason
					
				
			
						parent
						
							8ba047e33f
						
					
				
				
					commit
					47aaddfa0d
				
			| @@ -1649,8 +1649,14 @@ function M.open_floating_preview(contents, syntax, opts) | ||||
|  | ||||
|   if do_stylize then | ||||
|     vim.wo[floating_winnr].conceallevel = 2 | ||||
|     vim.wo[floating_winnr].concealcursor = 'n' | ||||
|     vim.bo[floating_bufnr].filetype = 'markdown' | ||||
|     vim.treesitter.start(floating_bufnr) | ||||
|     if not opts.height then | ||||
|       -- Reduce window height if TS highlighter conceals code block backticks. | ||||
|       local conceal_height = api.nvim_win_text_height(floating_winnr, {}).all | ||||
|       api.nvim_win_set_height(floating_winnr, conceal_height) | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   return floating_bufnr, floating_winnr | ||||
|   | ||||
		Reference in New Issue
	
	Block a user