|
|
@@ -2,44 +2,64 @@ local lspconfig = require("lspconfig")
|
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
|
local formatter = require("save-formatter")
|
|
|
|
|
|
+local ruff_pyright_lsp_base = function(mode, extra)
|
|
|
+ lspconfig.ruff.setup({
|
|
|
+ capabilities = capabilities,
|
|
|
+ on_attach = function(client, _)
|
|
|
+ client.server_capabilities.hoverProvider = false
|
|
|
+ end,
|
|
|
+ })
|
|
|
+ lspconfig.basedpyright.setup({
|
|
|
+ capabilities = capabilities,
|
|
|
+ settings = {
|
|
|
+ basedpyright = {
|
|
|
+ analysis = {
|
|
|
+ exclude = { "**/node_modules", "**/__pycache__", "**/build" },
|
|
|
+ typeCheckingMode = "off",
|
|
|
+ autoSearchPaths = true,
|
|
|
+ diagnosticMode = "openFilesOnly",
|
|
|
+ useLibraryCodeForTypes = true,
|
|
|
+
|
|
|
+ reportUnknownArgumentType = false,
|
|
|
+ reportUnknownLambdaType = false,
|
|
|
+ reportUnknownMemberType = false,
|
|
|
+ reportUnknownParameterType = false,
|
|
|
+ reportUnknownVariableType = false,
|
|
|
+
|
|
|
+ analyzeUnannotatedFunctions = true,
|
|
|
+ reportUnreachable = true,
|
|
|
+ },
|
|
|
+ openFilesOnly = true,
|
|
|
+ autoImportCompletions = true,
|
|
|
+ disableOrganizeImports = true,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+end
|
|
|
+
|
|
|
return {
|
|
|
default = {},
|
|
|
- ruff_pyright = { "ruff_pyright_format", "default_jsonls_config",
|
|
|
- "default_marksman_config",
|
|
|
- "default_sqlls_config", "default_yamlls_config", "ruff_pyright_lsp",
|
|
|
- "default_basedpyright_typechecking_options" },
|
|
|
+ ruff_pyright = { "ruff_pyright_base", "ruff_pyright_lsp_strict" },
|
|
|
+ ruff_pyright_light = { "ruff_pyright_base", "ruff_pyright_lsp_off" },
|
|
|
+ ruff_pyright_base = { "ruff_pyright_format", "default_jsonls_config",
|
|
|
+ "default_marksman_config", "default_sqlls_config",
|
|
|
+ "default_yamlls_config", "default_basedpyright_typechecking_options" },
|
|
|
ruff_pyright_format = function()
|
|
|
formatter.enable(vim.tbl_deep_extend("force", formatter.default(), {
|
|
|
python = false,
|
|
|
ruff = true,
|
|
|
}))
|
|
|
end,
|
|
|
- ruff_pyright_lsp = function()
|
|
|
- lspconfig.ruff.setup({
|
|
|
- capabilities = capabilities,
|
|
|
- on_attach = function(client, _)
|
|
|
- client.server_capabilities.hoverProvider = false
|
|
|
- end,
|
|
|
- })
|
|
|
- lspconfig.basedpyright.setup({
|
|
|
- capabilities = capabilities,
|
|
|
- settings = {
|
|
|
- basedpyright = {
|
|
|
- analysis = {
|
|
|
- exclude = { "**/node_modules", "**/__pycache__", "**/build" },
|
|
|
- typeCheckingMode = "strict",
|
|
|
- autoSearchPaths = true,
|
|
|
- diagnosticMode = "openFilesOnly",
|
|
|
- useLibraryCodeForTypes = true,
|
|
|
-
|
|
|
- analyzeUnannotatedFunctions = true,
|
|
|
- reportUnreachable = true,
|
|
|
- },
|
|
|
- openFilesOnly = true,
|
|
|
- autoImportCompletions = true,
|
|
|
- disableOrganizeImports = true,
|
|
|
- }
|
|
|
- }
|
|
|
+ ruff_pyright_lsp_strict = function()
|
|
|
+ ruff_pyright_lsp_base('strict', {})
|
|
|
+ end,
|
|
|
+ ruff_pyright_lsp_off = function()
|
|
|
+ ruff_pyright_lsp_base('off', {
|
|
|
+ reportUnknownArgumentType = false,
|
|
|
+ reportUnknownLambdaType = false,
|
|
|
+ reportUnknownMemberType = false,
|
|
|
+ reportUnknownParameterType = false,
|
|
|
+ reportUnknownVariableType = false,
|
|
|
})
|
|
|
end
|
|
|
}
|