Skip to content

Commit

Permalink
fix(render): incorrect type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Iron-E committed Jan 13, 2024
1 parent f6b950f commit e1386b5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
13 changes: 8 additions & 5 deletions lua/barbar/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ local GIT_STATUSES = {'added', 'changed', 'deleted'}
--- @type {[barbar.config.options.icons.preset]: fun(default_icons: barbar.config.options.icons, user_icons?: table)}
local ICON_PRESETS = {
default = function(default_icons, user_icons)
default_icons.inactive = { separator = { left = '', right = '' } }
default_icons.inactive = { separator = { left = '', right = '' } } --- @diagnostic disable-line: missing-fields
default_icons.separator = { left = '', right = '' }
default_icons.separator_at_end = true

Expand All @@ -114,18 +114,18 @@ local ICON_PRESETS = {
pinned_icons.button == false or
(pinned_icons.button and strwidth(pinned_icons.button) < 1)
then
default_icons.pinned.separator = { right = ' ' }
default_icons.pinned.separator = { right = ' ' } --- @diagnostic disable-line: missing-fields
end
end,

powerline = function(default_icons)
default_icons.inactive = { separator = { left = '', right = '' } }
default_icons.inactive = { separator = { left = '', right = '' } } --- @diagnostic disable-line: missing-fields
default_icons.separator = { left = '', right = '' }
default_icons.separator_at_end = false
end,

slanted = function(default_icons)
default_icons.inactive = { separator = { left = '', right = '' } }
default_icons.inactive = { separator = { left = '', right = '' } } --- @diagnostic disable-line: missing-fields
default_icons.separator = { left = '', right = '' }
default_icons.separator_at_end = false
end,
Expand Down Expand Up @@ -219,7 +219,10 @@ local DEPRECATED_OPTIONS = {

--- @class barbar.Config
--- @field options barbar.config.options
local config = { git_statuses = GIT_STATUSES, options = {} }
local config = {
git_statuses = GIT_STATUSES,
options = {}, --- @diagnostic disable-line: missing-fields
}

--- @param options? table
function config.setup(options)
Expand Down
1 change: 1 addition & 0 deletions lua/barbar/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ local WARN = severity.WARN
--- @field buffers integer[] the open buffers, in visual order.
--- @field data_by_bufnr {[integer]: barbar.state.data} the buffer data indexed on buffer number
--- @field is_picking_buffer boolean whether the user is currently in jump-mode
--- @field last_current_buffer? integer the previously-open buffer before rendering starts
--- @field offset barbar.state.offset
--- @field recently_closed string[] the list of recently closed paths
local state = {
Expand Down
4 changes: 2 additions & 2 deletions lua/barbar/ui/render.lua
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ local function get_bufferline_containers(data, bufnrs, refocus)
end

--- The close icon
--- @type barbar.ui.container
--- @type barbar.ui.node
local button = {hl = buffer_hl, text = ''}

local button_icon = icons_option.button
Expand Down Expand Up @@ -585,7 +585,7 @@ local function generate_tabline(bufnrs, refocus)

-- Buffer tabs
do
--- @type barbar.ui.container
--- @type barbar.ui.node[]
local content = { { hl = HL.FILL, text = (' '):rep(data.buffers.width) } }

do
Expand Down

0 comments on commit e1386b5

Please sign in to comment.