fix(dial): make sure defaults are part of every group. Fixes #4868

This commit is contained in:
Folke Lemaitre 2024-11-22 06:54:44 +01:00
parent 63150fa4c5
commit 2108028cde
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -106,14 +106,13 @@ return {
json = "json", json = "json",
lua = "lua", lua = "lua",
markdown = "markdown", markdown = "markdown",
python = "python",
sass = "css", sass = "css",
scss = "css", scss = "css",
yaml = "yaml",
}, },
groups = { groups = {
default = { default = {
augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...) augend.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...)
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.) augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.)
augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.) augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.)
ordinal_numbers, ordinal_numbers,
@ -124,25 +123,14 @@ return {
logical_alias, logical_alias,
}, },
vue = { vue = {
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
logical_alias,
augend.constant.new({ elements = { "let", "const" } }), augend.constant.new({ elements = { "let", "const" } }),
augend.hexcolor.new({ case = "lower" }), augend.hexcolor.new({ case = "lower" }),
augend.hexcolor.new({ case = "upper" }), augend.hexcolor.new({ case = "upper" }),
}, },
typescript = { typescript = {
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
logical_alias,
augend.constant.new({ elements = { "let", "const" } }), augend.constant.new({ elements = { "let", "const" } }),
}, },
yaml = {
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
},
css = { css = {
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.hexcolor.new({ augend.hexcolor.new({
case = "lower", case = "lower",
}), }),
@ -154,27 +142,25 @@ return {
augend.misc.alias.markdown_header, augend.misc.alias.markdown_header,
}, },
json = { json = {
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.semver.alias.semver, -- versioning (v1.1.2) augend.semver.alias.semver, -- versioning (v1.1.2)
}, },
lua = { lua = {
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
augend.constant.alias.bool, -- boolean value (true <-> false)
augend.constant.new({ augend.constant.new({
elements = { "and", "or" }, elements = { "and", "or" },
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc. word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
cyclic = true, -- "or" is incremented into "and". cyclic = true, -- "or" is incremented into "and".
}), }),
}, },
python = {
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
capitalized_boolean,
logical_alias,
},
}, },
} }
end, end,
config = function(_, opts) config = function(_, opts)
-- copy defaults to each group
for name, group in pairs(opts.groups) do
if name ~= "default" then
vim.list_extend(group, opts.groups.default)
end
end
require("dial.config").augends:register_group(opts.groups) require("dial.config").augends:register_group(opts.groups)
vim.g.dials_by_ft = opts.dials_by_ft vim.g.dials_by_ft = opts.dials_by_ft
end, end,