Python Auto-completion Setup #4689
Replies: 10 comments 2 replies
-
If you haven't already, you'll need to install the python language server With that installed, auto-complete and other language server driven features like goto-definition should work without any extra configuration or commands. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, that worked, is there anyway to fix error : W191, indentation contains tab |
Beta Was this translation helpful? Give feedback.
-
I'm not too familiar with python but I think it comes from this PEP https://peps.python.org/pep-0008/#tabs-or-spaces Seems like the language server wants you to use spaces for indentation instead of tabs. |
Beta Was this translation helpful? Give feedback.
-
Is there any way I can turn off the error messages, there are so many (E303, W141, my whole code is just underlined) if so how do I do it, because the tutorial given by the website "https://github.com/python-lsp/python-lsp-server" is not very clear, and I was unable to find a file called pycodestyle in my configs. |
Beta Was this translation helpful? Give feedback.
-
Oh hmm, I'm not sure how configurable pylsp is for turning those of or tuning them. As far as I know, there isn't an option within Helix to disable diagnostics. |
Beta Was this translation helpful? Give feedback.
-
If possible, I would recommend you use pyright instead of pylsp if you don't care about the linters. Pyright is much better in terms of autocompletion and correctness checks, but it doesn't have any style linting or code formatting (which you seem to not want anyway). If you have node.js installed, you can install pyright globally with
But there is also a wrapper package on pypi: https://pypi.org/project/pyright/ which I believe installs a per-project node.js. Then set up pyright like this: [[language]]
name = "python"
scope = "source.python"
injection-regex = "python"
file-types = ["py"]
shebangs = ["python"]
roots = ["pyproject.toml", "setup.py", "Poetry.lock"]
comment-token = "#"
language-server = { command = "pyright-langserver", args = ["--stdio"] }
auto-format = false
indent = { tab-width = 4, unit = " " }
config = {} You need to specify |
Beta Was this translation helpful? Give feedback.
-
In the world of python it's up to you to select the correct LSP for your needs, This is not true in all languages. Dart, for example, works with Helix without any configuration. Install dart, install helix, it's working. The zero-conf nature in this case is due to Dart coming prepackaged with a configured LSP. |
Beta Was this translation helpful? Give feedback.
-
Put the exact same thing inside my languages.toml and I still got the error: |
Beta Was this translation helpful? Give feedback.
-
Yes, I would like to learn more as I am yet just a beginner, a newborn coming out of the computers womb, searching merely for just answers that cannot be obtained oh so easily |
Beta Was this translation helpful? Give feedback.
-
@The-Rivers see #1898 for a possible work-around for your crash. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Sorry, completely new to this editor, and with the lack of videos on this fairly new text editor, I require some step by step and clear help on how to setup up Python Auto-completion on Mac M1 for Helix text editor. I tried copying from the repo area, but this led to nothing. Also, am I missing a command that I should type to toggle Auto-completion?
Thank you very much, and I look forward to using this text editor and being one of the first few people to get onto this!
Beta Was this translation helpful? Give feedback.
All reactions