From abed9bdabce79bc19bcd83481f64e63368608178 Mon Sep 17 00:00:00 2001 From: dlond Date: Thu, 22 May 2025 17:55:13 +1200 Subject: [PATCH] trying to add clangd and cmake lsps --- lua/custom/plugins/lsp.lua | 13 +++++++------ lua/custom/plugins/treesitter.lua | 11 ++++------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lua/custom/plugins/lsp.lua b/lua/custom/plugins/lsp.lua index 8e01b537..ec02e830 100644 --- a/lua/custom/plugins/lsp.lua +++ b/lua/custom/plugins/lsp.lua @@ -9,8 +9,6 @@ return { 'neovim/nvim-lspconfig', event = { 'BufReadPre', 'BufNewFile' }, -- Load LSP config early dependencies = { - -- Dependencies for nvim-lspconfig itself, if any. - -- Mason and mason-lspconfig are removed as Nix handles LSP installation. { 'j-hui/fidget.nvim', opts = {} }, -- Useful status updates for LSP 'hrsh7th/cmp-nvim-lsp', -- LSP completion source for nvim-cmp }, @@ -38,7 +36,8 @@ return { }, }, clangd = { - root_dir = require('lspconfig.util').root_pattern('compile_commands.json', '.git', '.clangd'), -- Helps find project root + cmd = { 'clangd', '--compile-commands-dir=build' }, + root_dir = require('lspconfig.util').root_pattern('CMakeLists.tst', '.git'), }, pyright = { settings = { @@ -56,9 +55,11 @@ return { nixd = {}, ruff = {}, texlab = {}, - -- Add other servers like "bashls", "yamlls", "gopls", "rust_analyzer" etc. - -- Ensure the corresponding packages (e.g., pkgs.bash-language-server) - -- are in your Home Manager home.packages list. + cmake = { + cmd = { 'cmake-language-server', '--stdio' }, + filetypes = { 'cmake' }, + root_dir = require('lspconfig.util').root_pattern('CMakeLists.tst', '.git'), + }, } -- Iterate through the defined servers list and set them up with lspconfig diff --git a/lua/custom/plugins/treesitter.lua b/lua/custom/plugins/treesitter.lua index 47f69f23..39bfce56 100644 --- a/lua/custom/plugins/treesitter.lua +++ b/lua/custom/plugins/treesitter.lua @@ -8,7 +8,6 @@ return { -- main = 'nvim-treesitter.configs', -- Keep if needed from kickstart opts = { -- Use opts to merge/override defaults ensure_installed = { - -- List ALL parsers you want installed based on your previous config 'bash', 'c', 'cmake', @@ -20,16 +19,14 @@ return { 'make', 'markdown', 'markdown_inline', - 'nix', -- Added based on previous diff - 'python', -- Added based on previous diff + 'nix', + 'python', 'query', 'vim', 'vimdoc', - 'yaml', -- Added based on previous diff - -- Add any others you commonly use + 'yaml', }, - -- Autoinstall languages that are not installed - auto_install = true, -- Keep kickstart's default or set as desired + auto_install = true, -- Keep other kickstart defaults like highlight/indent settings unless you want to change them highlight = {