Compare commits
3 Commits
ebb69274ba
...
7ec52ae64a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ec52ae64a | ||
|
|
278f31d4ea | ||
|
|
2dc48b5b4c |
@@ -9,6 +9,11 @@ helpers.edit_cf = function(map, path)
|
|||||||
end, { desc = 'Edit ' .. path .. ' in a new tab' })
|
end, { desc = 'Edit ' .. path .. ' in a new tab' })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
helpers.map = function(keys, func, opts, mode)
|
||||||
|
mode = mode or 'n'
|
||||||
|
vim.keymap.set(mode, keys, func, opts)
|
||||||
|
end
|
||||||
|
|
||||||
helpers.edit_cf('h', '/lua/helpers.lua')
|
helpers.edit_cf('h', '/lua/helpers.lua')
|
||||||
|
|
||||||
return helpers
|
return helpers
|
||||||
|
|||||||
@@ -15,6 +15,71 @@ return {
|
|||||||
-- Example nvim-tree.lua integration if needed
|
-- Example nvim-tree.lua integration if needed
|
||||||
{ '<leader>a+', '<cmd>AiderTreeAddFile<cr>', desc = 'Add File from Tree to Aider', ft = 'NvimTree' },
|
{ '<leader>a+', '<cmd>AiderTreeAddFile<cr>', desc = 'Add File from Tree to Aider', ft = 'NvimTree' },
|
||||||
{ '<leader>a-', '<cmd>AiderTreeDropFile<cr>', desc = 'Drop File from Tree from Aider', ft = 'NvimTree' },
|
{ '<leader>a-', '<cmd>AiderTreeDropFile<cr>', desc = 'Drop File from Tree from Aider', ft = 'NvimTree' },
|
||||||
|
-- Open aider with gpt-4.1 as the main model
|
||||||
|
-- {
|
||||||
|
-- '<leader>a?',
|
||||||
|
-- function()
|
||||||
|
-- require('nvim_aider').setup {
|
||||||
|
-- aider_cmd = 'aider',
|
||||||
|
-- args = {
|
||||||
|
-- '--config=$HOME/.config/aider/aider.yaml',
|
||||||
|
-- '--env-file=$(pwd)/.aider.env',
|
||||||
|
-- '--model=gpt-4.1',
|
||||||
|
-- },
|
||||||
|
-- auto_reload = true,
|
||||||
|
-- win = {
|
||||||
|
-- wo = { winbar = 'Aider (GPT-4.1)' },
|
||||||
|
-- style = 'nvim_aider',
|
||||||
|
-- position = 'bottom',
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
-- vim.cmd 'Aider toggle'
|
||||||
|
-- end,
|
||||||
|
-- desc = 'Open Aider with GPT-4.1',
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- '<leader>a>',
|
||||||
|
-- function()
|
||||||
|
-- require('nvim_aider').setup {
|
||||||
|
-- aider_cmd = 'aider',
|
||||||
|
-- args = {
|
||||||
|
-- '--config=$HOME/.config/aider/aider.yaml',
|
||||||
|
-- '--env-file=$(pwd)/.aider.env',
|
||||||
|
-- '--model=openai/gemini-2.5-pro',
|
||||||
|
-- '--architect',
|
||||||
|
-- },
|
||||||
|
-- auto_reload = true,
|
||||||
|
-- win = {
|
||||||
|
-- wo = { winbar = 'Aider (Gemini-2.5-Pro)' },
|
||||||
|
-- style = 'nvim_aider',
|
||||||
|
-- position = 'bottom',
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
-- vim.cmd 'Aider toggle'
|
||||||
|
-- end,
|
||||||
|
-- desc = 'Open Aider with Gemini 2.5 Pro',
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- '<leader>a4',
|
||||||
|
-- function()
|
||||||
|
-- require('nvim_aider').api.send_command('/model', 'gpt-4.1')
|
||||||
|
-- end,
|
||||||
|
-- desc = 'Switch aider model to GPT-4.1',
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- '<leader>ao',
|
||||||
|
-- function()
|
||||||
|
-- require('nvim_aider').api.send_command('/model', 'o4-mini')
|
||||||
|
-- end,
|
||||||
|
-- desc = 'Switch aider model to o4-mini',
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- '<leader>ag',
|
||||||
|
-- function()
|
||||||
|
-- require('nvim_aider').api.send_command('/model', 'openai/gemini-2.5-pro')
|
||||||
|
-- end,
|
||||||
|
-- desc = 'Switch aider model to Gemini 2.5 Pro',
|
||||||
|
-- },
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'folke/snacks.nvim',
|
'folke/snacks.nvim',
|
||||||
@@ -44,7 +109,7 @@ return {
|
|||||||
'--config=$HOME/.config/aider/aider.yaml',
|
'--config=$HOME/.config/aider/aider.yaml',
|
||||||
'--env-file=$(pwd)/.aider.env',
|
'--env-file=$(pwd)/.aider.env',
|
||||||
'--watch',
|
'--watch',
|
||||||
'--architect'
|
'--architect',
|
||||||
},
|
},
|
||||||
auto_reload = true,
|
auto_reload = true,
|
||||||
win = {
|
win = {
|
||||||
|
|||||||
@@ -4,98 +4,35 @@ require('helpers').edit_cf('pl', '/lua/plugins/lsp.lua')
|
|||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
|
||||||
-- Mason must be loaded before its dependents so we need to set it up here.
|
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
|
||||||
{ 'williamboman/mason.nvim', opts = {} },
|
{ 'williamboman/mason.nvim', opts = {} },
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
|
||||||
-- Useful status updates for LSP.
|
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
-- Allows extra capabilities provided by blink.cmp
|
|
||||||
'saghen/blink.cmp',
|
'saghen/blink.cmp',
|
||||||
'folke/lazydev.nvim',
|
'folke/lazydev.nvim',
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Brief aside: **What is LSP?**
|
|
||||||
--
|
|
||||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
|
||||||
--
|
|
||||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
|
||||||
-- and language tooling communicate in a standardized fashion.
|
|
||||||
--
|
|
||||||
-- In general, you have a "server" which is some tool built to understand a particular
|
|
||||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
|
||||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
|
||||||
-- processes that communicate with some "client" - in this case, Neovim!
|
|
||||||
--
|
|
||||||
-- LSP provides Neovim with features like:
|
|
||||||
-- - Go to definition
|
|
||||||
-- - Find references
|
|
||||||
-- - Autocompletion
|
|
||||||
-- - Symbol Search
|
|
||||||
-- - and more!
|
|
||||||
--
|
|
||||||
-- Thus, Language Servers are external tools that must be installed separately from
|
|
||||||
-- Neovim. This is where `mason` and related plugins come into play.
|
|
||||||
--
|
|
||||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
|
||||||
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
|
||||||
|
|
||||||
-- This function gets run when an LSP attaches to a particular buffer.
|
-- This function gets run when an LSP attaches to a particular buffer.
|
||||||
-- That is to say, every time a new file is opened that is associated with
|
-- That is to say, every time a new file is opened that is associated with
|
||||||
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
||||||
-- function will be executed to configure the current buffer
|
-- function will be executed to configure the current buffer
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }),
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
|
||||||
-- to define small helper and utility functions so you don't have to repeat yourself.
|
|
||||||
--
|
|
||||||
-- In this case, we create a function that lets us more easily define mappings specific
|
|
||||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
||||||
local map = function(keys, func, desc, mode)
|
local map = function(keys, func, desc, mode)
|
||||||
mode = mode or 'n'
|
require('helpers').map(keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }, mode)
|
||||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Rename the variable under your cursor.
|
|
||||||
-- Most Language Servers support renaming across files, etc.
|
|
||||||
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
|
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
|
|
||||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
|
||||||
-- or a suggestion from your LSP for this to activate.
|
|
||||||
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
|
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
|
||||||
|
|
||||||
-- Find references for the word under your cursor.
|
|
||||||
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
|
|
||||||
-- Jump to the implementation of the word under your cursor.
|
|
||||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
|
||||||
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||||
|
|
||||||
-- Jump to the definition of the word under your cursor.
|
|
||||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
|
||||||
-- To jump back, press <C-t>.
|
|
||||||
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||||
|
|
||||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
|
||||||
-- For example, in C this would take you to the header.
|
|
||||||
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current document.
|
|
||||||
-- Symbols are things like variables, functions, types, etc.
|
|
||||||
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
|
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current workspace.
|
|
||||||
-- Similar to document symbols, except searches over your entire project.
|
|
||||||
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
|
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
|
||||||
|
|
||||||
-- Jump to the type of the word under your cursor.
|
|
||||||
-- Useful when you're not sure what type a variable is and you want to see
|
|
||||||
-- the definition of its *type*, not where it was *defined*.
|
|
||||||
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
|
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
|
||||||
|
|
||||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
||||||
@@ -118,7 +55,7 @@ return {
|
|||||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
|
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
|
||||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false })
|
||||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||||
buffer = event.buf,
|
buffer = event.buf,
|
||||||
group = highlight_augroup,
|
group = highlight_augroup,
|
||||||
@@ -132,18 +69,14 @@ return {
|
|||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspDetach', {
|
vim.api.nvim_create_autocmd('LspDetach', {
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }),
|
||||||
callback = function(event2)
|
callback = function(event2)
|
||||||
vim.lsp.buf.clear_references()
|
vim.lsp.buf.clear_references()
|
||||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf }
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The following code creates a keymap to toggle inlay hints in your
|
|
||||||
-- code, if the language server you are using supports them
|
|
||||||
--
|
|
||||||
-- This may be unwanted, since they displace some of your code
|
|
||||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||||
map('<leader>th', function()
|
map('<leader>th', function()
|
||||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||||
@@ -152,8 +85,6 @@ return {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Diagnostic Config
|
|
||||||
-- See :help vim.diagnostic.Opts
|
|
||||||
vim.diagnostic.config {
|
vim.diagnostic.config {
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
float = { border = 'rounded', source = 'if_many' },
|
float = { border = 'rounded', source = 'if_many' },
|
||||||
@@ -181,14 +112,7 @@ return {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
|
||||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
|
||||||
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
|
||||||
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
|
||||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
|
||||||
|
|
||||||
-- Enable the following language servers
|
-- Enable the following language servers
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
|
||||||
--
|
--
|
||||||
-- Add any additional override configuration in the following tables. Available keys are:
|
-- Add any additional override configuration in the following tables. Available keys are:
|
||||||
-- - cmd (table): Override the default command used to start the server
|
-- - cmd (table): Override the default command used to start the server
|
||||||
@@ -199,111 +123,92 @@ return {
|
|||||||
|
|
||||||
local mason_registry = require 'mason-registry'
|
local mason_registry = require 'mason-registry'
|
||||||
local vue_language_server_path = vim.fn.expand '$MASON/packages/vue-language-server/node_modules/@vue/language-server'
|
local vue_language_server_path = vim.fn.expand '$MASON/packages/vue-language-server/node_modules/@vue/language-server'
|
||||||
print('Vue Language Server Path: ' .. vue_language_server_path)
|
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
clangd = {},
|
||||||
-- gopls = {},
|
gopls = {},
|
||||||
-- pyright = {},
|
pyright = {},
|
||||||
-- rust_analyzer = {},
|
rust_analyzer = {},
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
|
||||||
--
|
|
||||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
|
||||||
-- https://github.com/pmizio/typescript-tools.nvim
|
|
||||||
--
|
|
||||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
|
||||||
-- ts_ls = {},
|
|
||||||
--
|
|
||||||
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- cmd = { ... },
|
|
||||||
-- filetypes = { ... },
|
|
||||||
-- capabilities = {},
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
completion = {
|
completion = {
|
||||||
callSnippet = 'Replace',
|
callSnippet = 'Replace',
|
||||||
},
|
},
|
||||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
|
||||||
-- diagnostics = { disable = { 'missing-fields' } },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ts_ls = {
|
|
||||||
init_options = {
|
|
||||||
plugins = {
|
|
||||||
{
|
|
||||||
name = '@vue/typescript-plugin',
|
|
||||||
location = vue_language_server_path,
|
|
||||||
languages = { 'vue' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
preferences = {
|
|
||||||
importModuleSpecifierEnding = 'js',
|
|
||||||
importModuleSpecifierPreference = 'project-relative',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
|
||||||
capabilities = {
|
|
||||||
documentFormattingProvider = true,
|
|
||||||
documentRangeFormattingProvider = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- volar = {
|
|
||||||
-- on_attach = function(client, bufnr)
|
|
||||||
-- client.server_capabilities.documentFormattingProvider = false
|
|
||||||
-- end,
|
|
||||||
-- capabilities = {
|
|
||||||
-- documentFormattingProvider = true,
|
|
||||||
-- documentRangeFormattingProvider = true,
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
|
|
||||||
phpactor = {
|
phpactor = {
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
|
||||||
end,
|
|
||||||
init_options = {
|
init_options = {
|
||||||
['language_server_phpstan.enabled'] = false,
|
['language_server_phpstan.enabled'] = false,
|
||||||
['language_server_psalm.enabled'] = false,
|
['language_server_psalm.enabled'] = false,
|
||||||
['language_server_php_cs_fixer.enabled'] = true,
|
['language_server_php_cs_fixer.enabled'] = false,
|
||||||
['language_server_php_cs_fixer.bin'] = '~/.local/share/composer/vendor/bin/php-cs-fixer',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
vtsls = {
|
||||||
|
settings = {
|
||||||
|
vtsls = {
|
||||||
|
tsserver = {
|
||||||
|
globalPlugins = {
|
||||||
|
{
|
||||||
|
name = '@vue/typescript-plugin',
|
||||||
|
location = vue_language_server_path,
|
||||||
|
languages = { 'vue' },
|
||||||
|
configNamespace = 'typescript',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
||||||
|
},
|
||||||
|
['vue-language-server'] = {
|
||||||
|
on_init = function(client)
|
||||||
|
client.handlers['tsserver/request'] = function(_, result, context)
|
||||||
|
local clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = 'vtsls' })
|
||||||
|
if #clients == 0 then
|
||||||
|
vim.notify('Could not find `vtsls` lsp client, `vue-language-server` would not work without it.', vim.log.levels.ERROR)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local ts_client = clients[1]
|
||||||
|
|
||||||
|
local param = unpack(result)
|
||||||
|
local id, command, payload = unpack(param)
|
||||||
|
ts_client:exec_cmd({
|
||||||
|
title = 'vue_request_forward', -- You can give title anything as it's used to represent a command in the UI, `:h Client:exec_cmd`
|
||||||
|
command = 'typescript.tsserverRequest',
|
||||||
|
arguments = {
|
||||||
|
command,
|
||||||
|
payload,
|
||||||
|
},
|
||||||
|
}, { bufnr = context.bufnr }, function(_, r)
|
||||||
|
local response_data = { { id, r.body } }
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
client:notify('tsserver/response', response_data)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Ensure the servers and tools above are installed
|
|
||||||
--
|
|
||||||
-- To check the current status of installed tools and/or manually install
|
|
||||||
-- other tools, you can run
|
|
||||||
-- :Mason
|
|
||||||
--
|
|
||||||
-- You can press `g?` for help in this menu.
|
|
||||||
--
|
|
||||||
-- `mason` had to be setup earlier: to configure its options see the
|
|
||||||
-- `dependencies` table for `nvim-lspconfig` above.
|
|
||||||
--
|
|
||||||
-- You can add other tools here that you want Mason to install
|
|
||||||
-- for you, so that they are available from within Neovim.
|
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
local ensure_installed = vim.tbl_keys(servers or {})
|
||||||
vim.list_extend(ensure_installed, {
|
vim.list_extend(ensure_installed, {
|
||||||
'stylua', -- Used to format Lua code
|
'stylua', -- Used to format Lua code
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||||
|
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||||
|
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||||
|
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
||||||
|
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||||
|
|
||||||
|
for name, cfg in pairs(servers) do
|
||||||
|
cfg.capabilities = vim.tbl_deep_extend('force', {}, capabilities, cfg.capabilities or {})
|
||||||
|
vim.lsp.config(name, cfg) -- new Neovim 0.11 API
|
||||||
|
end
|
||||||
|
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
require('mason-lspconfig').setup {
|
require('mason').setup {}
|
||||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
require('mason-lspconfig').setup {}
|
||||||
automatic_installation = false,
|
|
||||||
handlers = {
|
|
||||||
function(server_name)
|
|
||||||
local server = servers[server_name] or {}
|
|
||||||
-- This handles overriding only values explicitly passed
|
|
||||||
-- by the server configuration above. Useful when disabling
|
|
||||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
|
||||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
|
||||||
require('lspconfig')[server_name].setup(server)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user