vscode-ruff
vscode-ruff copied to clipboard
"There is no formatter for 'python' files installed."
I have just installed the extension and reloaded my VSCode window. However, when attempted Cmd+P => Format document
, I'm now faced with an error modal dialog:
Have you tried setting the following in your settings.json
?
{
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
No, but is such a setting necessary to use ruff as a Python formatter?
I don't believe so, but I've also never run into the message you're seeing above once I've installed the extension.
I also just verified that if I uninstall the extension, I see that message; and if I then install it and run "Format Document", the document formats and I see no such message.
Anything other info you can provide? It seems like an issue with the VS Code setup rather than the extension specifically.
Ok I just created a .vscode/settings.json
file with the contents of https://github.com/astral-sh/ruff-vscode/issues/460#issuecomment-2080201961 but I'm still getting the same error.
Anything other info you can provide? It seems like an issue with the VS Code setup rather than the extension specifically.
I'm working in a dev container with the ruff extension installed in the container. I'm running on aarch64-darwin. Here is my .devcontainer/devcontainer.json
and .devcontainer/Dockerfile
.
Same issue here: Ubuntu 22.04, used to work before, not sure what changed. Here's the traceback:
2024-05-02 06:57:14.666 [error] Server: Start failed: Error: Unsupported server configuration {
"args": [
"/home/amin/.vscode/extensions/charliermarsh.ruff-2024.20.0-linux-x64/bundled/tool/server.py"
],
"options": {
"cwd": "/home/amin/Code/AutoEIS",
"env": {
"ATUIN_SESSION": "018f38f36e14719e855c2bfafec93de4",
"CHROME_DESKTOP": "code-url-handler.desktop",
"CONDA_EXE": "/home/amin/miniforge3/bin/conda",
"CONDA_PYTHON_EXE": "/home/amin/miniforge3/bin/python",
"CONDA_SHLVL": "0",
"DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/1000/bus",
"DEFAULTS_PATH": "/usr/share/gconf/pop.default.path",
"DESKTOP_SESSION": "pop",
"DISPLAY": ":1",
"GDK_BACKEND": "x11",
"GDMSESSION": "pop",
"GIO_LAUNCHED_DESKTOP_FILE": "/usr/share/applications/code.desktop",
"GIO_LAUNCHED_DESKTOP_FILE_PID": "32120",
"GJS_DEBUG_OUTPUT": "stderr",
"GJS_DEBUG_TOPICS": "JS ERROR;JS LOG",
"GNOME_DESKTOP_SESSION_ID": "this-is-deprecated",
"GNOME_SHELL_SESSION_MODE": "pop",
"GPG_AGENT_INFO": "/run/user/1000/gnupg/S.gpg-agent:0:1",
"GTK_IM_MODULE": "ibus",
"GTK_MODULES": "gail:atk-bridge",
"HOME": "/home/amin",
"HOMEBREW_CELLAR": "/home/linuxbrew/.linuxbrew/Cellar",
"HOMEBREW_PREFIX": "/home/linuxbrew/.linuxbrew",
"HOMEBREW_REPOSITORY": "/home/linuxbrew/.linuxbrew/Homebrew",
"INFOPATH": "/home/linuxbrew/.linuxbrew/share/info::/home/amin/Programs/texlive/2023/texmf-dist/doc/info",
"INVOCATION_ID": "63cde9c7c3c44c6c9f855e835e057f0d",
"JOURNAL_STREAM": "8:39213",
"LANG": "en_CA.UTF-8",
"LANGUAGE": "en_CA:en",
"LC_ADDRESS": "en_CA.UTF-8",
"LC_IDENTIFICATION": "en_CA.UTF-8",
"LC_MEASUREMENT": "en_CA.UTF-8",
"LC_MONETARY": "en_CA.UTF-8",
"LC_NAME": "en_CA.UTF-8",
"LC_NUMERIC": "en_CA.UTF-8",
"LC_PAPER": "en_CA.UTF-8",
"LC_TELEPHONE": "en_CA.UTF-8",
"LC_TIME": "en_CA.UTF-8",
"LD_LIBRARY_PATH": ":/home/amin/Code/panua-pardiso-20240229-linux/lib",
"LESSCLOSE": "/usr/bin/lesspipe %s %s",
"LESSOPEN": "| /usr/bin/lesspipe %s",
"LM_LICENSE_FILE": "[email protected]",
"LOGNAME": "amin",
"MANAGERPID": "5334",
"MANDATORY_PATH": "/usr/share/gconf/pop.mandatory.path",
"MANPATH": "/home/linuxbrew/.linuxbrew/share/man::/home/amin/Programs/texlive/2023/texmf-dist/doc/man:",
"MODULAR_HOME": "/home/amin/.modular",
"OPENAI_API_KEY": "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",
"ORIGINAL_XDG_CURRENT_DESKTOP": "pop:GNOME",
"PAPERSIZE": "letter",
"PARDISOLICMESSAGE": "0",
"PATH": "/home/amin/.local/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/amin/.modular/pkg/packages.modular.com_max/bin:/home/amin/miniforge3/condabin:/home/amin/.rbenv/shims:/home/amin/.rbenv/bin:/home/amin/.rye/shims:/home/amin/.cargo/bin:/home/amin/.juliaup/bin:/home/amin/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/amin/Code/git-filter-repo:/home/amin/.codon/bin:/opt/chromedriver_linux64:/usr/local/cuda-12.3/bin:/home/amin/Programs/texlive/2023/bin/x86_64-linux",
"PWD": "/home/amin",
"QT_ACCESSIBILITY": "1",
"QT_IM_MODULE": "ibus",
"RBENV_SHELL": "bash",
"RYE_NO_AUTO_INSTALL": "1",
"SESSION_MANAGER": "local/zaboor:@/tmp/.ICE-unix/6348,unix/zaboor:/tmp/.ICE-unix/6348",
"SHELL": "/bin/bash",
"SHLVL": "0",
"SSH_AGENT_LAUNCHER": "gnome-keyring",
"SSH_AUTH_SOCK": "/run/user/1000/keyring/ssh",
"STARSHIP_SESSION_KEY": "2051624185719320",
"STARSHIP_SHELL": "bash",
"SYSTEMD_EXEC_PID": "6377",
"TERMINFO_DIRS": "/etc/terminfo:/lib/terminfo:/usr/share/terminfo",
"USER": "amin",
"USERNAME": "amin",
"VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
"VSCODE_CODE_CACHE_PATH": "/home/amin/.config/Code/CachedData/e170252f762678dec6ca2cc69aba1570769a5d39",
"VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
"VSCODE_CWD": "/home/amin",
"VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
"VSCODE_IPC_HOOK": "/run/user/1000/vscode-94f0baa7-1.88-main.sock",
"VSCODE_NLS_CONFIG": "{\"locale\":\"en-gb\",\"osLocale\":\"en-ca\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
"VSCODE_PID": "32120",
"WINDOWPATH": "2",
"XAUTHORITY": "/run/user/1000/gdm/Xauthority",
"XDG_CONFIG_DIRS": "/etc/xdg/xdg-pop:/etc/xdg",
"XDG_CURRENT_DESKTOP": "Unity",
"XDG_DATA_DIRS": "/usr/share/pop:/usr/share/gnome:/home/amin/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop",
"XDG_MENU_PREFIX": "gnome-",
"XDG_RUNTIME_DIR": "/run/user/1000",
"XDG_SESSION_CLASS": "user",
"XDG_SESSION_DESKTOP": "pop",
"XDG_SESSION_TYPE": "x11",
"XMODIFIERS": "@im=ibus",
"_": "/usr/share/code/code",
"ELECTRON_RUN_AS_NODE": "1",
"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "1",
"VSCODE_L10N_BUNDLE_LOCATION": "",
"USE_DEBUGPY": "False",
"LS_SHOW_NOTIFICATION": "off"
}
}
}
Never mind. Mine was a strange one, I was working in a VS Code workspace with two folders, just removed one (AutoEIS, which is cwd
in the trace back), restarted Ruff server, added it back and voila!
Got the same error message but downgraded to the version v2024.30.0
which fixed it.
@MalteHB are you using VS Code dev containers where you're facing this? If not, can you open a new issue for it with all the relevant details about your setup and config?
Got the same error message but downgraded to the version
v2024.30.0
which fixed it.
I can confirm this. I used Remoted SSH
and the Ruff
can't be loaded, no special setting I made. Downgrading works for me!
It works btw locally with the newest version.
I have the same issue and despite downgrading to v2024.30.0 it still doesn't seem to work like it used to.
I had already added "editor.defaultFormatter": "charliermarsh.ruff"
to my settings before
I'm using VS code locally.
I wonder if the ruff server fails to start for some reason and, as a result thereof, the formatter capability doesn't get registered.
Would you mind sharing the Ruff logs with us by opening the logs and then run Ctrl+Shift+P - Ruff: Print debug information
https://github.com/astral-sh/ruff-vscode?tab=readme-ov-file#troubleshooting
In addition to the logs,
- What happens if you run the "Ruff: Format document" command?
- Do you still see the diagnostics provided by Ruff?
@MichaReiser
This only worked after downgrading to v2024.30.0
, when I tried to print debug information on the newest update nothing happened.
024-07-23 19:17:00.895 [info] [Trace - 7:17:00 PM] Sending request 'workspace/executeCommand - (1)'.
2024-07-23 19:17:00.895 [info] Params: {
"command": "ruff.printDebugInformation"
}
2024-07-23 19:17:00.897 [info] [Trace - 7:17:00 PM] Received notification 'window/logMessage'.
2024-07-23 19:17:00.897 [info] Params: {
"message": "executable = C:\\Users\\***\\AppData\\Roaming\\Python\\Python311\\Scripts\\ruff.exe\nversion = 0.5.4\nencoding = UTF16\nopen_document_count = 0\nactive_workspace_count = 2\nconfiguration_files = [\"c:\\\\Users\\\\***\\\\Meine Ablage\\\\***\\\\***\\\\ruff.toml\", \"c:\\\\git\\\\***\\\\ruff.toml\"]\ncapabilities.code_action_deferred_edit_resolution = true\ncapabilities.apply_edit = true\ncapabilities.document_changes = true\ncapabilities.workspace_refresh = true\ncapabilities.pull_diagnostics = true\n",
"type": 3
}
2024-07-23 19:17:00.897 [info] [Info - 7:17:00 PM] executable = C:\Users\***\AppData\Roaming\Python\Python311\Scripts\ruff.exe
version = 0.5.4
encoding = UTF16
open_document_count = 0
active_workspace_count = 2
configuration_files = ["c:\\Users\\***\\Meine Ablage\\***\\***\\ruff.toml", "c:\\git\\***\\ruff.toml"]
capabilities.code_action_deferred_edit_resolution = true
capabilities.apply_edit = true
capabilities.document_changes = true
capabilities.workspace_refresh = true
capabilities.pull_diagnostics = true
2024-07-23 19:17:00.898 [info] [Trace - 7:17:00 PM] Received response 'workspace/executeCommand - (1)' in 2ms.
2024-07-23 19:17:00.898 [info] No result returned.
@dhruvmanila
now I feel like an idiot. Not sure what I messed up earlier. The hotkey simply worked just now, and "Ruff: Format Document" as well.
On v2024.30.0 though.
now I feel like an idiot. Not sure what I messed up earlier. The hotkey simply worked just now, and "Ruff: Format Document" as well.
On v2024.30.0 though.
Does it work on the latest VS Code version?
now I feel like an idiot. Not sure what I messed up earlier. The hotkey simply worked just now, and "Ruff: Format Document" as well. On v2024.30.0 though.
Does it work on the latest VS Code version?
No. I just updated and double-checked again.
@kasi-mir33 Can you provide what's your setup is like? What are the extension settings that you've set? And, the full logs with the following settings:
{
"ruff.trace.server": "messages",
"ruff.logLevel": "debug"
}
for temporary solution I am using ruff cli to format files.
ruff format ./path/to/python/file
# or
python -m ruff format ./path/to/python/file
make sure you have installed the ruff using pip
pip install --upgrade ruff
ruff formatter docs: https://docs.astral.sh/ruff/formatter/
Any chance that you were seeing the native server enabled but using deprecated settings dialogue? If so, can you try to close it to see if Ruff then starts? See https://github.com/astral-sh/ruff-vscode/pull/557
Hi, to all the users who've subscribed to this issue, we've released a new version (2024.36.0
). Can you all try that out and check if the issue that you're facing is resolved or not? We'd appreciate any feedback regarding that.
Hi, to all the users who've subscribed to this issue, we've released a new version (
2024.36.0
). Can you all try that out and check if the issue that you're facing is resolved or not? We'd appreciate any feedback regarding that.
Resolved
i have the same problem using the latest vrsion : v2024.42.0 and ruff = "^0.6.2"
@issam-seghir can you open a new issue with necessary details about your environment?