Skip to content

Commit

Permalink
Refactor annotations to lua_ls style
Browse files Browse the repository at this point in the history
  • Loading branch information
monkoose committed Sep 12, 2024
1 parent 1865dea commit d2c968c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lua/neocodeium/api_key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function M.check()
end
end

---@return string?
---@return string|nil
function M.get()
return api_key
end
Expand Down
2 changes: 1 addition & 1 deletion lua/neocodeium/chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ nvim_create_autocmd("BufEnter", {
end,
})

---@return string?
---@return string|nil
local function get_project_root()
return fs.root(uv.cwd() or 0, options.root_dir)
end
Expand Down
8 changes: 4 additions & 4 deletions lua/neocodeium/renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ local Renderer = {

---Adds virtual text into the `lnum` line number and `col` column.
---If `id` is nil then a new id will be generated.
---@param id extmark_id?
---@param id? extmark_id
---@param str string text to display
---@param lnum lnum
---@param col col
Expand Down Expand Up @@ -88,7 +88,7 @@ end

---Adds virtual text below the line with `lnum` number.
---If `id` is nil then a new id will be generated.
---@param id extmark_id?
---@param id? extmark_id
---@param text string text to display, will be split into lines at "\n"
---@param lnum lnum
---@return extmark_id
Expand Down Expand Up @@ -182,7 +182,7 @@ end

---@private
---@param lnum lnum
---@param text string?
---@param text? string
function Renderer:display_block(text, lnum)
if text then
if not self.block.id or self.block.text ~= text then
Expand All @@ -197,7 +197,7 @@ end
---@private
---@param items compl.item[]
---@param index integer
---@param pending boolean?
---@param pending? boolean
function Renderer:display_label(items, index, pending)
if not (options.show_label and self.label.enabled) then
return
Expand Down
6 changes: 3 additions & 3 deletions lua/neocodeium/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ local Server = {
-- Auxiliary functions ------------------------------------- {{{1

---@param path filepath
---@return filepath?
---@return filepath|nil
local function find_port_file(path)
return fs.find(function(name)
return name:match("^%d%d%d%d%d?$")
end, { path = path, type = "file" })[1]
end

---@param t table list to append data
---@return fun(_, data: string?)
---@return fun(_, data?: string)
local function data_appender(t)
return function(_, data)
if data then
Expand Down Expand Up @@ -178,7 +178,7 @@ end
---Sends request to the server
---@param type request_type
---@param data request_data
---@param on_exit fun(response: response)?
---@param on_exit? fun(response: response)
function Server:request(type, data, on_exit)
---@type url
local uri = "http://127.0.0.1:"
Expand Down
2 changes: 1 addition & 1 deletion lua/neocodeium/utils/stdio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ end

---Reads file content into string, on failure returns nil
---@param path filepath
---@return string?
---@return string|nil
function M.read(path)
local f = io.open(path, "rb")
if f then
Expand Down

0 comments on commit d2c968c

Please sign in to comment.