Fix LSP setup
This commit is contained in:
parent
c4599db677
commit
15924b69d1
|
@ -8,33 +8,30 @@
|
|||
"cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp-tmux": { "branch": "main", "commit": "97ec06b8030b8bf6d1fd83d49bdd16c98e04c845" },
|
||||
"cmp-tmux": { "branch": "main", "commit": "95b1b921802e6f60627b3e76afb9380fddd87f9a" },
|
||||
"cmp-treesitter": { "branch": "master", "commit": "13e4ef8f4dd5639fca2eb9150e68f47639a9b37d" },
|
||||
"cmp_kitty": { "branch": "main", "commit": "a0716db2efb4c452600ef1e4a3ca610889279118" },
|
||||
"codeium.vim": { "branch": "main", "commit": "9286586f790f837c4c3032f2124559936e77e6ed" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
|
||||
"codeium.vim": { "branch": "main", "commit": "f2d90dedb45e35f7563d2ce3a31c6928f79de678" },
|
||||
"git-messenger.vim": { "branch": "master", "commit": "8a61bdfa351d4df9a9118ee1d3f45edbed617072" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "6e4027ae957cddf7b193adfaec4a8f9e03b4555f" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"neogit": { "branch": "master", "commit": "0d0879b0045fb213c328126969a3317c0963d34a" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
|
||||
"nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" },
|
||||
"nvim-html-css": { "branch": "main", "commit": "c072b05c56a40d3ec7874fa487723e6bef5d97f8" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "6b9f4bbe0aa1f351fd4845dc5fd4f3450b010f88" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "030defdb6522f5f716d8201d20ca1a2baa57ca66" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "1398b1ba4619cef240abd496b500b95819c8c496" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "7f5cf1121f772850a30bdaf83fb448e88846aa58" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "efafd73efa9bc8c26282aed563ba0f01c7465b06" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "70f03829afa31f8b619b56296cdcaa921118d912" },
|
||||
"nvim-treesitter-endwise": { "branch": "master", "commit": "60e8c288e011403f248b5f6478dde12bed8a6c55" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "14ac5887110b06b89a96881d534230dac3ed134d" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "4adea17610d140a99c313e3f79a9dc01825d59ae" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
|
||||
"repl.nvim": { "branch": "master", "commit": "ec202eb5786b305c7d73b8cab5ee8fe69a2534a7" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
|
||||
"vim-cool": { "branch": "master", "commit": "662e7b11064cbeedad17c45d2fe926e78d3cd0b6" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "011cf4fcb93a9649ffc6dcdff56ef948f5d0f7cc" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "41beedabc7e948c787ea5696e04c3544c3674e23" },
|
||||
"vim-rails": { "branch": "master", "commit": "3a155462d1c346e291595400ca238037d02a357f" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-wordmotion": { "branch": "master", "commit": "81d9bd298376ab0dc465c85d55afa4cb8d5f47a1" },
|
||||
"vimwiki": { "branch": "dev", "commit": "fde35bb87e45abe930eebef5ab99a16289e53789" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }
|
||||
}
|
|
@ -1,3 +1,87 @@
|
|||
-- textDocument/diagnostic support until 0.10.0 is released
|
||||
_timers = {}
|
||||
local function setup_diagnostics(client, buffer)
|
||||
if require("vim.lsp.diagnostic")._enable then
|
||||
return
|
||||
end
|
||||
|
||||
local diagnostic_handler = function()
|
||||
local params = vim.lsp.util.make_text_document_params(buffer)
|
||||
client.request("textDocument/diagnostic", { textDocument = params }, function(err, result)
|
||||
if err then
|
||||
local err_msg = string.format("diagnostics error - %s", vim.inspect(err))
|
||||
vim.lsp.log.error(err_msg)
|
||||
end
|
||||
local diagnostic_items = {}
|
||||
if result then
|
||||
diagnostic_items = result.items
|
||||
end
|
||||
vim.lsp.diagnostic.on_publish_diagnostics(
|
||||
nil,
|
||||
vim.tbl_extend("keep", params, { diagnostics = diagnostic_items }),
|
||||
{ client_id = client.id }
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
diagnostic_handler() -- to request diagnostics on buffer when first attaching
|
||||
|
||||
vim.api.nvim_buf_attach(buffer, false, {
|
||||
on_lines = function()
|
||||
if _timers[buffer] then
|
||||
vim.fn.timer_stop(_timers[buffer])
|
||||
end
|
||||
_timers[buffer] = vim.fn.timer_start(200, diagnostic_handler)
|
||||
end,
|
||||
on_detach = function()
|
||||
if _timers[buffer] then
|
||||
vim.fn.timer_stop(_timers[buffer])
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- adds ShowRubyDeps command to show dependencies in the quickfix list.
|
||||
-- add the `all` argument to show indirect dependencies as well
|
||||
local function add_ruby_deps_command(client, bufnr)
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "ShowRubyDeps",
|
||||
function(opts)
|
||||
|
||||
local params = vim.lsp.util.make_text_document_params()
|
||||
|
||||
local showAll = opts.args == "all"
|
||||
|
||||
client.request("rubyLsp/workspace/dependencies", params,
|
||||
function(error, result)
|
||||
if error then
|
||||
print("Error showing deps: " .. error)
|
||||
return
|
||||
end
|
||||
|
||||
local qf_list = {}
|
||||
for _, item in ipairs(result) do
|
||||
if showAll or item.dependency then
|
||||
table.insert(qf_list, {
|
||||
text = string.format("%s (%s) - %s",
|
||||
item.name,
|
||||
item.version,
|
||||
item.dependency),
|
||||
|
||||
filename = item.path
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
vim.fn.setqflist(qf_list)
|
||||
vim.cmd('copen')
|
||||
end, bufnr)
|
||||
end, {nargs = "?", complete = function()
|
||||
return {"all"}
|
||||
end})
|
||||
end
|
||||
|
||||
|
||||
|
||||
--Enable (broadcasting) snippet capability for completion
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
@ -6,7 +90,12 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|||
-- Stimulus
|
||||
require'lspconfig'.stimulus_ls.setup{}
|
||||
-- Ruby
|
||||
require'lspconfig'.ruby_ls.setup{}
|
||||
require("lspconfig").ruby_ls.setup({
|
||||
on_attach = function(client, buffer)
|
||||
setup_diagnostics(client, buffer)
|
||||
add_ruby_deps_command(client, buffer)
|
||||
end,
|
||||
})
|
||||
-- CSS
|
||||
require'lspconfig'.cssls.setup {
|
||||
capabilities = capabilities,
|
||||
|
|
|
@ -71,8 +71,6 @@ require("lazy").setup({
|
|||
"Eandrju/cellular-automaton.nvim",
|
||||
-- Auto disable search highlight
|
||||
"romainl/vim-cool",
|
||||
-- Wiki
|
||||
"vimwiki/vimwiki",
|
||||
-- Focus on current buffer
|
||||
{
|
||||
"folke/zen-mode.nvim",
|
||||
|
@ -82,22 +80,8 @@ require("lazy").setup({
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
require("trouble").setup()
|
||||
end
|
||||
},
|
||||
"mateuszwieloch/automkdir.nvim",
|
||||
{
|
||||
"NeogitOrg/neogit",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim", -- required
|
||||
"sindrets/diffview.nvim", -- optional - Diff integration
|
||||
"nvim-telescope/telescope.nvim", -- optional
|
||||
},
|
||||
config = true
|
||||
}
|
||||
-- REPL
|
||||
"https://gitlab.com/HiPhish/repl.nvim"
|
||||
})
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ vim.keymap.set('n', '<leader>tgh', builtin.git_bcommits, {}) -- Current buffer's
|
|||
vim.keymap.set('n', '<leader>tgb', builtin.git_branches, {}) -- CR: checkout, C-t: track, C-r: rebase, C-a: create, C-s: switch, C-d: delete, C-y: merge
|
||||
vim.keymap.set('n', '<leader>tgs', builtin.git_stash, {}) -- List stash, apply with CR
|
||||
-- LSP functionality (tl prefix)
|
||||
vim.keymap.set('n', '<leader>tla', function() vim.lsp.buf.code_action() end, bufopts)
|
||||
vim.keymap.set('n', '<leader>tlr', builtin.lsp_references, {})
|
||||
vim.keymap.set('n', '<leader>tli', builtin.lsp_incoming_calls, {})
|
||||
vim.keymap.set('n', '<leader>tlo', builtin.lsp_outgoing_calls, {})
|
||||
|
@ -49,6 +50,8 @@ vim.keymap.set('n', '<leader>zz', require('zen-mode').toggle)
|
|||
-- AAAARGH
|
||||
vim.keymap.set("n", "<leader>fml", "<cmd>CellularAutomaton make_it_rain<CR>")
|
||||
vim.keymap.set("n", "<leader>cnw", "<cmd>CellularAutomaton game_of_life<CR>")
|
||||
-- Codeium
|
||||
vim.keymap.set("n", "<leader>cc", "<cmd>call codeium#Chat()<CR>")
|
||||
|
||||
-- Custom Telescope commands for Rails
|
||||
vim.keymap.set('n', '<leader>trj', function()
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
neww 'IRC'
|
Loading…
Reference in New Issue