lsp: Add support for ShowMessage notification (#14012)
When "one newer language" sends these messages, "one newer editor" will display a pop-up for users to see. :) Related to https://github.com/gleam-lang/gleam/issues/3274  Release Notes: - A certain popular language recently had to work around a missing LSP notification. This has been fixed
This commit is contained in:
parent
8cfa690271
commit
09e7b481b8
1 changed files with 44 additions and 21 deletions
|
@ -3676,7 +3676,7 @@ impl Project {
|
||||||
let this = this.clone();
|
let this = this.clone();
|
||||||
let name = name.to_string();
|
let name = name.to_string();
|
||||||
async move {
|
async move {
|
||||||
if let Some(actions) = params.actions {
|
let actions = params.actions.unwrap_or_default();
|
||||||
let (tx, mut rx) = smol::channel::bounded(1);
|
let (tx, mut rx) = smol::channel::bounded(1);
|
||||||
let request = LanguageServerPromptRequest {
|
let request = LanguageServerPromptRequest {
|
||||||
level: match params.typ {
|
level: match params.typ {
|
||||||
|
@ -3699,9 +3699,6 @@ impl Project {
|
||||||
} else {
|
} else {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -3753,7 +3750,33 @@ impl Project {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
language_server
|
||||||
|
.on_notification::<lsp::notification::ShowMessage, _>({
|
||||||
|
let this = this.clone();
|
||||||
|
let name = name.to_string();
|
||||||
|
move |params, mut cx| {
|
||||||
|
let this = this.clone();
|
||||||
|
let name = name.to_string();
|
||||||
|
|
||||||
|
let (tx, _) = smol::channel::bounded(1);
|
||||||
|
let request = LanguageServerPromptRequest {
|
||||||
|
level: match params.typ {
|
||||||
|
lsp::MessageType::ERROR => PromptLevel::Critical,
|
||||||
|
lsp::MessageType::WARNING => PromptLevel::Warning,
|
||||||
|
_ => PromptLevel::Info,
|
||||||
|
},
|
||||||
|
message: params.message,
|
||||||
|
actions: vec![],
|
||||||
|
response_channel: tx,
|
||||||
|
lsp_name: name.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let _ = this.update(&mut cx, |_, cx| {
|
||||||
|
cx.emit(Event::LanguageServerPrompt(request));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
language_server
|
language_server
|
||||||
.on_notification::<lsp::notification::Progress, _>(move |params, mut cx| {
|
.on_notification::<lsp::notification::Progress, _>(move |params, mut cx| {
|
||||||
if let Some(this) = this.upgrade() {
|
if let Some(this) = this.upgrade() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue