changes to lsp regarding deno and tsserver
This commit is contained in:
parent
e87724e019
commit
fa7cf6ee09
@ -39,4 +39,4 @@ require "user.zk"
|
|||||||
require "user.tabout"
|
require "user.tabout"
|
||||||
require "user.cybu"
|
require "user.cybu"
|
||||||
require "user.dap"
|
require "user.dap"
|
||||||
require "user.noice"
|
-- require "user.noice"
|
||||||
|
|||||||
@ -82,5 +82,5 @@ vim.cmd [[autocmd VimLeave *.tex !texclear %]]
|
|||||||
|
|
||||||
-- Run install when editing my scripts
|
-- Run install when editing my scripts
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
autocmd BufWritePost ~/repos/inks-scripts/** !~/repos/inks-scripts/install
|
autocmd BufWritePost ~/repos/inks-scripts/scripts/** !~/repos/inks-scripts/install
|
||||||
]]
|
]]
|
||||||
|
|||||||
@ -82,7 +82,7 @@ local function attach_navic(client, bufnr)
|
|||||||
vim.g.navic_silence = false
|
vim.g.navic_silence = false
|
||||||
local status_ok, navic = pcall(require, "nvim-navic")
|
local status_ok, navic = pcall(require, "nvim-navic")
|
||||||
if not status_ok then
|
if not status_ok then
|
||||||
print"nvim-navic error!"
|
print("nvim-navic error!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if client.server_capabilities.documentSymbolProvider then
|
if client.server_capabilities.documentSymbolProvider then
|
||||||
@ -90,30 +90,35 @@ local function attach_navic(client, bufnr)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function lsp_keymaps(bufnr)
|
local function disable_deno_formatting(client)
|
||||||
local opts = { noremap = true, silent = true }
|
if client.name == "denols" then
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
require("null-ls").disable({ "prettier" })
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>Telescope lsp_declarations<CR>", opts)
|
end
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
end
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", "<cmd>Telescope lsp_implementations<CR>", opts)
|
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>Telescope lsp_references<CR>", opts)
|
local function resolve_tsserver_deno(client)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
local active_clients = vim.lsp.get_active_clients()
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
if client.name == "denols" then
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-f>", "<cmd>Format<cr>", opts)
|
for _, client_ in pairs(active_clients) do
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-a>", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
|
-- stop tsserver if denols is already active
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-s>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
if client_.name == "tsserver" then
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
client_.stop()
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
end
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
end
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
|
elseif client.name == "tsserver" then
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
for _, client_ in pairs(active_clients) do
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
-- prevent tsserver from starting if denols is already active
|
||||||
-- vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format({ async = true })' ]]
|
if client_.name == "denols" then
|
||||||
|
client.stop()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.on_attach = function(client, bufnr)
|
M.on_attach = function(client, bufnr)
|
||||||
lsp_keymaps(bufnr)
|
|
||||||
attach_navic(client, bufnr)
|
attach_navic(client, bufnr)
|
||||||
|
disable_deno_formatting(client)
|
||||||
|
resolve_tsserver_deno(client)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.enable_format_on_save()
|
function M.enable_format_on_save()
|
||||||
|
|||||||
@ -18,6 +18,7 @@ local servers = {
|
|||||||
"sumneko_lua",
|
"sumneko_lua",
|
||||||
"omnisharp",
|
"omnisharp",
|
||||||
"tflint",
|
"tflint",
|
||||||
|
"denols",
|
||||||
"terraformls",
|
"terraformls",
|
||||||
"tsserver",
|
"tsserver",
|
||||||
"pyright",
|
"pyright",
|
||||||
@ -73,7 +74,7 @@ for _, server in pairs(servers) do
|
|||||||
capabilities = require("user.lsp.handlers").capabilities,
|
capabilities = require("user.lsp.handlers").capabilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
server = vim.split(server, "@")[1]
|
server = vim.split(server, "@", {})[1]
|
||||||
|
|
||||||
if server == "yamlls" then
|
if server == "yamlls" then
|
||||||
local yamlls_opts = require("user.lsp.settings.yamlls")
|
local yamlls_opts = require("user.lsp.settings.yamlls")
|
||||||
@ -92,11 +93,6 @@ for _, server in pairs(servers) do
|
|||||||
opts = vim.tbl_deep_extend("force", tsserver_opts, opts)
|
opts = vim.tbl_deep_extend("force", tsserver_opts, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
if server == "pyright" then
|
|
||||||
local pyright_opts = require("user.lsp.settings.pyright")
|
|
||||||
opts = vim.tbl_deep_extend("force", pyright_opts, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
if server == "solc" then
|
if server == "solc" then
|
||||||
local solc_opts = require("user.lsp.settings.solc")
|
local solc_opts = require("user.lsp.settings.solc")
|
||||||
opts = vim.tbl_deep_extend("force", solc_opts, opts)
|
opts = vim.tbl_deep_extend("force", solc_opts, opts)
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
return {
|
|
||||||
cmd = { "pyright" },
|
|
||||||
settings = {
|
|
||||||
python = {
|
|
||||||
analysis = {
|
|
||||||
typeCheckingMode = "basic",
|
|
||||||
diagnosticMode = "workspace",
|
|
||||||
inlayHints = {
|
|
||||||
variableTypes = true,
|
|
||||||
functionReturnTypes = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@ -46,7 +46,7 @@ return packer.startup(function(use)
|
|||||||
use("wbthomason/packer.nvim") -- Have packer manage inself
|
use("wbthomason/packer.nvim") -- Have packer manage inself
|
||||||
|
|
||||||
-- Noice :D
|
-- Noice :D
|
||||||
use("folke/noice.nvim") -- magic by folke.
|
-- use("folke/noice.nvim") -- magic by folke.
|
||||||
|
|
||||||
-- Lua Development
|
-- Lua Development
|
||||||
use("nvim-lua/plenary.nvim") -- useful lua functions
|
use("nvim-lua/plenary.nvim") -- useful lua functions
|
||||||
@ -66,10 +66,6 @@ return packer.startup(function(use)
|
|||||||
use({ -- I'm currently just using this for a functional code action menu for omnisharp, I want to look further into its functions though.
|
use({ -- I'm currently just using this for a functional code action menu for omnisharp, I want to look further into its functions though.
|
||||||
"glepnir/lspsaga.nvim",
|
"glepnir/lspsaga.nvim",
|
||||||
branch = "main",
|
branch = "main",
|
||||||
config = function ()
|
|
||||||
local saga = require"lspsaga"
|
|
||||||
saga.init_lsp_saga({})
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
use("jose-elias-alvarez/null-ls.nvim")
|
use("jose-elias-alvarez/null-ls.nvim")
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user