ruff server: Introduce the ruff.printDebugInformation command (#11831)

## Summary

Closes #11715.

Introduces a new command, `ruff.printDebugInformation`. This will print
useful information about the status of the server to `stderr`.

Right now, the information shown by this command includes:
* The path to the server executable
* The version of the executable
* The text encoding being used
* The number of open documents and workspaces
* A list of registered configuration files
* The capabilities of the client

## Test Plan

First, checkout and use [the corresponding `ruff-vscode`
PR](https://github.com/astral-sh/ruff-vscode/pull/495).

Running the `Print debug information` command in VS Code should show
something like the following in the Output channel:

<img width="991" alt="Screenshot 2024-06-11 at 11 41 46 AM"
src="ab93c009-bb7b-4291-b057-d44fdc6f9f86">
This commit is contained in:
Jane Lewis 2024-06-11 11:42:46 -07:00 committed by GitHub
parent 507f5c1137
commit 4e9d771aa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 103 additions and 4 deletions

View file

@ -145,6 +145,18 @@ impl Session {
Ok(())
}
pub(crate) fn num_documents(&self) -> usize {
self.index.num_documents()
}
pub(crate) fn num_workspaces(&self) -> usize {
self.index.num_workspaces()
}
pub(crate) fn list_config_files(&self) -> Vec<&std::path::Path> {
self.index.list_config_files()
}
pub(crate) fn resolved_client_capabilities(&self) -> &ResolvedClientCapabilities {
&self.resolved_client_capabilities
}