Commit Graph

2946 Commits

Author SHA1 Message Date
Jaroslav Tulach
e47eb49ea8
Removing need for asynchronous thread to execute ResourceManager finalizers (#6335)
While Enso runs single-threaded, its `ResourceManager` required additional asynchronous thread to execute its _"finalizers"_. What has been necessary back then is no longer needed since _GraalVM 21.1_. GraalVM now provides support for submitting `ThreadLocalAction` that gets then picked and executed via `TruffleSafepoint` locations. This PR uses such mechanism to _"inject"_ finalizer execution into already running Enso evaluation thread.

Requiring more than one thread has complicated Enso's co-existence with other Truffle language. For example Graal.js is strictly singlethreaded and used to refuse (simple) co-existence with Enso. By allowing Enso to perform all its actions in a single thread, the synergy with Graal.js becomes better.
2023-04-20 13:33:45 +02:00
Pavel Marek
4076a64f33
NaN can be used as a key in Map (#6301)
`Number.nan` can be used as a key in `Map`. This PR basically implements the support for [JavaScript's Same Value Zero Equality](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#same-value-zero_equality) so that `Number.nan` can be used as a key in `Map`.

# Important Notes
- For NaN, it holds that `Meta.is_same_object Number.nan Number.nan`, and `Number.nan != Number.nan` - inspired by JS spec.
- `Meta.is_same_object x y` implies `Any.== x y`, except for `Number.nan`.
2023-04-20 09:25:36 +00:00
Hubert Plociniczak
6d3151f32d
UnresolvedSymbol is now accepted by Vector.sort (#6334)
`Vector.sort` does some custom method dispatch logic which always expected a function as `by` and `on` arguments. At the same time, `UnresolvedSymbol` is treated like a (to be resolved) `Function` and under normal circumstances there would be no difference between `_.foo` and `.foo` provided as arguments.

Rather than adding an additional phase that does some form of eta-expansion, to accomodate for this custom dispatch, this change only fixes the problem locally. We accept `Function` and `UnresolvedSymbol` and perform the resolution on the fly. Ideally, we would have a specialization on the latter but again, it would be dependent on the contents of the `Vector` so unclear if that is better.

Closes #6276,

# Important Notes
There was a suggestion to somehow modify our codegen to accomodate for this scenario but I went against it. In fact a lot of name literals have `isMethod` flag and that information is used in the passes but it should not control how (late) codegen is done. If we were to make this more generic, I would suggest maybe to add separate eta-expansion pass. But it could affect other things and could be potentially a significant change with limited potential initially, so potential future work item.
2023-04-20 07:58:58 +00:00
Kaz Wesley
dd4dce2c3f
Reduce borrow scope (#6359)
Reduce the scope of a borrow, to prevent `BorrowError`s.
2023-04-19 22:33:46 +02:00
Dmitry Bushev
fe0c8fd9a3
Increase the stack size (#6355)
close #6319
2023-04-19 19:09:05 +00:00
Kaz Wesley
bc4ed96d71
Layer/Rectangle improvements (#6247)
* Use Rectangle for breadcrumbs background.

* Use Rectangle for status bar bg.

* Use Rectangle for dropdown bg.

* Dirty global_element_depth_order invalidates sublayers

* Setting new parent may invalidate depth order

* Support per-instance pointer_events_enabled

* Remove workaround for #6241
2023-04-19 09:06:20 -07:00
Dmitry Bushev
8c9c2d79cd
Keep scheduled execution job on text edit (#6354)
close #6346

Changelog:
- fix: keep scheduled execution job in the queue when applying a text edit
2023-04-19 14:18:36 +00:00
Hubert Plociniczak
f288198b4b
Change order of arguments when controlling context (#6357)
https://github.com/orgs/enso-org/discussions/6344 requested to change the order of arguments when controlling context permissions.

# Important Notes
The change brings it closer to the design doc but IMHO also a bit cumbersome to use (see changed tests) - applications involving default arguments don't play well when the last argument is not the default 🤷 .`
2023-04-19 14:00:27 +00:00
Stijn ("stain") Seghers
9ae77f4b6f
Make play button clickable and hide it when irrelevant (#6302) 2023-04-19 14:51:12 +02:00
Hubert Plociniczak
4c1e73c864
Don't propagate warnings on suspended arguments (#6345)
* Don't propagate warnings on suspended arguments

In the current implementation, application of arguments with warnings
first extracts warnings, does the application and appends the warnings
to the result.
This process was however too eager if the suspended argument was a
literal (we don't know if it will be executed after all).

The change modifies method processor to take into account the
`@Suspend` annotation and not gather warnings before the application
takes place.

* PR review
2023-04-19 11:55:23 +02:00
Hubert Plociniczak
0088672f9b
Simplify test for 6248 (#6343)
As per suggestion https://github.com/enso-org/enso/pull/6275#discussion_r1167388449
2023-04-19 11:43:52 +02:00
somebody1234
d14e57b2ff
Fix uncaught sign up error; minor code style changes (#6313)
* Fix uncaught sign up error; minor code style changes

* Run prettier

* Fix bugs
2023-04-19 11:29:13 +02:00
Jaroslav Tulach
f52ef08be5
Avoid double WithWarnings wrapping (#6348) 2023-04-19 10:43:29 +02:00
Wojciech Daniło
fa995dd765
Vector Editor first visual implementation (#6245) 2023-04-19 04:26:01 +02:00
Dmitry Bushev
7733b9bdac
Async Language Server resources initialization (#6336)
close #6306

Changelog:
- add: `AsyncResourceInitialization` component
- update: initialize language server resources asynchronously

# Important Notes
Speeds up `session/InitProtocolConnection` request by ~300ms (~10%) 3051ms (before) vs 2740ms (after) on my machine.
2023-04-18 15:55:44 +00:00
Kaz Wesley
912556853f
Disable buffer compaction (#6339)
Fixes #6320.
2023-04-18 15:17:17 +00:00
Ilya Bogdanov
84f64bec65
Use red color for context switch button (#6266) 2023-04-18 17:00:57 +02:00
Hubert Plociniczak
117fab4f3a
Nit - fix typo in issue template (#6338) 2023-04-18 15:14:15 +02:00
Michael Mauderer
64043323e8
A drop-down that allows changing the execution mode. (#6130)
Implements https://github.com/enso-org/enso/issues/5931.

https://user-images.githubusercontent.com/1428930/228532453-2032b376-1aa5-4140-8331-be37e4e675d4.mp4

# Important Notes
Not functional yet, as it needs integration with the engine.
2023-04-18 10:26:17 +00:00
Jaroslav Tulach
e5a96b9782
Avoid NullPointerException in --dumpGraphs & test & docs (#6304) 2023-04-18 06:58:06 +02:00
Kaz Wesley
db3db975a6
Tests: Use debug-info level 1 instead of 2. (#6316) 2023-04-17 23:27:34 +02:00
Ilya Bogdanov
b700679d35
Allow opening dev-tools using keyboard shortcut in Electron (#6262)
Fixes #6249

See [Electron docs](https://www.electronjs.org/docs/latest/api/browser-window). We were explicitly disabling the ability to open dev-tools unless `debug.dev-tools` flag is provided.
2023-04-17 16:33:39 +00:00
Dmitry Bushev
93b9ca7789
Update the default project template (#6310)
close #6307

Changelog:
- update: the default project template

# Important Notes
[6307-update-the-default-project-template.webm](https://user-images.githubusercontent.com/357683/232487322-8aebc709-30aa-48f3-b86b-f868c83a6e21.webm)
2023-04-17 14:09:08 +00:00
Hubert Plociniczak
f720bd2516
Type of UnresolvedSymbol is Function (#6284)
`Meta.is_a` and `Meta.type_of` now recognize UnresolvedSymbol.
Closes #6277.
2023-04-17 13:44:15 +00:00
Paweł Buchowski
e68d16a38e
fix paths to dashboard modules (#6295) 2023-04-17 14:09:10 +02:00
Michał Wawrzyniec Urbańczyk
bbf7d1d307
Ready to merge no longer implies keeping up to date. (#6305) 2023-04-17 14:08:13 +02:00
Jaroslav Tulach
413661b366
Splitting Gigantic EqualsNode into few Smaller Ones (#6280)
Splitting gigantic `EqualsNode` into few smaller ones
2023-04-17 11:29:54 +02:00
Dmitry Bushev
b020e7f97b
Fix stepping out of the function after renaming the project (#6285)
close #6138

Rename method pointers in existing execution contexts after the project is renamed.
2023-04-17 08:48:32 +00:00
Pavel Marek
b42e910280
sort handles incomparable values (#5998)
* Update type ascriptions in some operators in Any

* Add @GenerateUncached to AnyToTextNode.

Will be used in another node with @GenerateUncached.

* Add tests for "sort handles incomparable types"

* Vector.sort handles incomparable types

* Implement sort handling for different comparators

* Comparison operators in Any do not throw Type_Error

* Fix some issues in Ordering_Spec

* Remove the remaining comparison operator overrides for numbers.

* Consolidate all sorting functionality into a single builtin node.

* Fix warnings attachment in sort

* PrimitiveValuesComparator handles other types than primitives

* Fix byFunc calling

* on function can be called from the builtin

* Fix build of native image

* Update changelog

* Add VectorSortTest

* Builtin method should not throw DataflowError.

If yes, the message is discarded (a bug?)

* TypeOfNode may not return only Type

* UnresolvedSymbol is not supported as `on` argument to Vector.sort_builtin

* Fix docs

* Fix bigint spec in LessThanNode

* Small fixes

* Small fixes

* Nothings and Nans are sorted at the end of default comparator group.

But not at the whole end of the resulting vector.

* Fix checking of `by` parameter - now accepts functions with default arguments.

* Fix changelog formatting

* Fix imports in DebuggingEnsoTest

* Remove Array.sort_builtin

* Add comparison operators to micro-distribution

* Remove Array.sort_builtin

* Replace Incomparable_Values by Type_Error in some tests

* Add on_incomparable argument to Vector.sort_builtin

* Fix after merge - Array.sort delegates to Vector.sort

* Add more tests for problem_behavior on Vector.sort

* SortVectorNode throws only Incomparable_Values.

* Delete Collections helper class

* Add test for expected failure for custom incomparable values

* Cosmetics.

* Fix test expecting different comparators warning

* isNothing is checked via interop

* Remove TruffleLogger from SortVectorNode

* Small review refactorings

* Revert "Remove the remaining comparison operator overrides for numbers."

This reverts commit 0df66b1080.

* Improve bench_download.py tool's `--compare` functionality.

- Output table is sorted by benchmark labels.
- Do not fail when there are different benchmark labels in both runs.

* Wrap potential interop values with `HostValueToEnsoNode`

* Use alter function in Vector_Spec

* Update docs

* Invalid comparison throws Incomparable_Values rather than Type_Error

* Number comparison builtin methods return Nothing in case of incomparables
2023-04-16 16:40:12 +02:00
somebody1234
64ecaa85e3
Start and open workspace (#5804)
- Adds project stop and fullscreen icons
- Adds spinner animation
- Adds `Ide` component as a container for the IDE

# Important Notes
This **does not work** on the desktop IDE as it runs `enso.main`
2023-04-15 09:12:53 +00:00
somebody1234
cd54e1b47d
Add TypeScript style guide (#6226)
Adds TypeScript style guide.

# Important Notes
This is more or less a straight port from Rust; I think the goal should be to make this a sort of living document which changes as the TypeScript parts of the codebase become more mature.

Several sections have been removed as they do not apply to the TypeScript codebase. Of note is the section about vertically aligning type annotations, local variable declarations and match arms.
2023-04-15 08:28:12 +00:00
Hubert Plociniczak
e163353d16
Deprecate Error's to_display_text builtin methods (#6275)
The primary motivation for this change was
https://github.com/enso-org/enso/issues/6248, which requested the possibility of defining `to_display_text` methods of common errors via regular method definitions. Until now one could only define them via builtins.

To be able to support that, polyglot invocation had to report `to_display_text` in the list of (invokable) members, which it didn't. Until now, it only considered fields of constructors and builtin methods. That is now fixed as indicated by the change in `Atom`.

Closes #6248.

# Important Notes
Once most of builtins have been translated to regular Enso code, it became apparent how the usage of `.` at the end of the message is not consistent and inflexible. The pure message should never follow with a dot or it makes it impossible to pretty print consistently for the purpose of error reporting. Otherwise we regularly end up with errors ending with `..` or worse. So I went medieval on the reasons for failures and removed all the dots.
The overall result is mostly the same except now we are much more consistent.

Finally, there was a bit of a good reason for using builtins as it simplified our testing.
Take for example `No_Such_Method.Error`. If we do not import `Errors.Common` module we only rely on builtin error types. The type obviously has the constructor but it **does not have** `to_display_text` in scope; the latter is no longer a builtin method but a regular method. This is not really a problem for users who will always import stdlib but our tests often don't. Hence the number of changes and sometimes lack of human-readable errors there.
2023-04-14 19:14:49 +00:00
GregoryTravis
4dcf5faddd
Add split and tokenize to the Table. (#6233)
Implement split and tokenize for tables.
2023-04-14 16:03:02 +00:00
Kaz Wesley
92ce47016a
Test, fix, re-enable buffer compaction. (#6202)
* Test, fix, re-enable buffer compaction.

- Fix a bug involving trying to move tombstones after multiple GCs (#6197).
- Refactor allocator for more testability.
- Add tests with extensive sequence of allocator operations.

* fmt

* Fix.

* Fix #6011. Don't use debug-assertion; fix sanity check that wasn't usually being run.

* Lint.

* Revert "Fix #6011. Don't use debug-assertion; fix sanity check that wasn't usually being run."

This reverts commit 47b9100c2b.

* Fix accidentally committed line

---------

Co-authored-by: Adam Obuchowicz <adam.obuchowicz@enso.org>
2023-04-14 07:04:37 -07:00
Jaroslav Tulach
a74933d10f
Speed cascade of if statements up (#6255)
Fixes #5709. We have a test and a generic fix that improves inlining of every builtin. Everything seems to be faster.
2023-04-14 13:27:23 +00:00
Dmitry Bushev
9ebda56385
Language Server preserves the suggestion updates order (#6268)
Related #6138

Fixes an issue when the `SuggestionsHandler` can send suggestion updates without preserving the order in which they were received.
2023-04-14 12:39:02 +00:00
somebody1234
f179f43ad1
Update top-bar styles and implement changePassword feature. (#6219)
Recreate #5857 and #6064. Implementation by @Nctdt.

- Adds dashboard <-> project switcher
- Adds search input (does nothing for now)
- Adds help button - currently links to the official Discord server
- Adds user account menu containing:
- Username
- User profile (does nothing for now)
- Change password button
- Sign out button
- Adds modal to change password

# Important Notes
N/A
2023-04-14 11:37:23 +00:00
Paweł Buchowski
467d3df4c2
Save cognito access token to ~/.enso/credentials (#6251)
To allow libs for using Cloud API they need to have access to the JWT token set by cognito. After talking to @jdunkerley and finding out it can not be obtained from localStorage we agreed to dump it to the file. This PR introduces simple saving jwt access token to ~/.enso/credentials (system agnostic)
2023-04-13 16:02:13 +00:00
somebody1234
72ae10c8e2
Add dashboard table view (#6015)
- Adds dummy views for all asset types (project, directory, secret, file)
- The backend metadata does not exist for many of these columns.

# Important Notes
To do:
- [x] figure out the best way to add the custom classes - tailwind likes to avoid custom classes whenever possible
2023-04-13 15:17:32 +00:00
Paweł Buchowski
5d81ae879e
Update codewoners with cloud dashboard & authentication (#6265)
Since the cloud dashboard is now embeded in Enso repository this PR adds owners over dashboard libraries. It also adds eslint specific files owner over @ somebody1234
2023-04-13 14:19:24 +00:00
somebody1234
135b9fc41e
Simplify authentication JS module (#6220)
- merge `hooks.useInput` into `Input` component
- inlines and removes `utils.handleEvent`
- splits `components/common.tsx` into individual files

# Important Notes
The goal of this PR is to minimize the number of helper functions we are using.
Switching (back?) to well-known React functions makes it clearer to new contributors what exactly is happening.
⚠️ This PR is *completely optional* and can be closed without merging. It is a relatively minor refactor that does not add any features.
2023-04-13 09:57:28 +00:00
James Dunkerley
4e92d76665
Add Warning methods onto Any to make working with them easier. (#6176)
Adds `has_warnings`, `remove_warnings` and `throw_on_warning` extension methods.
2023-04-12 15:08:01 +00:00
Adam Obuchowicz
b72ab4aee3
Fix: when default visualization is displayed, its entry is not present in the chooser list. (#6209)
The visualization was blank because we set a new visualization instance with same data for attaching, so `VisualizationManager` skipped attaching (and thus the data for previous instance were not shared with the new one).

And the entry was visible, because we informed chooser about selected vis before the visualization list arrived.

Fixes #5992 may also fix some other issues with blank visualizations.
2023-04-12 10:24:06 +00:00
Hubert Plociniczak
c8ea06c4a6
Provide Forbidden_Operation.to_display_text (#6246)
Added a missing `to_display_text` method which, by convention, is defined via a builtin method.

Also re-enabled and fixed pending tests.

Closes #6227.
2023-04-12 07:53:21 +00:00
Dmitry Bushev
b97fc39214
Remove SQL versions repo (#6242)
close #6232

Changelog:
- remove: `SqlVersionsRepo`
- update: `SuggestionsDatabaseModuleUpdateNotification` message removing the version
- update: cleanup versions repo usages in the language server
2023-04-11 19:22:30 +00:00
somebody1234
fe1798c9e3
Fix ./run gui watch on Windows (#6239)
Fixes a bug in the plugin used to workaround a bug in esbuild. The bug has since been fixed, however another plugin is causing issues with the *proper* fix

# Important Notes
N/A
2023-04-11 18:05:15 +00:00
Stijn ("stain") Seghers
810127b887
Add node button to enable/disable output context (#6205)
Closes #5929: Adding a node button to enable and disable the output context for that particular node.

I also added a temporary shortcut (cmd-shift-c) to switch the execution environment so we can properly test it.


https://user-images.githubusercontent.com/607786/230036314-052b734a-1846-4057-93d8-2152e1e0cce6.mp4

# Important Notes
While we're waiting to integrate it with the language server, the execution environment is temporarily stored in the presenter. (Otherwise we'd have to define it in multiple places and the behaviour would look rather weird.)

I also fixed a bug where the view didn't get any updates when the context switch expression changed. I'll make a comment on the relevant part. I think the SKIP and FREEZE macros might have the same issue.
2023-04-11 17:05:37 +00:00
Jaroslav Tulach
5b3cf6f503
Consolidate Vector and Array methods (#6218)
Fixes #5011 by making sure the same methods that are on `Vector` are also available on `Array`.
2023-04-11 16:20:11 +00:00
Michał Wawrzyniec Urbańczyk
3eb72ecfbe
Fix the --ide-option handling. (#6237) 2023-04-11 17:18:58 +02:00
Dmitry Bushev
6663125410
Language Server support for execution environments (#6217)
close #6133

Changelog:
- add: `executionContext/setExecutionEnvironment` request
- update: `executionContext/recompute` request to have optional `executionEnvironment` parameter.
2023-04-11 15:12:27 +00:00