|
|
|
@@ -148,10 +148,10 @@ require('lazy').setup({
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
{
|
|
|
|
{
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
|
|
|
|
tag = 'v0.9.3',
|
|
|
|
build = ':TSUpdate',
|
|
|
|
build = ':TSUpdate',
|
|
|
|
config = function()
|
|
|
|
config = function()
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
require('nvim-treesitter.configs').setup {
|
|
|
|
-- Install these parsers automatically
|
|
|
|
|
|
|
|
ensure_installed = {
|
|
|
|
ensure_installed = {
|
|
|
|
'bash', 'lua', 'markdown', 'markdown_inline',
|
|
|
|
'bash', 'lua', 'markdown', 'markdown_inline',
|
|
|
|
'typescript', 'javascript', 'c_sharp',
|
|
|
|
'typescript', 'javascript', 'c_sharp',
|
|
|
|
@@ -166,62 +166,76 @@ require('lazy').setup({
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- LSP: language server protocol
|
|
|
|
-- LSP: language server protocol
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
-- mason installs language servers for you.
|
|
|
|
-- mason installs language servers.
|
|
|
|
-- mason-lspconfig bridges mason and nvim-lspconfig.
|
|
|
|
-- mason-lspconfig makes mason-installed servers available to Neovim.
|
|
|
|
|
|
|
|
-- Neovim 0.11+ has a native vim.lsp.config API — no need to call
|
|
|
|
|
|
|
|
-- lspconfig.server.setup {} anymore.
|
|
|
|
{
|
|
|
|
{
|
|
|
|
'neovim/nvim-lspconfig',
|
|
|
|
'williamboman/mason.nvim',
|
|
|
|
dependencies = {
|
|
|
|
|
|
|
|
'williamboman/mason.nvim',
|
|
|
|
|
|
|
|
'williamboman/mason-lspconfig.nvim',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
config = function()
|
|
|
|
config = function()
|
|
|
|
-- mason must be set up first
|
|
|
|
|
|
|
|
require('mason').setup()
|
|
|
|
require('mason').setup()
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'williamboman/mason-lspconfig.nvim',
|
|
|
|
|
|
|
|
dependencies = { 'williamboman/mason.nvim' },
|
|
|
|
|
|
|
|
config = function()
|
|
|
|
require('mason-lspconfig').setup {
|
|
|
|
require('mason-lspconfig').setup {
|
|
|
|
-- These servers are installed automatically
|
|
|
|
-- These servers are installed automatically via mason
|
|
|
|
ensure_installed = {
|
|
|
|
ensure_installed = {
|
|
|
|
'ts_ls', -- TypeScript / JavaScript
|
|
|
|
'ts_ls', -- TypeScript / JavaScript
|
|
|
|
'omnisharp', -- C# and F#
|
|
|
|
'omnisharp', -- C# and F#
|
|
|
|
'marksman', -- Markdown
|
|
|
|
'marksman', -- Markdown
|
|
|
|
'lua_ls', -- Lua (for editing this config)
|
|
|
|
'lua_ls', -- Lua (for editing this config)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
-- nvim-lspconfig still provides default cmd/root detection per server.
|
|
|
|
|
|
|
|
-- We use it as a data source only — no setup() calls per server.
|
|
|
|
|
|
|
|
'neovim/nvim-lspconfig',
|
|
|
|
|
|
|
|
dependencies = { 'williamboman/mason-lspconfig.nvim' },
|
|
|
|
|
|
|
|
config = function()
|
|
|
|
|
|
|
|
|
|
|
|
-- Keymaps that only activate when an LSP attaches to a buffer
|
|
|
|
-- Server-specific settings using the native 0.11 API.
|
|
|
|
|
|
|
|
-- vim.lsp.config(name, opts) sets config for a server.
|
|
|
|
|
|
|
|
-- vim.lsp.enable(name) starts it when the right filetype opens.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.lsp.config('ts_ls', {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.lsp.config('omnisharp', {
|
|
|
|
|
|
|
|
-- Uncomment and point to your solution file if needed:
|
|
|
|
|
|
|
|
-- cmd = { 'omnisharp', '--solution-path', 'YourSolution.sln' },
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.lsp.config('marksman', {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.lsp.config('lua_ls', {
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
|
|
|
|
Lua = {
|
|
|
|
|
|
|
|
-- Tell the Lua LSP about Neovim's vim global
|
|
|
|
|
|
|
|
diagnostics = { globals = { 'vim' } },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.lsp.enable({ 'ts_ls', 'omnisharp', 'marksman', 'lua_ls' })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Keymaps that activate only when an LSP attaches to a buffer
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
callback = function(event)
|
|
|
|
callback = function(event)
|
|
|
|
local map = function(keys, func, desc)
|
|
|
|
local map = function(keys, func, desc)
|
|
|
|
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = desc })
|
|
|
|
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = desc })
|
|
|
|
end
|
|
|
|
end
|
|
|
|
map('gd', vim.lsp.buf.definition, 'Go to definition')
|
|
|
|
map('gd', vim.lsp.buf.definition, 'Go to definition')
|
|
|
|
map('gD', vim.lsp.buf.declaration, 'Go to declaration')
|
|
|
|
map('gD', vim.lsp.buf.declaration, 'Go to declaration')
|
|
|
|
map('gr', vim.lsp.buf.references, 'Go to references')
|
|
|
|
map('gr', vim.lsp.buf.references, 'Go to references')
|
|
|
|
map('K', vim.lsp.buf.hover, 'Hover documentation')
|
|
|
|
map('K', vim.lsp.buf.hover, 'Hover documentation')
|
|
|
|
map('<leader>rn', vim.lsp.buf.rename, 'Rename symbol')
|
|
|
|
map('<leader>rn', vim.lsp.buf.rename, 'Rename symbol')
|
|
|
|
map('<leader>ca', vim.lsp.buf.code_action, 'Code action')
|
|
|
|
map('<leader>ca', vim.lsp.buf.code_action, 'Code action')
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
-- Server-specific settings
|
|
|
|
|
|
|
|
local lspconfig = require 'lspconfig'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lspconfig.ts_ls.setup {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lspconfig.omnisharp.setup {
|
|
|
|
|
|
|
|
-- Point to your solution file if needed
|
|
|
|
|
|
|
|
-- cmd = { 'omnisharp', '--solution-path', 'YourSolution.sln' },
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lspconfig.marksman.setup {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lspconfig.lua_ls.setup {
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
|
|
|
|
Lua = {
|
|
|
|
|
|
|
|
-- Teach the Lua LSP about Neovim's globals
|
|
|
|
|
|
|
|
diagnostics = { globals = { 'vim' } },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|