ruff/crates/ruff_server
Jane Lewis 2882604451
ruff server: Important errors are now shown as popups (#10951)
## Summary

Fixes #10866.

Introduces the `show_err_msg!` macro which will send a message to be
shown as a popup to the client via the `window/showMessage` LSP method.

## Test Plan

Insert various `show_err_msg!` calls in common code paths (for example,
at the beginning of `event_loop`) and confirm that these messages appear
in your editor.

To test that panicking works correctly, add this to the top of the `fn
run` definition in
`crates/ruff_server/src/server/api/requests/execute_command.rs`:

```rust
panic!("This should appear");
```

Then, try running a command like `Ruff: Format document` from the
command palette (`Ctrl/Cmd+Shift+P`). You should see the following
messages appear:


![Screenshot 2024-04-16 at 11 20
57 AM](ae430da6-82c3-4841-a419-664ff34034e8)
2024-04-16 18:32:53 +00:00
..
resources/test/fixtures Implement client setting initialization and resolution for ruff server (#10764) 2024-04-05 22:41:50 +00:00
src ruff server: Important errors are now shown as popups (#10951) 2024-04-16 18:32:53 +00:00
tests ruff server - A new built-in LSP for Ruff, written in Rust (#10158) 2024-03-08 20:57:23 -08:00
Cargo.toml ruff server: Resolve configuration for each document individually (#10950) 2024-04-16 18:15:02 +00:00
CONTRIBUTING.md High-level project overview and contributing guide for ruff server (#10565) 2024-03-25 23:08:37 -07:00
README.md High-level project overview and contributing guide for ruff server (#10565) 2024-03-25 23:08:37 -07:00

The Ruff Language Server

Welcome! ruff server is a language server that powers editor integrations with Ruff. The job of the language server is to listen for requests from the client, (in this case, the code editor of your choice) and call into Ruff's linter and formatter crates to create real-time diagnostics or formatted code, which is then sent back to the client. It also tracks configuration files in your editor's workspace, and will refresh its in-memory configuration whenever those files are modified.

Contributing

If you're interested in contributing to ruff server - well, first of all, thank you! Second of all, you might find the contribution guide to be a useful resource. Finally, don't hesitate to reach out on our Discord if you have questions.