Skip to content
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

Server doesn't consider a file with no extension #12539

Closed
khufu1 opened this issue Jul 26, 2024 · 5 comments · Fixed by #13326
Closed

Server doesn't consider a file with no extension #12539

khufu1 opened this issue Jul 26, 2024 · 5 comments · Fixed by #13326
Assignees
Labels
bug Something isn't working server Related to the LSP server

Comments

@khufu1
Copy link

khufu1 commented Jul 26, 2024

consider this minimal example
#!/usr/bin/python3 target = None if target != None: print ("target's not none")
if the file that contains the script has a .py extension it will display the following

Screenshot from 2024-07-27 01-04-31

and if i remove the .py extension ,no warnings will display nor file can be formatted even though vscode detects
that it's a python file.

ruff version: 0.5.5
Python version: 3.12.4
vscode version: 1.91.1
OS: archlinux

@dhruvmanila
Copy link
Member

dhruvmanila commented Jul 27, 2024

Yeah, that's happening because a file without an extension is excluded as it's not in the inclusion set. This is a side effect of 0bb2fc6. Maybe in the LSP context, we should look at the languageId in the TextDocument in case it's not excluded and not present in the inclusion set.

@dhruvmanila dhruvmanila changed the title ruff doesnt work when file doesn't have an extention. Server doesn't consider a file with no extension Jul 27, 2024
@dhruvmanila dhruvmanila transferred this issue from astral-sh/ruff-vscode Jul 27, 2024
@dhruvmanila dhruvmanila added bug Something isn't working server Related to the LSP server labels Jul 27, 2024
@majutsushi
Copy link

I just wasted several hours trying to debug why the Ruff server wasn't working for me in Zed, where I was editing extension-less Python scripts that Ruff apparently silently skips. There really needs to be a way for the server to consider these files to make it generally useful.

@dhruvmanila
Copy link
Member

Apologies for the trouble, I can make this a priority. Thanks for sharing your experience.

@majutsushi
Copy link

Thanks for the fix! Sorry if I came across as a bit rude, I was just frustrated because according to all the logs I could find everything seemed to be fine, but it still wasn't working. Maybe it would be useful to log ignored files at debug level?

@dhruvmanila
Copy link
Member

Thanks for the fix! Sorry if I came across as a bit rude, I was just frustrated because according to all the logs I could find everything seemed to be fine, but it still wasn't working. Maybe it would be useful to log ignored files at debug level?

No need to apologize, sharing your experience is helpful and bugs are always considered high priority :)

The PR that fixes this also added debug level log for cases where this kind of exlusion happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server Related to the LSP server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants