fix: Enable clangd for C++ files

This commit is contained in:
Stephen Doyle 2025-12-07 15:12:43 +00:00
parent e725118e22
commit bb7214f26f
3 changed files with 106 additions and 1 deletions

View File

@ -614,7 +614,7 @@ require('lazy').setup({
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
clangd = {},
gopls = {},
pyright = {},
rust_analyzer = {},
@ -714,6 +714,7 @@ require('lazy').setup({
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
proto = { 'buf' },
cpp = { 'clang-format' },
},
},
},

View File

@ -0,0 +1,12 @@
return {
{
'neovim/nvim-lspconfig',
opts = {
setup = {
clangd = function(_, opts)
opts.capabilities.offsetEncoding = { 'utf-16' }
end,
},
},
},
}

View File

@ -0,0 +1,92 @@
return {
'nvim-neotest/neotest',
dependencies = {
'nvim-neotest/nvim-nio',
'nvim-lua/plenary.nvim',
'antoinemadec/FixCursorHold.nvim',
'nvim-treesitter/nvim-treesitter',
'nvim-neotest/neotest-python',
'nvim-neotest/neotest-plenary',
'nvim-neotest/neotest-vim-test',
},
config = function()
require('neotest').setup {
adapters = {
require 'neotest-python' {
dap = { justMyCode = false },
runner = 'pytest',
},
require 'neotest-plenary',
-- require 'neotest-vim-test' {
-- ignore_file_types = { 'python', 'vim', 'lua' },
-- },
},
}
end,
keys = {
{ '<leader>t', '', desc = '+test' },
{
'<leader>tt',
function()
require('neotest').run.run(vim.fn.expand '%')
end,
desc = 'Run File',
},
{
'<leader>tT',
function()
require('neotest').run.run(vim.uv.cwd())
end,
desc = 'Run All Test Files',
},
{
'<leader>tr',
function()
require('neotest').run.run()
end,
desc = 'Run Nearest',
},
{
'<leader>tl',
function()
require('neotest').run.run_last()
end,
desc = 'Run Last',
},
{
'<leader>ts',
function()
require('neotest').summary.toggle()
end,
desc = 'Toggle Summary',
},
{
'<leader>to',
function()
require('neotest').output.open { enter = true, auto_close = true }
end,
desc = 'Show Output',
},
{
'<leader>tO',
function()
require('neotest').output_panel.toggle()
end,
desc = 'Toggle Output Panel',
},
{
'<leader>tS',
function()
require('neotest').run.stop()
end,
desc = 'Stop',
},
{
'<leader>tw',
function()
require('neotest').watch.toggle(vim.fn.expand '%')
end,
desc = 'Toggle Watch',
},
},
}