Replies: 4 comments 19 replies
-
just change the args from the pylsp to ruff & make sure it's installed on path (both ruff and ruff-lsp) |
Beta Was this translation helpful? Give feedback.
-
Hey now that Helix support multi LSP. my setting are working well with Pyright + ruff as LSP and black + ruff as formatter [language-server.pyright]
command = "pyright-langserver"
args = ["--stdio"]
[language-server.pyright.config]
python.analysis.venvPath = "."
python.analysis.venv = ".venv"
python.analysis.lint = true
python.analysis.inlayHint.enable = true
python.analysis.autoSearchPaths = true
python.analysis.diagnosticMode = "workspace"
python.analysis.useLibraryCodeForType = true
python.analysis.logLevel = "Error"
python.analysis.typeCheckingMode = "off"
python.analysis.autoImoprtCompletion = true
python.analysis.reportOptionalSubscript = false
python.analysis.reportOptionalMemberAccess = false
[language-server.ruff]
command = "ruff"
args = ["server", "-q", "--preview"]
[[language]]
name = "python"
scope = "source.python"
injection-regex = "python"
file-types = ["py", "pyi", "py3", "pyw", "ptl", "rpy", "cpy", "ipy", "pyt", { glob = ".python_history" }, { glob = ".pythonstartup" }, { glob = ".pythonrc" }, { glob = "SConstruct" }, { glob = "SConscript" }]
shebangs = ["python"]
roots = ["pyproject.toml", "setup.py", "poetry.lock", "pyrightconfig.json", "requirements.txt", ".venv/"]
comment-token = "#"
language-servers = [ {name = "pyright", except-features=["diagnostics"]}, "ruff" ]
indent = { tab-width = 4, unit = " " }
auto-format = true
formatter = { command = "bash", args = ["-c", "ruff format --line-length 80 -q . && black --line-length 80 -q -"] }
|
Beta Was this translation helpful? Give feedback.
-
This is my current setup that works nicely, in case anybody wants to see a full example: [[language]]
name = "python"
language-id = "python"
roots = ["pyproject.toml", "setup.py", "poetry.lock", ".git", ".jj", ".venv/"]
language-servers = ["ruff", "pyright"]
auto-format = true
# formatter = { command = "black", args = ["--quiet", "-", "--line-length=80"] }
formatter = { command = "ruff", args = ["format", "-" ] }
file-types = ["py", "ipynb"]
comment-token = "#"
shebangs = ["python"]
[language-server.pyright]
command = "pyright-langserver"
args = ["--stdio"]
[language-server.ruff]
command = "ruff"
args = ["server"]
environment = { "RUFF_TRACE" = "messages" }
[language-server.ruff.config.settings]
lineLength = 80
logLevel = "debug"
[language-server.ruff.config.settings.lint]
select = ["E", "F", "W", "B", "I", "RUF", "N", "LOG", "ERA", "W", "D", "UP", "ANN", "ASYNC", "S", "RET", "TCH", "ARG", "PTH", "DOC"]
preview = true
[language-server.ruff.config.settings.format]
preview = true
quote-style = "double"
docstring-code-format = true
indent-style = "space" |
Beta Was this translation helpful? Give feedback.
-
How did you guys installed pyright / ruff lsp's? |
Beta Was this translation helpful? Give feedback.
-
Is there a way to use ruff with pyright? I read that ruff should probably be used with an LSP, but I've only found examples for pylsp, not pyright.
Beta Was this translation helpful? Give feedback.
All reactions