mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	refactor(lsp): client_hints typo #27250
This commit is contained in:
		 Maria José Solano
					Maria José Solano
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							d6f7fa14c5
						
					
				
				
					commit
					eee52d3427
				
			| @@ -6,7 +6,7 @@ local M = {} | |||||||
|  |  | ||||||
| ---@class lsp.inlay_hint.bufstate | ---@class lsp.inlay_hint.bufstate | ||||||
| ---@field version? integer | ---@field version? integer | ||||||
| ---@field client_hint? table<integer, table<integer, lsp.InlayHint[]>> client_id -> (lnum -> hints) | ---@field client_hints? table<integer, table<integer, lsp.InlayHint[]>> client_id -> (lnum -> hints) | ||||||
| ---@field applied table<integer, integer> Last version of hints applied to this line | ---@field applied table<integer, integer> Last version of hints applied to this line | ||||||
| ---@field enabled boolean Whether inlay hints are enabled for this buffer | ---@field enabled boolean Whether inlay hints are enabled for this buffer | ||||||
| ---@type table<integer, lsp.inlay_hint.bufstate> | ---@type table<integer, lsp.inlay_hint.bufstate> | ||||||
| @@ -39,11 +39,11 @@ function M.on_inlayhint(err, result, ctx, _) | |||||||
|   if not bufstate or not bufstate.enabled then |   if not bufstate or not bufstate.enabled then | ||||||
|     return |     return | ||||||
|   end |   end | ||||||
|   if not (bufstate.client_hint and bufstate.version) then |   if not (bufstate.client_hints and bufstate.version) then | ||||||
|     bufstate.client_hint = vim.defaulttable() |     bufstate.client_hints = vim.defaulttable() | ||||||
|     bufstate.version = ctx.version |     bufstate.version = ctx.version | ||||||
|   end |   end | ||||||
|   local hints_by_client = bufstate.client_hint |   local hints_by_client = bufstate.client_hints | ||||||
|   local client = assert(vim.lsp.get_client_by_id(client_id)) |   local client = assert(vim.lsp.get_client_by_id(client_id)) | ||||||
|  |  | ||||||
|   local new_hints_by_lnum = vim.defaulttable() |   local new_hints_by_lnum = vim.defaulttable() | ||||||
| @@ -162,7 +162,7 @@ function M.get(filter) | |||||||
|   end |   end | ||||||
|  |  | ||||||
|   local bufstate = bufstates[bufnr] |   local bufstate = bufstates[bufnr] | ||||||
|   if not (bufstate and bufstate.client_hint) then |   if not (bufstate and bufstate.client_hints) then | ||||||
|     return {} |     return {} | ||||||
|   end |   end | ||||||
|  |  | ||||||
| @@ -185,7 +185,7 @@ function M.get(filter) | |||||||
|   --- @type vim.lsp.inlay_hint.get.ret[] |   --- @type vim.lsp.inlay_hint.get.ret[] | ||||||
|   local hints = {} |   local hints = {} | ||||||
|   for _, client in pairs(clients) do |   for _, client in pairs(clients) do | ||||||
|     local hints_by_lnum = bufstate.client_hint[client.id] |     local hints_by_lnum = bufstate.client_hints[client.id] | ||||||
|     if hints_by_lnum then |     if hints_by_lnum then | ||||||
|       for lnum = range.start.line, range['end'].line do |       for lnum = range.start.line, range['end'].line do | ||||||
|         local line_hints = hints_by_lnum[lnum] or {} |         local line_hints = hints_by_lnum[lnum] or {} | ||||||
| @@ -218,11 +218,11 @@ local function clear(bufnr) | |||||||
|     return |     return | ||||||
|   end |   end | ||||||
|   local bufstate = bufstates[bufnr] |   local bufstate = bufstates[bufnr] | ||||||
|   local client_lens = (bufstate or {}).client_hint or {} |   local client_lens = (bufstate or {}).client_hints or {} | ||||||
|   local client_ids = vim.tbl_keys(client_lens) --- @type integer[] |   local client_ids = vim.tbl_keys(client_lens) --- @type integer[] | ||||||
|   for _, iter_client_id in ipairs(client_ids) do |   for _, iter_client_id in ipairs(client_ids) do | ||||||
|     if bufstate then |     if bufstate then | ||||||
|       bufstate.client_hint[iter_client_id] = {} |       bufstate.client_hints[iter_client_id] = {} | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   api.nvim_buf_clear_namespace(bufnr, namespace, 0, -1) |   api.nvim_buf_clear_namespace(bufnr, namespace, 0, -1) | ||||||
| @@ -319,7 +319,7 @@ api.nvim_set_decoration_provider(namespace, { | |||||||
|     if bufstate.version ~= util.buf_versions[bufnr] then |     if bufstate.version ~= util.buf_versions[bufnr] then | ||||||
|       return |       return | ||||||
|     end |     end | ||||||
|     local hints_by_client = assert(bufstate.client_hint) |     local hints_by_client = assert(bufstate.client_hints) | ||||||
|  |  | ||||||
|     for lnum = topline, botline do |     for lnum = topline, botline do | ||||||
|       if bufstate.applied[lnum] ~= bufstate.version then |       if bufstate.applied[lnum] ~= bufstate.version then | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user