Skip to content

Commit

Permalink
docs(vimdoc): add deprecated messages
Browse files Browse the repository at this point in the history
  • Loading branch information
saecki committed Aug 8, 2024
1 parent 69b22bc commit cd670ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 2 additions & 4 deletions doc/crates.txt
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ text.error *crates-config-text-error*


open_programs *crates-config-open_programs*
DEPRECATED
DEPRECATED: `vim.ui.open()` is used instead

highlight *crates-config-highlight*
Section type: `HighlightConfig`
Expand Down Expand Up @@ -1477,9 +1477,7 @@ completion.crates.max_results *crates-config-completion-crates-max_results*


src *crates-config-src*
DEPRECATED

Please use |crates-config-completion| instead.
DEPRECATED: please use |crates-config-completion| instead.

null_ls *crates-config-null_ls*
Section type: `NullLsConfig`
Expand Down
8 changes: 5 additions & 3 deletions docgen/gen_doc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,13 @@ local function gen_vimdoc_config(lines, path, schema)
end

if s.deprecated then
table.insert(lines, " DEPRECATED")
if s.deprecated.new_field then
local nf = "crates-config-" .. table.concat(s.deprecated.new_field, "-")
table.insert(lines, "")
table.insert(lines, string.format(" Please use |%s| instead.", nf))
table.insert(lines, string.format(" DEPRECATED: please use |%s| instead.", nf))
elseif s.deprecated.msg then
table.insert(lines, " DEPRECATED: " .. s.deprecated.msg)
elseif s.deprecated.hard then
table.insert(lines, " DEPRECATED: ignored")
end
table.insert(lines, "")
else
Expand Down
4 changes: 2 additions & 2 deletions lua/crates/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ entry(M.schema, {
name = "open_programs",
type = STRING_ARRAY_TYPE,
deprecated = {
msg = ", `vim.ui.open()` is used instead",
msg = "`vim.ui.open()` is used instead",
hard = true,
},
})
Expand Down Expand Up @@ -1751,7 +1751,7 @@ local function validate_schema(path, schema, user_config)
---@type string
local msg
if dep.msg then
msg = dep.msg
msg = ", " .. dep.msg
elseif dep.hard or not dep.new_field then
msg = " and won't work anymore"
else
Expand Down

0 comments on commit cd670ec

Please sign in to comment.