Compare commits

..

2 Commits

2 changed files with 57 additions and 43 deletions

View File

@@ -1,6 +1,6 @@
[user]
name = Your Name
email = you@example.com
name = Edwin van den Houdt
email = eho@respellion.nl
[core]
editor = nvim

View File

@@ -148,10 +148,10 @@ require('lazy').setup({
-- --------------------------------------------------------
{
'nvim-treesitter/nvim-treesitter',
tag = 'v0.9.3',
build = ':TSUpdate',
config = function()
require('nvim-treesitter.configs').setup {
-- Install these parsers automatically
ensure_installed = {
'bash', 'lua', 'markdown', 'markdown_inline',
'typescript', 'javascript', 'c_sharp',
@@ -166,62 +166,76 @@ require('lazy').setup({
-- --------------------------------------------------------
-- LSP: language server protocol
-- --------------------------------------------------------
-- mason installs language servers for you.
-- mason-lspconfig bridges mason and nvim-lspconfig.
-- mason installs language servers.
-- 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',
dependencies = {
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
},
'williamboman/mason.nvim',
config = function()
-- mason must be set up first
require('mason').setup()
end,
},
{
'williamboman/mason-lspconfig.nvim',
dependencies = { 'williamboman/mason.nvim' },
config = function()
require('mason-lspconfig').setup {
-- These servers are installed automatically
-- These servers are installed automatically via mason
ensure_installed = {
'ts_ls', -- TypeScript / JavaScript
'omnisharp', -- C# and F#
'marksman', -- Markdown
'lua_ls', -- Lua (for editing this config)
'ts_ls', -- TypeScript / JavaScript
'omnisharp', -- C# and F#
'marksman', -- Markdown
'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', {
callback = function(event)
local map = function(keys, func, desc)
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = desc })
end
map('gd', vim.lsp.buf.definition, 'Go to definition')
map('gD', vim.lsp.buf.declaration, 'Go to declaration')
map('gr', vim.lsp.buf.references, 'Go to references')
map('K', vim.lsp.buf.hover, 'Hover documentation')
map('<leader>rn', vim.lsp.buf.rename, 'Rename symbol')
map('gd', vim.lsp.buf.definition, 'Go to definition')
map('gD', vim.lsp.buf.declaration, 'Go to declaration')
map('gr', vim.lsp.buf.references, 'Go to references')
map('K', vim.lsp.buf.hover, 'Hover documentation')
map('<leader>rn', vim.lsp.buf.rename, 'Rename symbol')
map('<leader>ca', vim.lsp.buf.code_action, 'Code action')
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,
},