Commit Graph

148 Commits

Author SHA1 Message Date
Michał Wawrzyniec Urbańczyk
2507a2049b
Code Signing on Windows (#3654)
This PR reenables code signing on Windows.
Each Windows package built on CI should be now signed.
Additionally, some refactorings were done around electron-builder config, so it is easier to use outside the build script and offers more configuration options.
2022-08-23 00:49:23 +02:00
Michael Mauderer
58fb383791
Create new node when opening searcher and no node is selected. (#3645)
So far, when opening the searcher with no node selected, an empty input without an associated AST node was created. This input was manipulated by the user and the final expression from the input was used to create a new node when the user confirmed their input. This PR changes this, so that when the searcher is opened without a selected node, a new AST node is created right away with some placeholder content, and this node is updated when the user confirms their input.

The only change visible to the user, is that if the text editor is opened during editing, a new node will appear in the source when the searcher is opened to create a new node. All other behaviour should stay the same.
2022-08-22 15:32:44 +00:00
Mateusz Czapliński
fc089857d0
Filtering of Virtual Entries in Component Browser by input & return types. (#3652)
Filter the Virtual Entries displayed in the Component Browser based on the input type and the return type of the edited expression. Only the Virtual Entries with matching types are displayed.

https://www.pivotaltracker.com/story/show/182842444

#### Visuals

See below for two screenshots, showing the Component Browser with an empty expression and with the input port not connected. Two virtual entries are visible, with documentation.

<img width="871" alt="Screenshot 2022-08-16 at 15 19 55" src="https://user-images.githubusercontent.com/273837/184894042-0f64986d-2c89-4c94-90cf-215467e297c7.png">

<img width="866" alt="Screenshot 2022-08-16 at 15 20 04" src="https://user-images.githubusercontent.com/273837/184894059-5089414c-c1f3-407c-a6da-38fd9c3e7c81.png">

See below for a screenshot showing the Component Browser with `5.div ` expression entered. The `div` method expects an `Integer` argument. Only the `number input` virtual component is visible.

<img width="504" alt="Screenshot 2022-08-16 at 15 23 07" src="https://user-images.githubusercontent.com/273837/184894081-358ae780-cfca-4002-b7da-4be57f0357c1.png">

See below for a screenshot showing the Component Browser with `Geo.point ` expression entered. The `point` method expects a `Decimal` argument. Only the `number input` virtual component is visible.

<img width="500" alt="Screenshot 2022-08-16 at 15 24 37" src="https://user-images.githubusercontent.com/273837/184894119-d4f5e7e1-5948-4d8f-adc4-f94a2f4c7245.png">

See below for a screenshot showing the Component Browser with `5.format ` expression entered. The `format` method expects a `Text` argument. Only the `text input` virtual component is visible.


<img width="480" alt="Screenshot 2022-08-16 at 15 55 27" src="https://user-images.githubusercontent.com/273837/184897598-465569c8-8319-43ac-9589-4384ffdc33cc.png">

See below for a video showing that the Component Browser opened with the input port connected to a typed node. The Component Browser does not show virtual entries.

https://user-images.githubusercontent.com/273837/184914619-957a7369-1019-4636-989d-96d65954642f.mov

# Important Notes
- Unused code from the old `enso_gui::controller::searcher::action::hardcoded` module is removed. The `enso_gui::controller::searcher::component::hardcoded::Snippet` type is redefined to contain only the used fields from the old `action::hardcoded::Suggestion` type.
2022-08-18 09:40:41 +00:00
Mateusz Czapliński
3c12a8c0a2
Virtual Entries in Component Browser (#3621)
Add "text input" and "number input" virtual entries in the "Input" virtual component group in the Component Browser. The entries provide an easy way to put strings and numbers into a graph.

https://www.pivotaltracker.com/story/show/181870589

#### Visuals

See below for a video showing the "text input" and "number input" virtual entries in the "Input" component group in the "Favorites Data Science Tools" section of the Component Browser. Please note that the video also displays a few known issues that are present in the existing code and not introduced by this PR:

- "Opening the Component Browser 2nd or later time flashes its last contents from the previous time" - reported as [issue 15 in PR 3530](https://github.com/enso-org/enso/pull/3530#pullrequestreview-1035698205) (which is [expected](https://github.com/enso-org/enso/pull/3530#issuecomment-1187676313) to be fixed by https://www.pivotaltracker.com/story/show/182610422).
- The text of all the entries in the Component Browser does not show immediately, but the entries appear one by one instead (this is related to the performance of the current implementation of Component Browser and Text Area).
- Selection in the Component Browser can show half-way between entries - reported as https://www.pivotaltracker.com/story/show/182713338.

https://user-images.githubusercontent.com/273837/183472391-c14eeded-481f-492e-a1b8-b86f42faf0cd.mov

# Important Notes
- The virtual entries are not filtered by input type or return type. The filtering is expected to be implemented in https://www.pivotaltracker.com/story/show/182842444.
2022-08-17 13:28:07 +00:00
Michał W. Urbańczyk
146297a0a0 CR feedback 2022-08-16 15:38:10 +02:00
Michał Wawrzyniec Urbańczyk
6c82588972
Handling exceptions in IDE main to avoid entering "zombie process" state. (#3648)
This is meant to address https://www.pivotaltracker.com/story/show/182691027.
2022-08-16 12:56:08 +00:00
Ilya Bogdanov
973946d585
Fix zooming regression in demo scene & fix switching of the navigator in the component browser (#3646)
[ci no changelog needed]

This PR fixes a [regression](https://www.pivotaltracker.com/story/show/182972359) found in the `interface` debug the scene. It was caused by multiple `Navigator`s that were present in the demo scene and conflict with each other.

Also, this PR includes a fix for the invalid logic of the new component browser. We disable `Navigator` when the mouse hovers the component browser. Still, due to a mistake in the code, the component browser was considered visible at all times and therefore blocked the navigator in certain mouse positions.

To reproduce this bug (before this PR):
1. Open a default project
2. Place the mouse somewhere in the middle of the screen (near one of the nodes)
3. Try panning or zooming the scene (you won't be able because of this bug)
2022-08-12 14:22:37 +00:00
Michael Mauderer
3a6c558418
Implement reversion of nodes after editing via searcher. (#3613)
Add functionality to revert a node that was changed during editing through the searcher.
Note that currently, nodes are not edited by the searcher, except upon confirmation, Thus this functionality results in a no-op at the moment.

# Important Notes
[ci no changelog needed]
2022-08-12 07:55:54 +00:00
Michał Wawrzyniec Urbańczyk
bd3b778721
Replace webpack with esbuild (#3592)
This PR replaces webpack with esbuild, as our bundler.

The change leads to out-of-the-box ~5x improvement in bundling times, reducing the latency in watch-based workflows. 
Along with this a new development server (with live reload capacity) has been introduced to support watch command.

[ci no changelog needed]

### Important Notes
* workflow for checking docs has been removed because it was using outdated prettier version and caused troubles; while the same check is performed in a better way by the GUI/Lint job.
* introduced little more typescript in the scripts in place of js, usually with minimal changes.
2022-08-10 03:41:44 +02:00
Ilya Bogdanov
698a6a0674
Left align component browser to the edited node (#3636)
[ci no changelog needed]

[Task link](https://www.pivotaltracker.com/story/show/181870555)

This PR changes the relative position of the edited node in such a way that it is left-aligned to the component browser window. This change reflects the most recent version of the [design doc](https://github.com/enso-org/design/blob/main/epics/component-browser/design.md#overview)

<img width="1157" alt="Screenshot 2022-08-08 at 19 15 47" src="https://user-images.githubusercontent.com/6566674/183454192-81960e0a-ab69-43a4-b7df-d13320a9d16d.png">

As an additional change, the FRP implementation of the `Camera2d` was extended with a new output (screen dimensions) and fixed. With the old implementation, there was a possibility of panic at runtime because of non-exclusive borrows of `RefCell`. The FRP event for camera position was emited inside the scope with a mutable `RefCell` borrow. Any attempt to borrow the camera one more time (e.g., by calling one of the getters, such as `zoom()`) caused panic at runtime.
2022-08-09 23:03:54 +00:00
Ilya Bogdanov
7251b6379b
Fix: Selection does not follow mouse when scrolling and can show half-way between entries (#3604)
[ci no changelog needed]

[Task link](https://www.pivotaltracker.com/story/show/182713338).

This PR fixes the implementation of the entries highlight (selection box) in the component list panel of the component browser. The previous behavior was caused by the dumb implementation of keeping the selection inside the borders of the component list panel. Now the selection is correctly clipped and is hovering over entries at all times.

Screencasts:


https://user-images.githubusercontent.com/6566674/182196585-02ab5ec4-7d12-4d7a-8563-ac95aec3c9f4.mp4



https://user-images.githubusercontent.com/6566674/182196768-9d28e83d-6c77-4ef6-abb0-98d50c4e74b7.mp4

# Important Notes
- This PR does not change the fact that after opening the component browser, the selection hovers over a random entry. See a [dedicated task](#182729573) for that.
- The selection box shape was moved from the `component_group` module because it depends heavily on list panel view implementation.
- The selection was removed from the `component_group` demo scene. We have a `component_list_panel_view` demo scene instead.
2022-08-05 12:44:21 +00:00
Ilya Bogdanov
9f8829650a
Layouting algorithm for the Favorites section (#3625)
[ci no changelog needed]

[Task link](https://www.pivotaltracker.com/story/show/181431035)

This PR implements an algorithm that arranges component groups of the Favorites section into three columns, with the more important groups being accessible by fewer keystrokes. [The algorithm description](https://github.com/enso-org/design/blob/main/epics/component-browser/design.md#layouting-algorithm).


https://user-images.githubusercontent.com/6566674/181642100-62769419-66e0-4a82-8dd8-be10662745d6.mp4
2022-08-05 09:39:51 +00:00
Mateusz Czapliński
c6835d2de7
Show custom icons in Component Browser (#3606)
Show custom icons in Component Browser for entries that have a non-empty `Icon` section in their docs with the section's body containing a name of a predefined icon.

https://www.pivotaltracker.com/story/show/182584336

#### Visuals

A screenshot of a couple custom icons in the Component Browser:

<img width="346" alt="Screenshot 2022-07-27 at 15 55 33" src="https://user-images.githubusercontent.com/273837/181265249-d57f861f-8095-4933-9ef6-e62644e11da3.png">

# Important Notes
- The PR assigns icon names to four items in the standard library, but only three of them are shown in the Component Browser because of [a parsing bug in the Engine](https://www.pivotaltracker.com/story/show/182781673).
- Icon names are assigned only to four items in the standard library because only two currently predefined icons match entries in the currently defined Virtual Component Groups. Adjusting the definitions of icons and Virtual Component Groups is covered by [a different task](https://www.pivotaltracker.com/story/show/182584311).
- A bug in the documentation of the Enso protocol message `DocSection` is fixed. A `text` field in the `Tag` interface is renamed to `body` (this is the field name used in Engine).
2022-08-01 13:41:04 +00:00
Adam Obuchowicz
2aac511ac5
Component Browser: Add title with full component name to documentation (#3598)
This is a partial workaround for https://www.pivotaltracker.com/story/show/182713407

Because some entries' names are too long to be displayed inside the Component List Panel, the user may have no clue what the method is. Therefore, we add a title to each doc page.

There is also code introduced for displaying name of modules when submodule header is selected. However, it does not work, and it's hard to fix without significant changes in the Component List Panel API and implementation. Because those will be altered when implementing [Efficient Component List Panel](https://www.pivotaltracker.com/story/show/182561072), fixing is postponed until then.

![image](https://user-images.githubusercontent.com/3919101/179717147-00329637-1f87-42ae-b54a-63840766099f.png)

# Important Notes
The code contains some significant refactoring. Removed long functions obtaining entries from the component::List - instead you can get group, and then entry from group. They return an option, which is turned to Result in the presenter (where we actually take advantage of having Result instead of Option).
2022-07-29 08:26:07 +00:00
Mateusz Czapliński
5b4aac0138
Virtual Component Groups filtered by completion IDs (#3570)
Filter the Virtual Component Groups (a.k.a. "Favorites Data Science Tools") in the `component::List` (a.k.a. Hierarchical Action List) to only contain components with IDs listed in the Engine's response to a `search/completion` request.

This completes the "Virtual Component Groups filtered by input type" task (linked below) because the Engine's response to a `search/completion` request contains IDs of components filtered by input node type and `this` type.

https://www.pivotaltracker.com/story/show/182661634

#### Visuals

See below for a video showing the list of Favorites filtered by the type of the input node. Please note that the video also displays a few known issues that are present in the existing code and not introduced by this PR:
- "Opening the Component Browser 2nd or later time flashes its last contents from the previous time" - reported as [issue 15 in PR 3530](https://github.com/enso-org/enso/pull/3530#pullrequestreview-1035698205).
- The text of all the entries in the Component Browser does not show immediately, but the entries appear one by one instead (this is related to the performance of the current implementation of Component Browser and Text Area).

https://user-images.githubusercontent.com/273837/179000801-65ee7388-dde6-44b9-90fb-7453b4fb788c.mov


A screenshot showing the default, unfiltered list of Favorites when no input node is selected:

<img width="440" alt="Screenshot 2022-07-14 at 15 58 26" src="https://user-images.githubusercontent.com/273837/179000404-f14773a3-35a9-4e7a-877d-fcbb477b4769.png">
2022-07-22 01:18:44 +00:00
Mateusz Czapliński
07df7fabf2
Show default per-kind icons for all entries in Component Browser. (#3587)
Show default icons for all entries in the Component Browser. The icons are assigned to each entry depending on its kind.

https://www.pivotaltracker.com/story/show/182584326

#### Visuals

See below for a video showing entries of 5 different kinds in the Component Browser, each having a different icon. When watching the video, please note that the following are preexisting, known issues, not introduced by this PR:
- Selection is misaligned when hovering the mouse over the "new" component in the "Mcdbg Group 1" group - reported as issue 2 [in comments to PR 3530](https://github.com/enso-org/enso/pull/3530#pullrequestreview-1034223437).
- [Names of Modules and Atoms displayed in Component Browser start with a small letter.](https://www.pivotaltracker.com/story/show/182745386)




https://user-images.githubusercontent.com/273837/179016109-c3ebab5a-0205-4b44-85b8-df3129edd75d.mov

# Important Notes
- A new derive macro `ForEachVariant` is defined and added to the `enso-prelude` crate.
2022-07-21 23:57:41 +00:00
Mateusz Czapliński
f61849ce04
Fix behavior of "No Entries." text in Component Browser when zooming. (#3589)
Fix the behavior of the "No Entries." text while zooming with Component Browser open. Previously, the text changed size and moved around while zooming; after the fix, the text keeps constant size and stays in the expected place.

https://www.pivotaltracker.com/story/show/182713626

#### Visuals

The video below demonstrates the fixed behavior of the "No Entries." text while zooming with  Component Browser open.

https://user-images.githubusercontent.com/273837/179028254-812feabc-b3ed-4e20-8a06-7c37bf82f8ea.mov
2022-07-20 09:02:31 +00:00
Ilya Bogdanov
987333e1d3
Component Browser Section Navigator (left bar) (#3553)
[ci no changelog needed]
[Task link](https://www.pivotaltracker.com/story/show/181433641)

This PR adds a left bar with section navigation buttons to the Searcher List Panel. The buttons are implemented as a list view with an adjusted style.

https://user-images.githubusercontent.com/6566674/179517378-dba00f41-d32e-4ffb-a4d9-3cd376b3e781.mp4
2022-07-20 06:35:26 +00:00
Adam Obuchowicz
7fa4e5e369
Grid View with Scrolling (#3588)
**Note**: This PR also contains content of previous Grid View PR. We decided to discard the previous, because this one did some refactoring of old one, and it's not a big addition.

Added a scrollable::GridView component, which just embeds the GridView in ScrollArea. Also, re-worked the idea of text layers.

https://user-images.githubusercontent.com/3919101/179020359-512ee127-c333-4f86-bff5-f1cb4154e03c.mp4
2022-07-19 08:39:23 +00:00
Adam Obuchowicz
b0d627a797
Component list panel integration (#3530)
This PR contains all work for finishing integration of first Component List Panel in the IDE:
* It adds a stub for the whole Component Browser View. The documentation panel is re-used from the old searcher.
* It has the presenter implementation, integrating the view with Hierarchical Component List from the controller.
* It extends the View API, so the integration is possible, making use of Component Group Set wrapper.
* The selection integration was also merged into this PR, because it depended on the API extension mentioned above. However, we should avoid such practice in the future.

https://user-images.githubusercontent.com/3919101/177816427-8c4285b4-8941-4048-a400-52f4acf77a9f.mp4

# Important Notes
There are some known issues, to-be-fixed in the future.
* The performance is bad. It should be improved with new text::Area, and the decent one shall come with [GridView inside component browser](https://www.pivotaltracker.com/story/show/182561072)
* There is no keyboard navigation. It should also be delivered with [GridView](https://www.pivotaltracker.com/story/show/182561072).
* The Favorites section is not [filtered out by node source type](https://www.pivotaltracker.com/story/show/182661634).
2022-07-14 12:00:52 +00:00
Michael Mauderer
807d970d75
Implement saving of the pre-edit expression in the node metadata. (#3584)
Implements https://www.pivotaltracker.com/story/show/182633483

Adds functionality to the Searcher Controller to save the expression of a node to its metadata, while it is edited. In later PRs this will be used to restore the expression, if an edit is aborted. This will be needed, as the expression will be changed within the source while editing to allow the visualization preview to be shown. As of this PR, the information is only stored, not used yet.

Demo Video
------------------
Note how the metadata of the node includes a `edit_status` field, when the project is saved during editing, and how it is cleared when saving without an edit happening.

https://user-images.githubusercontent.com/1428930/178740111-d0bbaa43-00b0-42e3-9fbb-d9249f07ae35.mp4

# Important Notes
[ci no changelog needed]
2022-07-13 14:33:04 +00:00
James Dunkerley
73e9240a11
Remove here. from Javascript code. (#3577)
Visualization within the UI is no longer working since the removal of the `here` keyword.
This PR fixes the JavaScript calls.

# Important Notes
There are various lines of rust code which still have `here.` within them and these will need to be fixed at some point.
2022-07-12 13:34:37 +00:00
Michael Mauderer
ca034484b4
Component List Panel View Acceptance Fixes (#3576)
Updates the Component List Panel View to resolve issues spotted during acceptance review:
* order between "Local Scopes" and "Favourites Section" is switched.
* Headers in demo scenes now include a number indicating the index

https://user-images.githubusercontent.com/1428930/178252570-21405174-2a0f-4f58-8033-6a1a0055a16e.mp4

# Important Notes
[ci no changelog needed]
2022-07-12 10:06:36 +00:00
Mateusz Czapliński
ec5cd01dfa
Fix vertical alignment of short columns in Component Browser Local Scope (#3566)
Fix vertical alignment of columns in the Local Scope section of the Component Browser. All columns are now bottom-aligned and their entries align vertically. Previously, shorter columns were vertically centered and their entries did not align vertically with entries in longer columns.

https://www.pivotaltracker.com/story/show/180892146/comments/232101261 (see: *"Entries in the rightmost column of Local Scope is not vertically aligned with entries in other columns."*).

#### Visuals

Before:

<img width="626" alt="Screenshot 2022-07-06 at 18 14 18" src="https://user-images.githubusercontent.com/273837/177596439-cbe29a3a-2600-4b99-be20-955bf9fabd6e.png">


After:

<img width="626" alt="Screenshot 2022-07-06 at 18 08 27" src="https://user-images.githubusercontent.com/273837/177596072-1f3fd652-fe36-42c2-957c-4584b68539b4.png">
2022-07-07 22:59:51 +00:00
Mateusz Czapliński
dcd084eb07
Fix colors in Component List Panel View (#3565)
Fixes missing colors in the `component_list_panel_view` demo scene.

https://www.pivotaltracker.com/story/show/180892146/comments/232101261 (see: *"2. All groups in the demo scene look gray."*).

#### Visuals

Before:

<img width="450" alt="Screenshot 2022-07-06 at 16 07 29" src="https://user-images.githubusercontent.com/273837/177569995-e293ac58-69de-4fd3-bae6-22883047ae89.png">
<img width="441" alt="Screenshot 2022-07-06 at 16 08 06" src="https://user-images.githubusercontent.com/273837/177570026-e09c3b27-023d-4f56-9bd0-50ef3e8d225b.png">

After (the component groups are randomized in the demo scene, so the column heights may not align with the "before" screenshots):

<img width="445" alt="Screenshot 2022-07-06 at 16 02 04" src="https://user-images.githubusercontent.com/273837/177570107-accc94ed-42b3-465b-93d6-271914377e91.png">
<img width="459" alt="Screenshot 2022-07-06 at 16 02 28" src="https://user-images.githubusercontent.com/273837/177570213-18b94f7e-23d8-4d29-b15d-ccfdd9c41e07.png">
2022-07-07 08:29:55 +00:00
Mateusz Czapliński
d950499a90
Pan camera to created nodes. (#3552)
If a node created by the user gets placed off-screen, the screen's camera is panned to make the node visible.

https://www.pivotaltracker.com/story/show/181188687

#### Visuals

A screencast showing a number of node creation scenarios when the camera is panned to the newly created node, including when zoomed out.



https://user-images.githubusercontent.com/273837/177169716-50a12b0a-c742-4b01-9766-56206e7938b9.mov

# Important Notes
- Camera is panned also if the node is only partially visible, or if there's not enough free space visible around the node. The specific amount of free space that needs to be visible around a newly created node is configured in the theme.
- If the screen area is so small that the node cannot be fully fit in it (either horizontally or vertically), showing the left and top boundaries of the node's area takes priority over showing the corresponding opposite edges.
2022-07-06 10:33:35 +00:00
Mateusz Czapliński
2b2563a395
Implement trivial placeholder icons for all 5 Component Browser entry kinds. (#3557)
Implement simple placeholder icons for all entry kinds supported in the Suggestion Database. The icons are planned to be used in Component Browser as default icons for entries. This is intended to allow visually distinguishing different entry kinds.

The following additional fixes and tweaks are applied:
 - Icons previously using only 1 color from the theme now use the color provided through shape parameters instead.
 - The `data_science` and `network` icons now use only the 2 colors provided through shape parameters.
 - The `join` icon has its shape and colors modified and uses only the 2 colors provided through shape parameters.
 - The demo scene now parametrizes icon shapes using colors from the Component Browser Design Doc.

https://www.pivotaltracker.com/story/show/182584322

#### Visuals

Original contents of the demo scene before the PR:

<img width="2197" alt="x-orig" src="https://user-images.githubusercontent.com/273837/176669422-ee2e14c7-9ef4-42fd-acb7-ae3be6b68587.png">



Final contents of the demo scene after the PR:

<img width="2201" alt="x2-final" src="https://user-images.githubusercontent.com/273837/176668720-6f1685fd-f7e6-44d7-85f5-f6a6d6789644.png">
2022-07-04 16:36:27 +02:00
Michael Mauderer
e6b7d5b8fc
List Panel View Part 2 (#3537)
Design, integration and bugfix update for the List Panel View.

![image](https://user-images.githubusercontent.com/1428930/175554745-c4887d55-a885-4299-878b-4727f09a7520.png)

![image](https://user-images.githubusercontent.com/1428930/175554906-837db815-948d-4407-8233-10a15e4198b3.png)

![image](https://user-images.githubusercontent.com/1428930/175555165-bcbe5138-8e5c-416e-886b-c72df361d743.png)


[ci no changelog needed]
2022-07-04 14:08:31 +00:00
Michał Wawrzyniec Urbańczyk
43a893cae6
Bump the build script (#3535) 2022-07-01 03:58:14 +02:00
Mateusz Czapliński
d689777d7a
Local Scope entries in new Hierarchical Action List. (#3526)
Make the local scope components available to the Component Browser through `component::List` (previously known as "Hierarchical Action List"). (See the [Local Scope Section in the Design Doc](https://github.com/enso-org/design/blob/main/epics/component-browser/design.md#local-scope-section) for more details.)

https://www.pivotaltracker.com/story/show/181869186

# Important Notes
- Note: the PR description does not include a screencast due to the changes in this PR not having any visual effect at this moment. The result of this PR's changes would be only observed in the Component Browser, but the Component Browser is not merged yet. As described in the task's Acceptance Criteria, the changes in this PR are currently only covered by tests.
- The `component::group::Data::new_empty_visible` constructor was renamed to `from_name_and_id` and changed to set the `visible` field to a default value. All known code paths appear to call the `update_sorting_and_visibility` method before checking the value of the `visible` field, so setting the value to `true` when creating the object does not seem needed.

[ci no changelog needed]
2022-06-29 15:46:56 +00:00
Michael Mauderer
655793aa78
Component List Panel View (#3495) 2022-06-22 16:39:32 +01:00
Hubert Plociniczak
22a371a9c6
Substitute this with self (#3524)
A semi-manual s/this/self appied to the whole standard library.
Related to https://www.pivotaltracker.com/story/show/182328601

In the compiler promoted to use constants instead of hardcoded
`this`/`self` whenever possible.

# Important Notes
The PR **does not** require explicit `self` parameter declaration for methods as this part
of the design is still under consideration.
2022-06-21 10:53:52 +00:00
Ilya Bogdanov
71b3a9f40a
New selection box implementation for component groups (#3520)
[Task link](https://www.pivotaltracker.com/story/show/182194574).
[ci no changelog needed]

This PR implements a new selection box that will replace an old (not really working) one in the component browser. The old selection box wasn't working well with the headers of the component groups, so we were forced to make a much harder implementation.

The new implementation duplicates some visual components and places them in a separate layer. Then, a rectangular mask cuts off everything that is not "selected". This way:
- We have more control over what the selected entries should look like.
- We can easily support the multi-layer structure of the component groups with headers.
- We avoid problems with nested masks that our renderer doesn't support at the moment.

To be more precise, we duplicate the following:
- Background of the component group becomes the "fill" of the selection.
- Entries text and icons - we can alter them easily.
- Header background and header text. By placing them in separate scene layers we ensure correct rendering order.

https://user-images.githubusercontent.com/6566674/173657899-1067f538-4329-44f9-9dc2-78c8a4708b5a.mp4

# Important Notes
- This PR implements the base of our future selection mechanism, selecting entries with a mouse and keyboard still has several issues that will be fixed in the future tasks.
- The scrolling behavior will also be improved in future tasks. Right we only restrict the selection box position so that it never leaves the borders of the component group.
- I added a new function to `add` shapes to new layers in a non-exclusive way (we had only `add_exclusive`) before. I have no idea how we didn't use this feature before even though we mention it a lot in the docs.
- The demo scene restricts the position of the selection box for one-column component groups but does not for the wide component group.
2022-06-15 14:21:30 +00:00
Mateusz Czapliński
0c8b1a1e0b
Virtual Component Groups in the Hierarchical Action List (2/2) (#3510)
Put information about Virtual Component Groups in the Hierarchical Actions List.

https://www.pivotaltracker.com/story/show/181865548

# Important Notes
- This PR implements the subtask 2 of 2 in the ["Virtual Component Groups in the Hierarchical Action List" task](https://www.pivotaltracker.com/story/show/181865548).
- Note: the PR description does not include a screencast due to the changes in this PR not having any visual effect at this moment. The result of this PR's changes would be only observed in the Component Browser, but the Component Browser is not merged yet. As described in the task's Acceptance Criteria, the changes in this PR are currently only covered by tests.
- Manual integration testing with the Engine showed that a response to an `executionContext/getComponentGroups` request is non-empty only after an `executionContext/executionComplete` message is received by the IDE. (See also [a discussion on Discord](https://discord.com/channels/401396655599124480/983669600854106112).) This was not known by the IDE team or documented before, and the existing code was modified to take this into account. The protocol docs are expected to be updated by the Engine team.
- A list of component groups looked up in the suggestion database is cached in the node searcher as an optimization.

[ci no changelog needed]
2022-06-15 09:47:07 +00:00
Kaz Wesley
b756fc48d1
Symbol unregistration (#3507)
Remove a `Symbol`from the `SymbolRegistry` when its `SpriteSystem` is dropped.

This fixes the remaining buffer leak (after #3504) in https://www.pivotaltracker.com/story/show/181943457

# Important Notes
- The `SymbolRegistry` now assigns unique `SymbolId`s, so that we can tell if a `SymbolId` refers to a `Symbol` that has already been unregistered (this shouldn't happen, but it's not statically-obvious that it doesn't, so if it occurs we shouldn't misbehave).
- Also fix a bug in how `buffer_count` was tracked (we were decrementing more than incrementing!).
2022-06-15 03:54:59 +00:00
Kaz Wesley
a1bf0974ce
Better release build time; new maximum-performance production profile. (#3498)
### Pull Request Description

Using the new tooling (#3491), I investigated the **performance / compile-time tradeoff** of different codegen options for release mode builds. By scripting the testing procedure, I was able to explore many possible combinations of options, which is important because their interactions (on both application performance and build time) are complex. I found **two candidate profiles** that offer specific advantages over the current `release` settings (`baseline`):
- `thin16`: Supports incremental compiles in 1/3 the time of `baseline` in common cases. Application runs about 2% slower than `baseline`.
- `fat1-O4`: Application performs 13% better than `baseline`. Compile time is almost 3x `baseline`, and non-incremental.  
(See key in first chart for the settings defining these profiles.)

We can build faster or run faster, though not in the same build. Because the effect sizes are large enough to be impactful to developer and user experience, respectively, I think we should consider having it both ways. We could **split the `release` profile** into two profiles to serve different purposes:
- `release`: A profile that supports fast developer iteration, while offering realistic performance.
- `production`: A maximally-optimized profile, for nightly builds and actual releases.

Since `wasm-pack` doesn't currently support custom profiles (rustwasm/wasm-pack#1111), we can't use a Cargo profile for `production`; however, we can implement our own profile by overriding rustc flags.

### Performance details

![perf](https://user-images.githubusercontent.com/1047859/170788530-ab6d7910-5253-4a2b-b432-8bfa0b4735ba.png)

As you can see, `thin16` is slightly slower than `baseline`; `fat1-O4` is dramatically faster.

<details>
  <summary>Methodology (click to show)</summary>

I developed a procedure for benchmarking "whole application" performance, using the new "open project" workflow (which opens the IDE and loads a complex project), and some statistical analysis to account for variance. To gather this data:

Build the application with profiling:
`./run.sh ide build --profiling-level=debug`

Run the `open_project` workflow repeatedly:
`for i in $(seq 0 9); do dist/ide/linux-unpacked/enso --entry-point profile --workflow open_project --save-profile open_project_thin16_${i}.json; done`

For each profile recorded, take the new `total_self_time` output of the `intervals` tool; gather into CSV:
`echo $(for i in $(seq 0 9); do target/rust/debug/intervals < open_project_thin16_${i}.json | tail -n1 | awk '{print $2}'; do`
(Note that the output of intervals should not be considered stable; this command may need modification in the future. Eventually it would be nice to support formatted outputs...)

The data is ready to graph. I used the `boxplot` method of the [seaborn](https://seaborn.pydata.org/index.html) package, in order to show the distribution of data.
</details>

#### Build times
![thin16](https://user-images.githubusercontent.com/1047859/170788539-1578e41b-bc30-4f30-9b71-0b0181322fa5.png)

In the case of changing a file in `enso-prelude`, with the current `baseline` settings rebuilding takes over 3 minutes. With the `thin16` settings, the same rebuild completes in 40 seconds.

(To gather this data on different hardware or in the future, just run the new `bench-build.sh` script for each case to be measured.)
2022-06-11 00:09:54 +02:00
Ilya Bogdanov
c602404b1a
Multi Component Group Wrapper (#3473)
[ci no changelog needed]

This PR implements a new helper for the future Component Browser - `component_group::multi::Wrapper`. It propagates FRP events from multiple component groups and ensures that only a single component group is focused at all times.

See the updated component group demo scene (console logs shows propagated FRP events from all component groups):


https://user-images.githubusercontent.com/6566674/172359141-8ea6f1ba-e357-4c1b-852a-adb4d5207e03.mp4


- Fixed a `define_endpoints_2!` macro. FRP endpoints for `focus` events weren't connected properly.
- List View now uses an overlay shape to catch mouse events, it allows much easier implementation of `is_header_selected` in the component group.
2022-06-08 11:06:36 +00:00
Mateusz Czapliński
656d6e7660
Virtual Component Groups in the Hierarchical Action List (1/2) (#3488)
Parse the Engine's response containing Virtual Component Groups and store the results in a field of the Execution Context type.

https://www.pivotaltracker.com/story/show/181865548

# Important Notes
- This PR implements the subtask 1 of 2 in the ["Virtual Component Groups in the Hierarchical Action List" task](https://www.pivotaltracker.com/story/show/181865548).

[ci no changelog needed]
2022-06-03 17:18:20 +00:00
Adam Obuchowicz
66693ad642
Hierarchical Action List vel Component List. (#3501)
This PR introduces a new structure delivered by Searcher Controller: The Component List.

The Component list is hierarchical, and its structure reflects how the components are displayed in Component Browser - only "submodule" section at this point, other sections will be covered in next tasks.

This does not introduce anything visual; the structures are tested in unit tests.
2022-06-03 15:06:31 +00:00
Kaz Wesley
a5cd7dcab6
Fix leaks in input/output areas by partial revert of #3451. (#3504)
Fix a memory leak introduced by #3451. Found this to be part of the cause of [the buffer leaks](https://www.pivotaltracker.com/story/show/181943457/comments/231558434).

The problem with this use of `define_endpoints_2` is,
- The FRP network contains (strong) references to the `Model`.
- The `Model` has a strong reference to `api::Private`, which owns the FRP network.

Thus we never free the `Model`.
2022-06-02 18:33:36 +00:00
Kaz Wesley
bd60a20bd3
Profiling workflows (#3475)
Define some workflows for batch-mode profiling.

Implemented:
- collapse nodes
- create node
- enter collapsed node
- new project
- open visualization

They can currently be built and run with a command like:
`./run.sh ide build --profiling-level=debug && dist/ide/linux-unpacked/enso --entry-point profile --workflow create_node --save-profile out.json`

And the data can be displayed with:
`dist/ide/linux-unpacked/enso --entry-point profiling_run_graph --load-profile out.json`

Demo of recording and viewing a profile with a command-line one-liner:

https://user-images.githubusercontent.com/1047859/169954795-2d9520ca-84f9-45d2-b83a-5063ebe6f718.mp4

See: https://www.pivotaltracker.com/story/show/182195399.

# Important Notes
- When defining workflows, two helpers are enough to allow us to tell when the action is really done: `Fixture::compile_new_shaders`, and `Fixture::backend_execution`. Often, it is appropriate to await both, but it depends on the task.
- The shader compiler is now driven by a `Controller`; while the `Compiler` is reset if context is lost, the `Controller`'s state survives context loss.
- A new `--load-profile` option supports specifying a profile by path when running `profiling_run_graph`.
- Drop the `with_same_start` profiler interface; we ended up preferring a child profiler convention, and this interface was not implemented compatibly with the stricter data model we've had since the introduction of `profiler::data`.
- Fix the noisy `rustfmt` output.
2022-06-01 18:01:16 +00:00
Michał Wawrzyniec Urbańczyk
6fc4947764
Bumped the build script (#3489)
* The bash entry point was renamed `run.sh` -> `run`. Thanks to that `./run` works both on Linux and Windows with PowerShell (sadly not on CMD). 
* Everyone's favorite checks for WASM size and program versions are back. These can be disabled through `--wasm-size-limit=0` and `--skip-version-check` respectively. WASM size limit is stored in `build-config.yaml`.
* Improved diagnostics for case when downloaded CI run artifact archive cannot be extracted. 
* Added GH API authentication to the build script calls on CI. This should fix the macOS build failures that were occurring from time to time. (Actually they were due to runner being GitHub-hosted, not really an OS-specific issue by itself.)
* If the GH API Personal Access Token is provided, it will be validated. Later on it is difficult to say, whether fail was caused by wrong PAT or other issue.
* Renamed `clean` to `git-clean` as per suggestion to reduce risk of user accidently deleting unstaged work. 
* Whitelisting dependabot from changelog checks, so PRs created by it are mergeable.
* Fixing issue where wasm-pack-action (third party) randomly failed to recognize the latest version of wasm-pack (macOS runners), leading to failed builds.
* Build logs can be filtered using `ENSO_BUILD_LOG` environment variable. See https://docs.rs/tracing-subscriber/0.3.11/tracing_subscriber/struct.EnvFilter.html#directives for the supported syntax.
* Improve help for ci-run source, to make clear that PAT token is required and what scope is expected there.

Also, JS parts were updated with some cleanups and fixes following the changes made when introducing the build script.
2022-06-01 13:44:40 +02:00
Adam Obuchowicz
9c13a7fcbf
Integration Test for getComponentGroups method (#3483)
This PR contains minimal integration with new engine's method and an integration test printing the method's return value. It was written as a part of https://www.pivotaltracker.com/story/show/181743571

# Important Notes
The test requires 2022.1.1-nightly.2022-04-26 engine version or later.
2022-05-27 11:47:44 +00:00
Mateusz Czapliński
58581b69d0
Quick lookup Suggestion Database Entries by Name. (#3446)
Add a method in `SuggestionDatabase` allowing to find a suggestion entry by a fully qualified path, working faster than a linear search through all the entries in the `SuggestionDatabase`.

https://www.pivotaltracker.com/story/show/181852566

# Important Notes
- **Testing:** when testing the PR with the newest currently available nightly version of the Engine, you may observe the following warnings in the Chrome JS Developer Console (the numerical values may differ):

index.ts?ab16:289 WARN app/gui/src/model/suggestion_database.rs:61 An existing suggestion entry id at Standard.Base.Nothing.Nothing.is_nothing was overwritten with 768.
index.ts?ab16:289 WARN app/gui/src/model/suggestion_database.rs:61 An existing suggestion entry id at Standard.Base.Data.Numbers.Integer.up_to was overwritten with 936.
index.ts?ab16:289 WARN app/gui/src/model/suggestion_database.rs:61 An existing suggestion entry id at Standard.Base.Data.Numbers.Integer.down_to was overwritten with 937.
index.ts?ab16:289 WARN app/gui/src/model/suggestion_database.rs:61 An existing suggestion entry id at Standard.Base.Data.Text.Text.== was overwritten with 971.

This is a result of bugs in the Standard Library. Those are planned to be addressed by:
- #3480 short-term (to fix the specific bugs currently present in the Standard Library),
- https://www.pivotaltracker.com/story/show/182283983 long-term (to improve the Engine such that it disallows introducing this category of bugs in the Standard Library in the future).

(For more details, see also: https://discord.com/channels/401396655599124480/978929754138877962.)

As a result of the bugs mentioned above, the Engine is responding with some invalid replies. In case of such invalid replies, warnings are emitted in the JS Dev Console. Other than the warnings, the code is expected to work correctly with the Engine for the cases when the Engine returns correct data.
- A `HashMapTree` was used for storing the map. A quick back-of-the-envelope estimation of memory usage of a simpler alternative (a one-level `HashMap`) would put the alternative at ~1MB (~10k entities × averaged ~100 bytes per entity path), which was considered too much in a discussion with @farmaazon.
- The `HashMapTree::remove` method deletes a whole subtree of a `HashMapTree`. An alternative removal method was implemented for use in `suggestion_database::QualifiedNameToIdMap` to better match `HashMap` entry removal semantics.
- In case of path collisions, a warning is emitted.
- Paths are treated case-sensitively.
- The new method of the `SuggestionDatabase` type is currently only used in unit tests. This matches the explicit requirement in the Task's description.
- JS Developer Console logging was enabled for the `tracing` package. The `WARN` level was picked to match the default level enabled in the "old" logging infrastructure.

[ci no changelog needed]
2022-05-26 14:09:55 +00:00
Adam Obuchowicz
eef0738f63
Component Group Entry with icons and text highlighting. (#3459)
This PR extends the Component Group Entry with icon and option to highlight the text. Here the convert has highlighted "con".

https://user-images.githubusercontent.com/3919101/169046537-4f8b823c-322e-40dc-8abb-24d1d7092341.mp4


### Important Notes

Although this PR includes effort for adjusting Component Group style to better reflect the design, it is not entirely finished: the selection still works badly and will be fixed in another PR.
2022-05-24 09:48:19 +02:00
Michał Wawrzyniec Urbańczyk
14a01c4635
New IDE build script (#3466) 2022-05-23 04:16:04 +02:00
Ilya Bogdanov
4ebf637fd4
Fully visible group name in partially scrolled Component Group View (#3447)
[ci no changelog needed]

[Task link](https://www.pivotaltracker.com/story/show/181725003)

This PR implements a fully visible component group header while scrolling the group (using the ScrollArea).
The header moves in sync with scrolling movements (using new `set_header_pos` FRP input), so it looks like the component group is scrolled. ScrollArea masks the "scrolled" entries above the header. This design allows a fully visible header even though our renderer doesn't support nested layers masking yet.

The screencast:

https://user-images.githubusercontent.com/6566674/168320360-2c2017b2-0ef5-42ce-9c79-82b9641c1d73.mp4


The most recent one, with the updated demo scene from develop:


https://user-images.githubusercontent.com/6566674/168555268-8552c4b0-f887-4388-89a1-e65ddf668be6.mp4

# Important Notes
- I fixed the API of the list view so now it supports non-hardcoded scene layers (previously it did not). I also believe it was implemented incorrectly.
- I've found a [pretty weird bug](https://www.pivotaltracker.com/story/show/182193824): the component group inside the ScrollArea is invisible unless I add some arbitrary shape to the scroll area content. I use a `transparent_circle` for this purpose in the demo scene. The bug is probably related to masking the sublayers, though I wasn't able to reproduce it properly on a simpler example.
- The selection box is removed from the demo scene as agreed with @farmaazon . The correct implementation has proven to be much harder than I expected, and we will implement another approach in a separate PR.
- I also modified the `shadow::Parameters` so that it uses `Var`s instead of plain values.
2022-05-17 13:52:08 +00:00
Hubert Plociniczak
6b6b1430bc
Cleanup Ref - get/put (#3457)
The change promotes static methods of `Ref`, `get` and `put`, to be
methods of `Ref` type.
The change also removes `Ref` module from the default namespace.
Had to mostly c&p functional dispatch for now, in order for the methods
to be found. Will auto-generate that code as part of builtins system.

Related to https://www.pivotaltracker.com/story/show/182138899
2022-05-17 10:26:36 +00:00
Michael Mauderer
fd3c316636
Fix default text color not being applied correctly. (#3456) 2022-05-17 09:57:40 +01:00
Wojciech Daniło
9e219d698c
Initial parser implementation in Rust (#3341) 2022-05-17 05:13:20 +02:00