aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/home/.config/nvim/lua/cfg/lsp.lua
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2024-05-22 17:22:31 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2024-05-22 17:22:31 +0100
commitcdcc29eda36fcfe192dd3afd83d680732023c560 (patch)
treecce9bd6e281fbed7154e2a1db8455964108d0a4d /home/.config/nvim/lua/cfg/lsp.lua
parent2a244bec022d821c0790e8a30a91a3365b097a3d (diff)
downloaddotfiles-cdcc29eda36fcfe192dd3afd83d680732023c560.tar.gz
dotfiles-cdcc29eda36fcfe192dd3afd83d680732023c560.tar.bz2
dotfiles-cdcc29eda36fcfe192dd3afd83d680732023c560.zip
[nvim] Privatize lsp functions
Diffstat (limited to 'home/.config/nvim/lua/cfg/lsp.lua')
-rw-r--r--home/.config/nvim/lua/cfg/lsp.lua53
1 files changed, 0 insertions, 53 deletions
diff --git a/home/.config/nvim/lua/cfg/lsp.lua b/home/.config/nvim/lua/cfg/lsp.lua
deleted file mode 100644
index 894b578..0000000
--- a/home/.config/nvim/lua/cfg/lsp.lua
+++ /dev/null
@@ -1,53 +0,0 @@
-local M = {}
-local map = require("mapper")
-local lspconfig = require("lspconfig")
-
-function M.on_attach_wrapper(client, bufnr, opts)
- local autocmd = vim.api.nvim_create_autocmd
-
- if client.supports_method("textDocument/codeLens") then
- autocmd(
- { "CursorHold", "CursorHoldI", "InsertLeave" },
- { buffer = bufnr, callback = vim.lsp.codelens.refresh }
- )
- map.n("gl", vim.lsp.codelens.run, { buffer = bufnr })
- end
-
- map.n("<c-]>", vim.lsp.buf.definition, { buffer = bufnr })
- map.n("gD", vim.lsp.buf.declaration, { buffer = bufnr })
- map.n("gR", vim.lsp.buf.rename, { buffer = bufnr })
- map.n("ga", vim.lsp.buf.code_action, { buffer = bufnr })
- map.v("ga", vim.lsp.buf.code_action, { buffer = bufnr })
-end
-
-function M.switch_source_header_splitcmd(bufnr, splitcmd)
- bufnr = lspconfig.util.validate_bufnr(bufnr)
- local clangd_client = lspconfig.util.get_active_client_by_name(
- bufnr,
- "clangd"
- )
- local params = { uri = vim.uri_from_bufnr(bufnr) }
- if clangd_client then
- clangd_client.request(
- "textDocument/switchSourceHeader",
- params,
- function(err, result)
- if err then
- error(tostring(err))
- end
- if not result then
- print("Corresponding file cannot be determined")
- return
- end
- vim.api.nvim_command(splitcmd .. " " .. vim.uri_to_fname(result))
- end,
- bufnr
- )
- else
- print(
- "method textDocument/switchSourceHeader is not supported by any servers active on the current buffer"
- )
- end
-end
-
-return M