Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't let the IDE throw away executionContext/executionStatus messages #5734

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ pub enum DiagnosticType {
#[allow(missing_docs)]
#[serde(rename_all = "camelCase")]
pub struct Diagnostic {
kind: DiagnosticType,
message: String,
pub kind: DiagnosticType,
pub message: String,
path: Option<Path>,
location: Option<TextRange>,
expression_id: Option<ExpressionId>,
Expand Down
7 changes: 6 additions & 1 deletion app/gui/src/model/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,17 @@ pub type Synchronized = synchronized::Project;
// ====================

/// Notification emitted by the project model.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Notification {
/// One of the backend connections has been lost.
ConnectionLost(BackendConnection),
/// Indicates that the project VCS status has changed.
VcsStatusChanged(VcsStatus),
/// Any message to be displayed as a notification
Message {
/// text of the message
message: String,
},
Comment on lines +173 to +177
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not needed, we already have such notifications in

pub enum StatusNotification {

}

/// Denotes one of backend connections used by a project.
Expand Down
19 changes: 18 additions & 1 deletion app/gui/src/model/project/synchronized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use engine_protocol::language_server;
use engine_protocol::language_server::response;
use engine_protocol::language_server::CapabilityRegistration;
use engine_protocol::language_server::ContentRoot;
use engine_protocol::language_server::DiagnosticType;
use engine_protocol::language_server::ExpressionUpdates;
use engine_protocol::language_server::MethodPointer;
use engine_protocol::project_manager;
Expand Down Expand Up @@ -493,7 +494,23 @@ impl Project {
let execution_update = ExecutionUpdate::ExpressionUpdates(updates);
execution_update_handler(context_id, execution_update);
}
Event::Notification(Notification::ExecutionStatus(_)) => {}
Event::Notification(Notification::ExecutionStatus(status)) => {
if status.diagnostics.len() > 0 {
let fst = &status.diagnostics[0];
if fst.kind == DiagnosticType::Error {
let notification = model::project::Notification::Message {
message: fst.message.as_str().to_owned(),
};
publisher.notify(notification);
}
error!(
"Evaluation failed in context {}. {:?}: {}",
status.context_id,
fst.kind,
fst.message.as_str()
);
}
}
Event::Notification(Notification::ExecutionComplete { context_id }) => {
execution_update_handler(context_id, ExecutionUpdate::Completed);
}
Expand Down
4 changes: 4 additions & 0 deletions app/gui/src/presenter/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ impl Project {
Notification::VcsStatusChanged(VcsStatus::Clean) => {
model.set_project_changed(false);
}
Notification::Message { message } => {
let message = view::status_bar::event::Label::from(message);
model.status_bar.add_event(message);
}
};
std::future::ready(())
});
Expand Down