Skip to content

Commit 9c9fc89

Browse files
authored
fix: use correct type annotation for optional parameters (#562)
1 parent 3b49028 commit 9c9fc89

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

lua/gitlab/actions/common.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ M.print_node = function(tree)
127127
end
128128

129129
---Check if type of node is note or note body
130-
---@param node NuiTree.Node?
130+
---@param node? NuiTree.Node
131131
---@return boolean
132132
M.is_node_note = function(node)
133133
if node and (node.type == "note_body" or node.type == "note") then
@@ -139,7 +139,7 @@ end
139139

140140
---Get root node
141141
---@param tree NuiTree
142-
---@param node NuiTree.Node?
142+
---@param node? NuiTree.Node
143143
---@return NuiTree.Node?
144144
M.get_root_node = function(tree, node)
145145
if not node then
@@ -155,7 +155,7 @@ end
155155

156156
---Get note node
157157
---@param tree NuiTree
158-
---@param node NuiTree.Node?
158+
---@param node? NuiTree.Node
159159
---@return NuiTree.Node?
160160
M.get_note_node = function(tree, node)
161161
if not node then

lua/gitlab/actions/discussions/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ end
104104

105105
---Opens the discussion tree, sets the keybindings. It also
106106
---creates the tree for notes (which are not linked to specific lines of code)
107-
---@param callback function?
107+
---@param callback? function
108108
---@param view_type "discussions"|"notes" Defines the view type to select (useful for overriding the default view type when jumping to discussion tree when it's closed).
109109
M.open = function(callback, view_type)
110110
view_type = view_type and view_type or state.settings.discussion_tree.default_view

lua/gitlab/actions/discussions/tree.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local M = {}
1111

1212
---Create nodes for NuiTree from discussions
1313
---@param items Discussion[]
14-
---@param unlinked boolean? False or nil means that discussions are linked to code lines
14+
---@param unlinked? boolean False or nil means that discussions are linked to code lines
1515
---@return NuiTree.Node[]
1616
M.add_discussions_to_table = function(items, unlinked)
1717
local t = {}
@@ -102,7 +102,7 @@ end
102102
---Create path node
103103
---@param relative_path string
104104
---@param full_path string
105-
---@param child_nodes NuiTree.Node[]?
105+
---@param child_nodes? NuiTree.Node[]
106106
---@return NuiTree.Node
107107
local function create_path_node(relative_path, full_path, child_nodes)
108108
return NuiTree.Node({
@@ -154,7 +154,7 @@ end
154154
---Create file name node
155155
---@param file_name string
156156
---@param full_file_path string
157-
---@param child_nodes NuiTree.Node[]?
157+
---@param child_nodes? NuiTree.Node[]
158158
---@return NuiTree.Node
159159
local function create_file_name_node(file_name, full_file_path, child_nodes)
160160
local icon, icon_hl = u.get_icon(file_name)
@@ -262,7 +262,7 @@ end
262262

263263
---Build note node body
264264
---@param note Note|DraftNote
265-
---@param resolve_info table?
265+
---@param resolve_info? table
266266
---@return string
267267
---@return NuiTree.Node[]
268268
local function build_note_body(note, resolve_info)
@@ -297,7 +297,7 @@ end
297297

298298
---Build note node
299299
---@param note Note|DraftNote
300-
---@param resolve_info table?
300+
---@param resolve_info? table
301301
---@return NuiTree.Node
302302
---@return string
303303
---@return NuiTree.Node[]

lua/gitlab/actions/merge.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ M.merge = function(opts)
4646
end
4747

4848
---@param merge_body MergeOpts
49-
---@param squash_message string?
49+
---@param squash_message? string
5050
M.confirm_merge = function(merge_body, squash_message)
5151
if squash_message ~= nil then
5252
merge_body.squash_message = squash_message

lua/gitlab/indicators/diagnostics.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ end
8989
---@param namespace number namespace for diagnostics
9090
---@param bufnr number the bufnr for placing the diagnostics
9191
---@param diagnostics table see :h vim.diagnostic.set
92-
---@param opts table? see :h vim.diagnostic.set
92+
---@param opts? table see :h vim.diagnostic.set
9393
local set_diagnostics = function(namespace, bufnr, diagnostics, opts)
9494
vim.diagnostic.set(namespace, bufnr, diagnostics, opts)
9595
require("gitlab.indicators.signs").set_signs(diagnostics, bufnr)

lua/gitlab/popup.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ local M = {}
55
---Get the popup view_opts
66
---@param title string The string to appear on top of the popup
77
---@param user_settings table|nil User-defined popup settings
8-
---@param width number? Override default width
9-
---@param height number? Override default height
10-
---@param zindex number? Override default zindex
8+
---@param width? number Override default width
9+
---@param height? number Override default height
10+
---@param zindex? number Override default zindex
1111
---@return table
1212
M.create_popup_state = function(title, user_settings, width, height, zindex)
1313
local settings = u.merge(require("gitlab.state").settings.popup, user_settings or {})

lua/gitlab/utils/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ M.get_web_url = function()
663663
M.notify("Could not get Gitlab URL", vim.log.levels.ERROR)
664664
end
665665

666-
---@param url string?
666+
---@param url? string
667667
M.open_in_browser = function(url)
668668
if vim.fn.has("mac") == 1 then
669669
vim.fn.jobstart({ "open", url })

0 commit comments

Comments
 (0)