diff options
Diffstat (limited to 'nvim/completion.lua')
| -rw-r--r-- | nvim/completion.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nvim/completion.lua b/nvim/completion.lua new file mode 100644 index 0000000..d477367 --- /dev/null +++ b/nvim/completion.lua | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | vim.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 client:supports_method('textDocument/formatting') then | ||
| 9 | vim.api.nvim_create_autocmd('BufWritePre', { | ||
| 10 | group = vim.api.nvim_create_augroup('my.lsp', {clear=false}), | ||
| 11 | buffer = ev.buf, | ||
| 12 | callback = function() | ||
| 13 | vim.lsp.buf.format({ bufnr = ev.buf, id = client.id, timeout_ms = 1000 }) | ||
| 14 | end, | ||
| 15 | }) | ||
| 16 | end | ||
| 17 | end, | ||
| 18 | }) | ||
| 19 | |||
| 20 | vim.o.winborder = 'rounded' | ||
| 21 | |||
