Commit Graph

757 Commits

Author SHA1 Message Date
Paweł Grabarz
3fcbef35cf
do not override default shape alignment in macro (#6170) 2023-04-03 12:34:27 +02:00
Paweł Grabarz
18f7f03304
bump shader tools version and use distribution install by default (#6164)
Update shader tools to new version. Notably, this release contains spirv-cross with fixed issue https://github.com/KhronosGroup/SPIRV-Cross/issues/2129.

# Important Notes
Spirv-cross has no versioning that we could use to specify requirements for using system-wide installed versions. Instead, we have to download the prebuilt distribution by default, so we can rely on known good versions. The usage of binaries in PATH can still be enabled with a build flag, but it is discouraged due to severity of the bug and no easy way of detecting it. If the project is built with buggy shader tools version, the application will run, but it will be visually slightly broken in unexpected ways.
2023-04-01 13:04:36 +00:00
Paweł Grabarz
08f28998ab
remove content_origin property from layout (#6155)
Simplified layout algorithm by removing `content_origin`, and instead treating `(0.0, 0.0)` as origin point in every layout object. This change allows overflowing containers that are within auto-layout. The parent element will no longer be moved within the grid cell when its children overflow it.

![image](https://user-images.githubusercontent.com/919491/228926310-b0117570-9f83-4687-8f8c-3fc778ff7d3c.png)

# Important Notes
When implementing this change, I have found that when object's size was modified without ever touching its position, that change was not being picked up in the "modified children" list, and `on_updated` was never triggered. Because some sprites now are bottom-left aligned, that is now a common case and was reproducible on the auto-layout example scene. I ended up fixing it by introducing another dirty flag for `computed_size` changes. Right now that flag is applied very broadly (on each layout update), but in the future we might make it more precise by actually checking if the size was changed in the process.

I believe that this might also be a fix for #5095, as I cannot reproduce it anymore with those changes.
2023-04-01 11:48:01 +00:00
Dmitry Bushev
2338e5d8e6
When renaming the project clean old modules instead of updating (#6148)
close #6139
close #6137

When the project is renamed, the engine cleans up affected modules and initiates modules re-indexing to fill the suggestions database with new records. This way it reduces the amount of information stored in the suggestions database and helps implement #6080 optimization.

Changelog:
- remove: rename features from the suggestions database
- update: rename command to initiate modules cleanup and project re-execution
- fix: #6137
2023-03-31 09:40:21 +00:00
Paweł Grabarz
d89de84988
add alignment setting per shape system (#6087)
- Added alignment configuration option for shape systems. That allows creating bottom-left aligned sprites, which will behave much more naturally inside auto-layouts.
- Added support for alignment in manual layouts. When alignment is set, the manual layout will position the child node at the respective border of its bounding box. The size of aligned node will not be affected. The difference from auto-layout alignment is that each node is aligned individually, and it is not affected by its siblings. This allows for constructing more complicated responsive layouts that don't necessarily follow the grid, without creating wrapper auto-layout elements for each child.


![layout-anim-and-alignment](https://user-images.githubusercontent.com/919491/227951742-7a7fd48a-7d07-4e19-b824-8c136e3fb381.gif)
2023-03-30 14:10:36 +00:00
Stijn ("stain") Seghers
ef45b6eb0d
Make tooltips more visually pleasing (#6097)
Closes #6059: visually centering text and adding a longer delay before showing tooltips. See the commit messages for details.

![Recording 2023-03-28 at 09 43 17](https://user-images.githubusercontent.com/607786/228164744-5a3ae878-11ab-4cdd-8fdf-93bdf4fe84fe.gif)
2023-03-30 08:51:31 +00:00
Paweł Grabarz
99a6f8f2f9
Decouple node edit mode from ports (#5983)
Implements #5919

Apart from some fixed glitches, no visual differences are present. This is mostly a refactor.

- Decoupled node edit mode code from existing port implementation, so ports can easily be replaced in the near future without affecting edit functionality.
- Connected ports and widgets are now always hidden in edit mode. Previously in some situations the colored shapes were incorrectly displayed at wrong positions during editing.
- When entering edit mode, the text cursor is placed at the correct location corresponding to clicked code, compensating for shift introduced by argument placeholders.

# Important Notes
There is a remaining known issue with incoming edges being placed at incorrect places during edit mode, sometimes even outside of the node. This issue is also present in develop. It doesn't make sense to resolve it now, as we are planning to rewrite the ports tree very soon. It will be fixed with that rewrite.
2023-03-29 11:16:31 +00:00
Hubert Plociniczak
b3db805f92
More elaborate error message for invalid text edit (#6108)
It is sometimes impossible to figure out the real reason for invalid text edit request. Added a bit of context to failures to narrow down the cause of the failure.

# Important Notes
Should help with diagnosing issues like #6099.
2023-03-28 14:21:50 +00:00
Dmitry Bushev
aa97787603
Update ZIO library (#6072)
close #6069

Changelog:
- update: ZIO major version bump
2023-03-28 07:58:59 +00:00
Wojciech Daniło
3f7c4a47da
Refactoring mouse events. (#6078) 2023-03-28 04:41:25 +02:00
Stijn ("stain") Seghers
b977b5ac01
Add tooltips to the action bar (#6035)
Implements #5933: adding tooltips to the buttons next to nodes.

To make the UI consistent, I've added tooltips to the `ToggleButton` class directly, since whenever you have an icon button, it seems helpful to have a tooltip.

`ToggleButton` is only used for the profiling button in the top-right corner and the buttons next to nodes. The output context switch button [isn't implemented yet](https://github.com/enso-org/enso/issues/5929), but once it is, adding a tooltip should be one-liner.

![Recording 2023-03-22 at 17 21 58](https://user-images.githubusercontent.com/607786/226972920-81033b37-001f-49eb-9fc6-453120f01760.gif)
2023-03-27 17:02:06 +00:00
James Dunkerley
bf2545fa04
Use new common parse method throwing less exceptions. (#6075)
Avoiding exceptions by not using parseBest.

Time now in CLI is 1.15s for 500k rows vs 1.65s in GUI.

CLI:
![image](https://user-images.githubusercontent.com/4699705/227711266-bc005b0d-5011-450f-964b-65dd2e437c2e.png)

GUI:
![image](https://user-images.githubusercontent.com/4699705/227711259-f7ddda29-86c7-4eef-a002-4bf0bda6063f.png)

Added it as a function in the shared library so used by both engine and polyglot.
2023-03-27 11:02:10 +00:00
Adam Obuchowicz
866a58a0cf
Layout fixes (#6066) 2023-03-25 02:28:35 +01:00
Dmitry Bushev
4c62dc9061
Search suggestions by static attribute (#6036)
close #5874

Changelog:
- add: `isStatic` parameter to `search/completion` request to search by the `static` suggestion attribute
- update: search non-static suggestions when opening component browser

# Important Notes
Component browser doesn't show `Table.new` and `Table.from_rows` suggestions when a `Table` node is selected.

![2023-03-21-151117_1301x877_scrot](https://user-images.githubusercontent.com/357683/226874291-1ff99994-1bb6-41df-96b4-dc5c5178ba41.png)
2023-03-23 15:02:25 +00:00
Wojciech Daniło
ca0779c46b
Implementation of EnsoGL predefined Rectangle shape. (#6033) 2023-03-23 06:47:13 +01:00
Ilya Bogdanov
1b30a5275f
Cursor aware Component Browser (#5770)
Closes #5220

This PR implements the cursor-aware behavior of the CB, as described in [pivotal issue](https://www.pivotaltracker.com/n/projects/2539304/stories/183521918)


https://user-images.githubusercontent.com/6566674/221807206-39f93cb4-8253-421d-a33a-33ac0aa56e54.mp4


https://user-images.githubusercontent.com/6566674/223124947-259153ca-e656-4349-87b5-47c06fd21af2.mp4

# Important Notes
- The `intended_method` of the node's metadata is marked as deprecated, and all usages are removed.
- It seems *all usages of Scala parser are removed from IDE*. We no longer use it to parse documentation for snippets.

This is how the snippets docs look now:

<img width="410" alt="Screenshot 2023-02-28 at 13 18 11" src="https://user-images.githubusercontent.com/6566674/221808028-d69c54e4-2842-4f1c-aa16-781d3f7765a1.png">
2023-03-22 17:10:37 +00:00
Wojciech Daniło
abb0b447d5
Improving Performance Monitor (#5895) 2023-03-21 09:17:54 +01:00
Kaz Wesley
c9806496ee
Rendering improvement/debugging support (#6019)
Some small improvements relating to rendering:

- Add a debug option: `-debug.pixel-read-period`. This can be used to measure the performance impact of checking the pointer location on different hardware. [On my development box, it makes no difference to performance.] (Closes #5490).
- Unbind pixel pack buffers after each use. This is recommended practice. It has no performance impact on my machine, and allows SpectorJS to run (`-debug.enable-spector`). (Closes #5941).

Also, simplify the profiling CLI: the `profile.load-profile` and `profile.save-profile` options have been renamed to `profile.load`/`profile.save`; `profile.save` now has a default filename, so you can capture a profile at any time in Electron with Ctrl+Alt+P and it will be written to `profile.json`.
2023-03-21 06:34:24 +00:00
Ilya Bogdanov
c7da4df742
Apply enso-formatter (#6006)
Somebody forgot to apply `./run fmt` before committing to develop, so now we have a lot of whitespace changes in files.

# Important Notes
See https://github.com/enso-org/enso/issues/5166
2023-03-20 21:45:28 +00:00
Dmitry Bushev
8125d89676
Delay initialization of JSON-RPC protocol (#5997)
close #5881

Changelog
- add: ProtocolFactory object that initializes and returns the protocol object
- update: Add protocol initialization to the initialization component
2023-03-20 11:04:16 +00:00
Dmitry Bushev
b2aa58bf20
Delay writing IR caches (#5957)
close #5911

In interactive mode, perform writing IR caches in the background jobs queue. Background jobs execution is delayed until the first execution is complete.
2023-03-17 22:47:15 +00:00
Michael Mauderer
7a40ccc3ea
Fix wrong placement of nodes created from dropped files. (#5906)
Right now, we use the cursor position to determine the target position for dropped items. However, it seems that during dragging of files, we do not always receive mouse events, thus cannot update the cursor position. To avoid this, this PR refactors the functionality to use the location of the drop event, instead of the last known cursor position.

Fixes #5237.

https://user-images.githubusercontent.com/1428930/224735951-9cd6ff62-a749-4ff3-8437-c0bee3c0dd05.mp4
2023-03-17 20:52:13 +00:00
Kaz Wesley
75fda33837
Fix precedence of -1.x (#5830)
Fixes #5826.

# Important Notes
- Change frontend representation of negation.
- Fix a precedence issue: The `.` operators in -1.x and -1.2 must have different precedences.
- Remove a no-longer-needed special case from backend translation.
- Add tests for this case after all translations.
2023-03-17 18:53:34 +00:00
Nikita Pekin
e9d6d03c67
Cognito auth 3/7 - add registration (#5864)
3rd PR for IDE/Cloud authorization with cognito. This PR introduces registration templates + flows + amplify wrappers for registering & confirming user registration.

Login + Set Username + Forgot Password flows are to be added in next PRs to keep the changes reviewable.
2023-03-17 15:26:59 +00:00
Dmitry Bushev
265fb5d505
Delay initialization of SQL database (#5970)
close #5875

Move database initialization logic to the initialization component.
2023-03-17 13:38:11 +00:00
Paweł Grabarz
9234d742cb
support custom widget entry labels (#5705)
Implements #5640 and #5650

It made sense for me to implement those two together, as I wanted to make sure that the necessary widget API changes will support custom entry values for both dynamic and static data.

- Added support for custom dropdown labels defined on the method annotations
- Added shortening of static dropdown values, which resolves

| dynamic dropdown - custom labels | static dropdown - automatic shortening |
|-|-|
|![image](https://user-images.githubusercontent.com/919491/220117241-8682736e-d750-4eeb-b9bb-cd6cfce42356.png)|![image](https://user-images.githubusercontent.com/919491/220117412-05ad7f4a-3ccf-468b-a976-c52395a497e2.png)|

# Important Notes
During implementation I had multiple data update order issues caused by FRP network forming a diamond shape. Two inputs that are often updated together were combined with `all` combinator, and that was further fed into the dropdown. This caused two updates to propagate through the whole network, and one of them was immediately outdated. To fix this and similar future scenarios, I've added an `next_tick` FRP node. It buffers the incoming events until the next browser microtask, preserving only the last received event. Currently if it is called inside a `requestAnimationFrame` callback, the effects of that processing will only be rendered in the next frame. Later this can be mitigated by delaying the rendering logic until the microtask queue is empty.
2023-03-17 10:06:32 +00:00
Michael Mauderer
5f1539d531
Better sorting after filtering items in the Component Browser (#4115)
Fixes #5849

Now, the filtering alters the groups' layout, so the group with the best match are placed first. Also, we ensure that the best match is selected after filter change.

![image](https://user-images.githubusercontent.com/3919101/224324736-0b4cdfb1-edb2-4d12-aab0-7cfb36207230.png)

# Important Notes
After all, I haven't taken the advices from [the task description](#5849): they turned out to require very difficult refactoring.
2023-03-16 11:23:40 +00:00
Hubert Plociniczak
a6487e5105
Don't log installed engines and runtimes in prod (#5900)
The `logAvailableComponentsForDebugging` will check and install all necessary components of GraalVM for every mentioned version. While not harmful, it adds up to startup time.
Additionally added an option in language server startup to skip installation of GraalVM components. The latter is already performed by project-manager when opening the project and it is unnecessary to do it twice. Due to LS' architecture this configuration has to be passed around via multiple configs.

Finally, skipped the attempt to install Python component on Windows - this is not supported by GraalVM atm.

Closes #5749.

# Important Notes
The impact of this problem could be really felt the more versions of Enso and GraalVM one had since it would go through all of them.
2023-03-16 10:36:55 +00:00
Paweł Buchowski
d77d08358e
remove package-lock.json from gitignore; add unitl-now ignored files (#5954) 2023-03-15 16:54:38 +01:00
Kaz Wesley
e171fba301
New documentation parser (#5917)
Implement new Enso documentation parser; remove old Scala Enso parser.

Performance: Total time parsing documentation is now ~2ms.

# Important Notes
- Doc parsing is now done only in the frontend.
- Some engine tests had never been switched to the new parser. We should investigate tests that don't pass after the switch: #5894.
- The option to run the old searcher has been removed, as it is obsolete and was already broken before this (see #5909).
- Some interfaces used only by the old searcher have been removed.
2023-03-15 15:43:51 +00:00
Paweł Buchowski
6f29262f90
Cognito auth 2/7 - add authorization app (#5798)
2nd PR for IDE/Cloud authorization with cognito. This PR introduces boilerplate react app + some amplify code to fetch the access token + username of the currently logged in user, if they are already authenticated.

Registration + Login + Set Username + Forgot Password flows are to be added in next PRs to keep the changes reviewable.
2023-03-15 11:54:16 +00:00
Kaz Wesley
362840ee9a
Fix a font specification. Fixes #5912. (#5939) 2023-03-14 22:48:52 +01:00
Paweł Buchowski
09cb39cb4b
fix npx typecript errors (#5937)
Fix some errors in old code that blocks some PRs.
2023-03-14 20:10:10 +00:00
Michael Mauderer
8201c1c845
Change order of objects to avoid scrollbar over visualisation chooser (#5843)
Fixes the scrollbar of the text visualization overlaying the visualization chooser.  Fixes #5089
Also fixes the scrollbar not overlaying the visualization action bar.

https://user-images.githubusercontent.com/1428930/223997913-3a9c84ae-6675-4f8e-b2e2-99c9e9c98565.mp4
2023-03-14 13:27:37 +00:00
Radosław Waśko
263c3ad651
Add a common-polyglot-core-utils project (#5855)
Adds a common project that allows sharing code between the `runtime` and `std-bits`.

Due to classpath separation and the way it is compiled, the classes will be duplicated - we will have one copy for the `runtime` classpath and another copy as a small JAR for `Standard.Base` library.

This is still much better than having the code duplicated - now at least we have a single source of truth for the shared implementations.

Due to the copying we should not expand this project too much, but I encourage to put here any methods that would otherwise require us to copy the code itself.

This may be a good place to put parts of the hashing logic to then allow sharing the logic between the `runtime` and the `MultiValueKey` in the `Table` library (cc: @Akirathan).
2023-03-11 09:27:26 +00:00
Dmitry Bushev
725841467f
Log exceptions with stack traces (#5871)
close #5070

Changelog:
- Include the original exception to log expressions
- Enable logging of Akka Actors' lifecycle events on debug logging level
- Decrease the severity of interruption log messages because interruptions are part of the workflow. The computation can be interrupted at any time, and still be recomputed after. Warnings are just misleading in this case.
2023-03-11 08:23:31 +00:00
Paweł Grabarz
6c596f8760
triangle indicator for dropdowns (#5859)
Closes #5854

Switches dropdown activation indicator to a triangle shape, and moved it to the horizontal center of a port.
![image](https://user-images.githubusercontent.com/919491/223765985-ec2175b7-7b44-45fd-88ff-543e8c08538f.png)

# Important Notes
Modified triangle SDF to be exact. That way the grow operation behaves as expected, rounding the corners. Other than that, it produces the same bound shape at 0 distance.
2023-03-11 07:12:18 +00:00
Jaroslav Tulach
632a303089
Use SimpleFormatter.formatMessage to replace {0} with actual parameters (#5870)
Fixes #5801 to properly format Truffle log records before sending them for further processing.
2023-03-11 00:15:58 +00:00
Kaz Wesley
023d8ac239
Precompute MSDFs (#5811)
Precompute MSDFs for all ASCII glyphs; after this, we no longer spend any time on MSDF computations when loading or interacting with the example projects.

Also shader precompilation (during build) is now parallel; if you have many cores and an SSD, it's now practically instant.

Closes #5722.

# Important Notes
- The *dynamic-assets* mechanism now used for MSDF data and shaders is versatile, and could be used to pre-seed any other computation-intensive runtime caches.
2023-03-10 12:59:56 +00:00
Adam Obuchowicz
0f1d591bc1
Allow fractional pixel ratio in CacheShapesPass (#5820)
Fixes #5807 

When implementing [cached icons in the Component Browser](#5779), I assumed pixel_ratio may be only integral (1.0 on normal machines and 2.0 on Retina), but I forgot Windows by default scales its UI by 1.25, breaking the icons entirely.
2023-03-10 10:41:53 +01:00
Paweł Grabarz
73487adce9
Named arguments support in IDE (#5774)
Added support for named arguments in IDE.

https://user-images.githubusercontent.com/919491/223681303-4c716639-d06e-4e33-aa22-6ebca2801b01.mp4


Named arguments are now recognized in node expressions. The function argument placeholders are rendered around series of named arguments. Insertion and deletion of arguments either by connection dragging or by widget selection will cause arguments around to be rewritten into appropriate form, such that the meaning of the expression doesn't change. We no longer need to introduce any wildcards (`_`) in argument positions when editing an argument list of a resolved method.
![image](https://user-images.githubusercontent.com/919491/223682460-143eb6d7-5ac9-4732-9520-71216cbbe58f.png)

For unresolved function calls, the old behaviour remains, as we don't have data about argument names or their desired order.
2023-03-09 21:23:25 +00:00
Hubert Plociniczak
6769ab0ee7
Downgrade hashing to SHA-1 and other optimizations (#5791)
This change downgrades hashing algorithm used in caching IR and library bindings to SHA-1. It is sufficient and significantly faster for the purpose of simple checksum we use it for.

Additionally, don't calculate the digest for serialized bytes - if we get the expected object type then we are confident about the integrity.

Don't initialize Jackson's ObjectMapper for every metadata serialization/de-serialization. Initialization is very costly.

Avoid unnecessary conversions between Scala and Java. Those back-and-forth `asScala` and `asJava` are pretty expensive.

Finally fix an SBT warning when generating library cache.

Closes https://github.com/enso-org/enso/issues/5763

# Important Notes
The change cuts roughly 0.8-1s from the overall startup.
This change will certainly lead to invalidation of existing caches. It is advised to simply start with a clean slate.
2023-03-09 07:36:59 +00:00
Dmitry Bushev
9397a6ec2f
Pre compute suggestion db during build time (#5698)
Close #5068

Cache suggestions during the `buildEngineDistribution` command, and read them from the disk when the library is loaded. Initial graph coloring takes ~20 seconds vs ~25 seconds on the develop branch.

[peek-develop-branch.webm](https://user-images.githubusercontent.com/357683/223504462-e7d48262-4f5e-4724-b2b0-2cb97fc05140.webm)
[peek-suggestions-branch.webm](https://user-images.githubusercontent.com/357683/223504464-0fe86c04-8c4b-443c-ba96-6c5e2fb1e396.webm)
2023-03-08 12:37:48 +00:00
Kaz Wesley
b74debb151
Remove glyph FRP (#5725)
Implements #5724. Cuts `new_glyph` time in half. I'm looking in to the remainder of the time...
2023-03-06 23:16:52 +00:00
Michał Wawrzyniec Urbańczyk
ee981d2052
Reworked ide watch and ide start commands (#5634)
This PR changes build script's `ide watch` and `ide start` commands, so they don't use `electron-builder` to package. Instead, they invoke `electron` directly, significantly reducing time overhead.

`ide watch` will now start Electron process, while continuously rebuilding gui and the client in the background. Changes can be puilled by reloading within the electron, or closing the electron and letting it start once again. To stop, the script should be interrupted with `Ctrl+C`.
2023-03-02 23:00:47 +01:00
Adam Obuchowicz
0575c8d71a
Use cached icons in Component Browser (#5779)
Closes #5189

The component browser uses cached icons, both on the cached list and the navigator panel. It reduced the number of draw calls by 18.
2023-03-02 14:51:42 +00:00
Hubert Plociniczak
941512e0ba
Optimize import/export resolution (#5700)
This change adds serialization and deserialization of library bindings.
In order to be functional, one needs to first generate IR and
serialize bindings using `--compiled <path-to-library>` command. The bindings
will be stored under the library with `.bindings` suffix.
Bindings are being generated during `buildEngineDistribution` task, thus not
requiring any extra steps.

When resolving import/exports the compiler will first try to load
module's bindings from cache. If successful, it will not schedule its
imports/exports for immediate compilation, as we always did, but use the
bindings info to infer the dependent modules.

The current change does not make any optimizations when it comes to
compiling the modules, yet. It only delays the actual
compilation/loading IR from cache so that it can be done in bulk.
Further optimizations will come from this opportunity such as parallel
loading of caches or lazily inferring only the necessary modules.

Part of https://github.com/enso-org/enso/issues/5568 work.
2023-03-01 08:53:29 +00:00
James Dunkerley
ba3d45e782
Adjust generateCheckedArgumentRead to return correct expected type (#5769)
Correctly get the expected type and return an IllegalArgument if no Enso type.

![image](https://user-images.githubusercontent.com/4699705/221263862-bbc122ca-b11f-49f3-b7cf-6294ea811a22.png)
2023-02-27 17:23:45 +00:00
Adam Obuchowicz
d1a0f5a543
Filling cached shapes with a different color. (#5752)
Fixes #5188

Added a new method `ShapeOps::recolorize` which changes color depending on values on r, g, b channels. It should be explained more in the docs. It will allow us using colored cached icons in the Component Browser.
2023-02-27 10:38:47 +00:00
Adam Obuchowicz
625172a6d2
Cached Shape Parameter (#5685)
Fixes #5023

This PR adds the ability to add a parameter to shapes defined, with `shape!` macro being a reference to a cached shape.

The API and results may be read [in the example scene](33b6f5937e/lib/rust/ensogl/example/cached-shape/src/lib.rs)

It also contains many other changes, required to have it working:
* We render cached shapes to texture in a different mode than normal shapes: the alpha channel is replaced with information about signed distance. That allows us using cached shapes as normal shapes, i.e. translate them, add to other shapes etc.
* We initialize and arrange shapes as a part of Word initialization, not in pass.
* We keep and blend colors in RGBA instead of LCHA - this is preparation for replacing colors in the next task, and also speeds up our shaders a bit.

The code was refactored in the process: the cached-shape related things were moved to a single module.
2023-02-23 11:18:48 +00:00
Jaroslav Tulach
dfea59c24d
Exception message may not be specified (#5715)
Getting ready for `null` values in `WSLogMessage`. Closes #5683.
2023-02-22 03:43:46 +00:00
Kaz Wesley
dd3ee76ce7
Eager shader compilation (#5606) 2023-02-22 00:29:48 +01:00
Ilya Bogdanov
19beb01cf3
Open Project Dialog (#5607)
Closes #5022

This is basically a reimplementation of the Open Project Dialog that was present in the IDE a while ago. Now it uses the modern shiny `grid-view` instead of the old rusty `list-view`.

https://user-images.githubusercontent.com/6566674/219052041-ff99aa37-249c-4a63-93a5-5acd6b221dc8.mp4
2023-02-20 14:47:48 +00:00
Wojciech Daniło
663ed1e07e
Fixing Electron runner (#5633) 2023-02-19 01:37:58 +01:00
Kaz Wesley
2acc61d0b1
Optimize opening dropdown (#5688)
* Profiling

* Defer rendering hidden Text
2023-02-18 11:31:57 -08:00
Michael Mauderer
e81d1e3eea
Fix visualizations sometimes not opening with space bar. (#5624)
Visualizations closing right after opening was caused by the GUI being unresponsive during loading of some visualizations. This caused the timer for measuring the time between space bar press and space bar release to be inflated. The delayed events triggered the "visualization preview mode”, thus closing the visualization has it seemed that the space bar was held down, even though the events just arrived with some delay.

The problem is mitigated by considering the number of frames that have passed between the space and down and the space bar up event, instead of just the wall clock time. If the number of frames is too low, this indicates that frames were dropped to the time is inflated.

Fixes https://github.com/enso-org/enso/issues/5223
2023-02-17 11:33:21 +00:00
Michael Mauderer
0fd390de0c
Fix Match Scoring Algorithm (#5665)
Fixes an error in our scoring algorithm for computing match scores. It now correctly computes scores for patterns that are trailing the target text and ranks patterns at the end of the target text higher than patterns in the middle of the target text.

Closes  #4965 (for now).
See also Discussion https://github.com/enso-org/enso/discussions/5649
2023-02-17 09:25:25 +00:00
Galin Bajlekov
725b3da486
Roll back last VCS snapshot (#4050)
Fixes #5001

This PR implements reverting the current project state to the last state saved into the VCS. This action is performed on `ctrl+r`.

https://user-images.githubusercontent.com/117099775/216645556-1bf34ee7-fdb4-4833-bcad-670d688a3199.mp4

# Important Notes
* Currently on `vcs/restore` all expressions are invalidated and all nodes are re-executed. This is tracked in [task](https://www.pivotaltracker.com/n/projects/2539304/stories/184368950).
2023-02-16 18:14:34 +00:00
Paweł Buchowski
f316ba0136
add missing templates to allTemplates seq (#5657)
Add recently added templates to allTemplates seq so they are accessed from the command line
2023-02-14 17:17:28 +00:00
Paweł Buchowski
95c66baa3c
extend list of allowed project templates (#5601)
In cloud we want to allow users to create new project from the template. List of templates is a bit outdated and doesn't contain all from the https://github.com/enso-org/project-templates. This PR simply adds missing ones
2023-02-13 13:03:51 +00:00
Hubert Plociniczak
9ea9fd56e6
Fix separate compilation for ConstantsGen (#5630)
A combination of commands triggered separate compilation that only recompiled part of builtins. A mechanism that workaround annotation processor's problems with separate compilation was updated to include changes from https://github.com/enso-org/enso/pull/4111. This was pretty tough to find given the rather unusual circumstances in CI.

# Important Notes
This eliminates the _random_ failures in CI related to separate compilation.
To reproduce a specific set of steps has to be executed:
```
sbt> all buildEngineDistribution engine-runner/assembly runtime/Benchmark/compile language-server/Benchmark/compile searcher/Benchmark/compile
(exit sbt)
sbt> test
```
2023-02-10 22:14:43 +00:00
Kaz Wesley
d1af25793a
Port graph editor to new AST (#4113)
Use the Rust parser rather than the Scala parser to parse Enso code in the IDE.

Implements:
- https://www.pivotaltracker.com/story/show/182975925
- https://www.pivotaltracker.com/story/show/182988419
- https://www.pivotaltracker.com/story/show/182970096
- https://www.pivotaltracker.com/story/show/182973659
- https://www.pivotaltracker.com/story/show/182974161
- https://www.pivotaltracker.com/story/show/182974205

There is additional functionality needed before the transition is fully-completed, however I think it's time for this to see review and testing, so I've opened separate issues. In rough order of urgency (these issues are also linked from the corresponding disabled tests):
- #5573
- #5571
- #5572
- #5574

# Important Notes
The implementation is based partly on translation, and partly on new analysis. Method- and operator-related shapes are translated to the old `Ast` variants, so that all the analysis applied to them doesn't need to be ported at this time. Everything else (mostly "macros" in the old AST) is implemented with new analysis.
2023-02-10 18:05:40 +00:00
Kaz Wesley
4f70bcc5ff
Fix unhandled macro match failure case (#5056) (#5599)
Fix an unhandled case in macro resolution
2023-02-09 23:00:29 +00:00
Hubert Plociniczak
472580df4d
Report type of expressions returning polyglot values (#4111)
Expressions returning polyglot values were not reporting the type of the result because we have to do additional magic that infers the correct Enso type. Since this is exactly what `TypeOfNode` does, I re-used the logic.

Straightforward solution failed in tests because of assertions:
```
[enso] WARNING: Execution of function main failed (Invalid library usage. Cached library must be adopted by a RootNode before it is executed.).
java.lang.AssertionError: Invalid library usage. Cached library must be adopted by a RootNode before it is executed.
```

That is why this PR replaces `ExecutionEventListener` with `ExecutionEventNodeFactory`.

# Important Notes
Usage of `TypeOfNode` for programs that **do not** import stdlib means that we report types that do not involve stdlib e.g.
`Standard.Builtins.Main.Integer` instead of `Standard.Base.Data.Numbers.Integer`. While surprising, this is correct and I would say desirable. While reviewing the code, notice the difference in expectations in our runtime tests.
2023-02-09 01:06:27 +00:00
Paweł Grabarz
6b14ec5a63
Dynamic dropdown support (#4072)
Implementation of https://www.pivotaltracker.com/story/show/184012743

https://user-images.githubusercontent.com/919491/214082311-cf49e43c-1d1f-4654-903c-a4224cd954d8.mp4

This is also a step towards more general widget support. The widget metadata is queried using `Meta.get_annotation` method through a dedicated visualization. For now only `Single_Choice` case is handled, and always all suggestions are is returned.

# Important Notes
There are limitations as to which node segments receive a widget. Only chain method calls are supported now (`thing.method` syntax), and only outside of lambda scope. Widgets in lambdas will require support for visualisations of lambda subexpressions, which is currently missing in the engine. The IDE technically tries to place the widgets there, but the data never arrives. It should work once the engine support is added.

This PR includes a mock for `Meta.get_annotation` call that only supports `Table.at` method. Real implementation is a separate task that is already in progress.
2023-02-04 00:50:24 +00:00
Michael Mauderer
349cc210e0
Bump rustc to nightly-2023-01-12 (#4053)
Bump rustc nightly-2022-08-30 and fix new errors and lints.
https://www.pivotaltracker.com/story/show/184229094
2023-02-02 23:05:25 +00:00
Michał Wawrzyniec Urbańczyk
29582b7ee1
Fix for the cargo-installed build script usage. (#4096)
Use both current directory and current exe location for deducing the repository root location.
2023-02-02 20:34:20 +01:00
Ilya Bogdanov
89dc7a5726
Mark nodes with yellow stripes if their evaluation produced warnings (#4101)
[Task](https://www.pivotaltracker.com/story/show/184237388)

Nodes with warnings are highlighted with yellow stripes. Colors for dataflow errors and panics also changed.


https://user-images.githubusercontent.com/6566674/216285009-9d29eb84-f663-4f2e-a6c8-4c4f593bd1ef.mp4
2023-02-02 17:03:46 +00:00
Adam Obuchowicz
a103c8d82f
Cached_shape macro rendered to special texture. (#4089)
This PR contains the first implementation of `cached_shape!` macro, which should help us with reducing draw calls in our application.

```rust
mod icon1 {
use super::*;
ensogl_core::cached_shape! { 32 x 32;
() {
let shape = Circle(16.px()).fill(color::Rgba::green());
shape.into()
}
}
}

mod icon2 {
use super::*;
ensogl_core::cached_shape! { 202 x 312;
() {
let shape = Rect((200.px(), 310.px())).fill(color::Rgba::red());
shape.into()
}
}
}
```

The above code creates two cached shapes. They are similar to normal shapes (created with `shape!` macro), except that:
1. they do not allow for any parametrization
2. They are rendered at the application start to the special texture with cached shapes.

The texture will be used in next PRs to cache all Component Browser icons on the texture and draw all of them just by single, fast draw call. In the future, more shapes can be cached, further reducing draw calls and making them simple.

# Important Notes
The results are presented in `cached_shapes` debug scene: there are two shapes displayed and a scaled cached texture is displayed in the background.
2023-02-01 17:58:20 +00:00
Jaroslav Tulach
f54464881f
enso4igv can open engine/language-server & co. projects (#4098)
In order to investigate `engine/language-server` project, I need to be able to open its sources in IGV and NetBeans.

# Important Notes
By adding same Java source (this time `package-info.java`) and compiling with our Frgaal compiler the necessary `.enso-sources*` files are generated for `engine/language-server` and then the `enso4igv` plugin can open them and properly understand their compile settings.

![Logical View of language-server project](https://user-images.githubusercontent.com/26887752/215472696-ec9801f3-4692-4bdb-be92-c4d2ab552e60.png)

In addition to that this PR enhances the _"logical view"_ presentation of the project by including all source roots found under `src/*/*`.
2023-01-31 08:40:04 +00:00
Hubert Plociniczak
be91b1e8dd
Create static wrappers for builtin types (#4077)
https://github.com/enso-org/enso/pull/3764 introduced static wrappers for instance methods. Except it had a limitation to only be allowed for types with at least a single constructor.
That excluded builtin types as well which, by default, don't have them. This limitation is problematic for Array/Vector consolidation and makes builtin types somehow second-citizens.

This change lifts the limitation for builtin types only. Note that we do want to share the implementation of the generated builtin methods. At the same time due to the additional argument we have to adjust the starting index of the arguments.
This change avoids messing with the existing dispatch logic, to avoid unnecessary complexity.

As a result it is now possible to call builtin types' instance methods, statically:
```
arr = Array.new_1 42
Array.length arr
```
That would previously lead to missing method exception in runtime.

# Important Notes
The only exception is `Nothing`. Primarily because it requires `Nothing` to have a proper eigentype (`Nothing.type`) which would messed up a lot of existing logic for no obvious benefit (no more calling of `foo=Nothing` in parameters being one example).
2023-01-30 19:54:51 +00:00
Wojciech Daniło
ce5b078130
Dependency cleaning (#4092) 2023-01-27 23:39:37 +01:00
Ilya Bogdanov
9e4dd9d708
Documentation display delay and hovered item preview caption (#4075)
This PR adds a configurable delay before displaying documentation ([task](https://www.pivotaltracker.com/story/show/183970872)) and a "hovered item preview" caption on top of the panel when you hover some not-selected entry. ([task](https://www.pivotaltracker.com/story/show/183970838)). The caption design will be adjusted in a future PR with a style update.


https://user-images.githubusercontent.com/6566674/214233481-10550fcf-a106-4b11-b5a2-15283745cbbf.mp4
2023-01-27 01:34:35 +00:00
Wojciech Daniło
da84e34b9a
Shaders precompilation (#4003) 2023-01-27 01:09:09 +01:00
Kaz Wesley
1097c41297
Fix lexing bug encountered when doc-comments contain space-only lines (#4070)
See: https://www.pivotaltracker.com/story/show/184249780
2023-01-26 12:53:20 +00:00
Ilya Bogdanov
366f231765
New documentation panel (#4066)
This PR implements HTML generation from documentation IR for all suggestion database entries and replaces the old documentation panel with a newer one.

Additional adjustments to the looks of the documentation would be applied separately in a future PR. This PR focuses on the fastest possible delivery of a usable documentation panel. We want to test it in real-world use cases and gather feedback for future improvements.

Documentation demo scene with mocked data:

https://user-images.githubusercontent.com/6566674/213436313-88753ed8-346f-423e-956e-7db39f5dc266.mp4


Component browser with actual engine-provided data:


https://user-images.githubusercontent.com/6566674/213436375-d0ec074b-f7a6-4deb-a7de-3adee999cc86.mp4

# Important Notes
- Fixed language protocol data structures.
- Scrolling to the selected method is also implemented here.
- Also, the selected item is highlighted with yellow.
- Only some pieces of information we have are displayed. For example, we don't display return types for methods or types of arguments.
- A bunch of code related to previous implementation is removed, but probably not all of it.
2023-01-25 01:10:10 +00:00
Hubert Plociniczak
c85377f0ac
Eliminate various compiler warnings (#4079)
Slipped through review of https://github.com/enso-org/enso/pull/3862
2023-01-24 22:58:35 +00:00
Michael Mauderer
38906b39da
Implement Lazy Text Visualisation. (#3910)
Implements [#183453466](https://www.pivotaltracker.com/story/show/183453466).

https://user-images.githubusercontent.com/1428930/203870063-dd9c3941-ce79-4ce9-a772-a2014e900b20.mp4

# Important Notes
* the best laziness is used for `Text` type, which makes use of its internal representation to send data
* any type will first compute its default string representation and then send the content of that lazy to the IDE
* special handling of files and their content will be implemented in the future
* size of the displayed text can be updated dynamically based on best effort information: if the backend does not yet know the full width/height of the text, it can update the IDE at any time and this will be handled gracefully by updating the scrollbar position and sizes.
2023-01-24 20:55:36 +00:00
Marcin Kostrzewa
242bd52942
Unboxed atoms (#3862)
Introduces unboxed (and arity-specialized) storage schemes for Atoms. It results in improvements both in memory consumption and runtime.
Memory wise: instead of using an array, we now use object fields. We also enable unboxing. This cuts a good few pointers in an unboxed object. E.g. a quadruple of integers is now 64 bytes (4x8 bytes for long fields + 16 bytes for layout and constructor pointers + 16 bytes for a class header). It used to be 168 bytes  (4x24 bytes for boxed Longs + 16 bytes for array header + 32 bytes for array contents +  8 bytes for constructor ptr  + 16 bytes for class header), so we're saving 104 bytes a piece. In the least impressive scenarios (all-boxed fields) we're saving 8 bytes per object (saving 16 bytes for array header, using 8 bytes for the new layout field). In the most-benchmarked case (list of longs), we save 32 bytes per cons-cell.
Time wise:
All list-summing benchmarks observe a ~2x speedup. List generation benchmarks get ~25x speedups, probably both due to less GC activity and better allocation characteristics (only allocating one object per Cons, rather than Cons + Object[] for fields). The "map-reverse" family gets a neat 10x speedup (part of the work is reading, which is 2x faster, the other is allocating, which is now 25x faster, we end up with 10x when combined).
2023-01-24 13:03:06 +00:00
Hubert Plociniczak
86eee6199d
Fix TextEdit range (#4069)
Typo: TextEdit's range should refer to the old buffer's range rather than the new one.
2023-01-20 11:31:16 +00:00
Paweł Grabarz
a5df4d4716
handle compiler job cancelation in shader cache (#4061)
This is a followup to https://github.com/enso-org/enso/pull/4046#pullrequestreview-1248164069.

- Compiler job cancelation is now handled - the cache entry will be cleared or the job will be resumed if there is still demand.
- The compilation awaiting process has been rewritten to not use polling. The "read cache" job is now only used to dispatch known valid reads. It is always completed within a single run cycle.
- Changed shader struct to use `ImString` for storing code, so it can be cheaply cloned. This is now common, as we are cloning it from cache.
2023-01-20 10:27:18 +00:00
Kaz Wesley
591cacb79a
Reject @ as binary operator (#4021)
`@` should not be legal to use as a binary operator. I accepted it in the parser because it occurred in the .enso sources, but it was actually used to create a syntax error to test error recovery.

See: https://www.pivotaltracker.com/story/show/184054024
2023-01-19 20:31:14 +00:00
Hubert Plociniczak
246755d29b
Avoid IndexOutOfBounds when edits go out of range (#4065)
While doing regular node manipulation in editior, noticed a number of situations when

```
java.lang.IndexOutOfBoundsException: None
at java.base/java.lang.Character.offsetByCodePoints(Character.java:8699)
at java.base/java.lang.String.offsetByCodePoints(String.java:820)
at org.enso.text.buffer.CodePointView$Ops$.drop(CodePointView.scala:98)
at org.enso.text.buffer.CodePointView$Ops$.drop(CodePointView.scala:57)
at org.enso.text.buffer.Node.drop(Tree.scala:218)
at org.enso.text.buffer.Rope.dropWith(Rope.scala:86)
at org.enso.text.buffer.CodePointView.drop(CodePointView.scala:30)
at org.enso.text.editing.RopeTextEditor$.cutOutTail(RopeTextEditor.scala:42)
...
```
would be thrown. Further text edits would simply be rejected requiring a complete restart. I doubt we should propagate
`IndexOutOfBoundsException`. Instead it is safer to just apply the edit to the end of the rope.
2023-01-19 11:43:46 +00:00
Pavel Marek
fcc2163ae3
All Enso objects are hasheable (#3878)
* Hash codes prototype

* Remove Any.hash_code

* Improve caching of hashcode in atoms

* [WIP] Add Hash_Map type

* Implement Any.hash_code builtin for primitives and vectors

* Add some values to ValuesGenerator

* Fix example docs on Time_Zone.new

* [WIP] QuickFix for HashCodeTest before PR #3956 is merged

* Fix hash code contract in HashCodeTest

* Add times and dates values to HashCodeTest

* Fix docs

* Remove hashCodeForMetaInterop specialization

* Introduce snapshoting of HashMapBuilder

* Add unit tests for EnsoHashMap

* Remove duplicate test in Map_Spec.enso

* Hash_Map.to_vector caches result

* Hash_Map_Spec is a copy of Map_Spec

* Implement some methods in Hash_Map

* Add equalsHashMaps specialization to EqualsAnyNode

* get and insert operations are able to work with polyglot values

* Implement rest of Hash_Map API

* Add test that inserts elements with keys with same hash code

* EnsoHashMap.toDisplayString use builder storage directly

* Add separate specialization for host objects in EqualsAnyNode

* Fix specialization for host objects in EqualsAnyNode

* Add polyglot hash map tests

* EconomicMap keeps reference to EqualsNode and HashCodeNode.

Rather than passing these nodes to `get` and `insert` methods.

* HashMapTest run in polyglot context

* Fix containsKey index handling in snapshots

* Remove snapshots field from EnsoHashMapBuilder

* Prepare polyglot hash map handling.

- Hash_Map builtin methods are separate nodes

* Some bug fixes

* Remove ForeignMapWrapper.

We would have to wrap foreign maps in assignments for this to be efficient.

* Improve performance of Hash_Map.get_builtin

Also, if_nothing parameter is suspended

* Remove to_flat_vector.

Interop API requires nested vector (our previous to_vector implementation). Seems that I have misunderstood the docs  the first time I read it.

- to_vector does not sort the vector by keys by default

* Fix polyglot hash maps method dispatch

* Add tests that effectively test hash code implementation.

Via hash map that behaves like a hash set.

* Remove Hashcode_Spec

* Add some polyglot tests

* Add Text.== tests for NFD normalization

* Fix NFD normalization bug in Text.java

* Improve performance of EqualsAnyNode.equalsTexts specialization

* Properly compute hash code for Atom and cache it

* Fix Text specialization in HashCodeAnyNode

* Add Hash_Map_Spec as part of all tests

* Remove HashMapTest.java

Providing all the infrastructure for all the needed Truffle nodes is no longer manageable.

* Remove rest of identityHashCode message implementations

* Replace old Map with Hash_Map

* Add some docs

* Add TruffleBoundaries

* Formatting

* Fix some tests to accept unsorted vector from Map.to_vector

* Delete Map.first and Map.last methods

* Add specialization for big integer hash

* Introduce proper HashCodeTest and EqualsTest.

- Use jUnit theories.
- Call nodes directly

* Fix some specializations for primitives in HashCodeAnyNode

* Fix host object specialization

* Remove Any.hash_code

* Fix import in Map.enso

* Update changelog

* Reformat

* Add truffle boundary to BigInteger.hashCode

* Fix performance of HashCodeTest - initialize DataPoints just once

* Fix MetaIsATest

* Fix ValuesGenerator.textual - Java's char is not Text

* Fix indent in Map_Spec.enso

* Add maps to datapoints in HashCodeTest

* Add specialization for maps in HashCodeAnyNode

* Add multiLevelAtoms to ValuesGenerator

* Provide a workaround for non-linear key inserts

* Fix specializations for double and BigInteger

* Cosmetics

* Add truffle boundaries

* Add allowInlining=true to some truffle boundaries.

Increases performance a lot.

* Increase the size of vectors, and warmup time for Vector.Distinct benchmark

* Various small performance fixes.

* Fix Geo_Spec tests to accept unsorted Map.to_vector

* Implement Map.remove

* FIx Visualization tests to accept unsorted Map.to_vector

* Treat java.util.Properties as Map

* Add truffle boundaries

* Invoke polyglot methods on java.util.Properties

* Ignore python tests if python lang is missing
2023-01-19 10:33:25 +01:00
Adam Obuchowicz
503c680eb9
Fix CB making many frames for Undo-Redo (#4025)
The fix consists of two parts:
1. All the "review-apply" and "store temporary md" actions in the searcher controller are now guarded by an ignored transaction.
2. Because some of the temporary state may reach the UR frames assigned to other actions, added a bunch of code for removing all temporary expressions from the code and use it after restoring a frame. We may consider using it after project load as well.

### Important Notes

Added a useful method "log_err" to ResultOps (so every Result will have those).
2023-01-18 12:55:57 +01:00
Kaz Wesley
662992eb37
Replace tracing (#4017)
Logging: Replace tracing with an efficient logging implementation, with 0-runtime cost for disabled log levels. (https://www.pivotaltracker.com/story/show/183755412)

Profiling: Support submitting `profiler` events to the User Timing Web API, so that measurements can be viewed directly in the browser. (https://www.pivotaltracker.com/story/show/184003550)

# Important Notes
Logging interface:
- The macros (`warn!`, etc.) now take standard `format_args!` arguments (the tracing implementations accepted a broader syntax).
- Compile-time log levels can now be set through the CLI, like so:
`./run ide start --log-level=trace --uncollapsed-log-level=info`

Profiling:
- The hotkey Ctrl+Alt+Shift+P submits all `profiler` events logged since the application was loaded to the Web API, so that they can then be viewed with the browser's developer tools. Note that standard tools are not able to represent async task lifetimes or metadata; this is a convenient interface to a subset of `profiler` data.
- As an alternative interface, a runtime flag enables continuous measurement submission. In the browser it can be set through a URL parameter, like http://localhost:8080/?emit_user_timing_measurements=true. Note that this mode significantly impacts performance.
2023-01-16 20:31:01 +00:00
Dmitry Bushev
b8967b96b9
Fix serialization of NPE in logger (#4055)
Fixes an error when the logger processes NPE:
```
[internal-logger-error] One of the printers failed to write a message: java.lang.NullPointerException
```
2023-01-16 18:38:28 +00:00
Paweł Grabarz
1578ed093a
Defer dropdown view initialization until opened and cache shaders between layers (#4046)
Fixes https://www.pivotaltracker.com/story/show/184216698

Reduced impact of node dropdown widgets on load times by deferring creation of grid views until each widget is opened. This also improves node editing time, as the dropdowns are not recreated immediately.

This approach of lazy initialization now caused a significant lag when opening the dropdown. Two major causes of the lag spike is glyph generation (msdfgen, `new_glyph`) and shader compilation (happened every time, because each dropdown has unique layer stack). To reduce the impact of that, the shader compiler now caches the shaders based on generated shader source. Glyph creation hasn't been changed and is still slow. The startup performance is now roughly where it was before introducing widgets.
2023-01-13 15:30:38 +00:00
Kaz Wesley
e15583fe65
Parser: Support annotations in type defs (#4036)
Support application of the new type of annotation to method bindings in type definitions.
2023-01-12 16:51:44 +00:00
Ilya Bogdanov
6b8d8e9270
Implement documentation IR (#4024)
[Task link](https://www.pivotaltracker.com/story/show/184012434)

This PR implements Intermediate Representation for our documentation. Later these data structures would be used to generate HTML and CSS for the documentation panel. For now, we display it in the debug scene.


https://user-images.githubusercontent.com/6566674/210674850-480a3e6e-76c3-4f34-a235-15c44dc9ec01.mp4

# Important Notes
- `suggestion-database` now lives in a separate crate
- also, two utility crates were introduced for the `notification` and `executor` modules of enso-gui
- documentation debug scene is moved to a separate crate
- All refactorings are done in the last two commits
2023-01-12 14:50:33 +00:00
Paweł Grabarz
fe1cf9a9ce
Basic dropdown widget integration (#4013)
Implements https://www.pivotaltracker.com/n/projects/2539304/stories/184023445

Added a dropdown widget to graph node for all span tree nodes that have tag values present. When an option is selected, the controller receives a partial expression update, which targets specific crumbs of the expression (similar to how edge endpoint updates work).


https://user-images.githubusercontent.com/919491/210219931-8ae418fd-3ac4-44a5-abea-9e670f15cdf9.mp4

# Important Notes
Right now the dropdown widget is recreated every time the node is edited, including a dropdown option being selected. This causes it to close every time. I wanted to get around that by diffing span trees, but I wasn't able to do it in useful way. Additionally, current implementation of node input expression view heavily relies on being reinitialized from scratch every time. This led to more necessary changes than I was comfortable with for this task. I believe it will be easier to implement it as part of more complete widget support, especially after dynamic data support, as we will have proper widget type information.
2023-01-11 14:32:25 +00:00
Dmitry Bushev
2cd880f43d
Documentation for functions and locals (#4029)
Add documentation for functions and locals to suggestions database.
2023-01-10 16:59:53 +00:00
Kaz Wesley
0a782a2ed1
AST support for new annotation syntax (#4018)
* rename Annotated -> AnnotatedBuiltin

* update Panic.catch test

* new annotations

* Revert "update Panic.catch test"

This reverts commit ccda46e3a7.
2023-01-04 09:50:38 -08:00
Dmitry Bushev
cf67ca60d9
Add globs to logger configuration (#4004)
An artifact left from debugging some SQL last week. Just a nice feature to have.
2022-12-22 19:09:21 +00:00
Paweł Grabarz
4042b5b237
Grid-view based dropdown component (#3985)
Implements https://www.pivotaltracker.com/n/projects/2539304/stories/184023380

Dropdown component. Planned to be used in nodes as a single and multiple selection widget, both for static and dynamically loaded values. Initial support is focused on static data, with limited support for dynamic sources. Notably, loading states are not supported yet. Full support for that is planned to be added later with widget lazy-loading.

- Supports single and multiple selections.
- Dedicated API for providing a static list of all entries.
- Range-based query API for dynamically loading data as it is scrolled (only basic support - will need more work for proper async lazy-loading).
- Internal entry cache and query batching to avoid querying data one by one (the batching for now is very basic, will have to be improved for proper lazy-loading).
- Automatic dropdown width adjustment based on the entry label lengths, up to a set max allowed value.
- Open and close animation.
- Keyboard support for focusing and selecting entries.

![image](https://user-images.githubusercontent.com/919491/207866293-de2e3fef-c93b-48cc-8253-11c186d223fd.png)

# Important Notes
Implementing the dropdown on top of grid-view have uncovered some assumptions around grid-view layers. It was assumed to always be a part of the component browser. Removing that assumption required a mechanism for propagating camera update information through layer tree. This is now implemented using a `camera_parent` layer field. Ideally each layer should simply have at most a single parent, and camera inheritance would follow that. That refactor turned out to be quite involved, so right now the simpler temporary solution is introduced in order to not delay this PR further.
2022-12-22 18:19:40 +00:00
Jaroslav Tulach
7252af6d62
Enso.getMetaObject, Type.isMetaInstance and Meta.is_a consolidation (#3949)
Implements `getMetaObject` and related messages from Truffle interop for Enso values and types. Turns `Meta.is_a` into builtin and re-uses the same functionality.

# Important Notes
Adds `ValueGenerator` testing infrastructure to provide unified access to special Enso values and builtin types that can be reused by other tests, not just `MetaIsATest` and `MetaObjectTest`.
2022-12-22 08:00:06 +00:00
Radosław Waśko
c0c0abe4fe
Add benchmarks comparing ArrayProxy with elements generated ad-hoc with a regular Vector (#3831) 2022-12-21 20:15:39 +00:00
Kaz Wesley
d24019aa57
Implement SKIP/FREEZE in parser/TreeToIr (#3942)
See: https://www.pivotaltracker.com/story/show/183919788

# Important Notes
`SKIP` would be simpler if implemented in the parser, but there is some work needed before the Rust AST and Java IR are able to represent the results of macro-expansion: https://www.pivotaltracker.com/story/show/184004555
2022-12-20 17:32:59 +00:00
Wojciech Daniło
be17f31dbf
Fixing set_size regression. (#3995) 2022-12-20 12:42:31 +01:00
Galin Bajlekov
4b28f8f8f0
Visual indication of outdated VCS snapshot (#3950)
This PR provides a visual indication of whether the project's current state differs from the most recent snapshot saved in the VCS. The project name displayed in the IDE changes to a darker text to indicate that the VCS snapshot is outdated, and back to a lighter text when the current project state corresponds to the last saved VCS snapshot.

https://user-images.githubusercontent.com/117099775/208088438-20dfc2aa-2a7d-47bf-bc12-3d3dff7a4974.mp4

The outdated project snapshot indicator is set when:
* A node is moved.
* A node is added or removed.
* The text editor is used to edit the text.
* The project is auto-saved, and the auto-saved project state does not correspond to the last saved snapshot in the VCS.

The outdated project snapshot indicator is cleared when:
* A new project snapshot is successfully saved using `ctrl+s`.
* The project is auto-saved, and the auto-saved project state is confirmed to correspond to the last saved snapshot in the VCS. This occurs, for example, when a project change is undone and the project is reverted to the last saved snapshot state.

The auto-save events do not occur immediately after a project change but have a short delay, thus the VCS status update is affected by the same delay when triggered by an auto-save event.
2022-12-19 21:22:33 +00:00
Hubert Plociniczak
49204e92cf
Simplify exception handling for polyglot exceptions (#3981)
This removes the special handling of polyglot exceptions and allows matching on Java exceptions in the same way as for any other types.

`Polyglot_Error`, `Panic.catch_java` and `Panic.catch_primitive` are gone

The change mostly deals with the backslash of removing `Polyglot_Error` and two `Panic` methods.
`Panic.catch` was implemented as a builtin instead of delegating to `Panic.catch_primitive` builtin that is now gone.

This fixes https://www.pivotaltracker.com/story/show/182844611
2022-12-19 19:16:43 +00:00
Wojciech Daniło
06cfafca09
Auto Layouts (#3937) 2022-12-19 02:16:54 +01:00
Kaz Wesley
4d2668003f
Recover from invalid metadata (#3982)
If corrupt metadata is encountered in a source file, log an error and continue without metadata.

See: https://www.pivotaltracker.com/story/show/184030897
2022-12-15 17:36:31 +00:00
Ilya Bogdanov
285959835f
Scroll the documentation panel when it is hovered by the mouse (#3968)
[Task link](https://www.pivotaltracker.com/story/show/183970810).

Now documentation panel is being scrolled when only hovered by the cursor (you don't need to click on it beforehand).

Tested on macOS with both the touchpad and the mouse.

https://user-images.githubusercontent.com/6566674/206667769-04aae6b2-91ff-4877-bf10-8c0f0c4c5873.mp4
2022-12-14 16:37:04 +00:00
Michał Wawrzyniec Urbańczyk
965d1ff28b
Bump wasm-bindgen (#3971)
This PR brings wasm-bindgen (and related crates) to the latest version. I've also removed patching code, so future updates should be much easier.
2022-12-13 22:20:25 +01:00
James Dunkerley
79de5eecd9
Move Create New Project button to top. (#3972)
- Moves the Create button to the top.
- Adjust default project to also bring in Table and Database.
2022-12-12 15:30:36 +00:00
Dmitry Bushev
efb46c69dc
Fix adding constructor record to suggestions database (#3966) 2022-12-12 13:48:47 +03:00
Galin Bajlekov
b2b60612d7
Numeric slider component enhancement (#3885)
This is an enhancement of the `Slider` component implemented in #3852. It adds the following features:
* Tooltips and precision change hints
* Selectable slider limit behaviors
* Textual slider value editing
* Vertical slider layout

#### Tooltips

An information tooltip can now be added to a slider, it is shown when the mouse hovers over the component. Additionally, a pop-up indicating the slider's precision appears when the slider's precision has been adjusted.

https://user-images.githubusercontent.com/117099775/206148098-3b4dc059-18aa-4200-9ee0-5d4382363810.mp4

#### Slider limits

The previous slider implementation clamped the adjusted value to the slider's minimum/maximum limits. Now the following behaviors are available:
* Hard limits: Clamp the value to a range within the slider's limits.
* Soft limits: The value can extend beyond the slider's limits. When this occurs, an overflow indicator will be displayed on the side of the limit that is exceeded.
* Adaptive limits: The value can extend beyond the slider's limits. When this occurs, the exceeded limit will temporarily be adjusted to double the slider's range. This will be performed iteratively until the value falls within the extended limits. When a limit is extended and the value is adjusted to fit a smaller range, the extended limit will be iteratively halved until only the necessary range is covered. The slider's extended limits will never shrink to a range smaller than the original range.

These behaviors can be set to the lower and upper limits of a slider independently.

https://user-images.githubusercontent.com/117099775/206148139-6149c91d-ef49-4e2d-97f6-71084f52591c.mp4

#### Textual editing

The slider's value can now be entered through a text input field. Double-click to edit the slider's current value. To confirm the edit press `enter`, or press `escape` to cancel the edit. If an invalid value is entered on confirmation the slider will revert to its value before the edit. The slider's precision will be adjusted based on the number of decimal places of the value entered.

https://user-images.githubusercontent.com/117099775/206148170-d3fa4c82-6e73-4b1c-9be9-cb99979f7b70.mp4

#### Vertical layout

The slider component now supports a vertical layout. In this case value adjustment is performed by a vertical mouse movement, and a horizontal movement adjusts the slider's precision. The slider's track now fills the component in a vertical direction, and the slider's label is displayed near the top end of the component.

https://user-images.githubusercontent.com/117099775/206148211-0f176aaf-bc1b-45e2-afd7-0d28391aafcb.mp4

#### Scroll bar mode

The slider component supports two indicator modes:
* `Track`: The component is filled with a colored bar from the lower limit (empty) to the upper limit (full) dependent on the slider's value.
* `Thumb`: The component contains a rounded indicator that moves along the slider from one end to the other, indicating the slider's value proportionally to the slider's limits. The width of the indicator is configurable.
In addition, the value text, text entry, and precision adjustment can be turned off to provide a scroll bar appearance when used with the `Thumb` indicator.

https://user-images.githubusercontent.com/117099775/206148261-ae291073-85e9-4082-9f91-39b65fecdc0f.mp4

#### Example scene shortcuts

The example scene contains two shortcuts in order to evaluate the dynamic addition and removal of the slider components:
* `CTRL+D` drops all the slider components that are added to the scene.
* `CTRL+A` adds a new set of example slider components to the scene.
2022-12-12 08:53:19 +00:00
Ilya Bogdanov
82dabd329d
Show default mouse cursor over documentation panel (#3951)
[Task link](https://www.pivotaltracker.com/story/show/183970777)

The default mouse cursor is now displayed over the documentation panel.


https://user-images.githubusercontent.com/6566674/205954491-177fcc01-7e15-4a5c-825e-c0b02be527cc.mp4
2022-12-08 18:50:19 +00:00
Paweł Grabarz
054e9c4694
Fix disappearing text labels when entering edit mode (#3945)
Fixes regression https://www.pivotaltracker.com/n/projects/2539304/stories/183895961

# Important Notes
The root cause of the issue was a missing deref before `flavor()` call. The autoderef doesn't work there, because the `ShapeSystemFlavorProvider` trait is implemented for all types, including `Ref`. We should reconsider if blanket default impl is a good idea, as this is a very scary footgun.

Apart from that, the cleanup of layer elements was not handling systems with same ID but different flavors correctly. That could cause text to disappear when given layer had text of multiple fonts, and all shapes of one of them got removed. Now the element is removed from layer only when all systems sharing given system ID have no more instances to render.
2022-12-08 13:35:29 +00:00
Hubert Plociniczak
0855b74875
Vector should preserve warnings (#3938)
* Sequence literal (Vector) should preserve warnings

When Vector was created via a sequence literal, we simply dropped any
associated any warnings associated with it.
This change propagates Warnings during the creation of the Vector.
Ideally, it would be sufficient to propagate warnings from the
individual elements to the underlying storage but doesn't go well with
`Vector.fromArray`.

* update changelog

* Array-like structures preserver warnings

Added a WarningsLibrary that exposes `hasWarnings` and `getWarnings`
messages. That way we can have a single storage that defines how to
extract warnings from an Array and the others just delegate to it.

This simplifies logic added to sequence literals to handle warnings.

* Ensure polyglot method calls are warning-free

Since warnings are no longer automatically extracted from Array-like
structures, we delay the operation until an actual polyglot method call
is performed.

Discovered a bug in `Warning.detach_selected_warnings` which was missing
any usage or tests.

* nits

* Support multi-dimensional Vectors with warnings

* Propagate warnings from case branches

* nit

* Propagate all vector warnings when reading element

Previously, accessing an element of an Array-like structure would only
return warnings of that element or of the structure itself.
Now, accessing an element also returns warnings from all its elements as
well.
2022-12-07 11:10:11 +01:00
Ilya Bogdanov
410204a3d9
Update component browser design (#3935)
A continuation and replacement for #3832

This PR updates the design of the component browser to match the latest Figma design file.


<img width="588" alt="Screenshot 2022-12-02 at 16 52 51" src="https://user-images.githubusercontent.com/6566674/205297344-d8d46e68-8c46-4e5a-b7f5-5e23014df23f.png">


https://user-images.githubusercontent.com/6566674/205297307-659c633c-a977-4c9f-9903-db72958895b7.mp4

# Important Notes
- Invalid color of the section navigator highlight is caused by a regression [#183915546](https://www.pivotaltracker.com/story/show/183915546)
2022-12-05 17:43:27 +00:00
Nikita Pekin
bd455ffabd
feat(183557950): Add ProjectsGrid View for Cloud Dashboard (#3857)
This PR is a draft PR while I learn EnsoGL. The eventual goal is to implement the projects list portion of the cloud dashboard in this PR. This PR will implement part of https://www.pivotaltracker.com/n/projects/2539513/stories/183557950

### Important Notes

This PR is still really rough and contains a lot of hacks & hard-coded values. The FRP usage is also likely to be suboptimal and need fixing.
2022-12-04 05:41:56 +01:00
Pavel Marek
f5f5bff9a7
Improve undefined method error message on builtin types (#3907)
Improve undefined method error message for builtin types

### Important Notes
- Rename `org.enso.interpreter.runtime.Context` to `org.enso.interpreter.runtime.EnsoContext`.
- Rename `org.enso.interpreter.Language` to `or.enso.interpreter.EnsoLanguage`.
2022-11-30 13:37:17 +01:00
Kaz Wesley
b58470145c
Widgets: improve scalability in some cases (#3920)
Fix issues noted here: https://github.com/enso-org/enso/pull/3678#issuecomment-1273623924
- Time complexity of an operation during line-redrawing scaled quadratically with number of lines in a change; now linear.
- Time complexity of adding `n` selections to a group was `O(n^2)`. Now it is `O(n log n)`, even if the selections are added one by one.

Also fix a subtle bug I found in `Group::newest_mut`: It returned a mutable reference that allowed breaking the *sorted* invariant of the selection group. The new implementation moves the element to invalidated space before returning a reference (internally to `LazyInvariantVec`), so that if it is mutated it will be moved to its correct location.

### Important Notes

New APIs:
- `NonEmptyVec::extend_at` supports inserting a sequence of elements at a location, with asymptotically-better performance than a series of `insert`s. (This is a subset of the functionality of `Vec::splice`, a function which we can't safely offer for `NonEmptyVec`).
- `LazyInvariantVec` supports lazily-restoring an invariant on a vector. For an invariant such as *sorted* (or in this case, *sorted and merged*), this allows asymptotically-better performance than maintaining the invariant with each mutation.
2022-11-30 13:36:28 +01:00
Michael Mauderer
c7c555314a
Bump rustc nightly-2022-11-22 (#3911) 2022-11-30 03:16:25 +01:00
Michał Wawrzyniec Urbańczyk
e94352fdf3
Launch "Cancel Previous Runs" on GH-hosted runner (#3933) 2022-11-29 22:07:46 +01:00
Wojciech Daniło
717325f472
removing optional dependencies from prelude (#3922) 2022-11-28 12:42:31 +01:00
Kaz Wesley
336bbf505c
Parser: Newline normalization in text literals (#3903)
- Newlines in text literals are now normalized to `\n` when producing IR representation.
- Re-enabled tests that were dependent on the old behavior.
2022-11-27 09:40:44 +00:00
Michał Wawrzyniec Urbańczyk
6b25cfa91f
Build hotfix (#3916) 2022-11-25 14:05:57 +01:00
Wojciech Danilo
e8ac7e7048 fixes 2022-11-25 08:01:08 +01:00
Wojciech Daniło
d60e3835f2
Display object refactoring (#3877) 2022-11-25 07:49:52 +01:00
Adam Obuchowicz
d79b7df886
Make Component Browser code generation valid and other fixes. (#3890)
This PR fixes the `code_to_insert` method of entry to insert valid code according to the newest language version. Also created a separate method for getting imports required by given entry.

Now, method entries do not add imports (except when they are extensions), and are insterted with place for this type `_.method`. Static methods and constructors are inserted with the type name, and proper import for type is added.

There are some additional work done:
* The ReferentName and NormalizedName were removed, as we are now case-sensitive.
* All QualifiedName structures were replaced with new one in `name` module, as there is no longer functional difference between type qualified name and module qualified name.
* The QualifiedName structure removes "Main" module segment where it is not necessary, thus simplifying our code base and avoiding potential issues.
* Added macro `mock_suggestion_database` which should make creating consistent mocks of SuggestionDatabase much simpler.
* Fixed bug where the visualization preview show no value for some time.

https://user-images.githubusercontent.com/3919101/202750275-0d378d5f-1482-4637-bdcd-c428a9eac0d4.mp4

# Important Notes
The tests in controller/searcher.rs file are not of the best quality, but those will be overhauled anyway when implementing my next task.
2022-11-24 20:34:13 +00:00
Michał Wawrzyniec Urbańczyk
667c1cac27
Fox warnings about colliding filenames. (#3908) 2022-11-24 18:54:45 +01:00
Galin Bajlekov
4ae2cb1e2a
Numeric slider component with variable precision (#3852)
This `Slider` component allows adjusting a numeric value with the mouse. The value is increased or decreased by clicking on the component and dragging it to the left or right.

The `Slider` has a configurable default value. `Ctrl`+clicking on the component resets its value to that default. When the value is moved away from the default, the value is printed in **bold**.

The `Slider` precision is increased or decreased by clicking the component and dragging upward or downward. This precision influences how quickly the value changes when the mouse moves horizontally, the steps in which the value is incremented or decremented, and the number of digits used to display the value. There is a margin around the component within which the precision is not changed. Beyond this margin, the precision is increased or decreased in powers of 10 (e.g. `0.1` -> `0.01` -> `0.001` when moving the mouse downwards, or `0.1` -> `1.0` -> `10.0` when moving the mouse upwards). The margin and distance between consecutive steps along the vertical axis are configurable.

The value of the `Slider` is limited to a configurable range, and cannot be adjusted beyond that range. A colored bar fills the component to indicate the current value within the range.

#### Video demonstration

https://user-images.githubusercontent.com/117099775/202244982-2f6f419d-7281-41f6-8607-7e492ad25b46.mp4

#### Future additions
This is the first iteration of the `Slider` component. Additional features are planned for the future:
* Textual editing of the value.
* Improved visual feedback on precision changes.
* Additional out-of-range behaviors.
2022-11-24 15:37:03 +00:00
Jaroslav Tulach
f225a962ce
Allow conversion of EnsoBigInteger to double (#3865)
Make sure any Enso number (including `EnsoBigInteger`) can be passed to Java via Truffle interop and used on the Java side.
2022-11-24 10:00:16 +00:00
Kaz Wesley
580ed74726
Parser: identify lines earlier (#3900)
Unify line-finding by doing it at the beginning of parsing. See: https://www.pivotaltracker.com/story/show/183797744
2022-11-22 19:59:33 +00:00
Kaz Wesley
8f3bfe8ce2
Parser: Fix @Ignored tests (#3879)
- 3 ignored cases were old-parser bugs (one of which was quite interesting)
- 1 was a new-lexer bug, fixed here

See: https://www.pivotaltracker.com/story/show/183797809
2022-11-18 20:58:41 +00:00
Michael Mauderer
9361cfe3ff
Implement TextGridView (#3819)
Implements [#83453449](https://www.pivotaltracker.com/story/show/183453449).

https://user-images.githubusercontent.com/1428930/197791213-f2e0ec69-5fe0-4482-aaaa-673ca5fcacc9.mp4

# Important Notes
* refactors some part of the visualization API to allow integration of EnsoGL UI components that require access to an `Applciation` struct (instead of just a `Scene` which was available before)
* extends the JS API mock library
2022-11-18 18:52:28 +00:00
Dmitry Bushev
52a8c72303
Message handler supervisor (#3881)
Changelog:
- Fix a potential `null` value in diagnostic messages
- Add a supervising strategy to the message handler
2022-11-17 19:02:04 +00:00
Hubert Plociniczak
7b0759f8b3
Don't add module's builtins to the scope of a builtin type (#3791)
It appears that we were always adding builtin methods to the scope of the module and the builtin type that shared the same name.
This resulted in some methods being accidentally available even though they shouldn't.

This change treats differently builtins of types and modules and introduces auto-registration feature for builtins.
By default all builtin methods are registered with a type, unless explicitly defined in the annotation property.
Builtin methods that are auto-registered do not have to be explicitly defined and are registered with the underlying type.
Registration correctly infers the right type, depending whether we deal with static or instance methods.

Builtin methods that are not auto-registered have to be explicitly defined **always**. Modules' builtin methods are the prime example.

# Important Notes
Builtins now carry information whether they are static or not (inferred from the lack of `self` parameter).
They also carry a `autoRegister` property to determine if a builtin method should be automatically registered with the type.
2022-11-16 10:23:52 +00:00
Paweł Grabarz
88e40479d1
Rust compile time optimizations (#3873) 2022-11-15 14:09:39 +01:00
Kaz Wesley
a1db36b57c
Support mixed constructors/bindings in types (#3870)
Libraries: Revert changes that were necessitated by a new rule we have decided not to introduce.

Parser:
- Support mixed constructors/bindings in types.
- Disallow zero-length hex sequences in character escapes: `\x`, `\u`, `\u{}`, `\U`, `\U{}` are no longer legal synonyms for `\0` (matches old parser behavior).
2022-11-14 20:24:07 +00:00
Hubert Plociniczak
85d4337f26
Project save backed by git (#3851)
This change adds support for Version Controlled projects in language server.
Version Control supports operations:
- `init` - initialize VCS for a project
- `save` - commit all changes to the project in VCS
- `restore` - ability to restore project to some past `save`
- `status` - show the status of the project from VCS' perspective
- `list` - show a list of requested saves

# Important Notes
Behind the scenes, Enso's VCS uses git (or rather [jGit](https://www.eclipse.org/jgit/)) but nothing stops us from using a different implementation as long as it conforms to the establish API.
2022-11-14 17:32:39 +00:00
Jaroslav Tulach
ecd1fdc3f8
Caching the grapheme_length of a Text (#3864)
Computing length of a text takes time. Let's cache it after first computation.

# Important Notes
Wrote `StringBenchmarks` that sums lengths of (the same) `Text` present many time in a `Vector`. Initially it took `383.673 ms` per operation. Then it took `0.031 ms/op`. Looks like the `length` calls are returning instantly as they get cached.
2022-11-14 15:53:10 +00:00
Wojciech Daniło
77934e09f7
Focus management (#3863) 2022-11-14 10:09:49 +01:00
Jaroslav Tulach
5ce173316b
More improvements that work with both parsers (#3868) 2022-11-12 02:34:14 +01:00
Marcin Kostrzewa
23e04f905f
Another attempt at M1 compilation (#3859) 2022-11-09 15:26:25 +00:00
Kaz Wesley
e8f3ad3979
Ensure parses of invalid inputs represent all tokens (#3860)
Ensure all tokens from the input are represented in trees resulting from invalid inputs--tests now cover every reachable code line that creates an `Invalid` node. (Also implemented stricter validation, mainly of `import`/`export` statements.)

See: https://www.pivotaltracker.com/story/show/183405907
2022-11-09 02:57:40 +00:00
Wojciech Daniło
cee7f27dc1
Text rendering quality improvements. (#3855) 2022-11-08 19:15:05 +01:00
Jaroslav Tulach
c2633bc137
Metadata, in context and imports (#3856)
Another set of improvements extracted from #3611. This time it includes a fix to the Rust part of the parser.

# Important Notes
After digging into metadata parsing I realized the positions used to query the BTree data structure are wrong. This PR tries to address that by re-arranging the order of serialized fields and passing `startCode` and `endCode` locations in.

Originally I though I need changes on the Rust side to support `in` operator. Turned out I can do that just with changes on the Java side.

Qualified names in imports were missing UUIDs. Fixed now.
2022-11-07 19:05:19 +00:00
Dmitry Bushev
14012a751f
Add parent type field to suggestion (#3846)
PR adds `parentType` field to the `Type` suggestion. All Enso types have parent type except `Any`.
2022-11-07 13:21:04 +00:00
Paweł Grabarz
ed384bddb9
add scroll overshoot bounce animation (#3836)
Implements https://www.pivotaltracker.com/n/projects/2539304/stories/183390749

https://user-images.githubusercontent.com/919491/198984088-9c4f03db-922f-4503-83fa-f0301a11239e.mp4

# Important Notes
- The overshoot bounce animation is implemented as a animation-like FRP mixin. It is currently defined using `define_endpoints` macro, but should be migrated to `define_endpoints_2` as soon as it supports "frp mixins" - definitions that extend external networks.
2022-11-07 10:50:47 +00:00
Radosław Waśko
20cfea8422
Add docs explaining the purpose and mechanisms of launcher-shims project (#3834) 2022-11-04 07:04:57 +00:00
Paweł Grabarz
94eff1192a
reduce compile time by making output label generation non-generic (#3848)
Split `HasOutputTypeLabel::output_type_label` method implementation non-generic part into a separate function. This significantly reduces compile time without risking any performance regressions. That function is currently only used for debug network visualization using graphviz, but still contributed a significant compilation time.

I've made a single attempt to profile the compiler itself, and it turned out that the compiler spent a significant amount of time trying to resolve `Pattern` implementation for closures in that method. Each of those also had to separately go through codegen and optimization. That happened for each node type in the codebase, per crate. Moving that into separate non-inline function removed all those unnecessary duplicates from. I also took this opportunity to rewrite that small piece of parsing to make it a bit cleaner.

The method of measurement is explained here: https://blog.rust-lang.org/inside-rust/2020/02/25/intro-rustc-self-profile.html
In this specific case, I've used `self-profile` to generate a profile for all crates, then used `crox` and [perfetto](https://ui.perfetto.dev/) to analyze the output.

This also shows a pattern to be aware of - using closures in generic context forces the compiler to make a separate closure type per each instantiation, even if that closure doesn't close on anything and could be a static function. This in effect forces even more instantiations or unnecessary type resolutions for all code paths that touch that closure. Using static functions or separating the non-generic part away in those cases would likely continue to help with compile times and file size.

## Comparison

The measurement was done on same machine under same environment, cleaning the build artifacts inbetween runs.

| | before |  after |
|-|-|-|
|total build time|5m 5.5s|3m 59.0s|
| `ide-view-graph-editor` crate build time| 85.68s | 49.73s |
| `ide-view-component-list-panel-grid` crate build time | 49.88s | 32.07s |
| `ide-view` crate build time | 29.05s | 17.5s |
| `enso_gui.wasm` file size before wasm-opt | 83.6 MB | 80.9 MB |
| `enso_gui.wasm` file size after wasm-opt | 67.3 MB | 65.3 MB |

![image](https://user-images.githubusercontent.com/919491/199633193-64dada16-eb22-4020-8d31-3f24661497aa.png)
2022-11-03 14:43:56 +00:00
Dmitry Bushev
73666df8fa
Cleanup old benchmark (#3845)
Old parser benchmark fails to compile, and it is not checked by CI. I assume it is safe to remove it.
2022-11-03 09:39:06 +00:00
Wojciech Daniło
48ce68cda1
Wip/wdanilo/text shape system single scene 183406745 (#3776) 2022-11-03 08:35:06 +01:00
Jaroslav Tulach
85f71cbfc8
Including enso_parser library in the engine distribution (#3842)
Make sure `libenso_parser.so`, `.dll` or `.dylib` are packaged and included when `sbt buildEngineDistribution`.

# Important Notes
There was [a discussion](https://discord.com/channels/401396655599124480/1036562819644141598) about proper location of the library. It was concluded that _"there's no functional difference between a dylib and a jar."_ and as such the library is placed in `component` folder.

Currently the old parser is still used for parsing. This PR just integrates the build system changes and makes us ready for smooth flipping of the parser in the future as part of #3611.
2022-11-02 17:13:53 +00:00
Paweł Grabarz
418120f16c
box Application to reduce component struct sizes (#3839)
Wrap big and commonly copied `Application` struct into `Rc` to avoid large structure sizes for all widgets.

The `Application`  struct by itself takes 704 bytes, measured by `size_of::<Application>()`. This structure is very often directly copied into components and widgets. Most notably, the generic `Widget` struct contains it. There are also cases, where structs (especially various `Model`s) contain multiple other child widgets directly, and end up indirectly copying the application multiple times.

All of `Application` clones are logical references (via `CloneRef`), so wrapping it into extra `Rc` doesn't change semantics in any way, but makes all structs that clone it way smaller. This reduces the amount of `memcpy`s and overall volume of allocated memory.

Measurement of a few example structs:

Before change:
```
size_of Application: 704 B
size_of Scrollbar: 712 B
size_of Scrollbar Model: 1576 B
```

After change:
```
size_of Application: 4 B
size_of ApplicationData: 704 B
size_of Scrollbar: 12 B
size_of Scrollbar Model: 176 B
```

Ideally we would not need to clone application reference into each component, but that's out of scope of this PR since it requires a lot more effort.
2022-11-02 16:01:50 +00:00
Dmitry Bushev
a6ce49e8a5
Split Atom suggestion entry to Type and Constructor (#3835)
Changelog:
- update: split `Atom` suggestion to `Type` and `Constructor`
- update: gui API
- update: JSONRPC doc
2022-11-02 09:53:40 +00:00
Kaz Wesley
330612119a
Parse the standard library (#3830)
Fix bugs in `TreeToIr` (rewrite) and parser. Implement more undocumented features in parser. Emulate some old parser bugs and quirks for compatibility.

Changes in libs:
- Fix some bugs.
- Clean up some odd syntaxes that the old parser translates idiosyncratically.
- Constructors are now required to precede methods.

# Important Notes
Out of 221 files:
- 215 match the old parser
- 6 contain complex types the old parser is known not to handle correctly

So, compared to the old parser, the new parser parses 103% of files correctly.
2022-10-31 16:19:12 +00:00
Paweł Grabarz
d7954bf6da
Scrollbar LMB click and hold scrolling (#3824) 2022-10-26 20:20:44 +02:00
Marcin Kostrzewa
901760816c
State rework & IO Contexts (#3828)
1. Changes how we do monadic state – rather than a haskelly solution, we now have an implicit env with mutable data inside. It's better for the JVM. It also opens the possibility to have state ratained on exceptions (previously not possible) – both can now be implemented.
2. Introduces permission check system for IO actions.
2022-10-26 16:22:08 +00:00
Dmitry Bushev
46441ca7a8
Add isStatic method field (#3829)
PR adds `isStatic` field to suggestion. The field is required for Component Browser.
2022-10-26 09:12:45 +00:00
Ilya Bogdanov
c2b82b9934
Editing via esc does not correctly update node view (#3799)
Fixes https://www.pivotaltracker.com/story/show/182926584
[Task link](https://www.pivotaltracker.com/story/show/183426449)

This PR fixes an IDE freeze introduced by https://github.com/enso-org/enso/pull/3732 and reimplements reverting edited nodes to their previous state.

The cause of the IDE freeze is quite interesting. A detailed investigation is available [here](https://gist.github.com/vitvakatu/785e34881368b8cfda61715d7543cbd0).

The graph editor needs to update the Presenter state only if the user is editing the node. Before this PR, the graph editor notified the Presenter with a visual representation of the node content instead of code expression. It caused inconsistency between the states of the controller and Presenter and caused severe performance issues.

https://user-images.githubusercontent.com/6566674/195831224-6d6e8258-e347-48b4-890a-d89c7300bc39.mp4

# Important Notes
- ~~There is a more complex alternative solution – it requires refactoring of the `component::node::input::area` module. The Presenter can be notified with `expression.code` changes, not `expression.viz_code`. I found a simpler solution (`.gate(&edit_mode)`), which has the same effect but does not require additional refactoring.~~ Said solution is implemented in a separate commit
2022-10-25 15:37:49 +00:00
Radosław Waśko
bc09c7b4c2
Remove obsolete Rust parser experiment, superseded by the much more mature new Rust parser integration (#3815)
We've had an old attempt at integrating a Rust parser with our Scala/Java projects. It seems to have been abandoned and is not used anywhere - it is also superseded by the new integration of the Rust parser. I think it was used as an experiment to see how to approach such an integration.

Since it is not used anymore - it make sense to remove it, because it only adds some (slight, but non-zero) maintenance effort. We can always bring it back from git history if necessary.
2022-10-24 14:56:07 +00:00
Mateusz Czapliński
81e5e77ae8
A caption when hovering the marketplace button on the left bar of Component Browser (#3783)
When hovering the mouse pointer over the Marketplace button on the left bar of the Component Browser, show a caption informing that the Marketplace will be available soon.

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

#### Visuals

The video below demonstrates the caption shown when hovering the Marketplace button on the left bar of the Component Browser. It shows the caption disappearing after a hardcoded time, or when the mouse pointer is moved away from the button.







https://user-images.githubusercontent.com/273837/196195809-45a712e1-ad86-47d8-99ff-1475a0b74c6e.mov

# Important Notes
- The "Label" visual component was fixed. Previously, the width calculation of the background was not synchronized correctly with the text width. As a result, a zero-width background was displayed when a Label was shown for the first time.
2022-10-19 16:07:40 +00:00
Adam Obuchowicz
c4e89a8afd
Fix potential dobule-borrow panic. (#3807)
There is one place in code, where we can potentially panic on double borrow, because the drop routine is done while having data borrowed.

# Important Notes
The issue was easily reproducible on @Frizi machine.
2022-10-19 12:11:38 +00:00
Jaroslav Tulach
21fe0b8865
Process documentation in type definitions (#3806)
Another part of #3611 ready for integration into `develop` branch.

# Important Notes
Test `org.enso.compiler.EnsoCompilerTest.testTestGroup` is ignored as it has problems with source offsets - identifiers don't have the appropriate names due to `Tree.codeRepr()` being _off_.
2022-10-19 09:19:42 +00:00
Kaz Wesley
feb8eb4f83
fix span bug in doc comments (#3808) 2022-10-18 20:37:36 +00:00
Kaz Wesley
28daf14f75
Parse case-by-type, add an old-lambda syntax rule (#3802)
- Special precedence rules for case-of so that `:` operator works without parens or nospace-grouping.
- Support an old-lambda syntax: `x->x-> x`. According to the usual rules, the first nospace group would be parsed as an operator section. The expression now parses as a lambda that contains a lambda.
- Match old parser treatment of # in doc comments.
- Tweak precedence so (a : B = c) works.
- Documented constructors.
2022-10-17 22:46:52 +00:00
Kaz Wesley
2740406f93
Lex doc comments and attach text to AST (#3795)
- New `Documented` node attaches documentation, lexed as a raw text literal, to a statement.
- Handle a case of lambdas with body blocks.
2022-10-15 06:13:32 +00:00
Pavel Marek
e9260227c4
Duration type is a builtin type (#3759)
- Reimplement the `Duration` type to a built-in type.
- `Duration` is an interop type.
- Allow Enso method dispatch on `Duration` interop coming from different languages.

# Important Notes
- The older `Duration` type should now be split into new `Duration` builtin type and a `Period` type.
- This PR does not implement `Period` type, so all the `Period`-related functionality is currently not working, e.g., `Date - Period`.
- This PR removes `Integer.milliseconds`, `Integer.seconds`, ..., `Integer.years` extension methods.
2022-10-14 18:08:08 +00:00
Paweł Grabarz
ce6267f098
Add replace_text method to In-Memory Table (#3793)
Implements https://www.pivotaltracker.com/n/projects/2539304/stories/183415329
2022-10-14 17:42:29 +02:00
Adam Obuchowicz
148d32e4c3
Component Browser with Grid View (#3766)
This PR introduced an overhauled Component List Panel implementation, making use of the efficient EnsoGL grid view component. Also, it delivers a couple of new features:
* A part of the new design: there are no more section headers in grid, instead groups are "glued" together. The local scope section is under "popular" (old "favorites").
* The keyboard management inside grid works.
* there is a mouse hover highlight
* selecting the lowest entry in section when jumping with navigation bar.
* accepting input as-is with cmd/ctrl + Enter.

https://user-images.githubusercontent.com/3919101/194561890-fffb9b41-2f0d-4357-8d9a-5038a6bcb023.mp4


### Important Notes

**What is not implemented:**
* [Focus management between panels.](https://www.pivotaltracker.com/story/show/180872763) The grid is always focused. To accept the current input, use ctrl+Enter shortcut.
* [Proper handling of selection when having empty space on the right and pressing right arrow.](https://www.pivotaltracker.com/story/show/183487880)
* When entering a module, its name is not added to the input as described in the design doc. Will be a part of [this User Story](https://www.pivotaltracker.com/story/show/181058321).

**Known issues**
* [the selection, especially in the local scope section, has sometimes an undesirable offset](https://www.pivotaltracker.com/story/show/183487730). The cause is known, but not so easy to fix.
* The inserted nodes are often producing errors. The Browser's inherits the outdated understanding of the language from old Node Searcher, and it does not include new form of imports, static methods etc. Those all will be fixed as a part of [this User Story](https://www.pivotaltracker.com/story/show/181058321).
* The performance is improved, but still not ideal, due to problems in [text areas](https://www.pivotaltracker.com/story/show/183406745).
* To scroll the documentation panel, you must first click on it.
2022-10-14 12:42:59 +02:00
Kaz Wesley
0e412044f6
Macro contexts (#3792)
- Implement macro-contexts-lite (`from` is now only a keyword at the beginning of a line)
- Support special nospace-group handling for old lambdas (so expressions like this work: `x-> y-> x + y`)
- Fix a text-escape incompatibility

# Important Notes
- There is now an `OperatorFunction`, which is like a `Function` but has an operator for a name, and likewise an `OperatorTypeSignature`.
2022-10-13 22:47:02 +00:00
Kaz Wesley
5668cbcc24
Qualified defs (#3785)
Allow qualified names in LHS of type signatures and method definitions.
2022-10-12 17:40:16 +00:00
Michał Wawrzyniec Urbańczyk
ad69eeb4ad
Build script merge (#3743)
Merged the build script into main repository. Some related cleanups.
2022-10-10 23:38:48 +02:00
Kaz Wesley
2fab9ee1e9
Implement annotations (#3780)
- `->` lambda operator isn't bound by nospace groups; see new test case.
- Implemented annotations.
2022-10-10 07:09:01 +00:00
Kaz Wesley
44a031f9f0
Parser: Full constructor syntax for type definitions; Field syntax; Complex operator sections; Template functions; Text improvements; Operator methods; eliminate Unsupported; better ArgumentDefinitions (#3716)
I believe all parse failures remaining after these changes are because the new parser is intentionally stricter about some things. I'll be reviewing those failures and opening a bug to change the library/tests code.

Implements:
- https://www.pivotaltracker.com/story/show/182941610: full type def syntax
- https://www.pivotaltracker.com/story/show/182497490: field syntax
- https://www.pivotaltracker.com/story/show/182497395: complex operator sections
- https://www.pivotaltracker.com/story/show/182497236: template functions
- `codeRepr` without leading whitespace
- text literals: interpret escape sequences in lexer
- the multiline text-literal left-trim algorithm
- type operator-methods
- the `<=` operator is no longer treated as a modifier
- https://www.pivotaltracker.com/story/show/183315038: eliminate Unsupported
- use ArgumentDefinition for type constructor arguments
- more detailed ArgumentDefinition type
2022-10-05 04:45:31 +00:00
Dmitry Bushev
ff987212ce
fix: rust fmt (#3758) 2022-10-04 17:09:58 +02:00
Wojciech Danilo
5971faa53c Fixes 2022-10-04 15:29:35 +02:00
Wojciech Danilo
7ce7646beb Fixing tracing default debug level. Setting it to WARN instead of DEBUG. 2022-10-04 14:54:13 +02:00
Wojciech Daniło
61546a7ade
Wip/wdanilo/widgets 182746060 (#3678) 2022-10-04 04:51:27 +02:00
Ilya Bogdanov
0d74ab6124
Breadcrumbs integration (#3720)
[ci no changelog needed]
[Task link](https://www.pivotaltracker.com/story/show/182675703)

This PR implements the actual integration of the breadcrumbs panel with the component list panel. A special breadcrumbs controller (`controller::searcher::breadcrumbs`) is tracking the currently opened module with a list of its parents. The searcher presenter uses the API of the controller to sync the displayed list of breadcrumbs with the controller state.


https://user-images.githubusercontent.com/6566674/193064122-7d3fc4d6-9148-4ded-a73e-767ac9ac83f8.mp4

# Important Notes
- There is an `All` breadcrumb displayed at all times at the beginning of the list. It will be replaced with a section name as part of [Section Title on Component Browser's Breadcrumbs Panel](https://www.pivotaltracker.com/story/show/182610561) task.
- I changed the implementation of `project::main_module_id`, `project::QualifiedName::main_module`, and `API::main_module` so that they are logically connected which each other.
- I adjusted the Breadcrumbs View to avoid "appearance" animation glitches when opening new modules. `set_entries` was replaced with the `set_entries_from` endpoint.
2022-10-03 10:54:09 +00:00
Kaz Wesley
106bb0a044
profiling graphs: fall back to demo data (#3746)
When running the profiling run-graph and flamegraph demo scenes, if a profile file is not found in the directory served over http, fall back to generating demo data.
2022-09-30 06:45:31 +00:00
Michał Wawrzyniec Urbańczyk
6a56ceb147
Disable wasm-opt for all the entry point crates (#3734)
This PR disables the wasm-opt optimization in the crates that can be used as WASM entry points. Unfortunately, wasm-pack does not allow for disabling wasm-opt through a command line flag, so we have to disable it by setting an appropriate flag in each Cargo.toml.
2022-09-23 22:01:06 +02:00
James Dunkerley
a3de3c6128
Use ArraySlice to slice a Vector (#3724)
Use an `ArraySlice` to slice `Vector`.
Avoids memory copying for the slice function.

# Important Notes
| Test | Ref | New |
| --- | --- | --- |
| New Vector | 71.9 | 71.0 |
| Append Single | 26.0 | 27.7 |
| Append Large | 15.1 | 14.9 |
| Sum | 156.4 | 165.8 |
| Drop First 20 and Sum | 171.2 | 165.3 |
| Drop Last 20 and Sum | 170.7 | 163.0 |
| Filter | 76.9 | 76.9 |
| Filter With Index | 166.3 | 168.3 |
| Partition | 278.5 | 273.8 |
| Partition With Index | 392.0 | 393.7 |
| Each | 101.9 | 102.7 |

- Note: the performance of New and Append has got slower from previous tests.
2022-09-23 15:13:16 +00:00
Hubert Plociniczak
096fcfee82
Generate native image for engine-runner (#3638)
This PR adds a possibility to generate native-image for engine-runner.
Note that due to on-demand loading of stdlib, programs that make use of it are currently not yet supported
(that will be resolved at a later point).
The purpose of this PR is only to make sure that we can generate a bare minimum runner because due to lack TruffleBoundaries or misconfiguration in reflection config, this can get broken very easily.
To generate a native image simply execute:
```
sbt> engine-runner-native/buildNativeImage
... (wait a few minutes)
```
The executable is called `runner` and can be tested via a simple test that is in the resources. To illustrate the benefits
see the timings difference between the non-native and native one:
```
>time built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --no-ir-caches --in-project test/Tests/ --run engine/runner-native/src/test/resources/Factorial.enso 6
720

real	0m4.503s
user	0m9.248s
sys	0m1.494s
> time ./runner --run engine/runner-native/src/test/resources/Factorial.enso 6
720

real	0m0.176s
user	0m0.042s
sys	0m0.038s
```

# Important Notes
Notice that due to a [bug in GraalVM](https://github.com/oracle/graal/issues/4200), which is already fixed in 22.x, and us still being on 21.x for the time being, I had to add a workaround to our sbt build to build a different fat jar for native image. To workaround it I had to exclude sqlite jar. Hence native image task is on `engine-runner-native` and not on `engine-runner`.

Will need to add the above command to CI.
2022-09-22 14:45:10 +00:00
Mateusz Czapliński
7dc971f4bb
GridView auto-scrolling when navigating with keyboard (#3687)
When a GridView is navigated using the keyboard, scroll it to display the newly selected entry.

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

#### Visuals

See below for a video demonstrating automatic scrolling of the GridView when arrow keys are pressed on the keyboard. The first video below shows the default scrolling behavior in a GridView without headers.

Note:
- When the Grid View is scrolled, the mouse hover highlight moves away from the mouse position. This is not a new regression, the behavior is the same in the `develop` branch (e.g. when scrolling using the mouse).



https://user-images.githubusercontent.com/273837/190183984-91f7808c-3606-43f8-bcda-ac4d5f84e00f.mov



The video below shows the behavior in a GridView with headers when the GridView is first scrolled to its top-left corner. The following guidance from the Design Doc is enabled and showcased:

> Users can change the selected component by pressing the arrow keys. The Focus does not move up if it does not have to (in most cases, the focus is located in the second row from the bottom). Instead, the component list scrolls down if there are enough entries.

https://user-images.githubusercontent.com/273837/189151546-e50aaf22-6f4d-41cb-809f-60038305745f.mov

The next video shows the behavior in the same GridView as in the previous example when the GridView is first scrolled away from any of its boundary entries. Notably, scrolling happens only when the selection is moved using the keyboard arrow keys, not when changing the selection using the mouse. This behavior is based on a discussion with @wdanilo on Discord.

https://user-images.githubusercontent.com/273837/189151974-d992be93-f61f-4e9f-9f4c-dfe260bbec5b.mov
2022-09-21 17:41:20 +00:00
Adam Obuchowicz
50c8ecc255
Component Browser Entry (#3718)
This PR contains an entry definition for Grid View to be used inside Component List Panel View. The Example grid view with the entry definition may be seen on new_component_list_panel_view debug scene.

https://user-images.githubusercontent.com/3919101/190663278-23c35ab0-f426-4001-8128-df7147aafb9e.mp4

# Important Notes
* The styling is not detailed yet due to time constraints (I want to move to integration this grid view to Component Panel List ASAP) and the fact that I could not get new mplus1 font working with text Area.
* Implementing this required adding a "contour offset" feature to the Grid View.
2022-09-21 14:10:16 +00:00
Jaroslav Tulach
9134f9b2d7
EnsoCompilerTest to verify compatibility of parsers (#3723)
Adding new _compatibility test_ `EnsoCompilerTest` to verify the new Rust based parser can produce the same `IR` as the original `AST` based one. The simplest way to execute the test from an empty repository is:
```bash
enso$ sbt bootstrap
enso$ sbt "testOnly *EnsoCompilerTest"
```

There are [GitHub Actions run](https://github.com/enso-org/enso/actions/runs/3087664644/jobs/4993266212#step:9:5187) on Linux as well as [run on Windows](https://github.com/enso-org/enso/actions/runs/3087664644/jobs/4993266370#step:9:5254) that show `EnsoCompilerTest` is being executed by the CI (good, as that means `.so` was properly built and linked to the JVM running the test). The [linux](https://github.com/enso-org/enso/actions/runs/3087664644/jobs/4993266212#step:9:5187) as well as [windows](https://github.com/enso-org/enso/actions/runs/3087664644/jobs/4993266370#step:9:5254) runs also demonstrate that failures in the `EnsoCompilerTest` suite fail the CI.

# Important Notes
Right now [there are five test failures](https://github.com/enso-org/enso/actions/runs/3087664644/jobs/4993266212#step:9:5187) - waiting for @kazcw to make sure `codeRepr()` doesn't contain spaces. However, as this PR is more about the infrastructure, I am disabling the currently failing tests in [031169b](031169bd05)
2022-09-20 15:50:27 +00:00
Ilya Bogdanov
a771e40002
Component browser breadcrumbs (#3686)
[ci no changelog needed]

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

This PR implements a Breadcrumbs panel for the new component browser.
The Breadcrumbs is a horizontal list of text labels separated by a special icon and has an optional ellipsis icon at the end.
It is implemented using the new GridView component.

Video:

Demo of adding new breadcrumbs, scrolling behavior, and selecting breadcrumbs with the mouse.


https://user-images.githubusercontent.com/6566674/189199432-77807cef-00dc-4abe-b95c-b17a536f59f6.mp4

Demo of selecting breadcrumbs with keyboard shortcuts:


https://user-images.githubusercontent.com/6566674/189199603-53e55335-73ba-4ed7-8291-4455144c06aa.mp4

# Important Notes
- This PR implements an old interaction of the design of the component browser. The new design of the breadcrumbs can not be easily integrated into the current look of the component browser, so we would need to update styles later. It should be a relatively simple task. *The implementation uses color from the new design though. (but not fonts and sizes)*
- I found a bug in the grid view implementation that causes panics at runtime in some conditions. The reason is triggering FRP endpoints while constructing new entries. This issue is fixed in the PR.
2022-09-19 09:21:52 +00:00
Kaz Wesley
d8f274158a
Parser: Named and default arguments; Text interpolation; Escape sequences (#3709)
* named and default arguments

* text interpolation and escapes

* work around a limitation of Java
2022-09-14 22:32:28 -07:00
Kaz Wesley
605bd08e8d
Parser: Utf16, recursive spans, toString, lambdas, case expressions, operator precedence, array and tuple literals, numeric literals (#3706)
Implements:
- https://www.pivotaltracker.com/story/show/182807114 - Utf16
- https://www.pivotaltracker.com/story/show/182931097 - recursive span info
- https://www.pivotaltracker.com/story/show/182940917 - readable `toString`
- https://www.pivotaltracker.com/story/show/182497196 - lambdas
- https://www.pivotaltracker.com/story/show/182497518 - case expressions
- https://www.pivotaltracker.com/story/show/182497344 - operator precedence and associativity
- https://www.pivotaltracker.com/story/show/182497111 - array and tuple literals
- https://www.pivotaltracker.com/story/show/182496909 - numeric literals
2022-09-14 18:09:58 +00:00
Mateusz Czapliński
5cd94d0126
GridView selection keyboard navigation. (#3657)
Add support for moving the selection in a Grid View using the keyboard.

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

#### Visuals

See below for videos showcasing GridView selection keyboard navigation in the `grid_view` debug scene. In the videos, messages in the Developer Console can be observed. When a keypress would result in the selection being moved out of the GridView, the selection is not moved and a message is emitted in the Developer Console instead, showcasing an FRP output signal emitted on such event. Please note that the videos are recorded with the tracing level changed to `DEBUG`. In a default build, the tracing level is set to `WARN`, and the messages visible in the videos are not displayed in the Developer Console.

https://user-images.githubusercontent.com/273837/188483972-89d79f7b-1303-457b-869f-282e0809a755.mov

https://user-images.githubusercontent.com/273837/188484294-e9b6461c-a84f-4817-9447-d792f2ebdbb5.mov

The following video shows moving the selection between "regular" entries and header entries. It also shows a current usability limitation of the selection keyboard navigation feature, such that the Grid is not scrolled when the selection leaves the visible part of the Grid, and the selection may thus disappear from view.

https://user-images.githubusercontent.com/273837/188485238-29a82b27-de2f-4cf8-a2e7-ff8c3f41478d.mov

# Important Notes
- Keyboard navigation only works when a GridView has focus.
- Selection keyboard navigation only works if the selection was already set to some entry beforehand.
- If keyboard navigation would move selection outside of the grid, the selection movement is canceled and an FRP event is emitted.
2022-09-14 16:50:35 +00:00
Hubert Plociniczak
fba5047acc
Improved Vector/Array interop (#3667)
`Vector` type is now a builtin type. This requires a bunch of additional builtin methods for its creation:
- Use `Vector.from_array` to convert any array-like structure into a `Vector` [by copy](f628b28f5f)
- Use (already existing) `Vector.from_polyglot_array` to convert any array-like structure into a `Vector` **without** copying
- Use (already existing) `Vector.fill 1 item` to create a singleton `Vector`

Additional, for pattern matching purposes, we had to implement a `VectorBranchNode`. Use following to match on `x` being an instance of `Vector` type:
```
import Standard.Base.Data.Vector

size = case x of
Vector.Vector -> x.length
_ -> 0
```

Finally, `VectorLiterals` pass that transforms `[1,2,3]` to (roughly)
```
a1 = 1
a2 = 2
a3 = 3
Vector (Array (a1,a2, a3))
```
had to be modified to generate
```
a1 = 1
a2 = 2
a3 = 3
Vector.from_array (Array (a1, a2, a3))
```
instead to accomodate to the API changes. As of 025acaa676 all the known CI checks passes. Let's start the review.

# Important Notes
Matching in `case` statement is currently done via `Vector_Data`. Use:
```
case x of
Vector.Vector_Data -> True
```
until a better alternative is found.
2022-09-13 03:07:17 +00:00
Dmitry Bushev
f233ea66b3
Use Mplus1 font (#3688)
Use Mplus1 font in the welcome screen.

# Important Notes
#### Before:
![ide-causten](https://user-images.githubusercontent.com/357683/188605189-b37d4545-7b35-469f-8497-b026d1ce2e75.png)

#### After
![ide-mplus1](https://user-images.githubusercontent.com/357683/188605262-b46597b8-a622-4740-9b78-17a2f71ddaa1.png)
2022-09-09 12:47:34 +00:00
Dmitry Bushev
05a6415ec0
create inmem database (#3690) 2022-09-07 12:59:18 +03:00
Kaz Wesley
1e3b9a3624
Parse text literals (#3681)
Parse text literals. See: https://www.pivotaltracker.com/story/show/182496940

# Important Notes
- The left-trimming algorithm (https://github.com/enso-org/design/blob/wip/wd/enso-spec/epics/enso-spec-1.0/04.%20Expressions.md#inline-and-block-text-literals) requires two passes over the sequence of text segments. This implementation performs one pass while parsing (identifying the correct amount of trim). The other pass (applying the trim) can be done when building the value of the quoted string: Trim the amount of whitespace identified by the `trim` field off of the whitespace of each `TextSection` (the value will not exceed the amount of whitespace found in the tokens' offsets, except for tokens with 0 offset, in which case no trimming is necessary/possible).
2022-09-03 06:38:06 +00:00
Kaz Wesley
c3f758e0dc
Parser: Parse UUIDs; implement comments in AST; implement type annotations and signatures; fix field names (#3653)
Implements:
- UUIDs: https://www.pivotaltracker.com/story/show/182931137
- Comments: https://www.pivotaltracker.com/story/show/182981779
- Type annotations and signatures: https://www.pivotaltracker.com/story/show/182497454
- Fix getter names (https://github.com/enso-org/enso/pull/3627#discussion_r940887460).

# Important Notes
- I can't fully test UUIDs; I have tested that the data obtained in Rust matches my understanding of how the format is supposed to work. What remains to be tested is that the data in Java matches the way the old parser handles the format. So @JaroslavTulach, let me know if you see any cases where I'm not returning the same values.
- This implementation of type annotations and signatures accepts any expression in type context. It would probably be nice to narrow this down at some point, but for now I have no design info on what specifically should be allowed in type expressions; this implementation should be at least an incremental improvement.
2022-09-03 03:15:27 +00:00
Dmitry Bushev
de0a231417
IDE uses new visualization API (#3661) 2022-09-01 15:33:46 +03:00
Marcin Kostrzewa
4fc6dcced0
Get rid of free-floating atoms. Everything has a type now! (#3671)
This is a step towards the new language spec. The `type` keyword now means something. So we now have
```
type Maybe a
Some (from_some : a)
None
```
as a thing one may write. Also `Some` and `None` are not standalone types now – only `Maybe` is.
This halfway to static methods – we still allow for things like `Number + Number` for backwards compatibility. It will disappear in the next PR.

The concept of a type is now used for method dispatch – with great impact on interpreter code density.

Some APIs in the STDLIB may require re-thinking. I take this is going to be up to the libraries team – some choices are not as good with a semantically different language. I've strived to update stdlib with minimal changes – to make sure it still works as it did.

It is worth mentioning the conflicting constructor name convention I've used: if `Foo` only has one constructor, previously named `Foo`, we now have:
```
type Foo
Foo_Data f1 f2 f3
```

This is now necessary, because we still don't have proper statics. When they arrive, this can be changed (quite easily, with SED) to use them, and figure out the actual convention then.

I have also reworked large parts of the builtins system, because it did not work at all with the new concepts.

It also exposes the type variants in SuggestionBuilder, that was the original tiny PR this was based on.

PS I'm so sorry for the size of this. No idea how this could have been smaller. It's a breaking language change after all.
2022-08-30 22:54:53 +00:00
Wojciech Daniło
4b96b4887c
Better fonts support. (#3616) 2022-08-27 00:25:34 +02:00
James Dunkerley
a20d43390e
Adding DateTime part functions (#3669)
- Added `Zone`, `Date_Time` and `Time_Of_Day` to `Standard.Base`.
- Renamed `Zone` to `Time_Zone`.
- Added `century`.
- Added `is_leap_year`.
- Added `length_of_year`.
- Added `length_of_month`.
- Added `quarter`.
- Added `day_of_year`.
- Added `Day_Of_Week` type and `day_of_week` function.
- Updated `week_of_year` to support ISO.

# Important Notes
- Had to pass locale to formatter for date/time tests to work on my PC.
- Changed default of `week_of_year` to use ISO.
2022-08-26 15:47:58 +00:00
Adam Obuchowicz
d4142cfee3
Grid View Headers (#3656) 2022-08-24 16:36:23 +02:00
Hubert Plociniczak
d87a32d019
Builtin Date_Time, Time_Of_Day, Zone (#3658)
* Builtin Date_Time, Time_Of_Day, Zone

Improved polyglot support for Date_Time (formerly Time), Time_Of_Day and
Zone. This follows the pattern introduced for Enso Date.

Minor caveat - in tests for Date, had to bend a lot for JS Date to pass.
This is because JS Date is not really only a Date, but also a Time and
Timezone, previously we just didn't consider the latter.
Also, JS Date does not deal well with setting timezones so the trick I
used is to first call foreign function returning a polyglot JS Date,
which is converted to ZonedDateTime and only then set the correct
timezone. That way none of the existing tests had to be changes or
special cased.

Additionally, JS deals with milliseconds rather than nanoseconds so
there is loss in precision, as noted in Time_Spec.

* Add tests for Java's LocalTime

* changelog

* Make date formatters in table happy

* PR review, add more tests for zone

* More tests and fixed a bug in column reader

Column reader didn't take into account timezone but that was a mistake
since then it wouldn't map to Enso's Date_Time.
Added tests that check it now.

* remove redundant conversion

* Update distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time.enso

Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>

* First round of addressing PR review

* don't leak java exceptions in Zone

* Move Date_Time to top-level module

* PR review

Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>
Co-authored-by: Jaroslav Tulach <jaroslav.tulach@enso.org>
2022-08-24 12:31:29 +02:00
Ilya Bogdanov
8c504bd4b0
Grid View with variable column widths (#3651)
[ci no changelog needed]
[Task link](https://www.pivotaltracker.com/story/show/182955595)

This PR implements variable column widths in the new Grid View component. We need this feature to quickly implement various parts of the UI, including the breadcrumbs panel of the component browser.

There are two ways to change the width of the specific column:
1. "From the outside", using the `set_column_width` endpoint of the Grid View
2. "From the inside", using the `override_column_width` endpoint of the EntryFrp.

Both ways work similarly, but the latter is helpful for our breadcrumbs implementation, as it allows for entry to decide on the width of the column by its content.

See the screencast with three grid views. The top-left one has every even column shrunk by GridView API. Every grid view has a second column extended by EntryFrp API.


https://user-images.githubusercontent.com/6566674/185060985-7b7df076-c659-41fa-977a-22875493f8d4.mp4
2022-08-23 13:28:00 +00: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
Kaz Wesley
60b1dce79e
Parser: hide internal APIs in generated Java (#3605)
Now that there's a public `org.enso.syntax2.Parser` interface (after #3599), make APIs that don't need to be exposed package-private.
2022-08-09 23:32:49 +02:00