mirror of https://github.com/WolfeCub/dotfiles.git
2 changed files with 43 additions and 6 deletions
@ -1,9 +1,47 @@
@@ -1,9 +1,47 @@
|
||||
local lsp = require('lspconfig') |
||||
local nvim_lsp = require('lspconfig') |
||||
local lsp_installer = require('nvim-lsp-installer') |
||||
|
||||
lsp.tsserver.setup(coq.lsp_ensure_capabilities({})) |
||||
-- Use an on_attach function to only map the following keys |
||||
-- after the language server attaches to the current buffer |
||||
local on_attach = function(client, bufnr) |
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end |
||||
|
||||
lsp.omnisharp.setup{ |
||||
cmd = { "omnisharp", "--languageserver" , "--hostPID", tostring(vim.fn.getpid()) }; |
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end |
||||
|
||||
-- Enable completion triggered by <c-x><c-o> |
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') |
||||
|
||||
-- Mappings. |
||||
|
||||
local opts = { noremap=true, silent=true } |
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions |
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts) |
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts) |
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts) |
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts) |
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts) |
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts) |
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>', opts) |
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>', opts) |
||||
end |
||||
|
||||
local server_overrides = { |
||||
omnisharp = function(opts) |
||||
opts.cmd = { "omnisharp", "--languageserver" , "--hostPID", tostring(vim.fn.getpid()) } |
||||
end, |
||||
} |
||||
|
||||
lsp.graphql.setup{} |
||||
lsp_installer.on_server_ready(function(server) |
||||
-- Specify the default options which we'll use to setup all servers |
||||
local opts = { |
||||
on_attach = on_attach, |
||||
} |
||||
|
||||
if server_overrides[server.name] then |
||||
-- Enhance the default opts with the server-specific ones |
||||
server_overrides[server.name](opts) |
||||
end |
||||
|
||||
server:setup(coq.lsp_ensure_capabilities(opts)) |
||||
end) |
||||
|
Loading…
Reference in new issue