Compare commits

..

5 Commits

Author SHA1 Message Date
cfac74a751 update lsp for rust 2025-07-18 00:12:30 +01:00
21bedced4f update obsidian config 2025-07-18 00:12:18 +01:00
8dd515d654 add treesitter context 2025-07-14 09:16:25 +01:00
2f5b79505f switch back to ollama now that qwen3 works with tools 2025-07-14 09:11:35 +01:00
b854338b20 use on_init to check golangci_lint_ls version
also ensure language servers are compatible with navbuddy before
registering them
2025-07-14 09:10:20 +01:00
6 changed files with 88 additions and 65 deletions

View File

@ -29,7 +29,7 @@ return {
return require('codecompanion.adapters').extend('ollama', {
schema = {
model = {
default = 'devstral',
default = 'qwen3:14b',
},
},
})
@ -49,10 +49,15 @@ return {
allow_insecure = true,
},
--Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua
-- strategies = {
-- chat = { adapter = 'anthropic' },
-- inline = { adapter = 'anthropic' },
-- cmd = { adapter = 'anthropic' },
-- },
strategies = {
chat = { adapter = 'anthropic' },
inline = { adapter = 'anthropic' },
cmd = { adapter = 'anthropic' },
chat = { adapter = 'ollama' },
inline = { adapter = 'ollama' },
cmd = { adapter = 'ollama' },
},
},
},

View File

@ -1,21 +0,0 @@
return {
enable = function() -- disable lsp if wrong version installed
local enable = true
local ok, _ = pcall(function()
vim
.system({ 'golangci-lint', '--version' }, { text = true }, function(out)
if out.code ~= 0 then
enable = false
return
end
if out.stdout:match ' 1%.%d+%.%d+' then
enable = false
return
end
end)
:wait()
end)
return enable and ok
end,
}

View File

@ -1,5 +1,11 @@
return function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then
require('nvim-navbuddy').attach(client, bufnr)
end
if client.server_capabilities.inlayHintProvider ~= nil and client.server_capabilities.inlayHintProvider.resolveProvider then
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
end
local nmap = function(keys, func, desc)
if desc then

View File

@ -1,5 +1,25 @@
local M = {}
local enable = {
['golangci_lint_ls'] = function()
local enable = true
local ok, _ = pcall(function()
vim
.system({ 'golangci-lint', '--version' }, { text = true }, function(out)
if out.code ~= 0 then
enable = false
return
end
if out.stdout:match ' 1%.%d+%.%d+' then
enable = false
return
end
end)
:wait()
end)
return enable and ok
end,
}
function M.setup()
local servers = {
ts_ls = { filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' } },
@ -16,34 +36,36 @@ function M.setup()
'-Wclippy::complexity',
'-Wclippy::pedantic',
'-Wclippy::perf',
'-Aclippy::missing_errors_doc',
'-Aclippy::missing_panics_doc',
},
},
},
},
},
golangci_lint_ls = require 'plugins.lsp.golangci_lint_ls',
golangci_lint_ls = {
filetypes = { 'go' },
on_init = function(client)
local name = client.name
if enable[name] then
if not enable[name]() then
vim.notify('Disabling language server ' .. name, vim.log.levels.WARN)
vim.lsp.enable(client.name, false)
return
end
end
end,
},
erlangls = { cmd = { '/home/fergusmolloy/.local/bin/erlang_ls' }, filetypes = { 'erlang' } },
elixirls = { cmd = { 'elixir-ls' }, filetypes = { 'elixir' } },
lua_ls = require 'plugins.lsp.lua_ls',
}
local on_attach = require 'plugins.lsp.on_attach'
local lspconfig = require 'lspconfig'
for server, config in pairs(servers) do
if config['enable'] then
if not config.enable() then
vim.notify('Disabling language server ' .. server, vim.log.levels.WARN)
goto continue
end
end
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
config.on_attach = require 'plugins.lsp.on_attach'
vim.lsp.enable(server)
vim.lsp.config(server, config)
::continue::
end
end

View File

@ -1,28 +1,29 @@
return {
-- {
-- 'epwalsh/obsidian.nvim',
-- version = '*',
-- ft = 'markdown',
-- dependencies = {
-- 'nvim-lua/plenary.nvim',
-- },
-- config = function(_, opts)
-- require('obsidian').setup(opts)
-- vim.api.nvim_create_autocmd('FileType', {
-- group = vim.api.nvim_create_augroup('MarkdownConceal', {}),
-- pattern = 'markdown',
-- callback = function(ev)
-- vim.opt_local.conceallevel = 2
-- end,
-- })
-- end,
-- opts = {
-- workspaces = {
-- {
-- name = 'notes',
-- path = '~/notes',
-- },
-- },
-- },
-- },
{
'epwalsh/obsidian.nvim',
version = '*',
lazy = false,
dependencies = {
'nvim-lua/plenary.nvim',
},
config = function(_, opts)
require('obsidian').setup(opts)
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('MarkdownConceal', {}),
pattern = 'markdown',
callback = function(ev)
vim.opt_local.conceallevel = 2
vim.opt_local.concealcursor = 'cn'
end,
})
end,
opts = {
workspaces = {
{
name = 'notes',
path = '~/notes',
},
},
},
},
}

View File

@ -3,9 +3,14 @@ return {
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects', -- maybe try mini.ai instead?
'nvim-treesitter/nvim-treesitter-context',
},
build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
config = function(_, opts)
require('nvim-treesitter.configs').setup(opts)
require('treesitter-context').setup(opts.context)
end,
opts = {
auto_install = false,
highlight = { enable = true },
@ -72,6 +77,11 @@ return {
include_surrounding_whitespace = true,
},
},
context = {
enable = true,
max_lines = 3,
trim_scope = 'innner', -- show inner most context (could be outer)
},
},
},
}