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

Ruff Native server not working In the latest version #555

Closed
zhengyu-yang opened this issue Jul 23, 2024 · 16 comments
Closed

Ruff Native server not working In the latest version #555

zhengyu-yang opened this issue Jul 23, 2024 · 16 comments

Comments

@zhengyu-yang
Copy link

Ruff Version: 2024.34.0
VS Code Version:1.91.1 Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729

Ruff Setting:

"ruff.nativeServer": true

After the latest update, the ruff lsp server will not start. The log looks like:

2024-07-23 14:17:50.822 [info] Name: Ruff
2024-07-23 14:17:50.822 [info] Module: ruff

All formatting command does not have any response.

@charliermarsh
Copy link
Member

Can you try running Ruff: Restart server in VS Code?

@zhengyu-yang
Copy link
Author

The server started after Ruff: Restart server . However, when try to format a document, it shows Ruff does not recognize this file. Also, 2024.30.0 works fine.

@dhruvmanila
Copy link
Member

@zhengyu-yang Do you have any other ruff.* settings set apart from ruff.nativeServer ? Can you provide a screenshot of the VS Code toolbar which is present at the bottom of the window? This mentions the Python version and environment. If possible, can we connect on Discord or another platform? We've been seeing this a lot but unable to reproduce it.

@dhruvmanila
Copy link
Member

@zhengyu-yang Can you try the pre-release version and check if it's still occurring?

Screenshot 2024-07-24 at 10 28 16

@Adam-Antios
Copy link

I face the same issue.

@dhruvmanila
Copy link
Member

I face the same issue.

Can you please provide what issue you're facing along with the details about your setup and settings?

@dhruvmanila dhruvmanila added the needs-mre Needs more information for reproduction label Jul 24, 2024
@Adam-Antios
Copy link

Adam-Antios commented Jul 24, 2024

My setup is:

Version: 1.92.0-insider
Commit: 22e3447b4b410dcf8426bf70743c5dd4030d6122
Date: 2024-07-23T05:03:52.385Z (1 day ago)
Platform: Windows 10 and WSL2.

I am facing the exact same issue. Recently Ruff stopped working properly. When I start VS Code, Ruff fails to start and I get the following output:

2024-07-24 10:36:48.143 [info] Name: Ruff
2024-07-24 10:36:48.143 [info] Module: ruff

In order to get it working I have to either select Ruff: Restart Server or change the setting ruff.nativeServer from on to auto or vice versa. In that case, I get the following output:

2024-07-24 10:36:48.143 [info] Name: Ruff
2024-07-24 10:36:48.143 [info] Module: ruff
2024-07-24 10:37:23.800 [info] Falling back to bundled executable: /home/vscode/.vscode-server-insiders/extensions/charliermarsh.ruff-2024.34.0-linux-x64/bundled/libs/bin/ruff
2024-07-24 10:37:23.820 [info] Found Ruff 0.5.3 at /home/vscode/.vscode-server-insiders/extensions/charliermarsh.ruff-2024.34.0-linux-x64/bundled/libs/bin/ruff
2024-07-24 10:37:23.820 [info] Server run command: /home/vscode/.vscode-server-insiders/extensions/charliermarsh.ruff-2024.34.0-linux-x64/bundled/libs/bin/ruff server
2024-07-24 10:37:23.821 [info] Server: Start requested.
    "[python]": {
        "editor.wordWrap": "off",
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "charliermarsh.ruff",
        "editor.codeActionsOnSave": {
            "source.organizeImports": "explicit",
            // "source.fixAll": "explicit"
        },
        "editor.rulers": [
            {
                "column": 79
            },
        ],
    },
    "python.languageServer": "Jedi",
    "python.analysis.autoImportCompletions": true,
    "python.analysis.completeFunctionParens": true,
    "ruff.nativeServer": "on",
    "ruff.lineLength": 79,
    "ruff.interpreter": [
        "/opt/conda/bin/python",
        "/opt/conda/bin/python3",
    ]

@dhruvmanila
Copy link
Member

@Adam-Antios Thank you for the details. I can see that you're using the latest stable version of the extension. Can you try this on the pre-release version? You can do so by clicking on the "Switch to Pre-Release Version" in the VS Code marketplace (image reference: #555 (comment))?

@Adam-Antios
Copy link

In the pre-release version Ruff seems to work properly.

@dhruvmanila
Copy link
Member

Thank you for trying it out and confirming. It must've been fixed by #553.

@zhengyu-yang
Copy link
Author

I also tried to switch to pre-release. Interestingly, if I have unsupported settings in ruff.lint.args, the native server wont start initially. The extension seems to hang when the notification (unsupported settings used with the native server. Refer to the logs for more details) pops up. After I dismiss the notification, the extension start to work.

@dhruvmanila
Copy link
Member

@zhengyu-yang Thanks for trying out the pre-release version and sharing that. That scenario is fixed in #557 and I'm about to release a new version.

@dhruvmanila
Copy link
Member

Hi @zhengyu-yang, @Adam-Antios we just released a new stable version (2024.36.0) with all the bug fixes. Can you try it out?

@Adam-Antios
Copy link

Adam-Antios commented Jul 25, 2024

It seems to work as intended! Thank you for your great work. Since I discovered Ruff I am impressed by its performance and would hate to have to go back to other alternatives.

The output of Ruff during startup:

2024-07-25 09:51:53.349 [info] Name: Ruff
2024-07-25 09:51:53.349 [info] Module: ruff
2024-07-25 09:51:53.349 [info] Using interpreter: /opt/conda/bin/python /opt/conda/bin/python3
2024-07-25 09:51:53.897 [info] Falling back to bundled executable: /home/vscode/.vscode-server-insiders/extensions/charliermarsh.ruff-2024.36.0-linux-x64/bundled/libs/bin/ruff
2024-07-25 09:51:53.918 [info] Found Ruff 0.5.4 at /home/vscode/.vscode-server-insiders/extensions/charliermarsh.ruff-2024.36.0-linux-x64/bundled/libs/bin/ruff
2024-07-25 09:51:53.918 [info] Server run command: /home/vscode/.vscode-server-insiders/extensions/charliermarsh.ruff-2024.36.0-linux-x64/bundled/libs/bin/ruff server
2024-07-25 09:51:53.920 [info] Server: Start requested.

Now it seems to start the server as intended. If you need further diagnostics feel free to ask me as I don't really know what else I could provide.

@dhruvmanila
Copy link
Member

This looks good! Thank you for confirming. I'll mark this issue as resolved.

@dhruvmanila dhruvmanila removed the needs-mre Needs more information for reproduction label Jul 25, 2024
@dhruvmanila
Copy link
Member

The issue that the author is facing is also resolved: #555 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants