fix nvim lsp_keymap function call
This commit is contained in:
@@ -88,8 +88,6 @@ lua <<EOF
|
|||||||
-- Use an on_attach function to only map the following keys
|
-- Use an on_attach function to only map the following keys
|
||||||
-- after the language server attaches to the current buffer
|
-- after the language server attaches to the current buffer
|
||||||
local lsp_keymap = require('lsp_keymap')
|
local lsp_keymap = require('lsp_keymap')
|
||||||
local on_attach = lsp_keymap.attach(client, bufnr)
|
|
||||||
|
|
||||||
|
|
||||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
lsp_installer.on_server_ready(function(server)
|
lsp_installer.on_server_ready(function(server)
|
||||||
@@ -101,7 +99,7 @@ lua <<EOF
|
|||||||
|
|
||||||
-- This setup() function is exactly the same as lspconfig's setup function.
|
-- This setup() function is exactly the same as lspconfig's setup function.
|
||||||
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
server:setup {capabilities = capabilities, on_attach = on_attach}
|
server:setup {capabilities = capabilities, on_attach = lsp_keymap.custom_attach}
|
||||||
end)
|
end)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ local lsp_installer = require("nvim-lsp-installer")
|
|||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
-- Use an on_attach function to only map the following keys
|
||||||
-- after the language server attaches to the current buffer
|
-- after the language server attaches to the current buffer
|
||||||
local lsp_keymap = require('lsp_keymap')
|
local lsp_keymap = require('lsp_keymap')
|
||||||
local on_attach = lsp_keymap.attach(client, bufnr)
|
|
||||||
|
|
||||||
-- Register a handler that will be called for all installed servers.
|
-- Register a handler that will be called for all installed servers.
|
||||||
-- Alternatively, you may also register handlers on specific server instances instead (see example below).
|
-- Alternatively, you may also register handlers on specific server instances instead (see example below).
|
||||||
@@ -50,7 +49,7 @@ lsp_installer.on_server_ready(function(server)
|
|||||||
-- server:setup(opts)
|
-- server:setup(opts)
|
||||||
|
|
||||||
-- With coq.nvim:
|
-- With coq.nvim:
|
||||||
server:setup(coq.lsp_ensure_capabilities{on_attach = on_attach})
|
server:setup(coq.lsp_ensure_capabilities{on_attach = lsp_keymap.custom_attach})
|
||||||
end)
|
end)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
function M.attach(client, bufnr)
|
function M.custom_attach(client, bufnr)
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
|
|
||||||
@@ -28,6 +28,8 @@ function M.attach(client, bufnr)
|
|||||||
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||||
|
|
||||||
|
print("Language Server attached!")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Reference in New Issue
Block a user