nvim: mason
This commit is contained in:
parent
d60c2c7b48
commit
e6cf9b4a9d
5 changed files with 118 additions and 86 deletions
1
dot_config/nvim/after/ftplugin/xml.vim
Normal file
1
dot_config/nvim/after/ftplugin/xml.vim
Normal file
|
@ -0,0 +1 @@
|
||||||
|
setlocal tabstop=2 shiftwidth=2
|
|
@ -1,3 +1,4 @@
|
||||||
autocmd BufRead,BufNewFile Directory.Build.props set ft=xml
|
autocmd BufRead,BufNewFile Directory.Build.props set ft=xml
|
||||||
autocmd BufRead,BufNewFile Directory.Build.targets set ft=xml
|
autocmd BufRead,BufNewFile Directory.Build.targets set ft=xml
|
||||||
|
autocmd BufRead,BufNewFile *.axaml set ft=xml
|
||||||
autocmd BufRead,BufNewFile *.cake set filetype=cs
|
autocmd BufRead,BufNewFile *.cake set filetype=cs
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
return {
|
return {
|
||||||
{ 'mfussenegger/nvim-dap',
|
{ 'mfussenegger/nvim-dap',
|
||||||
|
init = function ()
|
||||||
|
local php = require("mason-registry").get_package('php-debug-adapter')
|
||||||
|
if not php:is_installed() then
|
||||||
|
php:install()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'rcarriga/nvim-dap-ui',
|
'rcarriga/nvim-dap-ui',
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ '<F2>', function() require('dap').step_over() end },
|
{ '<F2>', function() require('dap').step_over() end },
|
||||||
|
@ -74,12 +85,6 @@ return {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ 'xdebug/vscode-php-debug',
|
|
||||||
build = { 'npm install && npm run build' },
|
|
||||||
config = false,
|
|
||||||
module = false,
|
|
||||||
lazy = true,
|
|
||||||
},
|
|
||||||
{ 'leoluz/nvim-dap-go',
|
{ 'leoluz/nvim-dap-go',
|
||||||
ft = 'go',
|
ft = 'go',
|
||||||
config = true,
|
config = true,
|
||||||
|
|
|
@ -52,9 +52,9 @@ local function on_attach(args) -- {{{
|
||||||
if client.server_capabilities.codeLensProvider then
|
if client.server_capabilities.codeLensProvider then
|
||||||
vim.api.nvim_create_autocmd(
|
vim.api.nvim_create_autocmd(
|
||||||
{ 'BufEnter', 'CursorHold', 'InsertLeave' }, {
|
{ 'BufEnter', 'CursorHold', 'InsertLeave' }, {
|
||||||
callback = vim.lsp.codelens.refresh,
|
callback = vim.lsp.codelens.refresh,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
vim.keymap.set('n', '<leader>cl', vim.lsp.codelens.run, mkOpts('LSP Run code lens'))
|
vim.keymap.set('n', '<leader>cl', vim.lsp.codelens.run, mkOpts('LSP Run code lens'))
|
||||||
vim.keymap.set('n', '<leader>ci', vim.lsp.buf.implementation, mkOpts('LSP implementation'))
|
vim.keymap.set('n', '<leader>ci', vim.lsp.buf.implementation, mkOpts('LSP implementation'))
|
||||||
|
@ -69,8 +69,8 @@ local function on_attach(args) -- {{{
|
||||||
vim.keymap.set('n', '<leader>cr', '<Cmd>Trouble lsp_references<CR>', mkOpts('LSP references'))
|
vim.keymap.set('n', '<leader>cr', '<Cmd>Trouble lsp_references<CR>', mkOpts('LSP references'))
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
{ 'v', 'n' }, '<leader>F', function()
|
{ 'v', 'n' }, '<leader>F', function()
|
||||||
vim.lsp.buf.format({ async = true, filter = formatting_filter })
|
vim.lsp.buf.format({ async = true, filter = formatting_filter })
|
||||||
end,
|
end,
|
||||||
mkOpts('Lsp Format')
|
mkOpts('Lsp Format')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -82,71 +82,71 @@ local function on_attach(args) -- {{{
|
||||||
client.server_capabilities.semanticTokensProvider.legend = {
|
client.server_capabilities.semanticTokensProvider.legend = {
|
||||||
tokenModifiers = { 'static' },
|
tokenModifiers = { 'static' },
|
||||||
tokenTypes = {
|
tokenTypes = {
|
||||||
'comment', -- "comment",
|
'comment', -- "comment",
|
||||||
'comment', -- "excluded_code",
|
'comment', -- "excluded_code",
|
||||||
'identifier', -- "identifier",
|
'identifier', -- "identifier",
|
||||||
'keyword', -- "keyword",
|
'keyword', -- "keyword",
|
||||||
'keyword', -- "keyword_control",
|
'keyword', -- "keyword_control",
|
||||||
'number', -- "number",
|
'number', -- "number",
|
||||||
'operator', -- "operator",
|
'operator', -- "operator",
|
||||||
'operator', -- "operator_overloaded",
|
'operator', -- "operator_overloaded",
|
||||||
'preproc', -- "preprocessor_keyword",
|
'preproc', -- "preprocessor_keyword",
|
||||||
'string', -- "string",
|
'string', -- "string",
|
||||||
'whitespace', -- "whitespace",
|
'whitespace', -- "whitespace",
|
||||||
'text', -- "text",
|
'text', -- "text",
|
||||||
'static', -- "static_symbol",
|
'static', -- "static_symbol",
|
||||||
'preproc', -- "preprocessor_text",
|
'preproc', -- "preprocessor_text",
|
||||||
'punctuation', -- "punctuation",
|
'punctuation', -- "punctuation",
|
||||||
'string.escape', -- "string_verbatim",
|
'string.escape', -- "string_verbatim",
|
||||||
'character.special', -- "string_escape_character",
|
'character.special', -- "string_escape_character",
|
||||||
'class', -- "class_name",
|
'class', -- "class_name",
|
||||||
'type', -- "delegate_name",
|
'type', -- "delegate_name",
|
||||||
'enum', -- "enum_name",
|
'enum', -- "enum_name",
|
||||||
'interface', -- "interface_name",
|
'interface', -- "interface_name",
|
||||||
'namespace', -- "module_name",
|
'namespace', -- "module_name",
|
||||||
'struct', -- "struct_name",
|
'struct', -- "struct_name",
|
||||||
'typeParameter', -- "type_parameter_name",
|
'typeParameter', -- "type_parameter_name",
|
||||||
'field', -- "field_name",
|
'field', -- "field_name",
|
||||||
'enumMember', -- "enum_member_name",
|
'enumMember', -- "enum_member_name",
|
||||||
'constant', -- "constant_name",
|
'constant', -- "constant_name",
|
||||||
'variable', -- "local_name",
|
'variable', -- "local_name",
|
||||||
'parameter', -- "parameter_name",
|
'parameter', -- "parameter_name",
|
||||||
'method', -- "method_name",
|
'method', -- "method_name",
|
||||||
'method', -- "extension_method_name",
|
'method', -- "extension_method_name",
|
||||||
'property', -- "property_name",
|
'property', -- "property_name",
|
||||||
'event', -- "event_name",
|
'event', -- "event_name",
|
||||||
'namespace', -- "namespace_name",
|
'namespace', -- "namespace_name",
|
||||||
'label', -- "label_name",
|
'label', -- "label_name",
|
||||||
'text.literal', -- "xml_doc_comment_attribute_name",
|
'text.literal', -- "xml_doc_comment_attribute_name",
|
||||||
'text.literal', -- "xml_doc_comment_attribute_quotes",
|
'text.literal', -- "xml_doc_comment_attribute_quotes",
|
||||||
'text.literal', -- "xml_doc_comment_attribute_value",
|
'text.literal', -- "xml_doc_comment_attribute_value",
|
||||||
'text.literal', -- "xml_doc_comment_cdata_section",
|
'text.literal', -- "xml_doc_comment_cdata_section",
|
||||||
'text.literal', -- "xml_doc_comment_comment",
|
'text.literal', -- "xml_doc_comment_comment",
|
||||||
'text.literal', -- "xml_doc_comment_delimiter",
|
'text.literal', -- "xml_doc_comment_delimiter",
|
||||||
'text.literal', -- "xml_doc_comment_entity_reference",
|
'text.literal', -- "xml_doc_comment_entity_reference",
|
||||||
'text.literal', -- "xml_doc_comment_name",
|
'text.literal', -- "xml_doc_comment_name",
|
||||||
'text.literal', -- "xml_doc_comment_processing_instruction",
|
'text.literal', -- "xml_doc_comment_processing_instruction",
|
||||||
'text.literal', -- "xml_doc_comment_text",
|
'text.literal', -- "xml_doc_comment_text",
|
||||||
'text.literal', -- "xml_literal_attribute_name",
|
'text.literal', -- "xml_literal_attribute_name",
|
||||||
'text.literal', -- "xml_literal_attribute_quotes",
|
'text.literal', -- "xml_literal_attribute_quotes",
|
||||||
'text.literal', -- "xml_literal_attribute_value",
|
'text.literal', -- "xml_literal_attribute_value",
|
||||||
'text.literal', -- "xml_literal_cdata_section",
|
'text.literal', -- "xml_literal_cdata_section",
|
||||||
'text.literal', -- "xml_literal_comment",
|
'text.literal', -- "xml_literal_comment",
|
||||||
'text.literal', -- "xml_literal_delimiter",
|
'text.literal', -- "xml_literal_delimiter",
|
||||||
'text.literal', -- "xml_literal_embedded_expression",
|
'text.literal', -- "xml_literal_embedded_expression",
|
||||||
'text.literal', -- "xml_literal_entity_reference",
|
'text.literal', -- "xml_literal_entity_reference",
|
||||||
'text.literal', -- "xml_literal_name",
|
'text.literal', -- "xml_literal_name",
|
||||||
'text.literal', -- "xml_literal_processing_instruction",
|
'text.literal', -- "xml_literal_processing_instruction",
|
||||||
'text.literal', -- "xml_literal_text",
|
'text.literal', -- "xml_literal_text",
|
||||||
'regexp', -- "regex_comment",
|
'regexp', -- "regex_comment",
|
||||||
'regexp', -- "regex_character_class",
|
'regexp', -- "regex_character_class",
|
||||||
'regexp', -- "regex_anchor",
|
'regexp', -- "regex_anchor",
|
||||||
'regexp', -- "regex_quantifier",
|
'regexp', -- "regex_quantifier",
|
||||||
'regexp', -- "regex_grouping",
|
'regexp', -- "regex_grouping",
|
||||||
'regexp', -- "regex_alternation",
|
'regexp', -- "regex_alternation",
|
||||||
'regexp', -- "regex_text",
|
'regexp', -- "regex_text",
|
||||||
'regexp', -- "regex_self_escaped_character",
|
'regexp', -- "regex_self_escaped_character",
|
||||||
'regexp' -- "regex_other_escape",
|
'regexp' -- "regex_other_escape",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -164,7 +164,7 @@ local function config()
|
||||||
-- Use a loop to conveniently both setup defined servers
|
-- Use a loop to conveniently both setup defined servers
|
||||||
-- and map buffer local keybindings when the language server attaches
|
-- and map buffer local keybindings when the language server attaches
|
||||||
local servers = {
|
local servers = {
|
||||||
powershell_es = { bundle_path = '/home/vladimir/devel/PowerShellEditorServices/module' },
|
powershell_es = {},
|
||||||
gopls = {},
|
gopls = {},
|
||||||
clangd = {},
|
clangd = {},
|
||||||
zls = {},
|
zls = {},
|
||||||
|
@ -212,10 +212,10 @@ local function config()
|
||||||
handlers = {
|
handlers = {
|
||||||
['textDocument/publishDiagnostics'] = vim.lsp.with(
|
['textDocument/publishDiagnostics'] = vim.lsp.with(
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
virtual_text = {
|
virtual_text = {
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
severity = vim.diagnostic.severity.ERROR,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
root_dir = function(startpath)
|
root_dir = function(startpath)
|
||||||
|
@ -260,18 +260,35 @@ local function config()
|
||||||
}, -- }}}
|
}, -- }}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local mlsp = require('mason-lspconfig')
|
||||||
|
local available = mlsp.get_available_servers()
|
||||||
|
local ensure = {}
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
for name, conf in pairs(servers) do
|
for name, conf in pairs(servers) do
|
||||||
conf.capabilities = capabilities
|
conf.capabilities = capabilities
|
||||||
nvim_lsp[name].setup(conf)
|
nvim_lsp[name].setup(conf)
|
||||||
|
if vim.tbl_contains(available, name) then
|
||||||
|
ensure[#ensure + 1] = name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mlsp.setup({ ensure_installed = ensure })
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{ 'neovim/nvim-lspconfig',
|
{
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ 'j-hui/fidget.nvim', config = true },
|
{ 'j-hui/fidget.nvim', config = true },
|
||||||
{ 'ray-x/lsp_signature.nvim', opts = { hint_prefix = '⥊ ', floating_window = false, hint_scheme = 'Identifier' } },
|
{
|
||||||
|
'ray-x/lsp_signature.nvim',
|
||||||
|
opts = {
|
||||||
|
hint_prefix = '⥊ ',
|
||||||
|
floating_window = false,
|
||||||
|
hint_scheme = 'Identifier'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ 'williamboman/mason-lspconfig.nvim' },
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ '<leader>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
{ '<leader>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
||||||
|
@ -284,4 +301,11 @@ return {
|
||||||
{ 'Hoffs/omnisharp-extended-lsp.nvim', lazy = true },
|
{ 'Hoffs/omnisharp-extended-lsp.nvim', lazy = true },
|
||||||
{ 'b0o/schemastore.nvim', lazy = true },
|
{ 'b0o/schemastore.nvim', lazy = true },
|
||||||
{ 'folke/neodev.nvim', lazy = true },
|
{ 'folke/neodev.nvim', lazy = true },
|
||||||
|
{
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
cmd = 'Mason',
|
||||||
|
keys = {},
|
||||||
|
opts = {},
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ 'dyng/ctrlsf.vim', cmd = 'CtrlSF' },
|
{ 'dyng/ctrlsf.vim', cmd = 'CtrlSF' },
|
||||||
|
|
||||||
{ 'andymass/vim-matchup',
|
{ 'andymass/vim-matchup',
|
||||||
event = 'BufRead',
|
event = 'BufRead',
|
||||||
|
@ -113,8 +113,9 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ 'fpob/nette.vim', ft = 'nette' },
|
{ 'fpob/nette.vim', ft = 'nette' },
|
||||||
{ 'ziglang/zig.vim', ft = 'zig' },
|
{ 'ziglang/zig.vim', ft = 'zig' },
|
||||||
|
{ 'chrisbra/csv.vim', ft = 'csv' },
|
||||||
|
|
||||||
{
|
{
|
||||||
'mfussenegger/nvim-jdtls',
|
'mfussenegger/nvim-jdtls',
|
||||||
|
|
Loading…
Add table
Reference in a new issue