python pyright-langserver not working #5369
-
[[language]]
name = "python"
file-types = ["py", "pyi"]
roots = ["pyproject.toml"]
language-server = { command = "pyright-langserver", args = ["--stdio"] }
formatter = { command = "black", args = ["-", "-q"] }
auto-format = true The language server does not work. Doing anything results in: |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 9 replies
-
You can check the log file while running in verbose mode to see the communication between helix and the language server: https://github.com/helix-editor/helix/wiki/FAQ#access-the-log-file |
Beta Was this translation helpful? Give feedback.
-
I have the same problem and can't fix it even with suggested solution.
My config:
|
Beta Was this translation helpful? Give feedback.
-
What is the status of this? I have tried all of the different configs listed as well as downgrading to pyright 1.1.292 and nothing has worked. |
Beta Was this translation helpful? Give feedback.
-
yea it stopped working again |
Beta Was this translation helpful? Give feedback.
-
After #2507, some changes are needed at # add the language server
[language-server.pyright]
command = "pyright-langserver"
args = ["--stdio"]
# will get "Async jobs timed out" errors if this empty config is not added
config = {}
# tie python files to pyright
# this is simply replacing pylsp with pyright in master's languages.toml
[[language]]
name = "python"
scope = "source.python"
injection-regex = "python"
file-types = ["py","pyi","py3","pyw","ptl",".pythonstartup",".pythonrc","SConstruct"]
shebangs = ["python"]
roots = ["setup.py", "setup.cfg", "pyproject.toml"]
comment-token = "#"
language-servers = [ "pyright" ]
indent = { tab-width = 4, unit = " " } |
Beta Was this translation helpful? Give feedback.
-
Usually, I use other ways to declare environment. It is dependent on project. I think that it is snippet can be helpful to others. #!/usr/bin/env fish
if test -e ./pyproject.toml
if type -q poetry
set path_to_env (poetry env info -p)
if test $status -eq 0
echo "detected pyright env"
source $path_to_env/bin/activate.fish
end
end
end
if test -d ./venv
echo "detected env in ./venv"
source ./venv/bin/activate.fish
end
pyright-langserver --stdio |
Beta Was this translation helpful? Give feedback.
-
Simplest configuration I could find that also supports virtual environments as of 2024-02-15. works when starting helix from the [[language]]
name = "python"
roots = ["pyproject.toml"]
language-servers = ["pyright"]
[language-server.pyright]
command = "pyright-langserver"
[language-server.pyright.config]
venvPath = "."
venv = ".venv"
# other pyright config options go here, e.g.
typeCheckingMode = "basic" |
Beta Was this translation helpful? Give feedback.
You can check the log file while running in verbose mode to see the communication between helix and the language server: https://github.com/helix-editor/helix/wiki/FAQ#access-the-log-file