From 22b264311ac09c6bc9027a47e6f233510151dfee Mon Sep 17 00:00:00 2001 From: dlond Date: Fri, 30 May 2025 19:29:31 +1200 Subject: [PATCH] lazy clangd --- lua/custom/plugins/lsp/clangd.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/custom/plugins/lsp/clangd.lua b/lua/custom/plugins/lsp/clangd.lua index fa373460..54a1e48e 100644 --- a/lua/custom/plugins/lsp/clangd.lua +++ b/lua/custom/plugins/lsp/clangd.lua @@ -144,14 +144,14 @@ return { pattern = '*', callback = function(args) local ft = vim.bo[args.buf].filetype - if vim.tbl_contains(M.clang_filetypes, ft) then - print('[clangd] BufReadPost fired for ft=' .. ft) - local dir = find_compile_commands() + if vim.tbl_contains(require('custom.plugins.lsp.clangd').clang_filetypes, ft) then + local M = require 'custom.plugins.lsp.clangd' + local dir = M.find_compile_commands() M.start_clangd(dir) - vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) vim.api.nvim_clear_autocmds { group = 'clangd-once' } end end, }) + vim.keymap.set('n', 'lc', M.pick_commands_dir, { desc = '[L]ocate [c]ompile_commands.json for clangd' }) end, }