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