Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lua/dial/augend/case.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ local util = require "dial.util"

local M = {}

---@alias casetype '"PascalCase"' | '"camelCase"' | '"snake_case"' | '"kebab-case"' | '"SCREAMING_SNAKE_CASE"'
---@alias extractf fun(word: string) -> string[] | nil
---@alias constractf fun(terms: string[]) -> string
---@alias casetype "PascalCase" | "camelCase" | "snake_case" | "kebab-case" | "SCREAMING_SNAKE_CASE"
---@alias extractf fun(word: string): string[] | nil
---@alias constractf fun(terms: string[]): string
---@alias casepattern { word_regex: string, extract: extractf, constract: constractf }

---@class AugendCase
Expand Down
2 changes: 1 addition & 1 deletion lua/dial/augend/date.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local common = require "dial.augend.common"

local M = {}

---@alias datekind '"year"' | '"month"' | '"day"' | '"hour"' | '"min"' | '"sec"'
---@alias datekind "year" | "month" | "day" | "hour" | "min" | "sec"
---@alias dttable table<datekind, integer>
---@alias dateparser fun(string, osdate): osdate
---@alias dateformatter fun(osdate): string
Expand Down
4 changes: 2 additions & 2 deletions lua/dial/augend/hexcolor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ local function cast_u8(n)
return n
end

---@alias colorcase '"upper"' | '"lower"' | '"prefer_upper"' | '"prefer_lower"'
---@alias colorkind '"r"' | '"g"' | '"b"' | '"all"'
---@alias colorcase "upper" | "lower" | "prefer_upper" | "prefer_lower"
---@alias colorkind "r" | "g" | "b" | "all"

---@class AugendHexColor
---@implement Augend
Expand Down
8 changes: 4 additions & 4 deletions lua/dial/augend/integer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local util = require "dial.util"
---@field prefix string
---@field natural boolean
---@field query string
---@field case '"upper"' | '"lower"'
---@field case "upper" | "lower"
---@field delimiter string
---@field delimiter_digits integer
local AugendInteger = {}
Expand All @@ -22,7 +22,7 @@ local M = {}
---@field radix integer
---@field plus fun(self:BigInt, value:BigInt, natural:boolean):BigInt `value` must be positive
---@field minus fun(self:BigInt, value:BigInt, natural:boolean):BigInt `value` must be positive
---@field to_string fun(self:BigInt, case:'"upper"'|'"lower"'):string
---@field to_string fun(self:BigInt, case:"upper"|"lower"):string
local BigInt = {}

---@param n string|integer
Expand Down Expand Up @@ -163,7 +163,7 @@ function BigInt.new(n, radix)
return self
end

---@param case '"upper"' | '"lower"'
---@param case "upper" | "lower"
---@return string
function self:to_string(case)
local digits
Expand Down Expand Up @@ -238,7 +238,7 @@ local function radix_to_query_character(radix)
return "0-9a-" .. string.char(86 + radix) .. "A-" .. string.char(54 + radix)
end

---@param config { radix?: integer, prefix?: string, natural?: boolean, case?: '"upper"' | '"lower"', delimiter?: string, delimiter_digits?: number }
---@param config { radix?: integer, prefix?: string, natural?: boolean, case?: "upper" | "lower", delimiter?: string, delimiter_digits?: number }
---@return Augend
function M.new(config)
vim.validate("radix", config.radix, "number", true)
Expand Down
2 changes: 1 addition & 1 deletion lua/dial/augend/semver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end

---@class AugendSemver
---@implement Augend
---@field kind '"major"' | '"minor"' | '"patch"'
---@field kind "major" | "minor" | "patch"
local AugendSemver = {}

local M = {}
Expand Down
12 changes: 6 additions & 6 deletions lua/dial/types.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
-- define type annotations
-- (See: https://github.com/sumneko/lua-language-server/wiki/Annotations)

---@alias direction '"increment"' | '"decrement"'
---@alias mode '"normal"' | '"gnormal"' | '"visual"' | '"gvisual"'
---@alias direction "increment" | "decrement"
---@alias mode "normal" | "gnormal" | "visual" | "gvisual"
---@alias textrange {from: integer, to: integer}
---@alias addresult {text?: string, cursor?: integer}

---@alias findf fun(line: string, cursor?: integer) -> textrange?
---@alias addf fun(text: string, addend: integer, cursor?: integer) -> addresult?
---@alias findf fun(line: string, cursor?: integer): textrange?
---@alias addf fun(text: string, addend: integer, cursor?: integer): addresult?

---@alias findmethod fun(self: Augend, line: string, cursor?: integer) -> textrange?
---@alias addmethod fun(self: Augend, text: string, addend: integer, cursor?: integer) -> addresult?
---@alias findmethod fun(self: Augend, line: string, cursor?: integer): textrange?
---@alias addmethod fun(self: Augend, text: string, addend: integer, cursor?: integer): addresult?

---@class Augend
---@field find findmethod
Expand Down
2 changes: 1 addition & 1 deletion lua/dial/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ end

---Returns the indices with the value nil.
---returns an index array
---@param tbl array
---@param tbl any[]
---@return integer[]
function M.index_with_nil_value(tbl)
-- local maxn, k = 0, nil
Expand Down