1
0
Fork 0

nvim: rework deps

This commit is contained in:
Vladimír Dudr 2023-05-29 08:55:10 +02:00
parent 04d6ccc15e
commit a755c2b7de
4 changed files with 157 additions and 145 deletions
dot_config/nvim/lua/configs/packages

View file

@ -54,8 +54,7 @@ return {
php = { -- {{{
adapter = {
type = 'executable',
command = 'node',
args = { vim.env.HOME .. '/.local/share/nvim/lazy/vscode-php-debug/out/phpDebug.js' },
command = 'php-debug-adapter',
},
confs = {
{
@ -70,20 +69,20 @@ return {
config = function(_plug, opts)
-- signs - move to colorsheme? {{{
vim.fn.sign_define('DapBreakpoint', {
text = '⦿',
text = '',
texthl = 'DiagnosticSignError',
linehl = '',
numhl = ''
})
vim.fn.sign_define('DapBreakpointCondition', {
text = '',
text = '',
texthl = 'DiagnosticSignError',
linehl = '',
numhl = ''
})
vim.fn.sign_define('DapLogPoint', { text = '󱂅', texthl = '', linehl = '', numhl = '' })
vim.fn.sign_define('DapStopped', { text = '', texthl = 'DiagnosticSignOk', linehl = '', numhl = '' })
vim.fn.sign_define('DapBreakpointRejected', { text = '🛑', texthl = '', linehl = '', numhl = '' })
vim.fn.sign_define('DapBreakpointRejected', { text = '', texthl = 'DiagnosticSignError', linehl = '', numhl = '' })
--- }}}
local dap = require('dap')

View file

@ -1,3 +1,119 @@
local server_configs = function()
return {
powershell_es = {},
gopls = {},
clangd = {},
zls = {},
-- hls = {},
tsserver = {},
-- perlls = {},
rust_analyzer = {},
cssls = {},
html = {},
lemminx = {
--{{{
settings = {
xml = {
format = {
enabled = true,
splitAttributes = true,
formatComments = true,
joinCDATALines = false,
joinCommentLines = false,
joinContentLines = false,
spaceBeforeEmptyCloseTag = true,
},
},
},
}, -- }}}
rnix = {},
omnisharp = {
-- {{{
handlers = {
['textDocument/definition'] = require('omnisharp_extended').handler,
},
cmd = { 'omnisharp', 'RoslynExtensionsOptions:EnableDecompilationSupport=true' },
enable_editorconfig_support = true,
enable_ms_build_load_projects_on_demand = false,
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
sdk_include_prereleases = true,
analyze_open_documents_only = false,
}, -- }}}
lua_ls = {
-- {{{
settings = {
Lua = {
workleader = {
checkThirdParty = false,
},
completion = {
callSnippet = 'Replace',
},
},
},
}, -- }}}
phpactor = {
-- {{{
handlers = {
['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = {
severity = vim.diagnostic.severity.ERROR,
},
}
),
},
root_dir = function(startpath)
local u = require('lspconfig.util')
return u.search_ancestors(startpath, function(path)
return not string.find(path, '/vendor/') and (
u.path.exists(u.path.join(path, 'composer.json'))
or u.path.exists(u.path.join(path, 'sharedLibs'))
or u.path.exists(u.path.join(path, '.git'))
)
end)
end,
}, -- }}}
yamlls = {
-- {{{
settings = {
yaml = {
format = { enable = true },
validate = { enable = true },
completion = { enable = true },
hover = { enable = true },
schemas = require('schemastore').yaml.schemas(),
keyOrdering = false,
},
},
}, -- }}}
jsonls = {
-- {{{
settings = {
validate = { enable = true },
json = {
schemas = require('schemastore').json.schemas {
replace = {
['openapi.json'] = {
description = 'A JSON schema for Open API documentation files',
fileMatch = { 'openapi.json', 'openapi.yml', 'openapi.yaml', 'openapi/*.json' },
name = 'openapi.json',
url = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json',
versions = {
['3.1'] = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json',
['3.0'] = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json',
},
},
},
},
},
},
}, -- }}}
}
end
local function formatting_filter(c)
local bl = {
'phpactor',
@ -171,7 +287,7 @@ local function on_attach(args) -- {{{
'regexp', -- "regex_alternation",
'regexp', -- "regex_text",
'regexp', -- "regex_self_escaped_character",
'regexp' -- "regex_other_escape",
'regexp', -- "regex_other_escape",
},
}
end
@ -185,164 +301,56 @@ local function make_client_capabilities()
return caps
end
local function config() -- {{{
local function config()
require('neodev').setup({})
vim.api.nvim_create_autocmd('LspAttach', {
callback = on_attach,
})
local nvim_lsp = require('lspconfig')
-- vim.lsp.handlers['client/registerCapability'] = function ()
-- vim.print("nasrat!")
-- return vim.NIL
-- end
local servers = {
-- {{{
-- powershell_es = {},
gopls = {},
clangd = {},
zls = {},
-- hls = {},
tsserver = {},
-- perlls = {},
rust_analyzer = {},
cssls = {},
html = {},
lemminx = {
settings = {
xml = {
format = {
enabled = true,
splitAttributes = true,
formatComments = true,
joinCDATALines = false,
joinCommentLines = false,
joinContentLines = false,
spaceBeforeEmptyCloseTag = true,
},
},
},
}, -- xml
rnix = {},
omnisharp = {
-- {{{
handlers = {
['textDocument/definition'] = require('omnisharp_extended').handler,
},
cmd = { 'omnisharp', 'RoslynExtensionsOptions:EnableDecompilationSupport=true' },
enable_editorconfig_support = true,
enable_ms_build_load_projects_on_demand = false,
enable_roslyn_analyzers = true,
organize_imports_on_format = true,
enable_import_completion = true,
sdk_include_prereleases = true,
analyze_open_documents_only = false,
}, -- }}}
lua_ls = {
-- {{{
settings = {
Lua = {
workleader = {
checkThirdParty = false,
},
completion = {
callSnippet = 'Replace',
},
},
},
}, -- }}}
phpactor = {
-- {{{
handlers = {
['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = {
severity = vim.diagnostic.severity.ERROR,
},
}
),
},
root_dir = function(startpath)
local u = require('lspconfig.util')
return u.search_ancestors(startpath, function(path)
return not string.find(path, '/vendor/') and (
u.path.exists(u.path.join(path, 'composer.json'))
or u.path.exists(u.path.join(path, 'sharedLibs'))
or u.path.exists(u.path.join(path, '.git'))
)
end)
end,
}, -- }}}
yamlls = {
-- {{{
settings = {
yaml = {
format = { enable = true },
validate = { enable = true },
completion = { enable = true },
hover = { enable = true },
schemas = require('schemastore').yaml.schemas(),
keyOrdering = false,
},
},
}, -- }}}
jsonls = {
-- {{{
settings = {
validate = { enable = true },
json = {
schemas = require('schemastore').json.schemas {
replace = {
['openapi.json'] = {
description = 'A JSON schema for Open API documentation files',
fileMatch = { 'openapi.json', 'openapi.yml', 'openapi.yaml', 'openapi/*.json' },
name = 'openapi.json',
url = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json',
versions = {
['3.1'] = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json',
['3.0'] = 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json',
},
},
},
},
},
},
}, -- }}}
}
-- }}}
local mlsp = require('mason-lspconfig')
local available = mlsp.get_available_servers()
local ensure = {}
local capabilities = make_client_capabilities()
local servers = server_configs();
local nvim_lsp = require('lspconfig')
for name, conf in pairs(servers) do
conf.capabilities = capabilities
nvim_lsp[name].setup(conf)
end
end
local function config_mason_lsp()
local mlsp = require('mason-lspconfig')
local servers = server_configs()
local available = mlsp.get_available_servers()
local ensure = {}
for name, _ in pairs(servers) do
if vim.tbl_contains(available, name) and name ~= 'phpactor' then
ensure[#ensure + 1] = name
end
end
mlsp.setup({ ensure_installed = ensure })
end -- }}}
end
return {
{
'neovim/nvim-lspconfig',
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'
hint_scheme = 'Identifier',
},
},
{ 'williamboman/mason-lspconfig.nvim' },
{
'williamboman/mason-lspconfig.nvim',
lazy = true,
dependencies = { 'williamboman/mason.nvim' },
config = config_mason_lsp,
},
},
keys = {
{ '<leader>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
@ -356,11 +364,4 @@ return {
{ 'b0o/schemastore.nvim', lazy = true },
{ 'folke/neodev.nvim', lazy = true },
{ 'Issafalcon/lsp-overloads.nvim', lazy = true },
{
'williamboman/mason.nvim',
cmd = 'Mason',
keys = {},
opts = {},
config = true,
},
}

View file

@ -163,6 +163,10 @@ return {
{ 'fpob/nette.vim', ft = 'nette' },
{ 'ziglang/zig.vim', ft = 'zig' },
{ 'chrisbra/csv.vim', ft = 'csv' },
{ 'NoahTheDuke/vim-just' },
{ 'williamboman/mason.nvim', cmd = 'Mason', config = true },
{
'mfussenegger/nvim-jdtls',

View file

@ -63,6 +63,14 @@ function M.config()
},
filetype = 'xml', -- if filetype does not match the parser name
}
ts_parsers.just = {
install_info = {
url = 'https://github.com/IndianBoy42/tree-sitter-just', -- local path or git repo
files = { 'src/parser.c', 'src/scanner.cc' },
-- optional entries:
branch = 'main', -- default branch in case of git repo if different from master
},
}
require 'nvim-treesitter.configs'.setup {
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
@ -83,7 +91,7 @@ function M.config()
},
},
indent = {
disable = { "php" },-- php indent SUCKS A LOT
disable = { 'php' }, -- php indent SUCKS A LOT
enable = true,
},
textobjects = {