-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I001: Inconsistent application of I001 between neovim and vscode #15782
Comments
Thanks for the report. I think the order in Neovim is correct because Trying to reproduce in VS Code seems to be giving the same outcome as in Neovim. Can you provide the VS Code debug logs (refer to the troubleshooting guide. Directory structure:
VS Code settings: {
"ruff.nativeServer": "on",
"ruff.logLevel": "debug",
"ruff.configuration": "/tmp/ruff-config/ruff.toml"
} |
Hey, sure, using these settings:
The client output is:
Server output:
Unsure if this is in anyway useful, but here is the LS Trace too:
The result:
Though, with dotenv being third party, I would expect it to be organised separately to the first party imports, as vscode is doing right? it seems to be in amongst the first party imports in neovim, and just organised along with the other |
I agree that the VS code behavior is the expected behavior with I somewhat suspect that Neovim categorizes the imports differently, maybe because the root directory is different. Can you try enable logging in neovim as described at the end of the neovim setup instructions and share the logs with us? |
Ah, sorry, I diagnosed it incorrectly. You can get the root directory using for the buffer where Ruff is currently running in: vim.lsp.get_clients({name = 'ruff', buffer = 0})[1].root_dir |
Let me give these a try and come back to you |
You may be onto something
This gave an error but in :LspInfo, I have:
I also ran:
Upon inspecting the file, I see:
So it looks as though init_options and settings are empty tables. |
Guys, I have fixed it, it was an issue with the way I was loading lsp configs. I created my own loader and it turns out it had a bug that was being missed because the nvim_lsp default configs were taking over giving it the appearance it had worked. Sorry for wasting your time, and thank you for your help. |
No worries. Thanks for posting an update. Enjoy Ruff |
Description
Hey guys,
I'm new to coding and even newer to python, so this is likely a skill issue.
I switch between vscode and neovim. Both are set up to use
~/.config/ruff/ruff.toml
:VSCode:
Neovim:
I have stripped the settings in both editors right back so that they only point to the config file, and make no other changes. There is no local project config file. Caches have been cleared.
The contents of the ruff configuration are:
Both are using ruff version 0.9.3 with neovim managing it via Mason and homebrew managing globally.
Using ruff to organise imports in each of them results in a different order, with neovim sorting as follows:
and vscode then showing the I001 warning. Applying organize imports in vscode then using ruff gives:
which of course then flags the I001 warning in neovim.
Note: fetcher, stock_calculations, data, and emailer are custom modules and they are all saved in root:
Running
ruff check -v main.py
in the console gives:Hoping someone can point me in the right direction with this, I've been trying to get them to behave the same now for a good few hours.
Thanks
Screen.Recording.2025-01-28.at.10.58.22.mov
The text was updated successfully, but these errors were encountered: