Add logic for selecting pyright or pylsp, remove cspell

This commit is contained in:
Evie Litherland-Smith 2023-06-16 16:41:55 +01:00
parent 8dd36f4d45
commit 698670fc84
2 changed files with 14 additions and 26 deletions

View file

@ -1 +0,0 @@
{"version":"0.2","language":"en-GB","words":["UKAEA","DVCM","indica","Ziga","Carine","ITPA","IMAS"],"allowCompoundWords":true,"useGitignore":true}

View file

@ -49,29 +49,23 @@ local config = function()
flags = { debounce_text_changes = 150 }, flags = { debounce_text_changes = 150 },
capabilities = require("cmp_nvim_lsp").default_capabilities(), capabilities = require("cmp_nvim_lsp").default_capabilities(),
} }
local lsp = require("lspconfig") local lsp = require "lspconfig"
if vim.fn.executable("pyright") == 1 then lsp["pyright"].setup(lsp_config) end if vim.fn.executable "pyright" == 1 then
if vim.fn.executable("pylsp") == 1 then lsp["pylsp"].setup(lsp_config) end lsp["pyright"].setup(lsp_config)
if vim.fn.executable("jedi-language-server") == 1 then lsp["jedi_language_server"].setup(lsp_config) end elseif vim.fn.executable "pyslp" == 1 then
if vim.fn.executable("ruff-lsp") == 1 then lsp["ruff_lsp"].setup(lsp_config) end lsp["pylsp"].setup(lsp_config)
if vim.fn.executable("lua-language-server") == 1 then lsp["lua_ls"].setup(lsp_config) end end
if vim.fn.executable("nil") == 1 then lsp["nil_ls"].setup(lsp_config) end if vim.fn.executable "ruff-lsp" == 1 then lsp["ruff_lsp"].setup(lsp_config) end
if vim.fn.executable("fortls") == 1 then lsp["fortls"].setup(lsp_config) end if vim.fn.executable "lua-language-server" == 1 then lsp["lua_ls"].setup(lsp_config) end
if vim.fn.executable("yaml-language-server") == 1 then lsp["yamlls"].setup(lsp_config) end if vim.fn.executable "nil" == 1 then lsp["nil_ls"].setup(lsp_config) end
if vim.fn.executable("vim-language-server") == 1 then lsp["vimls"].setup(lsp_config) end if vim.fn.executable "fortls" == 1 then lsp["fortls"].setup(lsp_config) end
if vim.fn.executable("bash-language-server") == 1 then lsp["bashls"].setup(lsp_config) end if vim.fn.executable "yaml-language-server" == 1 then lsp["yamlls"].setup(lsp_config) end
if vim.fn.executable "vim-language-server" == 1 then lsp["vimls"].setup(lsp_config) end
if vim.fn.executable "bash-language-server" == 1 then lsp["bashls"].setup(lsp_config) end
local builtins = require "null-ls.builtins" local builtins = require "null-ls.builtins"
local cspell = require "cspell"
local cspell_config = {
filetypes = { "json", "yaml", "html", "markdown", "norg", "gitcommit" },
config={ config_file_preferred_name = ".cspell.json" }
}
require("null-ls").setup { require("null-ls").setup {
sources = { sources = {
cspell.diagnostics.with (cspell_config),
cspell.code_actions.with (cspell_config),
builtins.code_actions.gitsigns, builtins.code_actions.gitsigns,
builtins.formatting.alejandra, builtins.formatting.alejandra,
builtins.formatting.beautysh, builtins.formatting.beautysh,
@ -93,11 +87,6 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
cond = not vim.g.vscode, cond = not vim.g.vscode,
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = { "cmp-nvim-lsp", "folke/trouble.nvim", "folke/neodev.nvim", "jose-elias-alvarez/null-ls.nvim" },
"cmp-nvim-lsp",
"folke/trouble.nvim",
"folke/neodev.nvim",
{ "jose-elias-alvarez/null-ls.nvim", dependencies = "davidmh/cspell.nvim" },
},
config = config, config = config,
} }