-
Notifications
You must be signed in to change notification settings - Fork 56
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
ruff doesn't work when I rename'xxx.PY' to 'xxx.py' #574
Comments
Can you provide a way to reproduce this? The log message that you've provided is the request payload sent by VS Code.
How are you running the formatter? And, how are you renaming the file? Is it from the command-line or by right-clicking the filename in VS Code and selecting the "Rename" option? At least on Mac, VS Code seems to not care about whether it's uppercase or lowercase as I see that the payload always contains |
system is windows10 , renaming is done by clicking on the file, when it's editable, formatting is done by right-clicking and selecting from the menu, and ruff turns on native server mode. I tried again, and as long as the suffix was written as PY and changed from PY to py, the file would have problems. |
ruff-lsp doesn't seem to have this problem |
Is it possible for you to record a video doing this and send it? I'm not able to follow how is the renaming being done and which option is selected for the formatting. Can you also provide the verbose logs by setting |
ruff_log.txt |
Windows is case-insensitive, maybe related. |
@Zander-1024 Have you changed the case-sensitivity setting for the file system? (https://learn.microsoft.com/en-us/windows/wsl/case-sensitivity#modify-case-sensitivity). |
I checked and it is disabled, maybe I need to turn it on. When I only change the case of the suffix, the uri doesn't change, so rust can't recognize the file properly, causing this problem! ruff-lsp doesn't have this problem because it doesn't read the file directly? |
If it's disabled then Can you send me your VS Code settings? Do you see this happening in other Python extension like |
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"test",
"proto",
]
# Same as Black.
line-length = 120
indent-width = 4
extend-include = ["*.ipynb"]
# Assume Python 3.8
target-version = "py310"
[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E", "F", "B"]
ignore = ["E501","B905"]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
|
I have another file that says
xxx.PY
in the name. When I found the problem, I changed it toxxx.py
. At this point I found that the format didn't work.When I change the file name or the extension, I find that it can be formatted normally again.
However, when the file is modified to xxx.py, it does not take effect. Finally, I find that the URI still points to xxx.PY. However, when I modify the file to xxx.PY again, the file still cannot be formatted.
Is there a cache for this? When I restarted the computer, the problem persisted.
Ruff v2024.36.0
The text was updated successfully, but these errors were encountered: