@@ -54,6 +54,7 @@ local M = {}
54
54
--- @class Deprecated
55
55
--- @field new_field string[] ?
56
56
--- @field hard boolean ?
57
+ --- @field msg string ?
57
58
58
59
--- @param schema table<string,SchemaElement> | SchemaElement[]
59
60
--- @param elem SchemaElement
@@ -210,14 +211,6 @@ entry(M.schema, {
210
211
Maximum number of parallel requests.
211
212
]] ,
212
213
})
213
- entry (M .schema , {
214
- name = " open_programs" ,
215
- type = STRING_ARRAY_TYPE ,
216
- default = { " xdg-open" , " open" },
217
- description = [[
218
- A list of programs that used to open urls.
219
- ]] ,
220
- })
221
214
entry (M .schema , {
222
215
name = " expand_crate_moves_cursor" ,
223
216
type = BOOLEAN_TYPE ,
@@ -324,6 +317,15 @@ entry(schema_text, {
324
317
Format string used when there was an error loading crate information.
325
318
]] ,
326
319
})
320
+ -- DEPRECATED
321
+ entry (M .schema , {
322
+ name = " open_programs" ,
323
+ type = STRING_ARRAY_TYPE ,
324
+ deprecated = {
325
+ msg = " , `vim.ui.open()` is used instead" ,
326
+ hard = true ,
327
+ },
328
+ })
327
329
328
330
329
331
local schema_hl = section_entry (M .schema , {
@@ -1746,41 +1748,44 @@ local function validate_schema(path, schema, user_config)
1746
1748
local dep = elem .deprecated
1747
1749
1748
1750
if dep then
1749
- if dep .new_field then
1750
- --- @type string
1751
- local dep_text
1752
- if dep .hard then
1753
- dep_text = " deprecated and won't work anymore"
1754
- else
1755
- dep_text = " deprecated and will stop working soon"
1756
- end
1751
+ --- @type string
1752
+ local msg
1753
+ if dep .msg then
1754
+ msg = dep .msg
1755
+ elseif dep .hard or not dep .new_field then
1756
+ msg = " and won't work anymore"
1757
+ else
1758
+ msg = " and will stop working soon"
1759
+ end
1757
1760
1761
+ if dep .new_field then
1758
1762
warn (
1759
- " '%s' is now %s, please use '%s' " ,
1763
+ " `%s` is now deprecated%s \n Please use `%s` " ,
1760
1764
table.concat (p , " ." ),
1761
- dep_text ,
1765
+ msg ,
1762
1766
table.concat (dep .new_field , " ." )
1763
1767
)
1764
1768
else
1765
1769
warn (
1766
- " '%s' is now deprecated, ignoring" ,
1767
- table.concat (p , " ." )
1770
+ " `%s` is now deprecated%s" ,
1771
+ table.concat (p , " ." ),
1772
+ msg
1768
1773
)
1769
1774
end
1770
1775
elseif elem .type .config_type == " section" then
1771
1776
if value_type == " table" then
1772
1777
validate_schema (p , elem .fields , v )
1773
1778
else
1774
1779
warn (
1775
- " Config field '%s' was expected to be of type ' table' but was '%s' , using default value." ,
1780
+ " Config field `%s` was expected to be of type ` table` but was `%s` , using default value." ,
1776
1781
table.concat (p , " ." ),
1777
1782
value_type
1778
1783
)
1779
1784
end
1780
1785
else
1781
1786
if not matches_type (value_type , elem .type ) then
1782
1787
warn (
1783
- " Config field '%s' was expected to be of type '%s' but was '%s' , using default value." ,
1788
+ " Config field `%s` was expected to be of type `%s` but was `%s` , using default value." ,
1784
1789
table.concat (p , " ." ),
1785
1790
to_user_config_type_string (elem .type ),
1786
1791
value_type
@@ -1789,7 +1794,7 @@ local function validate_schema(path, schema, user_config)
1789
1794
end
1790
1795
else
1791
1796
warn (
1792
- " Ignoring invalid config key '%s' " ,
1797
+ " Ignoring invalid config key `%s` " ,
1793
1798
table.concat (p , " ." )
1794
1799
)
1795
1800
end
@@ -1800,15 +1805,15 @@ end
1800
1805
--- @return Config
1801
1806
local function setup_neoconf (config )
1802
1807
--- @type boolean , table
1803
- local ok , neoconf = pcall (require , ' neoconf' )
1808
+ local ok , neoconf = pcall (require , " neoconf" )
1804
1809
if not ok then
1805
1810
return config
1806
1811
end
1807
1812
1808
1813
-- enables neodev to autocomplete settings in .neoconf.json
1809
1814
pcall (function ()
1810
1815
--- @type table
1811
- local neoconf_plugins = require (' neoconf.plugins' )
1816
+ local neoconf_plugins = require (" neoconf.plugins" )
1812
1817
neoconf_plugins .register {
1813
1818
on_schema = function (schema )
1814
1819
schema :import (" crates" , config )
@@ -1871,7 +1876,7 @@ function M.build(user_config)
1871
1876
user_config = user_config or {}
1872
1877
local user_config_type = type (user_config )
1873
1878
if user_config_type ~= " table" then
1874
- warn (" Expected config of type ' table' found '%s' " , user_config_type )
1879
+ warn (" Expected config of type ` table` found `%s` " , user_config_type )
1875
1880
user_config = {}
1876
1881
end
1877
1882
0 commit comments