ruff-pycharm-plugin icon indicating copy to clipboard operation
ruff-pycharm-plugin copied to clipboard

Diagnostics stopped working in Intellij 2025.1.2 when using native lsp

Open NikolaiES opened this issue 5 months ago • 8 comments

Describe the bug When using the Intellij native lsp diagnostics are not shown in the editor.

To Reproduce Steps to reproduce the behavior:

  1. Turn on Intellij`s lsp client and use "ruff server"
  2. Open a python file which contains code that triggers a warning when using ruff check

Expected behavior When ruff check reports an error I expect the same error to be shown in the ide.

Environments (please complete the following information):

  • IDE: PyCharm 2025.1.2 (unified with commercial license)
  • OS: Arch linux
  • Ruff Version: 0.12.0
  • Plugin version: 0.0.47

Additional context I attempted to debug the issue myself and discovered that ruff server only does diagnostic push notifications to lsp clients that don't support pulling diagnostics. IntelliJ reports that it supports this but does in fact never pull diagnostics unless you override a "shouldAskServerForDiagnostics" in the class RuffLspDiagnosticsSupport. See https://youtrack.jetbrains.com/issue/IJPL-172853. By adding this override I have built a version of the plugin that works for me. This pulling feature was introduced in version 2025.1.2. I checked in version 2025.1.1.1 and it works without the override there as IntelliJ lsp does not claim to support pulling diagnostics in that version. I built a version of the plugin with the override and tried running it in 2025.1.2 and 2025.1.1 and in both places it seems to work fine, but I have never worked with IntelliJ plugins before so take it with a grain of salt. https://github.com/NikolaiES/ruff-pycharm-plugin/blob/05883079251bea97fd652e4df398a92ce536efa8/src/com/koxudaxi/ruff/lsp/intellij/supports/RuffLspDiagnosticsSupport.kt#L10

NikolaiES avatar Jun 29 '25 06:06 NikolaiES

Same here with PyCharm 2025.1.2 (pro) Mac. Previous IDE version working ok. With Intelij's LSP client.

Good research @NikolaiES ! 🆒

stronk7 avatar Jul 01 '25 14:07 stronk7

Likely experiencing the same issue. Just starting to use this plugin, so I don't have history to compare to, but it seems to work except for the LSP functionality. The "Ruff: Fix all auto-fixable problems" and "Ruff: Organize imports" actions are visible (if I mouseover an issue flagged by a different tool), but issues flagged by Ruff itself are not highlighted (squiggles) in the UI nor are they listed in the Problems pane.

I am doing remote development using PyCharm Pro PyCharm 2025.1.2 Build #PY-251.26094.141, built on June 10, 2025 Ruff 0.12.1 Plugin version: 0.0.47

In Ruff settings: Under "Language Server Protocols (LSP), each of the following is checked:

  • Enable Ruff LSP feature LSP Features
  • Code Action
  • Diagnostic
  • Formatting
  • Hover

LSP Server

  • ruff server command (currently selected)

LSP Client

  • Intellij's LSP Client (only pro versions) (currently selected)

Thanks you for contributing this plugin!

smroels avatar Jul 01 '25 17:07 smroels

same issue

zepc007 avatar Jul 04 '25 06:07 zepc007

I wonder if you select LSP4IJ (and you install it) it is working better?

angelozerr avatar Jul 04 '25 06:07 angelozerr

Same problem here!

I've updated Pycharm to 5.1.3 and still having this problem.

As mentioned by @smroels, the code linting works fine, but the LSP is not highlighting the errors in the IDE.

fabiobatalha avatar Jul 04 '25 19:07 fabiobatalha

I wonder if you select LSP4IJ (and you install it) it is working better?

I tested with lsp4ij and that does indeed work. I guess that either lsp4ij actually pulls diagnostics or does not support pulling diagnostics causing ruff server to use push diagnostics. Either way it works, so I would recommend everyone else facing this issue to test using lsp4ij to see if that works for them. I will be sticking to the native lsp, as lsp4ij has in the past caused other issues with other plugins when I have tried using it

NikolaiES avatar Jul 05 '25 11:07 NikolaiES

I wonder if you select LSP4IJ (and you install it) it is working better?

I tested with lsp4ij and that does indeed work. I guess that either lsp4ij actually pulls diagnostics or does not support pulling diagnostics causing ruff server to use push diagnostics.

LSP4IJ supports pull and publish diagnostic both. You can see that if you set trace as verbose https://github.com/redhat-developer/lsp4ij/blob/main/docs/UserGuide.md

Either way it works, so I would recommend everyone else facing this issue to test using lsp4ij to see if that works for them. I will be sticking to the native lsp, as lsp4ij has in the past caused other issues with other plugins when I have tried using it

Pull diagnostic has been implemented by consuming Rust language server which is complex because it mixes pull and publish diagnostics, so it should work.

angelozerr avatar Jul 05 '25 11:07 angelozerr

Same issue, though unfortunately the LSP4IJ workaround doesn't work for me - still no error highlighting.

With LSP4IJ I sporadically see in the ruff console log Error checking LSP enablement: null, and there's nothing showing in the Traces or Logs tabs in the Language Servers panel under "Ruff Language Server". 😢

feltech avatar Sep 03 '25 09:09 feltech