configurating pyrefly

This commit is contained in:
huyjaky
2026-01-04 10:30:04 +07:00
parent 70f0c7fe5d
commit d409682cc6
7 changed files with 92 additions and 108 deletions

View File

@@ -35,36 +35,31 @@ vim.api.nvim_create_autocmd("BufWinEnter", {
command = "let @/ = ''",
})
-- vim.lsp.config("pyrefly", {
-- -- example of how to run `uv` installed Pyrefly without adding to your path
-- cmd = { "uvx", "pyrefly", "-c", "~/.config/nvim/pyrefly_config.yaml", "lsp" },
-- capabilities = {
-- textDocument = {
-- completion = {
-- completionItem = {
-- snippetSupport = false,
-- preselectSupport = false,
-- },
-- },
-- },
-- },
-- })
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function() vim.opt_local.spell = false end,
})
vim.lsp.enable "pyrefly"
vim.lsp.config("pyrefly", {
cmd = {
"uvx",
"pyrefly",
"lsp",
},
capabilities = {
textDocument = {
completion = {
completionItem = {
snippetSupport = false,
preselectSupport = false,
},
},
},
-- example of how to run `uv` installed Pyrefly without adding to your path
cmd = { "uvx", "pyrefly", "lsp" },
filetypes = { 'python' },
root_markers = {
'pyrefly.toml',
'pyproject.toml',
'setup.py',
'setup.cfg',
'requirements.txt',
'Pipfile',
'.git',
'.venv',
'.env',
},
on_init = function(client)
client.server_capabilities.definitionProvider = false
client.server_capabilities.renameProvider = false
client.server_capabilities.diagnosticProvider = false
-- client.server_capabilities.inlayHintProvider = false
end,
})

View File

@@ -27,9 +27,6 @@ return {
-- jedi_language_server = require "plugins.configs.lsp.config.jedi_language",
-- ruff = require "plugins.configs.lsp.config.ruff",
-- pylsp = require "plugins.configs.lsp.config.pylsp",
pyrefly = {
}
},
-- customize how language servers are attached
handlers = {
@@ -114,13 +111,21 @@ return {
-- if client.name == "jedi_language_server" then client.server_capabilities.renameProvider = false end
if client.name == "pyrefly" then
-- client.server_capabilities.hoverProvider = false
-- client.server_capabilities.signatureHelpProvider = nil
client.server_capabilities.definitionProvider = false
-- client.server_capabilities.referencesProvider = false
-- client.server_capabilities.implementationProvider = false
end
if client.name == "pyright" then
-- client.server_capabilities.renameProvider = false
-- client.server_capabilities.definitionProvider = false
client.server_capabilities.inlayHintProvider = false
client.server_capabilities.hoverProvider = false
client.server_capabilities.renameProvider = false
client.server_capabilities.signatureHelpProvider = nil
client.server_capabilities.completionProvider = nil
client.server_capabilities.definitionProvider = false
client.server_capabilities.codeLensProvider = nil
client.server_capabilities.colorProvider = false
client.server_capabilities.callHierarchyProvider = false
@@ -148,41 +153,6 @@ return {
fileOperations = { supported = false },
}
end
-- if client.name == "basedpyright" then
-- -- client.server_capabilities.definitionProvider = false # turn on inlay hints
-- client.server_capabilities.renameProvider = false
-- client.server_capabilities.completionProvider = nil
-- client.server_capabilities.hoverProvider = false
-- client.server_capabilities.signatureHelpProvider = nil
--
-- client.server_capabilities.codeLensProvider = nil
-- client.server_capabilities.colorProvider = false
-- client.server_capabilities.callHierarchyProvider = false
-- client.server_capabilities.documentFormattingProvider = false
-- client.server_capabilities.documentRangeFormattingProvider = false
-- client.server_capabilities.declarationProvider = false
-- client.server_capabilities.documentLinkProvider = nil
-- client.server_capabilities.documentOnTypeFormattingProvider = nil
-- client.server_capabilities.documentSymbolProvider = false
-- client.server_capabilities.inlineCompletionProvider = false
-- client.server_capabilities.inlineValueProvider = false
-- client.server_capabilities.notebookDocumentSync = nil
-- client.server_capabilities.typeDefinitionProvider = false
-- client.server_capabilities.workspaceSymbolProvider = false
-- client.server_capabilities.monikerProvider = false
-- client.server_capabilities.semanticTokensProvider = nil
-- client.server_capabilities.referencesProvider = false
-- client.server_capabilities.implementationProvider = false
-- client.server_capabilities.foldingRangeProvider = false
-- client.server_capabilities.selectionRangeProvider = false
-- client.server_capabilities.linkedEditingRangeProvider = false
-- client.server_capabilities.executeCommandProvider = nil
-- client.server_capabilities.workspace = {
-- workspaceFolders = { supported = false },
-- fileOperations = { supported = false },
-- }
-- end
end,
},
}

View File

@@ -0,0 +1,42 @@
return {
before_init = function(_, c)
if not c.settings then c.settings = {} end
if not c.settings.python then c.settings.python = {} end
c.settings.python.pythonPath = vim.fn.exepath "python3"
end,
settings = {
python = {
disableLanguageServices = true,
disableOrganizeImports = true,
disableTaggedHints = true,
openFilesOnly = true,
useLibraryCodeForTypes = false,
analysis = {
useLibraryCodeForTypes = false,
autoImportCompletions = false,
diagnosticMode = "openFilesOnly",
typeCheckingMode = "off",
autoSearchPath = false,
logLevel = "Error",
verboseOutput = false,
pythonPlatform = "Linux",
exclude = {
"**/unsloth_compiled_cache/**",
"**/__pycache__/**",
"**/.venv/**",
"__index__",
"**/.*",
},
ignore = {
"**/unsloth_compiled_cache/**",
"**/__pycache__/**",
"__index__",
"**/.venv/**",
"**/*.ipynb",
},
},
},
},
}

View File

@@ -9,7 +9,7 @@ return {
type = "󰜁 ",
parameter = "󰏪 ",
offspec = "󰀒 ", -- hint kind not defined in official LSP spec
unknown = " ", -- hint kind is nil
unknown = "", -- hint kind is nil
},
label = {
truncateAtChars = 100,

View File

@@ -13,6 +13,7 @@ return {
-- { "ray-x/lsp_signature.nvim", enabled = false },
{ "brenoprata10/nvim-highlight-colors", enabled = false },
{ "OXY2DEV/markview.nvim", enabled = false },
-- Disabled development plugins
{ "mfussenegger/nvim-dap", enabled = false },

View File

@@ -38,29 +38,5 @@ return {
},
},
},
{
"OXY2DEV/markview.nvim",
lazy = false,
ft = function()
local plugin = require("lazy.core.config").spec.plugins["markview.nvim"]
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
return opts.filetypes or { "markdown", "quarto", "rmd" }
end,
dependencies = {
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed =
require("astrocore").list_insert_unique(opts.ensure_installed, { "html", "markdown", "markdown_inline" })
end
end,
"saghen/blink.cmp"
},
opts = {
preview = {
hybrid_modes = { "n" },
headings = { shift_width = 0 },
},
},
},
}