@@ -1566,6 +1566,34 @@ entry(schema_null_ls, {
1566
1566
]] ,
1567
1567
})
1568
1568
1569
+ local schema_neoconf = section_entry (M .schema , {
1570
+ name = " neoconf" ,
1571
+ type = {
1572
+ config_type = " section" ,
1573
+ emmylua_annotation = " NeoconfConfig" ,
1574
+ },
1575
+ description = [[
1576
+ Configuration options for neoconf.nvim integration.
1577
+ ]] ,
1578
+ fields = {},
1579
+ })
1580
+ entry (schema_neoconf , {
1581
+ name = " enabled" ,
1582
+ type = BOOLEAN_TYPE ,
1583
+ default = false ,
1584
+ description = [[
1585
+ Whether to enable project-local configuration with |neoconf.nvim|.
1586
+ ]] ,
1587
+ })
1588
+ entry (schema_neoconf , {
1589
+ name = " namespace" ,
1590
+ type = STRING_TYPE ,
1591
+ default = " crates" ,
1592
+ description = [[
1593
+ The root namespace for the project-local neoconf schema.
1594
+ ]] ,
1595
+ })
1596
+
1569
1597
1570
1598
local schema_lsp = section_entry (M .schema , {
1571
1599
name = " lsp" ,
@@ -1804,22 +1832,19 @@ end
1804
1832
--- @param config Config
1805
1833
--- @return Config
1806
1834
local function setup_neoconf (config )
1807
- --- @type boolean , table
1808
1835
local ok , neoconf = pcall (require , " neoconf" )
1809
1836
if not ok then
1837
+ warn (" neoconf.nvim was not found" )
1810
1838
return config
1811
1839
end
1812
1840
1813
1841
-- enables neodev to autocomplete settings in .neoconf.json
1814
- pcall (function ()
1815
- --- @type table
1816
- local neoconf_plugins = require (" neoconf.plugins" )
1817
- neoconf_plugins .register {
1818
- on_schema = function (schema )
1819
- schema :import (" crates" , config )
1820
- end
1821
- }
1822
- end )
1842
+ local neoconf_plugins = require (" neoconf.plugins" )
1843
+ neoconf_plugins .register ({
1844
+ on_schema = function (schema )
1845
+ schema :import (config .neoconf .namespace , config )
1846
+ end
1847
+ })
1823
1848
1824
1849
return setmetatable ({}, {
1825
1850
__index = function (self , key )
@@ -1829,7 +1854,7 @@ local function setup_neoconf(config)
1829
1854
return loc [key ]
1830
1855
end
1831
1856
--- @type Config
1832
- loc = neoconf .get (" crates " , config , {
1857
+ loc = neoconf .get (config . neoconf . namespace , config , {
1833
1858
buffer = buf ,
1834
1859
lsp = true ,
1835
1860
})
@@ -1883,7 +1908,11 @@ function M.build(user_config)
1883
1908
handle_deprecated ({}, M .schema , user_config , user_config )
1884
1909
validate_schema ({}, M .schema , user_config )
1885
1910
local config = build_config (M .schema , user_config )
1886
- return setup_neoconf (config )
1911
+ if config .neoconf .enabled then
1912
+ return setup_neoconf (config )
1913
+ else
1914
+ return config
1915
+ end
1887
1916
end
1888
1917
1889
1918
return M
0 commit comments