Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
52d730a5a2 | |||
e36bce4610 |
4 changed files with 247 additions and 249 deletions
44
config/nvim/lua/fschauen/completion.lua
Normal file
44
config/nvim/lua/fschauen/completion.lua
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local cmp = function()
|
||||||
|
return require 'cmp'
|
||||||
|
end
|
||||||
|
|
||||||
|
M.select_next_or_complete = function(fallback)
|
||||||
|
local func = cmp().visible()
|
||||||
|
and cmp().mapping.select_next_item { behavior = cmp().SelectBehavior.Select }
|
||||||
|
or cmp().mapping.complete()
|
||||||
|
func(fallback)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.select_prev_or_complete = function(fallback)
|
||||||
|
local func = cmp().visible()
|
||||||
|
and cmp().mapping.select_prev_item { behavior = cmp().SelectBehavior.Select }
|
||||||
|
or cmp().mapping.complete()
|
||||||
|
func(fallback)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.select_next_item = function(fallback)
|
||||||
|
cmp().mapping.select_next_item({ behavior = cmp().SelectBehavior.Select })(fallback)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.select_prev_item = function(fallback)
|
||||||
|
cmp().mapping.select_prev_item({ behavior = cmp().SelectBehavior.Select })(fallback)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.scroll_docs = function(delta)
|
||||||
|
return function(fallback)
|
||||||
|
cmp().mapping.scroll_docs(delta)(fallback)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.abort = function(fallback)
|
||||||
|
cmp().mapping.abort()(fallback)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.confirm = function(fallback)
|
||||||
|
cmp().mapping.confirm({ select = true })(fallback)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
|
@ -3,6 +3,7 @@ local M = {}
|
||||||
local diagnostic = require 'fschauen.diagnostic'
|
local diagnostic = require 'fschauen.diagnostic'
|
||||||
local window = require 'fschauen.window'
|
local window = require 'fschauen.window'
|
||||||
local pick = require('fschauen.telescope').pickers
|
local pick = require('fschauen.telescope').pickers
|
||||||
|
local completion = require 'fschauen.completion'
|
||||||
|
|
||||||
local toggle_number = function()
|
local toggle_number = function()
|
||||||
vim.wo.number = not vim.wo.number
|
vim.wo.number = not vim.wo.number
|
||||||
|
@ -82,6 +83,21 @@ local keymap = {
|
||||||
{ '<c-j>', '<down>', mode = 'c' },
|
{ '<c-j>', '<down>', mode = 'c' },
|
||||||
{ '<c-k>', '<up>', mode = 'c' },
|
{ '<c-k>', '<up>', mode = 'c' },
|
||||||
|
|
||||||
|
completion = {
|
||||||
|
{'<c-n>' , completion.select_next_or_complete, mode = { 'i', 'c' }, desc = ' Complete: select next'},
|
||||||
|
{'<c-p>' , completion.select_prev_or_complete, mode = { 'i', 'c' }, desc = ' Complete: select previous'},
|
||||||
|
{'<down>' , completion.select_next_item, mode = { 'i', 'c' }, desc = ' Complete: select next'},
|
||||||
|
{'<up>' , completion.select_prev_item, mode = { 'i', 'c' }, desc = ' Complete: select previous'},
|
||||||
|
|
||||||
|
{'<c-f>' , completion.scroll_docs(-3), mode = { 'i', 'c' }, desc = ' Complete: scroll docs down'},
|
||||||
|
{'<s-down>' , completion.scroll_docs(-3), mode = { 'i', 'c' }, desc = ' Complete: scroll docs down'},
|
||||||
|
{'<c-b>' , completion.scroll_docs( 3), mode = { 'i', 'c' }, desc = ' Complete: scroll docs up'},
|
||||||
|
{'<s-up>' , completion.scroll_docs( 3), mode = { 'i', 'c' }, desc = ' Complete: scroll docs up'},
|
||||||
|
|
||||||
|
{'<c-e>' , completion.abort, mode = { 'i', 'c' }, desc = ' Complete: abort'},
|
||||||
|
{'<c-y>' , completion.confirm, mode = { 'i', 'c' }, desc = ' Complete: confirm'},
|
||||||
|
},
|
||||||
|
|
||||||
-- quickly change background
|
-- quickly change background
|
||||||
{ '<leader>bg', [[<cmd>let &background = &background ==? 'light' ? 'dark' : 'light'<cr>]] },
|
{ '<leader>bg', [[<cmd>let &background = &background ==? 'light' ? 'dark' : 'light'<cr>]] },
|
||||||
|
|
||||||
|
|
|
@ -1,164 +1,5 @@
|
||||||
local repeat_mapping = function(value, keys)
|
|
||||||
local tbl = {}
|
|
||||||
for _, k in ipairs(keys) do tbl[k] = value end
|
|
||||||
return tbl
|
|
||||||
end
|
|
||||||
|
|
||||||
local transform_keymap = function(mappings, modes)
|
|
||||||
modes = modes or 'n'
|
|
||||||
modes = type(modes) == 'table' and modes or { modes }
|
|
||||||
local tbl = {}
|
|
||||||
for lhs, rhs in pairs(mappings) do
|
|
||||||
tbl[lhs] = repeat_mapping(rhs, modes)
|
|
||||||
end
|
|
||||||
return tbl
|
|
||||||
end
|
|
||||||
|
|
||||||
local cond = function(condition, yes, no)
|
|
||||||
return function(fallback)
|
|
||||||
if condition() then yes(fallback) else no(fallback) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local config = function()
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
local map = cmp.mapping
|
|
||||||
|
|
||||||
local keymap = {
|
|
||||||
['<c-n>'] = cond(cmp.visible,
|
|
||||||
map.select_next_item { behavior = cmp.SelectBehavior.Select },
|
|
||||||
map.complete()),
|
|
||||||
['<c-p>'] = cond(cmp.visible,
|
|
||||||
map.select_prev_item { behavior = cmp.SelectBehavior.Select },
|
|
||||||
map.complete()),
|
|
||||||
|
|
||||||
['<down>'] = map.select_next_item { behavior = cmp.SelectBehavior.Select },
|
|
||||||
['<up>'] = map.select_prev_item { behavior = cmp.SelectBehavior.Select },
|
|
||||||
|
|
||||||
['<c-f>'] = map.scroll_docs( 3),
|
|
||||||
['<s-down>'] = map.scroll_docs( 3),
|
|
||||||
['<c-b>'] = map.scroll_docs(-3),
|
|
||||||
['<s-up>'] = map.scroll_docs(-3),
|
|
||||||
|
|
||||||
['<c-e>'] = map.abort(),
|
|
||||||
['<c-y>'] = map.confirm { select = true },
|
|
||||||
['<tab>'] = cond(cmp.visible,
|
|
||||||
map.confirm { select = true },
|
|
||||||
function(fallback) fallback() end),
|
|
||||||
}
|
|
||||||
|
|
||||||
cmp.setup {
|
|
||||||
mapping = transform_keymap(keymap, 'i'),
|
|
||||||
|
|
||||||
enabled = function()
|
|
||||||
local c = require 'cmp.config.context'
|
|
||||||
return not c.in_treesitter_capture('comment') and
|
|
||||||
not c.in_syntax_group('Comment')
|
|
||||||
end,
|
|
||||||
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
formatting = {
|
|
||||||
format = require('lspkind').cmp_format {
|
|
||||||
mode = 'symbol_text',
|
|
||||||
|
|
||||||
menu = {
|
|
||||||
buffer = 'buf',
|
|
||||||
nvim_lsp = 'LSP',
|
|
||||||
nvim_lua = 'lua',
|
|
||||||
path = '',
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Custom mix of lspkind defaults and VS Code codicons :)
|
|
||||||
symbol_map = {
|
|
||||||
Array = '',
|
|
||||||
Boolean = '',
|
|
||||||
Class = '',
|
|
||||||
Color = '',
|
|
||||||
Constant = '',
|
|
||||||
Constructor = '',
|
|
||||||
Copilot = '',
|
|
||||||
Enum = '',
|
|
||||||
EnumMember = '',
|
|
||||||
Event = '',
|
|
||||||
Field = '',
|
|
||||||
File = '',
|
|
||||||
Folder = '',
|
|
||||||
Function = '',
|
|
||||||
Interface = '',
|
|
||||||
Key = '',
|
|
||||||
Keyword = '',
|
|
||||||
Method = '',
|
|
||||||
Module = '',
|
|
||||||
Namespace = '',
|
|
||||||
Null = '',
|
|
||||||
Number = '',
|
|
||||||
Object = '',
|
|
||||||
Operator = '',
|
|
||||||
Package = '',
|
|
||||||
Property = '',
|
|
||||||
Reference = '',
|
|
||||||
Snippet = '',
|
|
||||||
String = '',
|
|
||||||
Struct = '',
|
|
||||||
Text = '',
|
|
||||||
TypeParameter = '',
|
|
||||||
Unit = '',
|
|
||||||
Value = '',
|
|
||||||
Variable = '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lua' },
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
}, {
|
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'buffer', keyword_length = 5 },
|
|
||||||
}),
|
|
||||||
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
|
|
||||||
experimental = {
|
|
||||||
ghost_text = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
mapping = transform_keymap(
|
|
||||||
vim.tbl_extend('force', keymap, {
|
|
||||||
['<tab>'] = cond(cmp.visible, map.confirm {select = true }, map.complete()),
|
|
||||||
}),
|
|
||||||
'c'),
|
|
||||||
|
|
||||||
completion = {
|
|
||||||
autocomplete = false,
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
|
|
||||||
cmp.setup.filetype('TelescopePrompt', { enabled = false })
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
|
|
||||||
config = config,
|
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
'hrsh7th/cmp-nvim-lua',
|
'hrsh7th/cmp-nvim-lua',
|
||||||
|
@ -166,9 +7,101 @@ return {
|
||||||
'hrsh7th/cmp-buffer',
|
'hrsh7th/cmp-buffer',
|
||||||
'hrsh7th/cmp-cmdline',
|
'hrsh7th/cmp-cmdline',
|
||||||
'onsails/lspkind-nvim',
|
'onsails/lspkind-nvim',
|
||||||
|
|
||||||
'L3MON4D3/LuaSnip',
|
'L3MON4D3/LuaSnip',
|
||||||
'saadparwaiz1/cmp_luasnip',
|
'saadparwaiz1/cmp_luasnip',
|
||||||
},
|
},
|
||||||
|
keys = require('fschauen.keymap').completion,
|
||||||
|
config = function()
|
||||||
|
local cmp = require('cmp')
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
enabled = function()
|
||||||
|
local c = require 'cmp.config.context'
|
||||||
|
return not c.in_treesitter_capture('comment') and
|
||||||
|
not c.in_syntax_group('Comment')
|
||||||
|
end,
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
format = require('lspkind').cmp_format {
|
||||||
|
mode = 'symbol_text',
|
||||||
|
menu = {
|
||||||
|
buffer = 'buf',
|
||||||
|
nvim_lsp = 'LSP',
|
||||||
|
nvim_lua = 'lua',
|
||||||
|
path = '',
|
||||||
|
},
|
||||||
|
symbol_map = {
|
||||||
|
Array = '',
|
||||||
|
Boolean = '',
|
||||||
|
Class = '',
|
||||||
|
Color = '',
|
||||||
|
Constant = '',
|
||||||
|
Constructor = '',
|
||||||
|
Copilot = '',
|
||||||
|
Enum = '',
|
||||||
|
EnumMember = '',
|
||||||
|
Event = '',
|
||||||
|
Field = '',
|
||||||
|
File = '',
|
||||||
|
Folder = '',
|
||||||
|
Function = '',
|
||||||
|
Interface = '',
|
||||||
|
Key = '',
|
||||||
|
Keyword = '',
|
||||||
|
Method = '',
|
||||||
|
Module = '',
|
||||||
|
Namespace = '',
|
||||||
|
Null = '',
|
||||||
|
Number = '',
|
||||||
|
Object = '',
|
||||||
|
Operator = '',
|
||||||
|
Package = '',
|
||||||
|
Property = '',
|
||||||
|
Reference = '',
|
||||||
|
Snippet = '',
|
||||||
|
String = '',
|
||||||
|
Struct = '',
|
||||||
|
Text = '',
|
||||||
|
TypeParameter = '',
|
||||||
|
Unit = '',
|
||||||
|
Value = '',
|
||||||
|
Variable = '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
}, {
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'buffer', keyword_length = 5 },
|
||||||
|
}),
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
completion = {
|
||||||
|
autocomplete = false,
|
||||||
|
},
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.filetype('TelescopePrompt', { enabled = false })
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,98 +1,103 @@
|
||||||
local config = function()
|
local border = 'rounded'
|
||||||
-- Enable rounded borders for LSP handlers and :LspInfo windows.
|
|
||||||
local border = 'rounded'
|
|
||||||
for request, handler in pairs {
|
|
||||||
['textDocument/hover'] = vim.lsp.handlers.hover,
|
|
||||||
['textDocument/signatureHelp'] = vim.lsp.handlers.signature_help,
|
|
||||||
} do
|
|
||||||
vim.lsp.handlers[request] = vim.lsp.with(handler, { border = border })
|
|
||||||
end
|
|
||||||
require('lspconfig.ui.windows').default_options = { border = border }
|
|
||||||
|
|
||||||
local opts = {
|
|
||||||
capabilities = vim.lsp.protocol.make_client_capabilities(),
|
|
||||||
|
|
||||||
on_attach = function(--[[client]]_, bufnr)
|
|
||||||
vim.bo.omnifunc = 'v:lua.vim.lsp.omnifunc' -- do completion with <c-x><c-o>
|
|
||||||
local map, opts = vim.keymap.set, { buffer = bufnr }
|
|
||||||
map('n', '<localleader>c', vim.lsp.buf.code_action, opts)
|
|
||||||
map('n', '<localleader>f', vim.lsp.buf.format, opts)
|
|
||||||
map('n', 'gd', vim.lsp.buf.definition, opts)
|
|
||||||
map('n', 'gD', vim.lsp.buf.declaration, opts)
|
|
||||||
map('n', 'gi', vim.lsp.buf.implementation, opts)
|
|
||||||
map('n', 'grr', vim.lsp.buf.rename, opts)
|
|
||||||
map('n', 'gt', vim.lsp.buf.type_definition, opts)
|
|
||||||
map('n', 'K', vim.lsp.buf.hover, opts)
|
|
||||||
map('i', '<c-l>', vim.lsp.buf.signature_help, opts)
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_init = function(client, --[[init_result]]_)
|
|
||||||
-- Opt out of semantic highlighting because it has been casusing the issues
|
|
||||||
-- https://github.com/neovim/nvim-lspconfig/issues/2542#issuecomment-1547019213
|
|
||||||
if client.server_capabilities then
|
|
||||||
client.server_capabilities.semanticTokensProvider = false
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
local cmp = vim.F.npcall(require, 'cmp_nvim_lsp')
|
|
||||||
if cmp then
|
|
||||||
vim.tbl_deep_extend('force', opts.capabilities, cmp.default_capabilities())
|
|
||||||
end
|
|
||||||
|
|
||||||
require('mason').setup {
|
|
||||||
ui = {
|
|
||||||
border = 'rounded',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
require('mason-lspconfig').setup {}
|
|
||||||
require("mason-lspconfig").setup_handlers {
|
|
||||||
--[[ default = ]] function(server)
|
|
||||||
require('lspconfig')[server].setup(opts)
|
|
||||||
end,
|
|
||||||
|
|
||||||
lua_ls = function()
|
|
||||||
require('lspconfig').lua_ls.setup(vim.tbl_extend('force', opts, {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
-- I'm using lua only inside neovim, so the runtime is LuaJIT.
|
|
||||||
runtime = { version = 'LuaJIT' },
|
|
||||||
|
|
||||||
-- Get the language server to recognize the `vim` global.
|
|
||||||
diagnostics = { globals = {'vim'} },
|
|
||||||
|
|
||||||
-- Make the server aware of Neovim runtime files.
|
|
||||||
workspace = { library = vim.api.nvim_get_runtime_file("", true) },
|
|
||||||
|
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
|
||||||
telemetry = { enable = false },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
end,
|
|
||||||
|
|
||||||
omnisharp = function()
|
|
||||||
require('lspconfig').omnisharp.setup(vim.tbl_extend('force', opts, {
|
|
||||||
-- Show unimported types and add`using` directives.
|
|
||||||
enable_import_completion = true,
|
|
||||||
|
|
||||||
-- Enable roslyn analyzers, code fixes, and rulesets.
|
|
||||||
enable_roslyn_analyzers = true,
|
|
||||||
|
|
||||||
-- Don't include preview versions of the .NET SDK.
|
|
||||||
sdk_include_prereleases = false,
|
|
||||||
}))
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
|
||||||
config = config,
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
},
|
},
|
||||||
|
event = {
|
||||||
|
'BufReadPost',
|
||||||
|
'BufNewFile'
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local opts = {
|
||||||
|
capabilities = (function()
|
||||||
|
local caps = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
local cmp = vim.F.npcall(require, 'cmp_nvim_lsp')
|
||||||
|
if cmp then
|
||||||
|
vim.tbl_deep_extend('force', caps, cmp.default_capabilities())
|
||||||
|
end
|
||||||
|
return caps
|
||||||
|
end)(),
|
||||||
|
|
||||||
|
on_attach = function( --[[client]] _, bufnr)
|
||||||
|
vim.bo.omnifunc = 'v:lua.vim.lsp.omnifunc' -- do completion with <c-x><c-o>
|
||||||
|
local map, opts = vim.keymap.set, { buffer = bufnr }
|
||||||
|
map('n', '<localleader>c', vim.lsp.buf.code_action, opts)
|
||||||
|
map('n', '<localleader>f', vim.lsp.buf.format, opts)
|
||||||
|
map('n', 'gd', vim.lsp.buf.definition, opts)
|
||||||
|
map('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||||
|
map('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||||
|
map('n', 'grr', vim.lsp.buf.rename, opts)
|
||||||
|
map('n', 'gt', vim.lsp.buf.type_definition, opts)
|
||||||
|
map('n', 'K', vim.lsp.buf.hover, opts)
|
||||||
|
map('i', '<c-l>', vim.lsp.buf.signature_help, opts)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_init = function(client, --[[init_result]] _)
|
||||||
|
-- Opt out of semantic highlighting because it has been casusing the issues
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/issues/2542#issuecomment-1547019213
|
||||||
|
if client.server_capabilities then
|
||||||
|
client.server_capabilities.semanticTokensProvider = false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Enable rounded borders for LSP handlers and :LspInfo windows.
|
||||||
|
for request, handler in pairs {
|
||||||
|
['textDocument/hover'] = vim.lsp.handlers.hover,
|
||||||
|
['textDocument/signatureHelp'] = vim.lsp.handlers.signature_help,
|
||||||
|
} do
|
||||||
|
vim.lsp.handlers[request] = vim.lsp.with(handler, { border = border })
|
||||||
|
end
|
||||||
|
require('lspconfig.ui.windows').default_options = { border = border }
|
||||||
|
|
||||||
|
require('mason').setup {
|
||||||
|
ui = {
|
||||||
|
border = border,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
require('mason-lspconfig').setup {
|
||||||
|
handlers = {
|
||||||
|
--[[ default = ]] function(server)
|
||||||
|
require('lspconfig')[server].setup(opts)
|
||||||
|
end,
|
||||||
|
|
||||||
|
lua_ls = function()
|
||||||
|
require('lspconfig').lua_ls.setup(vim.tbl_extend('force', opts, {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
-- I'm using lua only inside neovim, so the runtime is LuaJIT.
|
||||||
|
runtime = { version = 'LuaJIT' },
|
||||||
|
|
||||||
|
-- Get the language server to recognize the `vim` global.
|
||||||
|
diagnostics = { globals = { 'vim' } },
|
||||||
|
|
||||||
|
-- Make the server aware of Neovim runtime files.
|
||||||
|
workspace = { library = vim.api.nvim_get_runtime_file('', true) },
|
||||||
|
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = { enable = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
end,
|
||||||
|
|
||||||
|
omnisharp = function()
|
||||||
|
require('lspconfig').omnisharp.setup(vim.tbl_extend('force', opts, {
|
||||||
|
-- Show unimported types and add`using` directives.
|
||||||
|
enable_import_completion = true,
|
||||||
|
|
||||||
|
-- Enable roslyn analyzers, code fixes, and rulesets.
|
||||||
|
enable_roslyn_analyzers = true,
|
||||||
|
|
||||||
|
-- Don't include preview versions of the .NET SDK.
|
||||||
|
sdk_include_prereleases = false,
|
||||||
|
}))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue