aboutsummaryrefslogtreecommitdiff
path: root/nvim_alt/completion.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nvim_alt/completion.lua')
-rw-r--r--nvim_alt/completion.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/nvim_alt/completion.lua b/nvim_alt/completion.lua
new file mode 100644
index 0000000..747607e
--- /dev/null
+++ b/nvim_alt/completion.lua
@@ -0,0 +1,21 @@
1vim.api.nvim_create_autocmd("LspAttach", {
2 callback = function(ev)
3 local client = vim.lsp.get_client_by_id(ev.data.client_id)
4 -- if client and client:supports_method("textDocument/completion") then
5 -- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
6 -- end
7
8 if client and not client:supports_method('textDocument/willSaveWaitUntil') and
9 client:supports_method('textDocument/formatting') then
10 vim.api.nvim_create_autocmd('BufWritePre', {
11 group = vim.api.nvim_create_augroup('my.lsp', { clear = false }),
12 buffer = ev.buf,
13 callback = function()
14 vim.lsp.buf.format({ bufnr = ev.buf, id = client.id, timeout_ms = 1000 })
15 end,
16 })
17 end
18 end,
19})
20
21vim.o.winborder = 'rounded'