remove legacy
This commit is contained in:
@@ -40,107 +40,3 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
||||
end
|
||||
end,
|
||||
})
|
||||
-- ]]
|
||||
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||
-- callback = function(args)
|
||||
-- local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
-- client.server_capabilities.completionProvider.triggerCharacters = vim.split("qwertyuiopasdfghjklzxcvbnm. ", "")
|
||||
-- vim.api.nvim_create_autocmd({ "TextChangedI" }, {
|
||||
-- buffer = args.buf,
|
||||
-- callback = function()
|
||||
-- vim.lsp.completion.get()
|
||||
-- end,
|
||||
-- })
|
||||
-- -- if client:supports_method("textDocument/implementation") then
|
||||
-- -- Create a keymap for vim.lsp.buf.implementation ...
|
||||
-- -- end
|
||||
-- if client.server_capabilities.inlayHintProvider then
|
||||
-- vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
|
||||
-- end
|
||||
|
||||
---[[AUTOCOMPLETION SETUP
|
||||
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||
-- callback = function(args)
|
||||
-- local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
-- client.server_capabilities.completionProvider.triggerCharacters = vim.split("qwertyuiopasdfghjklzxcvbnm. ", "")
|
||||
-- vim.api.nvim_create_autocmd({ "TextChangedI" }, {
|
||||
-- buffer = args.buf,
|
||||
-- callback = function()
|
||||
-- vim.lsp.completion.get()
|
||||
-- end,
|
||||
-- })
|
||||
-- -- if client:supports_method("textDocument/implementation") then
|
||||
-- -- Create a keymap for vim.lsp.buf.implementation ...
|
||||
-- -- end
|
||||
-- if client.server_capabilities.inlayHintProvider then
|
||||
-- vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
|
||||
-- end
|
||||
-- vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||
-- ---
|
||||
-- ---[[Code required to add documentation popup for an item
|
||||
-- local _, cancel_prev = nil, function() end
|
||||
-- vim.api.nvim_create_autocmd("CompleteChanged", {
|
||||
-- buffer = args.buf,
|
||||
-- callback = function()
|
||||
-- if client:supports_method("textDocument/implementation") then
|
||||
-- cancel_prev()
|
||||
-- local info = vim.fn.complete_info({ "selected" })
|
||||
-- local completionItem =
|
||||
-- vim.tbl_get(vim.v.completed_item, "user_data", "nvim", "lsp", "completion_item")
|
||||
-- if nil == completionItem then
|
||||
-- return
|
||||
-- end
|
||||
-- _, cancel_prev = vim.lsp.buf_request(
|
||||
-- args.buf,
|
||||
-- vim.lsp.protocol.Methods.completionItem_resolve,
|
||||
-- completionItem,
|
||||
-- function(err, item, ctx)
|
||||
-- if not item then
|
||||
-- return
|
||||
-- end
|
||||
-- local docs = (item.documentation or {}).value
|
||||
-- local win = vim.api.nvim__complete_set(info["selected"], { info = docs })
|
||||
-- if win.winid and vim.api.nvim_win_is_valid(win.winid) then
|
||||
-- vim.treesitter.start(win.bufnr, "markdown")
|
||||
-- vim.wo[win.winid].conceallevel = 3
|
||||
-- end
|
||||
-- end
|
||||
-- )
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
-- ---]]
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- -- Expanding multiline snippets
|
||||
-- vim.api.nvim_create_augroup("user-snippet-expand", {})
|
||||
-- vim.api.nvim_create_autocmd("CompleteDone", {
|
||||
-- group = "user-snippet-expand",
|
||||
-- desc = "Expand LSP snippet",
|
||||
-- pattern = "*",
|
||||
-- callback = function(opts)
|
||||
-- local comp = vim.v.completed_item
|
||||
-- local item = vim.tbl_get(comp, "user_data", "nvim", "lsp", "completion_item")
|
||||
--
|
||||
-- -- check that we were given a snippet
|
||||
-- if not item or not item.insertTextFormat or item.insertTextFormat == 1 then
|
||||
-- return
|
||||
-- end
|
||||
--
|
||||
-- -- remove the inserted text
|
||||
-- local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
-- local line = vim.api.nvim_get_current_line()
|
||||
-- local lnum = cursor[1] - 1
|
||||
-- local start_char = cursor[2] - #comp.word
|
||||
-- vim.api.nvim_buf_set_text(opts.buf, lnum, start_char, lnum, #line, { "" })
|
||||
--
|
||||
-- -- insert snippet
|
||||
-- local snip_text = vim.tbl_get(item, "textEdit", "newText") or item.insertText
|
||||
-- assert(snip_text, "Language server indicated it had a snippet, but no snippet text could be found!")
|
||||
-- require("luasnip").lsp_expand(snip_text)
|
||||
-- end,
|
||||
-- })
|
||||
-- ---AUTOCOMPLETION SETUP END]]
|
||||
|
||||
Reference in New Issue
Block a user