Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
A set of small fixes (#1264)
Browse files Browse the repository at this point in the history
* Make a window bigger, so the "Unsupported engine version" message will fit into it.
* Add indicator that stdlib is still compiling, removed once we get first expression updates
* Fix the "white-on-white" bug in nodes.
* Update the parser commt, so we will have a fix for unresolved macros crashes
  • Loading branch information
farmaazon authored Feb 25, 2021
1 parent 7cd367e commit a3f2d31
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/js/lib/client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const resources = path.join(root, "..")
// ================

let windowCfg = {
width : 640,
width : 960,
height : 640,
}

Expand Down
1 change: 1 addition & 0 deletions src/rust/ide/lib/ast/impl/src/crumbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ fn pattern_subcrumbs(pat:&MacroPatternMatch<Shifted<Ast>>) -> Vec<Vec<PatternMat
Block(_) => {crumb.push(PatternMatchCrumb::Block) ; crumbs.push(crumb)},
Macro(_) => {crumb.push(PatternMatchCrumb::Macro) ; crumbs.push(crumb)},
Invalid(_) => {crumb.push(PatternMatchCrumb::Invalid) ; crumbs.push(crumb)},
FailedMatch(_)=> (),
Except(pat) => {
crumb.push(PatternMatchCrumb::Except);
patterns.push((crumb,&pat.elem))
Expand Down
50 changes: 26 additions & 24 deletions src/rust/ide/lib/ast/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,18 +666,19 @@ pub type MacroPattern = Rc<MacroPatternRaw>;
Cls { cls : PatternClass , pat : MacroPattern },

// === Token Patterns ===
Tok { spaced : Spaced , ast : Ast },
Blank { spaced : Spaced },
Var { spaced : Spaced },
Cons { spaced : Spaced },
Opr { spaced : Spaced , max_prec : Option<usize> },
Annotation { spaced : Spaced },
Mod { spaced : Spaced },
Num { spaced : Spaced },
Text { spaced : Spaced },
Block { spaced : Spaced },
Macro { spaced : Spaced },
Invalid { spaced : Spaced },
Tok { spaced : Spaced , ast : Ast },
Blank { spaced : Spaced },
Var { spaced : Spaced },
Cons { spaced : Spaced },
Opr { spaced : Spaced , max_prec : Option<usize> },
Annotation { spaced : Spaced },
Mod { spaced : Spaced },
Num { spaced : Spaced },
Text { spaced : Spaced },
Block { spaced : Spaced },
Macro { spaced : Spaced },
Invalid { spaced : Spaced },
FailedMatch { spaced : Spaced },
}

#[ast] pub enum PatternClass { Normal, Pattern }
Expand Down Expand Up @@ -739,18 +740,19 @@ pub enum MacroPatternMatchRaw<T> {
Cls { pat: MacroPatternRawCls , elem: MacroPatternMatch<T> },

// === Token Matches ===
Tok { pat: MacroPatternRawTok , elem: T },
Blank { pat: MacroPatternRawBlank , elem: T },
Var { pat: MacroPatternRawVar , elem: T },
Cons { pat: MacroPatternRawCons , elem: T },
Opr { pat: MacroPatternRawOpr , elem: T },
Annotation { pat: MacroPatternRawAnnotation , elem: T },
Mod { pat: MacroPatternRawMod , elem: T },
Num { pat: MacroPatternRawNum , elem: T },
Text { pat: MacroPatternRawText , elem: T },
Block { pat: MacroPatternRawBlock , elem: T },
Macro { pat: MacroPatternRawMacro , elem: T },
Invalid { pat: MacroPatternRawInvalid , elem: T },
Tok { pat: MacroPatternRawTok , elem: T },
Blank { pat: MacroPatternRawBlank , elem: T },
Var { pat: MacroPatternRawVar , elem: T },
Cons { pat: MacroPatternRawCons , elem: T },
Opr { pat: MacroPatternRawOpr , elem: T },
Annotation { pat: MacroPatternRawAnnotation , elem: T },
Mod { pat: MacroPatternRawMod , elem: T },
Num { pat: MacroPatternRawNum , elem: T },
Text { pat: MacroPatternRawText , elem: T },
Block { pat: MacroPatternRawBlock , elem: T },
Macro { pat: MacroPatternRawMacro , elem: T },
Invalid { pat: MacroPatternRawInvalid , elem: T },
FailedMatch { pat: MacroPatternRawFailedMatch },
}

// =============================================================================
Expand Down
1 change: 1 addition & 0 deletions src/rust/ide/lib/ast/impl/src/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ has_tokens!(MacroPatternMatchRawText <T>, self.elem);
has_tokens!(MacroPatternMatchRawBlock <T>, self.elem);
has_tokens!(MacroPatternMatchRawMacro <T>, self.elem);
has_tokens!(MacroPatternMatchRawInvalid <T>, self.elem);
has_tokens!(MacroPatternMatchRawFailedMatch);


// === Switch ===
Expand Down
3 changes: 1 addition & 2 deletions src/rust/ide/lib/parser/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::path::PathBuf;
const PARSER_PATH: &str = "./pkg/scala-parser.js";

/// Commit from `enso` repository that will be used to obtain parser from.
const PARSER_COMMIT: &str = "5e309bddcbec33cfbd150fcb8a16b45192cf5189";
const PARSER_COMMIT: &str = "2c5ed028aab74fa50747c5c9eaa1ec21ae0c5c07";

/// Magic code that needs to be prepended to ScalaJS generated parser due to:
/// https://github.com/scala-js/scala-js/issues/3677/
Expand Down Expand Up @@ -128,7 +128,6 @@ impl ParserProvider {
Ok(hash) => hash != PARSER_COMMIT
};
if changed {
println!("cargo:warning=Parser version changed. Rebuilding.");
let parser_js = self.download().await;
self.patch_and_store(parser_js);
fs::write(&fingerprint,PARSER_COMMIT).expect("Unable to write parser fingerprint.");
Expand Down
1 change: 0 additions & 1 deletion src/rust/ide/lib/parser/tests/bugs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ wasm_bindgen_test_configure!(run_in_browser);
fn missing_macro_segment() {
// TODO: should succeed
// https://github.com/enso-org/enso/issues/256
assert!(parser::Parser::new_or_panic().parse_line("a ->").is_err());
assert!(parser::Parser::new_or_panic().parse_line("-> a").is_err());
}

Expand Down
2 changes: 2 additions & 0 deletions src/rust/ide/lib/parser/tests/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ impl Fixture {
, "export bar"
, "from bar import all"
, "from bar export bo"
, "a ->"
];

for macro_usage in macro_usages.iter() {
Expand All @@ -424,6 +425,7 @@ impl Fixture {
assert_eq!(segment_body.off,2);
assert_var(&segment_body.wrapped,"foo");
});

}

fn run(&mut self) {
Expand Down
14 changes: 14 additions & 0 deletions src/rust/ide/src/ide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ pub mod integration;
use crate::prelude::*;

use crate::controller::FilePath;
use crate::controller::graph::executed::Notification as GraphNotification;
use crate::model::module::Path as ModulePath;
use crate::ide::integration::Integration;

use ensogl::application::Application;
use enso_protocol::language_server::MethodPointer;
use ide_view::status_bar;
use parser::Parser;

pub use initializer::Initializer;
Expand Down Expand Up @@ -90,6 +92,18 @@ impl Ide {
let text = controller::Text::new(&logger, &project, file_path).await?;
let visualization = project.visualization().clone();

let status_bar = view.status_bar().clone_ref();
status_bar.add_process(status_bar::process::Label::new("Compiling standard library..."));
let compiling_process = status_bar.last_process.value();
let notifications = graph.subscribe();
let mut computed_value_notifications = notifications.filter(|notification|
futures::future::ready(matches!(notification, GraphNotification::ComputedValueInfo(_)))
);
executor::global::spawn(async move {
computed_value_notifications.next().await;
status_bar.finish_process(compiling_process);
});

let integration = Integration::new(view,graph,text,visualization,project);
Ok(Ide {application,integration})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ impl Area {
let not_a_port
= node.is_positional_insertion_point()
|| node.is_chained()
|| node.is_root()
|| (node.is_root() && !node.children.is_empty())
|| skip_opr
|| node.is_token()
|| builder.parent_parensed;
Expand Down
17 changes: 14 additions & 3 deletions src/rust/ide/view/src/status_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ impl Model {
fn finish_process(&self, id:process::Id) -> bool {
self.processes.borrow_mut().remove(&id).is_some()
}

/// Returns empty string if no event received so far.
fn last_event_message(&self) -> event::Label {
self.events.borrow().last().cloned().unwrap_or_default()
}
}


Expand Down Expand Up @@ -182,9 +187,15 @@ impl View {
));
displayed_process_finished <- frp.finish_process.all(&frp.output.displayed_process).filter(|(fin,dis)| dis.contains(fin));

label_after_adding_event <- frp.add_event.map(|label| AsRef::<ImString>::as_ref(label).clone_ref());
label_after_adding_process <- frp.add_process.map(|label| AsRef::<ImString>::as_ref(label).clone_ref());
label_after_finishing_process <- displayed_process_finished.constant(ImString::default());
label_after_adding_event <- frp.add_event.map(
|label| AsRef::<ImString>::as_ref(label).clone_ref()
);
label_after_adding_process <- frp.add_process.map(
|label| AsRef::<ImString>::as_ref(label).clone_ref()
);
label_after_finishing_process <- displayed_process_finished.map(
f_!([model] AsRef::<ImString>::as_ref(&model.last_event_message()).clone_ref())
);

label <- any(label_after_adding_event,label_after_adding_process,label_after_finishing_process);
eval label ((label) model.label.set_content(label.to_string()));
Expand Down

0 comments on commit a3f2d31

Please sign in to comment.