Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into wip/farmaazon/cach…
Browse files Browse the repository at this point in the history
…ed-shape-parameter-184212663
  • Loading branch information
farmaazon committed Feb 21, 2023
2 parents 01c611a + 58c7ca5 commit 20149c1
Show file tree
Hide file tree
Showing 175 changed files with 9,677 additions and 4,786 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,14 @@
- [Added restoring of last project snapshot on shortcut.][4050]
- [Added contextual suggestions to argument dropdowns][4072]. Dropdowns will now
contain suggestions which are based on evaluated data.
- [Added a shortcut to show internal components (private API) in the component
browser.][5582]
- [Improved component browser entry filtering and sorting][5645]. The component
browser will now provide suggestions matching either the component's label or
the corresponding code.
- [Improved argument placeholder resolution in more complex expressions][5656].
It is now possible to drop node connections onto missing arguments of chained
and nested function calls.

#### EnsoGL (rendering engine)

Expand Down Expand Up @@ -310,6 +315,9 @@
- [Updated `Table.set` to new API. New `Column.parse` function and added case
sensitivity to `Filter_Condition` and column functions.][4097]
- [Updated column selector APIs and new `Excel_Workbook` type.][5646]
- [Moved regex functionality out of `Text.locate` and `Text.locate_all` into
`Text.match` and `Text.match_all`.][5679]
- [`File.parent` may return `Nothing`.][5699]

[debug-shortcuts]:
https://github.com/enso-org/enso/blob/develop/app/gui/docs/product/shortcuts.md#debug
Expand Down Expand Up @@ -476,8 +484,11 @@
[4120]: https://github.com/enso-org/enso/pull/4120
[4050]: https://github.com/enso-org/enso/pull/4050
[4072]: https://github.com/enso-org/enso/pull/4072
[5582]: https://github.com/enso-org/enso/pull/5582
[5645]: https://github.com/enso-org/enso/pull/5645
[5646]: https://github.com/enso-org/enso/pull/5646
[5656]: https://github.com/enso-org/enso/pull/5656
[5699]: https://github.com/enso-org/enso/pull/5699

#### Enso Compiler

Expand Down
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/gui/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
[dependencies]
ensogl = { path = "../../../lib/rust/ensogl" }
enso-prelude = { path = "../../../lib/rust/prelude" }
enso-json-to-struct = { path = "../../../lib/rust/json-to-struct" }
semver = "1.0.0"

[build-dependencies]
Expand Down
61 changes: 27 additions & 34 deletions app/gui/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use enso_prelude::*;

use ensogl::system::web;
use enso_json_to_struct::json_to_struct;



Expand All @@ -37,37 +37,30 @@ pub fn engine_version_requirement() -> semver::VersionReq {
// === Args ===
// ============

ensogl::read_args! {
application_config_url: String,
authentication_enabled: bool,
dark_theme: bool,
data_gathering: bool,
debug: bool,
email: Option<String>,
emit_user_timing_measurements: bool,
enable_new_component_browser: bool,
enable_skip_and_freeze: bool,
enable_spector:bool,
entry: String,
frame: bool,
is_in_cloud: bool,
language_server_data: Option<String>,
language_server_rpc: Option<String>,
loader_download_to_init_ratio: f32,
max_before_main_entry_points_time_ms: f32,
namespace: Option<String>,
node_labels: bool,
pkg_js_url: String,
pkg_wasm_url: String,
platform: Option<web::platform::Platform>,
preferred_engine_version: Option<semver::Version>,
project: Option<String>,
project_manager: Option<String>,
shaders_url: String,
skip_min_version_check: bool,
/// When profiling the application (e.g. with the `./run profile` command), this argument
/// chooses what is profiled.
test_workflow: Option<String>,
theme: String,
use_loader: bool,
json_to_struct!(
"../../../../lib/rust/ensogl/pack/js/src/runner/config.json",
"../../../../app/ide-desktop/lib/content-config/src/config.json"
);

pub fn read_args() -> Args {
debug_span!("Reading application arguments from JS.").in_scope(|| {
let mut args = Args::default();
if let Ok(js_app) = ensogl::system::js::app::app() {
for param in js_app.config().params() {
if let Some(value) = param.value() {
let path = format!("{}.value", param.structural_name());
if let Some(err) = args.set(&path, value) {
error!("{}", err.display())
}
}
}
} else {
error!("Could not connect to JS application. Using default configuration.")
}
args
})
}

lazy_static! {
pub static ref ARGS: Args = read_args();
}
1 change: 1 addition & 0 deletions app/gui/docs/product/shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ broken and require further investigation.
| <kbd>ctrl</kbd> + <kbd>alt</kbd> + <kbd>shift</kbd> + <kbd>r</kbd> | Reload the visual interface. |
| <kbd>ctrl</kbd> + <kbd>alt</kbd> + <kbd>0 - 10</kbd> | Switch between debug rendering modes (0 is the normal mode). |
| <kbd>ctrl</kbd> + <kbd>alt</kbd> + <kbd>`</kbd> | Toggle profiling monitor (performance, memory usage, etc). |
| <kbd>ctrl</kbd> + <kbd>alt</kbd> + <kbd>p</kbd> | Toggle the visibility of internal components (private API) in the component browser. |
| <kbd>ctrl</kbd> + <kbd>d</kbd> | Send test data to the selected node. |
| <kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>enter</kbd> | Push a hardcoded breadcrumb without navigating. |
| <kbd>ctrl</kbd> + <kbd>shift</kbd> + <kbd>arrow up</kbd> | Pop a breadcrumb without navigating. |
Expand Down
12 changes: 11 additions & 1 deletion app/gui/language/ast/impl/src/opr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,19 @@ impl GeneralizedInfix {
infix_id: self.id,
};

let rest_offset = rest.operand.as_ref().map_or_default(|op| op.offset);

let target_subtree_infix = target.clone().and_then(|arg| {
let offset = arg.offset;
GeneralizedInfix::try_new(&arg.arg).map(|arg| ArgWithOffset { arg, offset })
GeneralizedInfix::try_new(&arg.arg).map(|arg| ArgWithOffset { arg, offset }).filter(
|target_infix| {
// For access operators, do not flatten them if there is a space before the dot.
// For example, `Foo . Bar . Baz` should not be flattened to `Foo.Bar.Baz`, as
// those should be treated as potential separate prefix expressions, allowing
// operator placeholders to be inserted.
rest_offset == 0 || target_infix.arg.name() != predefined::ACCESS
},
)
});
let mut target_subtree_flat = match target_subtree_infix {
Some(target_infix) if target_infix.arg.name() == self.name() =>
Expand Down
12 changes: 1 addition & 11 deletions app/gui/language/parser-scala/src/jsclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ impl From<JsValue> for Error {

#[wasm_bindgen(module = "/pkg/scala-parser.js")]
extern "C" {
#[wasm_bindgen(catch)]
fn doc_parser_generate_html_source(content: String) -> std::result::Result<String, JsValue>;
#[wasm_bindgen(catch)]
fn doc_parser_generate_html_from_doc(content: String) -> std::result::Result<String, JsValue>;
}
Expand All @@ -56,16 +54,8 @@ impl Client {
Ok(Client {})
}

/// Calls JS doc parser to generate HTML from documented Enso code.
pub fn generate_html_docs(&self, program: String) -> api::Result<String> {
let html_code = || {
let html_code = doc_parser_generate_html_source(program)?;
Result::Ok(html_code)
};
Ok(html_code()?)
}

/// Calls JS doc parser to generate HTML from pure doc code without Enso's AST.
#[profile(Detail)]
pub fn generate_html_doc_pure(&self, code: String) -> api::Result<String> {
let html_code = || {
let html_code = doc_parser_generate_html_from_doc(code)?;
Expand Down
6 changes: 0 additions & 6 deletions app/gui/language/parser-scala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ impl DocParser {
DocParser::new().unwrap_or_else(|e| panic!("Failed to create doc parser: {e:?}"))
}

/// Parses program with documentation and generates HTML code.
/// If the program does not have any documentation will return empty string.
pub fn generate_html_docs(&self, program: String) -> api::Result<String> {
self.borrow_mut().generate_html_docs(program)
}

/// Parses pure documentation code and generates HTML code.
/// Will return empty string for empty entry.
pub fn generate_html_doc_pure(&self, code: String) -> api::Result<String> {
Expand Down
12 changes: 1 addition & 11 deletions app/gui/language/parser-scala/src/wsclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ impl From<serde_json::error::Error> for Error {
#[allow(clippy::enum_variant_names)]
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub enum Request {
DocParserGenerateHtmlSource { program: String },
DocParserGenerateHtmlFromDoc { code: String },
}

Expand Down Expand Up @@ -196,17 +195,8 @@ impl Client {
Ok(client)
}

/// Sends a request to parser service to generate HTML code from documented Enso code.
pub fn generate_html_docs(&mut self, program: String) -> api::Result<String> {
let request = Request::DocParserGenerateHtmlSource { program };
let response_doc = self.rpc_call_doc(request)?;
match response_doc {
ResponseDoc::SuccessDoc { code } => Ok(code),
ResponseDoc::Error { message } => Err(ParsingError(message)),
}
}

/// Sends a request to parser service to generate HTML code from pure documentation code.
#[profile(Detail)]
pub fn generate_html_doc_pure(&mut self, code: String) -> api::Result<String> {
let request = Request::DocParserGenerateHtmlFromDoc { code };
let response_doc = self.rpc_call_doc(request)?;
Expand Down
12 changes: 6 additions & 6 deletions app/gui/language/span-tree/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub fn main() {
let parens_cr1 = ast::crumbs::MatchCrumb::Segs { val: val.clone(), index: 0 };
let parens_cr = ast::crumbs::MatchCrumb::Segs { val, index: 0 };
let _input_span_tree = builder::TreeBuilder::<()>::new(36)
.add_child(0, 14, node::Kind::Chained, PrefixCrumb::Func)
.add_child(0, 9, node::Kind::operation(), PrefixCrumb::Func)
.add_child(0, 14, node::Kind::chained(), PrefixCrumb::Func)
.add_child(0, 9, node::Kind::Operation, PrefixCrumb::Func)
.set_ast_id(Uuid::new_v4())
.done()
.add_empty_child(10, InsertionPointType::BeforeTarget)
Expand All @@ -41,7 +41,7 @@ pub fn main() {
.set_ast_id(Uuid::new_v4())
.add_child(1, 19, node::Kind::argument(), parens_cr1)
.set_ast_id(Uuid::new_v4())
.add_child(0, 12, node::Kind::operation(), PrefixCrumb::Func)
.add_child(0, 12, node::Kind::Operation, PrefixCrumb::Func)
.set_ast_id(Uuid::new_v4())
.done()
.add_empty_child(13, InsertionPointType::BeforeTarget)
Expand All @@ -57,11 +57,11 @@ pub fn main() {
let input_span_tree2 = Node::<()>::new()
.new_child(|t| {
t.new_ast_id()
.kind(node::Kind::Chained)
.kind(node::Kind::chained())
.crumbs(PrefixCrumb::Func)
.new_child(|t| {
t.size(9.bytes())
.kind(node::Kind::operation())
.kind(node::Kind::Operation)
.crumbs(PrefixCrumb::Func)
.new_ast_id()
})
Expand All @@ -85,7 +85,7 @@ pub fn main() {
.crumbs(parens_cr)
.new_child(|t| {
t.size(12.bytes())
.kind(node::Kind::operation())
.kind(node::Kind::Operation)
.crumbs(PrefixCrumb::Func)
.new_ast_id()
})
Expand Down
4 changes: 2 additions & 2 deletions app/gui/language/span-tree/src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ mod test {
// Consider Span Tree for `foo bar` where `foo` is a method known to take 3 parameters.
// We can try setting each of 3 arguments to `baz`.
let tree = TreeBuilder::<()>::new(7)
.add_leaf(0, 3, node::Kind::operation(), PrefixCrumb::Func)
.add_leaf(0, 3, node::Kind::Operation, PrefixCrumb::Func)
.add_leaf(4, 7, node::Kind::this(), PrefixCrumb::Arg)
.add_empty_child(7, ExpectedArgument(1))
.add_empty_child(7, ExpectedArgument(2))
Expand All @@ -416,7 +416,7 @@ mod test {
// parameters. We can try setting each of 2 arguments to `baz`.
let tree: SpanTree = TreeBuilder::new(10)
.add_leaf(0, 4, node::Kind::this(), InfixCrumb::LeftOperand)
.add_leaf(5, 6, node::Kind::operation(), InfixCrumb::Operator)
.add_leaf(5, 6, node::Kind::Operation, InfixCrumb::Operator)
.add_leaf(7, 10, node::Kind::argument(), InfixCrumb::RightOperand)
.add_empty_child(10, ExpectedArgument(0))
.add_empty_child(10, ExpectedArgument(1))
Expand Down
Loading

0 comments on commit 20149c1

Please sign in to comment.