aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/diagnostic.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-12-13 12:00:11 +0000
committerLewis Russell <me@lewisr.dev>2023-12-14 12:39:18 +0000
commit97bea3163a3fe50359e7f6ffda747e28974a818a (patch)
treedd369da0134c8d08596f7b80931642c28580d47d /runtime/lua/vim/lsp/diagnostic.lua
parent320e9c1c21817fd76b84345018661f70437fa4b5 (diff)
downloadrneovim-97bea3163a3fe50359e7f6ffda747e28974a818a.tar.gz
rneovim-97bea3163a3fe50359e7f6ffda747e28974a818a.tar.bz2
rneovim-97bea3163a3fe50359e7f6ffda747e28974a818a.zip
feat(lsp): more annotations
Diffstat (limited to 'runtime/lua/vim/lsp/diagnostic.lua')
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index b6f0cfa0b3..cba5b66672 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -37,6 +37,10 @@ local function severity_vim_to_lsp(severity)
return severity
end
+---@param lines string[]
+---@param lnum integer
+---@param col integer
+---@param offset_encoding string
---@return integer
local function line_byte_from_position(lines, lnum, col, offset_encoding)
if not lines or offset_encoding == 'utf-8' then
@@ -52,6 +56,8 @@ local function line_byte_from_position(lines, lnum, col, offset_encoding)
return col
end
+---@param bufnr integer
+---@return string[]
local function get_buf_lines(bufnr)
if vim.api.nvim_buf_is_loaded(bufnr) then
return vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
@@ -223,6 +229,7 @@ end
--- )
--- ```
---
+---@param ctx lsp.HandlerContext
---@param config table Configuration table (see |vim.diagnostic.config()|).
function M.on_publish_diagnostics(_, result, ctx, config)
local client_id = ctx.client_id
@@ -284,6 +291,7 @@ end
--- )
--- ```
---
+---@param ctx lsp.HandlerContext
---@param config table Configuration table (see |vim.diagnostic.config()|).
function M.on_diagnostic(_, result, ctx, config)
local client_id = ctx.client_id
@@ -400,6 +408,7 @@ end
local bufstates = {}
--- Disable pull diagnostics for a buffer
+--- @param bufnr integer
--- @private
local function disable(bufnr)
local bufstate = bufstates[bufnr]