@@ -14,9 +14,6 @@ M.config = require "astrocore.config"
1414--- A table to manage ToggleTerm terminals created by the user, indexed by the command run and then the instance number
1515--- @type table<string,table<integer,table>>
1616M .user_terminals = {}
17- --- A table of settings for different levels of diagnostics
18- --- @type table<integer,vim.diagnostic.Opts>
19- M .diagnostics = { [0 ] = {}, {}, {}, {} }
2017
2118--- Merge extended options with a default table of options
2219--- @param default ? table The default table that you want to merge into
@@ -548,7 +545,25 @@ function M.setup(opts)
548545
549546 -- setup diagnostics
550547 vim .diagnostic .config (M .config .diagnostics )
551- vim .diagnostic .enable (vim .tbl_get (M .config , " features" , " diagnostics" ) or false )
548+ local diagnostic_feature = vim .tbl_get (M .config , " features" , " diagnostics" )
549+ if diagnostic_feature then
550+ vim .diagnostic .enable (true )
551+ if type (diagnostic_feature ) == " table" then
552+ local diagnostic_config = assert (vim .diagnostic .config ())
553+ -- setup startup state of virtual text and virtual_lines
554+ for _ , feature in ipairs { " virtual_text" , " virtual_lines" } do
555+ if
556+ diagnostic_config [feature ] ~= nil
557+ and diagnostic_feature [feature ] ~= nil
558+ and (diagnostic_config [feature ] ~= false ) ~= diagnostic_feature [feature ]
559+ then
560+ require (" astrocore.toggles" )[feature ](true )
561+ end
562+ end
563+ end
564+ else
565+ vim .diagnostic .enable (false )
566+ end
552567
553568 vim .api .nvim_create_autocmd ({ " BufReadPre" , " BufReadPost" }, {
554569 group = vim .api .nvim_create_augroup (" large_buf_detector" , { clear = true }),
0 commit comments