Closed wolfch-elsevier closed 3 months ago
Can you share any relevant logging from VS Code? There isn't much to go off in the write-up above. I'm referring to this pane:
You should be able to access it by clicking "Ruff" here from a Python file, though it may vary based on how your VS Code is configured:
Wow - thanks for the timely reply! I look at the bottom strip and only see:
I don't see "Ruff"; I do see a warning, "Select Interpreter" but when invoke Shift-Command-P
, it shows the "Selected Interpeter" to be:
...which is correct. I should mention this is running inside of a dev-container (sorry, I should have made that clear initially)
Could you try opening the log file from the command palette instead, like this?
Wait - I needed to select "Ruff" from the "Output" drop-down
I re-tried "Select Interpreter" which select the default
(not correct in terms of installed dependencies) but this tine the Ruff VSCode extension works - see the attached log.
ruff.log
but I expected it to work with the selected hatch environment. Let me change the title of this issue - and offer my apologies.. this dev-container concept is a bit difficult.
Oh God - it totally works in the dev-container - sorry!. However: I have some caveats for people looking to use this extension in a VSCode dev-container. If you have a monorepo with each service having a corresponding hatch environment other than default
, you need to insure that the ruff dependency is declared and installed in the particular hatch environment you are using.
The use-case was specific to using within a dev-container which lead to the false belief it was not working.
Glad to see it resolved, sorry you ran into trouble!
Here's a simple piece of contrived code:
In the first case, I wanted the extension to perform the equivalent of
isort
, so in VSCode, I invokeShift-Command-P
(MacOs) and from the list:Ruff: Format Imports
...nothing happens - the code doesn't change.Then, from the command line, I invoke:
ruff check --fix --select I roughruff.py
...whereroughtruff.py
is the quoted code above and this time, it gets changed to:So
ruff
can successfully replaceisort
but only via the command line - the VSCode extension doesn't work.