diff options
author | talha <talha@talhaamir.xyz> | 2025-01-10 14:54:54 +0500 |
---|---|---|
committer | talha <talha@talhaamir.xyz> | 2025-01-10 15:01:25 +0500 |
commit | ec235190e8f3240b78f943f6fbb10408783949d0 (patch) | |
tree | 6b1a447a5c68584e54cc0c03235b77d37d61897d /after/plugin/lsp.lua | |
parent | 440cc9de7021c7059523b6dafbf02f247291f160 (diff) |
initializing new branch
Diffstat (limited to 'after/plugin/lsp.lua')
-rw-r--r-- | after/plugin/lsp.lua | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index b0977c1..41e7870 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -45,27 +45,38 @@ lsp.on_attach(function(client, bufnr) vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("n", "<leader>vlf", function() + vim.keymap.set("n", "<leader>vlf", function() vim.lsp.buf.format({ async = false, timeout_ms = 10000, - filter = allow_format({'rust_analyzer', 'tsserver'}), - }) + filter = allow_format({'rust_analyzer', 'tsserver', 'gopls', 'clangd', 'html-lsp'}), + }) end, opts) vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) end) + -- specific setup for python as it's lsp does not come with formatting require('lspconfig').pyright.setup({ single_file_support = false, - on_attach = function(client, bufnr) - local opts = {buffer = bfnr, remap = false} + on_attach = function(_, bufnr) + local opts = {buffer = bufnr, remap = false} vim.keymap.set({'n', 'x'}, '<leader>vcf', function() local filename = GetCurrFileName() vim.cmd(":silent !autopep8 -i " .. filename) vim.cmd(":silent !isort " .. filename) - end, opts) - end + end, opts) + end, +}) + +require('lspconfig').lua_ls.setup({ + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + } }) lsp.setup() @@ -105,3 +116,10 @@ cmp.setup({ end, }, }) + +cmp.setup.filetype({ 'sql' }, { + sources = { + { name = 'vim-dadbod-completion' }, + { name = 'buffer'}, + }, +}) |