diff --git a/neovim/lua/jdkaplan/cool_theme.lua b/neovim/lua/jdkaplan/cool_theme.lua index e34b68a..c75d473 100644 --- a/neovim/lua/jdkaplan/cool_theme.lua +++ b/neovim/lua/jdkaplan/cool_theme.lua @@ -108,7 +108,7 @@ local theme = lush(function(injected_functions) Error { fg = '#EEEEEE', bg = '#AF0000' }, -- Any erroneous construct Todo { fg = '#D70000' }, -- Anything that needs extra attention; mostly the keywords TODO FIXME and XXX - LspInlayHint { fg = '#777777' }, + LspInlayHint { Comment }, LspReferenceText {} , -- Used for highlighting "text" references LspReferenceRead {} , -- Used for highlighting "read" references LspReferenceWrite {} , -- Used for highlighting "write" references diff --git a/neovim/lua/jdkaplan/warm_theme.lua b/neovim/lua/jdkaplan/warm_theme.lua index f69893a..2ecf95a 100644 --- a/neovim/lua/jdkaplan/warm_theme.lua +++ b/neovim/lua/jdkaplan/warm_theme.lua @@ -108,7 +108,7 @@ local theme = lush(function(injected_functions) Error { fg = '#000000', bg = '#FF5F00' }, -- Any erroneous construct Todo { fg = '#FF0000' }, -- Anything that needs extra attention; mostly the keywords TODO FIXME and XXX - LspInlayHint { fg = '#015F00' }, + LspInlayHint { Comment }, LspReferenceText {} , -- Used for highlighting "text" references LspReferenceRead {} , -- Used for highlighting "read" references LspReferenceWrite {} , -- Used for highlighting "write" references diff --git a/neovim/lua/plugins/ide.lua b/neovim/lua/plugins/ide.lua index 4efffa9..d807bc9 100644 --- a/neovim/lua/plugins/ide.lua +++ b/neovim/lua/plugins/ide.lua @@ -1,5 +1,29 @@ vim.lsp.inlay_hint.enable(true) +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('jdkaplan.lsp', {}), + callback = function(args) + local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) + + if client:supports_method('textDocument/completion') then + vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = false}) + end + + -- Usually not needed if server supports "textDocument/willSaveWaitUntil". + already_waits = client:supports_method('textDocument/willSaveWaitUntil') + can_fmt = client:supports_method('textDocument/formatting') + if not already_waits and can_fmt then + vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('jdkaplan.lsp', {clear=false}), + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 }) + end, + }) + end + end, +}) + return { -- HUD {