From ccc402964b4e75efa1337672b08c631ebefbb485 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sat, 30 Nov 2024 11:55:46 +0200 Subject: [PATCH] Added back C and other languages LSPs and tooling --- .../lua/custom/config/language-servers.lua | 84 +++++++++---------- .config/nvim/lua/custom/plugins/conform.lua | 2 +- .config/nvim/lua/custom/plugins/mason.lua | 8 +- 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/.config/nvim/lua/custom/config/language-servers.lua b/.config/nvim/lua/custom/config/language-servers.lua index 4163628..88b9db9 100644 --- a/.config/nvim/lua/custom/config/language-servers.lua +++ b/.config/nvim/lua/custom/config/language-servers.lua @@ -13,48 +13,48 @@ return { }, }, }, -- lua - -- clangd = { - -- cmd = { - -- 'clangd', - -- '--background-index', - -- '--clang-tidy', - -- '--header-insertion=iwyu', - -- '--completion-style=detailed', - -- '--function-arg-placeholders', - -- '--fallback-style=llvm', - -- }, - -- root_dir = function(filename) - -- return require('lspconfig/util').root_pattern( - -- '.clang-tidy', - -- '.clang-format', - -- 'compile_commands.json', - -- '.git' - -- )(filename) or vim.fn.getcwd() - -- end, - -- init_options = { - -- usePlaceholders = true, - -- completeUnimported = true, - -- clangdFileStatus = true, - -- }, - -- }, -- c/cpp - -- neocmake = { - -- root_dir = function(filename) - -- return require('lspconfig/util').root_pattern( - -- 'CMakePresets.json', - -- 'CTestConfig.cmake', - -- 'build', - -- 'cmake', - -- '.git' -- NOTE: git is last due to monorepos (so it tries to use build/cmake first) - -- )(filename) or vim.fn.getcwd() - -- end, - -- }, - -- pyright = { - -- settings = { - -- python = { - -- pythonPath = '~/python/venv/bin/python', - -- }, - -- }, - -- }, -- python + clangd = { + cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=iwyu', + '--completion-style=detailed', + '--function-arg-placeholders', + '--fallback-style=llvm', + }, + root_dir = function(filename) + return require('lspconfig/util').root_pattern( + '.clang-tidy', + '.clang-format', + 'compile_commands.json', + '.git' + )(filename) or vim.fn.getcwd() + end, + init_options = { + usePlaceholders = true, + completeUnimported = true, + clangdFileStatus = true, + }, + }, -- c/cpp + neocmake = { + root_dir = function(filename) + return require('lspconfig/util').root_pattern( + 'CMakePresets.json', + 'CTestConfig.cmake', + 'build', + 'cmake', + '.git' -- NOTE: git is last due to monorepos (so it tries to use build/cmake first) + )(filename) or vim.fn.getcwd() + end, + }, + pyright = { + settings = { + python = { + pythonPath = '~/python/venv/bin/python', + }, + }, + }, -- python bashls = true, -- bash taplo = true, -- toml lemminx = true, -- xml diff --git a/.config/nvim/lua/custom/plugins/conform.lua b/.config/nvim/lua/custom/plugins/conform.lua index 2610884..30d7588 100644 --- a/.config/nvim/lua/custom/plugins/conform.lua +++ b/.config/nvim/lua/custom/plugins/conform.lua @@ -13,7 +13,7 @@ return { opts = { formatters_by_ft = { ['lua'] = { 'stylua' }, - -- ['c'] = { 'clang-format' }, + ['c'] = { 'clang-format' }, -- ['python'] = { 'isort', 'black' }, -- ['rust'] = { 'rustfmt' }, ['go'] = { 'gofumpt', 'goimports-reviser' }, diff --git a/.config/nvim/lua/custom/plugins/mason.lua b/.config/nvim/lua/custom/plugins/mason.lua index c42ebc0..43e1557 100644 --- a/.config/nvim/lua/custom/plugins/mason.lua +++ b/.config/nvim/lua/custom/plugins/mason.lua @@ -18,14 +18,14 @@ return { opts = { ensure_installed = { 'stylua', -- lua formatting - -- 'clang-format', -- C/C++ formatter - -- 'codelldb', -- C/C++ debugger - -- 'cpplint', -- C/C++ linter + 'clang-format', -- C/C++ formatter + 'codelldb', -- C/C++ debugger + 'cpplint', -- C/C++ linter -- 'black', -- python formatter -- 'isort', -- python formatter for imports -- 'flake8', -- python linter 'gofumpt', -- go formatter - -- 'golangci-lint', -- go linter + 'golangci-lint', -- go linter 'prettierd', -- multi-lang formatter 'prettier', -- prettierd but slower, used as a fallback 'jq', -- json formatter