Have on_attach/capabilites associated with each LSP.
parent
73530c939b
commit
1c5dffb8ed
|
@ -8,7 +8,7 @@ let
|
||||||
"Julian/lean.nvim";
|
"Julian/lean.nvim";
|
||||||
config = ''
|
config = ''
|
||||||
lua << EOF
|
lua << EOF
|
||||||
require('lean').setup {
|
require('init.lsp').setup(require('lean')) {
|
||||||
abbreviations = { builtin = true },
|
abbreviations = { builtin = true },
|
||||||
mappings = true,
|
mappings = true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
nvim-lspconfig = ''
|
nvim-lspconfig = ''
|
||||||
require('lspconfig').nil_ls.setup {}
|
require('init.lsp').setup(require('lspconfig').nil_ls) {}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
extraPackages = [ pkgs.nil ];
|
extraPackages = [ pkgs.nil ];
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local function on_attach(client, bufnr)
|
||||||
|
local opts = { buffer = bufnr }
|
||||||
|
vim.keymap.set('n', 'gq', function()
|
||||||
|
vim.lsp.buf.format { async = true }
|
||||||
|
end, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
function M.setup(client)
|
||||||
|
-- Return a nested function so that we can continue invoking `setup` in the
|
||||||
|
-- familiar way.
|
||||||
|
return function(opts)
|
||||||
|
opts.on_attach = opts.on_attach or on_attach
|
||||||
|
opts.cabailities = opts.cabailities or capabilities
|
||||||
|
client.setup(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -1,7 +1,7 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.nvim_lspconfig()
|
function M.nvim_lspconfig()
|
||||||
require('lspconfig').lua_ls.setup {
|
require('init.lsp').setup(require('lspconfig').lua_ls) {
|
||||||
-- Provide completions, analysis, and location handling for plugins on the
|
-- Provide completions, analysis, and location handling for plugins on the
|
||||||
-- vim runtime path.
|
-- vim runtime path.
|
||||||
-- https://github.com/neovim/nvim-lspconfig/blob/48347089666d5b77d054088aa72e4e0b58026e6e/doc/server_configurations.md#lua_ls
|
-- https://github.com/neovim/nvim-lspconfig/blob/48347089666d5b77d054088aa72e4e0b58026e6e/doc/server_configurations.md#lua_ls
|
||||||
|
|
|
@ -26,7 +26,7 @@ function M.nvim_dap(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.nvim_lspconfig()
|
function M.nvim_lspconfig()
|
||||||
require('lspconfig').pylsp.setup {
|
require('init.lsp').setup(require('lspconfig').pylsp) {
|
||||||
settings = {
|
settings = {
|
||||||
pylsp = {
|
pylsp = {
|
||||||
-- `flake8` currently fails in some cases. Prefer the default set of
|
-- `flake8` currently fails in some cases. Prefer the default set of
|
||||||
|
|
Loading…
Reference in New Issue