|
|
@ -124,7 +124,9 @@ local on_attach = function(client, bufnr) |
|
|
|
group = augroup, |
|
|
|
group = augroup, |
|
|
|
buffer = bufnr, |
|
|
|
buffer = bufnr, |
|
|
|
callback = function() |
|
|
|
callback = function() |
|
|
|
vim.lsp.buf.format({ bufnr = bufnr }) |
|
|
|
vim.lsp.buf.format({ |
|
|
|
|
|
|
|
bufnr = bufnr, |
|
|
|
|
|
|
|
}) |
|
|
|
end |
|
|
|
end |
|
|
|
}) |
|
|
|
}) |
|
|
|
end |
|
|
|
end |
|
|
@ -140,8 +142,9 @@ lsp.svelte.setup { on_attach = on_attach } |
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities() |
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities() |
|
|
|
capabilities.offsetEncoding = { "utf-16" } |
|
|
|
capabilities.offsetEncoding = { "utf-16" } |
|
|
|
lsp.clangd.setup { on_attach = on_attach, capabilities = capabilities } |
|
|
|
lsp.clangd.setup { on_attach = on_attach, capabilities = capabilities } |
|
|
|
-- https://github.com/denoland/deno - maybe switch? |
|
|
|
lsp.ts_ls.setup { on_attach = function(client, bufnr) |
|
|
|
lsp.tsserver.setup { on_attach = on_attach } |
|
|
|
on_attach(client, bufnr) |
|
|
|
|
|
|
|
end, } |
|
|
|
lsp.marksman.setup { on_attach = on_attach } |
|
|
|
lsp.marksman.setup { on_attach = on_attach } |
|
|
|
lsp.rust_analyzer.setup { on_attach = on_attach } |
|
|
|
lsp.rust_analyzer.setup { on_attach = on_attach } |
|
|
|
lsp.lua_ls.setup { on_attach = on_attach, |
|
|
|
lsp.lua_ls.setup { on_attach = on_attach, |
|
|
@ -298,10 +301,8 @@ return require('packer').startup(function(use) |
|
|
|
}) |
|
|
|
}) |
|
|
|
end |
|
|
|
end |
|
|
|
} |
|
|
|
} |
|
|
|
--use { 'jose-elias-alvarez/typescript.nvim', |
|
|
|
|
|
|
|
-- config = function() require("typescript") |
|
|
|
|
|
|
|
use { |
|
|
|
use { |
|
|
|
'jose-elias-alvarez/null-ls.nvim', |
|
|
|
'nvimtools/none-ls.nvim', |
|
|
|
config = function() |
|
|
|
config = function() |
|
|
|
local null_ls = require("null-ls") |
|
|
|
local null_ls = require("null-ls") |
|
|
|
local lsp_conf = require("lspconfig") |
|
|
|
local lsp_conf = require("lspconfig") |
|
|
@ -309,6 +310,7 @@ return require('packer').startup(function(use) |
|
|
|
-- util.root_pattern returns a function |
|
|
|
-- util.root_pattern returns a function |
|
|
|
local find_pyproject = lsp_conf.util.root_pattern('pyproject.toml') |
|
|
|
local find_pyproject = lsp_conf.util.root_pattern('pyproject.toml') |
|
|
|
local find_flake8 = lsp_conf.util.root_pattern('.flake8') |
|
|
|
local find_flake8 = lsp_conf.util.root_pattern('.flake8') |
|
|
|
|
|
|
|
-- local find_eslint = lsp_conf.util.root_pattern('eslint.config.js') |
|
|
|
|
|
|
|
|
|
|
|
local isort = null_ls.builtins.formatting.isort.with({ |
|
|
|
local isort = null_ls.builtins.formatting.isort.with({ |
|
|
|
cwd = function(params) |
|
|
|
cwd = function(params) |
|
|
@ -322,21 +324,21 @@ return require('packer').startup(function(use) |
|
|
|
end |
|
|
|
end |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
local flake8 = null_ls.builtins.diagnostics.flake8.with({ |
|
|
|
local flake8 = require("none-ls.diagnostics.flake8").with({ |
|
|
|
cwd = function(params) |
|
|
|
cwd = function(params) |
|
|
|
return find_flake8(params.root) or params.root |
|
|
|
return find_flake8(params.root) or params.root |
|
|
|
end |
|
|
|
end |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
local eslint_format = null_ls.builtins.formatting.eslint_d.with({ |
|
|
|
local eslint_format = require("none-ls.formatting.eslint_d").with({ |
|
|
|
extra_filetypes = { "svelte" }, |
|
|
|
extra_filetypes = { "svelte" }, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
local eslint_diag = null_ls.builtins.diagnostics.eslint_d.with({ |
|
|
|
local eslint_diag = require("none-ls.diagnostics.eslint_d").with({ |
|
|
|
extra_filetypes = { "svelte" }, |
|
|
|
extra_filetypes = { "svelte" }, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
local eslint_code_actions = null_ls.builtins.code_actions.eslint_d.with({ |
|
|
|
local eslint_code_actions = require("none-ls.code_actions.eslint_d").with({ |
|
|
|
extra_filetypes = { "svelte" }, |
|
|
|
extra_filetypes = { "svelte" }, |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -348,19 +350,22 @@ return require('packer').startup(function(use) |
|
|
|
eslint_diag, |
|
|
|
eslint_diag, |
|
|
|
eslint_code_actions, |
|
|
|
eslint_code_actions, |
|
|
|
null_ls.builtins.code_actions.gitsigns, |
|
|
|
null_ls.builtins.code_actions.gitsigns, |
|
|
|
|
|
|
|
flake8, |
|
|
|
isort, |
|
|
|
isort, |
|
|
|
black, |
|
|
|
black, |
|
|
|
flake8 |
|
|
|
flake8 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
end, |
|
|
|
end, |
|
|
|
requires = { "nvim-lua/plenary.nvim" }, |
|
|
|
requires = { "nvim-lua/plenary.nvim", |
|
|
|
|
|
|
|
"nvimtools/none-ls-extras.nvim" |
|
|
|
|
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
use { |
|
|
|
use { |
|
|
|
'folke/trouble.nvim', |
|
|
|
'folke/trouble.nvim', |
|
|
|
config = function() |
|
|
|
config = function() |
|
|
|
require("trouble").setup { |
|
|
|
require("trouble").setup { |
|
|
|
nmap("<leader>xx", "<cmd>TroubleToggle<cr>"), |
|
|
|
nmap("<leader>xx", "<cmd>Trouble<cr>"), |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
} |
|
|
|
} |
|
|
@ -428,7 +433,7 @@ return require('packer').startup(function(use) |
|
|
|
require('gitsigns').setup { |
|
|
|
require('gitsigns').setup { |
|
|
|
on_attach = function() |
|
|
|
on_attach = function() |
|
|
|
nmap('<leader>hd', '<cmd>Gitsigns diffthis<cr>') |
|
|
|
nmap('<leader>hd', '<cmd>Gitsigns diffthis<cr>') |
|
|
|
nmap('<leader>hp', '<cmd>Gitsigns preview_hunk<cr>') |
|
|
|
nmap('<leader>hr', '<cmd>Gitsigns reset_hunk<cr>') |
|
|
|
nmap('<leader>td', '<cmd>Gitsigns toggle_deleted<cr>') |
|
|
|
nmap('<leader>td', '<cmd>Gitsigns toggle_deleted<cr>') |
|
|
|
end |
|
|
|
end |
|
|
|
} |
|
|
|
} |
|
|
|