Expose more errors from rust-analyzer on invalid Cargo.toml contents (#8356)

Release Notes:

- Fixed ([#7574](https://github.com/zed-industries/zed/issues/7574)).
This commit is contained in:
Zephaniah Ong 2024-03-02 16:07:25 +08:00 committed by GitHub
parent 0903062933
commit 6fcd57ac53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 74 additions and 1 deletions

View file

@ -164,6 +164,34 @@ struct Error {
message: String,
}
/// Experimental: Informs the end user about the state of the server
///
/// [Rust Analyzer Specification](https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#server-status)
#[derive(Debug)]
pub enum ServerStatus {}
/// Other(String) variant to handle unknown values due to this still being experimental
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub enum ServerHealthStatus {
Ok,
Warning,
Error,
Other(String),
}
#[derive(Debug, PartialEq, Deserialize, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct ServerStatusParams {
pub health: ServerHealthStatus,
pub message: Option<String>,
}
impl lsp_types::notification::Notification for ServerStatus {
type Params = ServerStatusParams;
const METHOD: &'static str = "experimental/serverStatus";
}
impl LanguageServer {
/// Starts a language server process.
pub fn new(