Open giovanniOfficioso opened 2 months ago
You need to add it to your settings. "show_completions_on_input": true,
. Let me know if it worked! Please close the issue if it did. I also opened #17555, if you're interested.
Hi man, also with your suggestion, the issue still. Pyright doesn't provide suggestion based on what I code, but only on standard libraries that I installed in the virtual environment. As you can see I have no suggestion for the "df" object, but in other tools it there is. Not only fleet, also in VSCode, as you can see from the following screen. So the issue still both for suggestion and for the inexistent highlighted error.
Did you create your pyrightconfig.json
in the root of your repository?
You will have to link it to your conda env
For example, with ~/miniconda3/
as the base directory where miniconda is installed you have to create a pyrightconfig.json like this:
{
"venv": "env_name",
"venvPath": "~/miniconda3/envs/"
}
You will have to change the path if you have installed it globally (like /opt/miniconda3/envs/
)
If you are using anaconda the directory might be anaconda
. (Double check it)
Yes, I did. I have a pyrightconfig in each different folder for each different project. Indeed the imports are not highlighted, so the libraries installed are recognized. However the suggestions don’t work as I showed in the previous images. If I define any object as a pandas dataframe, then I have no suggestion as I showed and it is very difficult to code without knowing each library in a deep way, that is impossible.
I see your issue #16076 from 11 August reporting a similar problem. Based on the configuration you provided, it appears that you are reporting the same issue. Is this correct?
The issues are different because if I install ruff, pyright doesn’t work because it doesn’t provide any suggestion. So they seem incompatible. If I install only pyright, the suggestions are very poor if they are compared with the other ones provided in other tools and also the code checker doesn’t work in the right way because it highlights errors which really don’t exists. The main problems appears to be pyright here and it would be awesome if we could have alternatives such as Jedi in order to have a better coding experience.
yes I had the exact same issue when I installed ruff as an extension in zed.
But using these options in my settings.json
I was able to get both ruff (formatting) and pyright (linting and suggestions) working together.
(Note: Ruff is still not installed as an extension)
"languages": {
"Python": {
"format_on_save": {
"external": {
"command": "bash",
"arguments": [
"-c",
"ruff check --select I --fix --stdin-filename {buffer_path} | ruff format --stdin-filename {buffer_path}"
]
}
}
}
},
This uses Ruff as (just) the formatter and Pyright as the language server.
EDIT: I got suggestions in the editor while Ruff was installed as an extension by pressing CTRL
+ SPACE
. But the import suggestions were not working (typing urlretrieve
wouldn't give a suggestion to import it directly from urllib.request
)
The issues are different because if I install ruff, pyright doesn’t work because it doesn’t provide any suggestion. So they seem incompatible. If I install only pyright, the suggestions are very poor if they are compared with the other ones provided in other tools and also the code checker doesn’t work in the right way because it highlights errors which really don’t exists. The main problems appears to be pyright here and it would be awesome if we could have alternatives such as Jedi in order to have a better coding experience.
This issue has some weird behaviour, I believe it has to do with the order they are loaded in.
I managed to get around this by changing the order when specifying language servers.
Going from:
"language_servers": ["ruff", "pyright"]
To:
"language_servers": ["pyright", "ruff"]
After changing nothing work, no suggestion and worse code checking
"language_servers": ["pyright", "ruff"]
"pythonPath": ".venv/bin/python"
{
...
"languages": {
"Python": {
**"language_servers": ["pyright", "ruff"],**
"format_on_save": "on",
"formatter": [
{
"code_actions": {
"source.organizeImports.ruff": true,
"source.fixAll.ruff": true
}
},
{
"language_server": {
"name": "ruff"
}
}
]
}
},
"lsp": {
"pyright": {
"settings": {
"python.analysis": {
"diagnosticMode": "workspace",
"typeCheckingMode": "strict"
},
"python": {
**"pythonPath": ".venv/bin/python"**
}
}
}
...
}
Taking a suggestion for taming Pylance, this is how you keep your sanity in Zed.
{
"lsp": {
"pyright": {
"settings": {
"python.analysis": {
"ignore": ["*"]
}
}
}
},
"languages": {
"Python": {
"language_servers": ["ruff", "pyright"],
"format_on_save": "on",
"formatter": [
{
"code_actions": {
"source.organizeImports.ruff": true,
"source.fixAll.ruff": true
}
}
]
}
}
}
Ruff is on (here highlighting the f-string without placeholders). Pyright stays on and does the type hints and autocompletes, but does not complain about anything.
More in https://github.com/zed-industries/zed/discussions/18688
Check for existing issues
Describe the bug / provide steps to reproduce it
The suggestion in pyright don't work properly, both with base and local environment. I'm on miniconda. No suggestion and a problem, that not exists really, highlighted by pyright.
I'm working with virtual environment using conda, but the issue still in the base environment. Is possible to fix it? Here is also my setting:
Environment
Zed: v0.152.1 (Zed Preview) OS: macOS 13.6.7 Memory: 32 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
When I write the code here is as it appears in zed:
Here is the same windows in fleet editor, with both linter and suggestions which work properly:
If applicable, attach your Zed.log file to this issue.
Zed.log