redhat-developer / lsp4ij

LSP Client for IntelliJ
Eclipse Public License 2.0
111 stars 24 forks source link

How to silence warnings from and get status of an LSP server session? #552

Open angelozerr opened 1 month ago

angelozerr commented 1 month ago

Discussed in https://github.com/redhat-developer/lsp4ij/discussions/493

Originally posted by **harry-xm** August 28, 2024 Open a Rust file in https://github.com/eunomia-bpf/eunomia-bpf/tree/master/ecli on macOS and LSP4IJ turns every warning message from `rust-analyzer` into a notification that is persisted in the Notifications panel. ![lsp4ij screenshot](https://github.com/user-attachments/assets/f82ccebc-4470-44b1-b041-189b5599f389) ![lsp4ij screenshot 2](https://github.com/user-attachments/assets/22e67dd4-41a2-4449-8544-4a5c0fbf8928) Is it possible to suppress these notifications, and like the VSCode plugin, display a warning in the status bar? The user can then choose to open the LSP log buffer by clicking it. IMHO, that would be more user-friendly than a bunch of notifications. ![vscode screenshot](https://github.com/user-attachments/assets/bc8582b1-64d7-4e7a-9419-2041c4b90de6)
angelozerr commented 1 month ago

Today this notification error is handled with LanguageClientImpl with

  @Override
    public final void showMessage(MessageParams messageParams) {
        ServerMessageHandler.showMessage(wrapper.getServerDefinition().getDisplayName(), messageParams, getProject());
    }

Badly we cannot override it because of final modifier.

I removed this final modifier in https://github.com/redhat-developer/lsp4ij/pull/543 and you will able to override this showMessage to handle message as you wish.