Skip to content

Commit ff3a329

Browse files
committed
feat!: deprecate the nvim-cmp, coq_nvim, and null-ls sources
1 parent e2e1579 commit ff3a329

File tree

4 files changed

+49
-37
lines changed

4 files changed

+49
-37
lines changed

doc/crates.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,6 @@ text.error *crates-config-text-error*
734734
Format string used when there was an error loading crate information.
735735

736736

737-
open_programs *crates-config-open_programs*
738-
DEPRECATED: `vim.ui.open()` is used instead
739-
740737
highlight *crates-config-highlight*
741738
Section type: `HighlightConfig`
742739

@@ -1414,6 +1411,7 @@ completion.cmp *crates-config-completion-cmp*
14141411

14151412

14161413
completion.cmp.enabled *crates-config-completion-cmp-enabled*
1414+
DEPRECATED: The nvim-cmp source will be removed soon. Use the in-process language server instead.
14171415
Type: `boolean`, Default: `false`
14181416

14191417
Whether to load and register the |nvim-cmp| source.
@@ -1478,6 +1476,7 @@ completion.coq *crates-config-completion-coq*
14781476

14791477

14801478
completion.coq.enabled *crates-config-completion-coq-enabled*
1479+
DEPRECATED: The coq_nvim source will be removed soon. Use the in-process language server instead.
14811480
Type: `boolean`, Default: `false`
14821481

14831482
Whether to load and register the |coq_nvim| source.
@@ -1590,21 +1589,26 @@ completion.crates.max_results *crates-config-completion-crates-max_results*
15901589

15911590

15921591
src *crates-config-src*
1593-
DEPRECATED: please use |crates-config-completion| instead.
1592+
DEPRECATED: This will be ignored.
1593+
Please use |crates-config-completion| instead.
1594+
Type: `boolean`, Default: `nil`
15941595

15951596
null_ls *crates-config-null_ls*
1597+
DEPRECATED: The null-ls source will be removed soon. Use the in-process language server instead.
15961598
Section type: `NullLsConfig`
15971599

15981600
Configuration options for null-ls.nvim actions.
15991601

16001602

16011603
null_ls.enabled *crates-config-null_ls-enabled*
1604+
DEPRECATED: The null-ls source will be removed soon. Use the in-process language server instead.
16021605
Type: `boolean`, Default: `false`
16031606

16041607
Whether to register the |null-ls.nvim| source.
16051608

16061609

16071610
null_ls.name *crates-config-null_ls-name*
1611+
DEPRECATED: The null-ls source will be removed soon. Use the in-process language server instead.
16081612
Type: `string`, Default: `"crates.nvim"`
16091613

16101614
The |null-ls.nvim| name.

docgen/gen_doc.lua

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ end
284284
---@param lines string[]
285285
---@param path string[]
286286
---@param schema SchemaElement[]
287-
local function gen_vimdoc_config(lines, path, schema)
287+
---@param parent_deprecated Deprecated?
288+
local function gen_vimdoc_config(lines, path, schema, parent_deprecated)
288289
for _, s in ipairs(schema) do
289290
if s.hidden then
290291
goto continue
@@ -302,34 +303,39 @@ local function gen_vimdoc_config(lines, path, schema)
302303
table.insert(lines, key)
303304
end
304305
305-
if s.deprecated then
306-
if s.deprecated.new_field then
307-
local nf = "crates-config-" .. table.concat(s.deprecated.new_field, "-")
308-
table.insert(lines, string.format(" DEPRECATED: please use |%s| instead.", nf))
309-
elseif s.deprecated.msg then
310-
table.insert(lines, " DEPRECATED: " .. s.deprecated.msg)
311-
elseif s.deprecated.hard then
312-
table.insert(lines, " DEPRECATED: ignored")
313-
end
314-
table.insert(lines, "")
315-
else
316-
if s.type.config_type == "section" then
317-
table.insert(lines, string.format(" Section type: `%s`", s.type.emmylua_annotation))
318-
table.insert(lines, "")
306+
local deprecated = s.deprecated or parent_deprecated
307+
if deprecated then
308+
if deprecated.msg then
309+
local msg = string.sub(deprecated.msg, 1, 1):upper() .. string.sub(deprecated.msg, 2)
310+
table.insert(lines, " DEPRECATED: " .. msg)
311+
elseif not deprecated.hard then
312+
table.insert(lines, " DEPRECATED: This will stop working soon.")
319313
else
320-
local t = s.type.emmylua_annotation
321-
local d = s.default_text or vim.inspect(s.default)
322-
table.insert(lines, string.format(" Type: `%s`, Default: `%s`", t, d))
323-
table.insert(lines, "")
314+
table.insert(lines, " DEPRECATED: This will be ignored.")
324315
end
316+
if deprecated.new_field then
317+
local nf = "crates-config-" .. table.concat(deprecated.new_field, "-")
318+
table.insert(lines, string.format(" Please use |%s| instead.", nf))
319+
end
320+
end
321+
322+
if s.type.config_type == "section" then
323+
table.insert(lines, string.format(" Section type: `%s`", s.type.emmylua_annotation))
324+
else
325+
local t = s.type.emmylua_annotation
326+
local d = s.default_text or vim.inspect(s.default)
327+
table.insert(lines, string.format(" Type: `%s`, Default: `%s`", t, d))
328+
end
329+
table.insert(lines, "")
325330
331+
if s.description then
326332
local description = s.description:gsub("^ ", ""):gsub("\n ", "\n")
327333
table.insert(lines, description)
328334
table.insert(lines, "")
329335
end
330336
331337
if s.type.config_type == "section" then
332-
gen_vimdoc_config(lines, p, s.fields)
338+
gen_vimdoc_config(lines, p, s.fields, deprecated)
333339
end
334340
335341
::continue::
@@ -348,7 +354,7 @@ local function gen_def_config(lines, indent, path, schema)
348354
end
349355
350356
for _, s in ipairs(schema) do
351-
if not s.hidden and not s.deprecated then
357+
if not s.hidden and not (s.deprecated and (s.deprecated.hard or s.deprecated.new_field)) then
352358
local name = s.name
353359
354360
if s.type.config_type == "section" then
@@ -396,7 +402,7 @@ local function gen_vim_doc()
396402
elseif ph == "SUBCOMMANDS" then
397403
gen_vimdoc_subcommands(lines)
398404
elseif ph == "CONFIGURATION" then
399-
gen_vimdoc_config(lines, {}, config.schema)
405+
gen_vimdoc_config(lines, {}, config.schema, nil)
400406
elseif ph == "HIGHLIGHTS" then
401407
gen_vimdoc_highlights(lines)
402408
else

lua/crates/config/init.lua

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,6 @@ entry(schema_text, {
335335
Format string used when there was an error loading crate information.
336336
]],
337337
})
338-
-- DEPRECATED
339-
entry(M.schema, {
340-
name = "open_programs",
341-
type = STRING_ARRAY_TYPE,
342-
deprecated = {
343-
msg = "`vim.ui.open()` is used instead",
344-
hard = true,
345-
},
346-
})
347338

348339

349340
local schema_hl = section_entry(M.schema, {
@@ -1418,6 +1409,9 @@ entry(schema_completion_cmp, {
14181409
require("crates.completion.cmp").setup()
14191410
<
14201411
]],
1412+
deprecated = {
1413+
msg = "the nvim-cmp source will be removed soon. Use the in-process language server instead.",
1414+
},
14211415
})
14221416
entry(schema_completion_cmp, {
14231417
name = "use_custom_kind",
@@ -1502,6 +1496,9 @@ entry(schema_completion_coq, {
15021496
description = [[
15031497
Whether to load and register the |coq_nvim| source.
15041498
]],
1499+
deprecated = {
1500+
msg = "the coq_nvim source will be removed soon. Use the in-process language server instead.",
1501+
},
15051502
})
15061503
entry(schema_completion_coq, {
15071504
name = "name",
@@ -1653,12 +1650,13 @@ entry(schema_completion_crates, {
16531650
complete a crate name.
16541651
]],
16551652
})
1656-
-- deprecated
1653+
-- DEPRECATED
16571654
entry(M.schema, {
16581655
name = "src",
16591656
type = BOOLEAN_TYPE,
16601657
deprecated = {
16611658
new_field = { "completion" },
1659+
hard = true,
16621660
}
16631661
})
16641662

@@ -1673,6 +1671,9 @@ local schema_null_ls = section_entry(M.schema, {
16731671
Configuration options for null-ls.nvim actions.
16741672
]],
16751673
fields = {},
1674+
deprecated = {
1675+
msg = "the null-ls source will be removed soon. Use the in-process language server instead.",
1676+
},
16761677
})
16771678
entry(schema_null_ls, {
16781679
name = "enabled",

scripts/gen_types.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ local function gen_config_types(lines, schema, type_name, user)
1616
---@param s SchemaElement
1717
---@return boolean
1818
local function skip(s)
19-
return s.deprecated ~= nil or s.hidden and user
19+
return s.deprecated ~= nil and (s.deprecated.hard or s.deprecated.new_field)
20+
or s.hidden and user
2021
end
2122

2223
for _, s in ipairs(schema) do

0 commit comments

Comments
 (0)