summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/configs/lspconfig.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/configs/lspconfig.lua')
-rw-r--r--.config/nvim/lua/configs/lspconfig.lua67
1 files changed, 67 insertions, 0 deletions
diff --git a/.config/nvim/lua/configs/lspconfig.lua b/.config/nvim/lua/configs/lspconfig.lua
new file mode 100644
index 0000000..34c2fb5
--- /dev/null
+++ b/.config/nvim/lua/configs/lspconfig.lua
@@ -0,0 +1,67 @@
+-- load defaults i.e lua_lsp
+require("nvchad.configs.lspconfig").defaults()
+
+local lspconfig = require "lspconfig"
+
+-- EXAMPLE
+local servers = { "html", "cssls" }
+local nvlsp = require "nvchad.configs.lspconfig"
+local spell_words = {}
+
+-- lsps with default config
+for _, lsp in ipairs(servers) do
+ lspconfig[lsp].setup {
+ on_attach = nvlsp.on_attach,
+ on_init = nvlsp.on_init,
+ capabilities = nvlsp.capabilities,
+ }
+end
+
+lspconfig.ltex.setup({
+ settings = {
+ ltex = {
+ language = "en-US",
+ enabled = true,
+ dictionary = {
+ ["en-US"] = spell_words,
+ },
+ },
+ },
+})
+
+lspconfig.eslint.setup({
+ on_attach = function(client, bufnr)
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ buffer = bufnr,
+ command = "EslintFixAll",
+ })
+ end,
+})
+
+lspconfig.rust_analyzer.setup {
+ -- server-specific settings. See ':help lspconfig-setup'
+ settings = {
+ ['rust_analyzer'] = {},
+ },
+}
+
+lspconfig.basedpyright.setup {
+ cmd = { "basedpyright-langserver", "--stdio" },
+ filetypes = { "python" },
+ settings = {
+ basedpright = {
+ analysis = {
+ autoSearchPaths = true,
+ diagnosticMode = "openFilesOnly",
+ uuseLibraryCodeForTypes = true
+ },
+ },
+ },
+}
+
+-- configuring single server, example: typescript
+-- lspconfig.tsserver.setup {
+-- on_attach = nvlsp.on_attach,
+-- on_init = nvlsp.on_init,
+-- capabilities = nvlsp.capabilities,
+-- }