Commit Graph

75 Commits

Author SHA1 Message Date
James Dunkerley
ed9e71c4eb
Make ICON section work consistently between old and new GUI. (#8369)
- Handle name mismatch in icons between old and new IDE.
- Set the default icon for a few types.
- If can't find and icon use the Enso logo.

![image](https://github.com/enso-org/enso/assets/4699705/43d828b4-58cf-429e-b659-b1c389953b23)
2023-11-23 09:03:34 +00:00
somebody1234
1cf5ea96d6
More consistent reactive indices (#8353)
- Renames all `ReactiveIndex` and `ReactiveDb`s into the format `<key>To<value>`
- `ReactiveMapping`s (in `graphDatabase.ts`) currently have not been renamed - I'm not sure they need to be
- Removes various methods that have been made unnecessary by this change
- Simplifies some other methods
- Changes `SuggestionDb` to extend `ReactiveDb`

# Important Notes
None
2023-11-23 04:48:12 +00:00
Paweł Grabarz
e492d3f260
[GUI2] Render widget arguments (#8339)
Fixes #8256 #8257

Implemented displaying node argument placeholders. Refactored widgets to allow arbitrary input types, and split widget matching into two phases, separating input type validation step and allowing it to influence the derived TypeScript type of widget component props.

Connecting an edge to the placeholder is not implemented yet. Only connections to existing arguments are supported for now.

https://github.com/enso-org/enso/assets/919491/ad3bf254-5f56-4f2f-8c0d-616a7195c6d8


Nested argument lists are also supported:
<img width="396" alt="image" src="https://github.com/enso-org/enso/assets/919491/b61f6870-0f01-48c3-9b45-c7c6bc464638">
2023-11-22 14:43:58 +00:00
somebody1234
375e610660
Layout nodes without position (#8326)
- Closes #8071

# Important Notes
There is currently no way to predict the width a node, taking into account the width of widgets.
This should probably be done in another task.
2023-11-20 14:17:34 +00:00
somebody1234
062992bb8b
Fixes for GUI2 (#8310)
Addresses several issues found during book club.
- Add placeholder icons for visualizations (see screenshot)
- Also add the corresponding export to visualizations, and relevant support in the visualization store and visualization metadata DB.
- Show icon both on the visualization selector button, and in each visualization selector entry
- Adjust gaps between visualization selector entries
- Port table viz fixes (#8102) to Vue
- Fix height of table rows to avoid cutting off descenders on letters like `y` and `g`
- Make the space and enter keys work on visualization toolbar buttons, if they are selected
- `.blur()` code editor when clicking outside of it
- And similarly `.blur()` visualization selector
- Move selection brush on scroll by scaling the delta of `scrollTop` and `scrollLeft`
- Note that mouse position is technically still incorrect when scrolling past the end. I think this is fine - the new behavior is less broken, plus I am not aware of any way to fix this.

# Important Notes
None
2023-11-20 13:23:50 +00:00
somebody1234
9edc94afa0
Unify GUI2 headers (#8327)
- Closes #8304

# Important Notes
- A better long-term solution may be to remove COOP/COEP/CORP headers instead, but that is out of scope of this PR.
- Feel free to create a new issue, or discuss elsewhere, if this is something we want to do eventually
2023-11-20 11:32:40 +00:00
somebody1234
078260d8e7
Fix Geo Map visualization (#8311)
- Fixes #8300
- Fixes Geo Map visualization being completely broken
- Fixes Mapbox attribution icon in bottom right being invisible
- Fixes Mapbox attribution button being unclickable

# Important Notes
None
2023-11-20 11:25:23 +00:00
Michael Mauderer
85e2c72204
Fix component browser interactions. (#8303)
Fixes: #8064

Fixes broken interactions with of the component browser.
2023-11-17 15:28:45 +00:00
Michael Mauderer
aef3a4ffc0
enso-8194 Copy and pasting a single node (#8298)
Implements  #8194

[Peek 2023-11-13 14-15.webm](https://github.com/enso-org/enso/assets/1428930/22882487-7288-4eb7-af08-6539060b4967)
2023-11-17 03:57:30 +00:00
Paweł Grabarz
febce5dad7
[GUI2] Selection and rendering of basic node widgets (#8253) 2023-11-15 16:26:18 +00:00
Adam Obuchowicz
dc4de729b6
Fix CORS problems on built package (#8301)
Fixes #8297

Some external resources were failing due to CORS policies. This is the simplest fix.
2023-11-14 17:31:11 +00:00
Michael Mauderer
198fdece0b
Opening searcher with source node (#8279)
Implements #8065.
2023-11-14 14:42:33 +00:00
Adam Obuchowicz
5baec46466
Fix node placement (#8277)
Fixes: #8230

Fixes some rare cases caught by property tests, involving nodes with 0 width. `MultiRange` does not handle those. The thing is fixed by not using MultiRange, but by sorting nodes by the axis along which we're searching for free place.

All three reported seeds seem to be fixed.

# Important Notes
`MultiRange` is not used now, but I decided to spare it, violating YAGNI rule, as it is tested, and I feel it's a structure which may be useful.
2023-11-14 08:53:07 +00:00
Ilya Bogdanov
876cbd7b5d
Displaying progress for file uploads (#8227)
Closes #8182

Also, improved handling of multiple files – they are placed with a small vertical gap now.

The design for uploading files is non-existent, so I implemented something simple and good-looking. We can easily adjust it at any time.

You can’t move or otherwise interact with nodes while they are uploading.

https://github.com/enso-org/enso/assets/6566674/c0709d8f-3b95-4913-a6eb-caae225b6598
2023-11-13 13:50:57 +00:00
Adam Obuchowicz
c01ba83a3a
Use alias analysis to handle internal variables in CB input. (#8268)
Fixes #7926

See the new test cases to see what is the improvement.

The self still will be not ideal, but it's because it uses same logic as edges discovery. [When it will be improved](https://github.com/enso-org/enso/pull/8252) this should be improved as well.

https://github.com/enso-org/enso/assets/3919101/25efd56d-5aaa-4f10-957d-8ed6a40f3d9b

# Important Notes
It contains part of #8250. That PR may be reviewed, or here both PRs may be reviewed at once.
2023-11-13 12:59:15 +00:00
Michael Mauderer
148f34f778
Adding a new node with searcher (#8241)
Implements #8064 /

@kazcw Could you double-check that this plays well with your edge dragging implementation. Some of the code seemed a work in progress, and I want to avoid any issues with what you had planned there.
2023-11-10 14:10:44 +00:00
Kaz Wesley
ce042569b0
line:col positions in parser (#8203)
Add `line:column` information to source code references produced by the parser. This information will be used by GUI2 as part of the solution to #8134.

# Important Notes
- `parse_all_enso_files.sh` has been used to ensure this doesn't affect tree structures.
- `parse_all_enso_files.sh` now checks emitted locations for consistency, and has been used to verify that all line:col references match the values found by an independent scan of the source up to the given UTF8 position.
2023-11-08 16:53:39 +00:00
Michał Wawrzyniec Urbańczyk
2c04b1424e
Alias Analysis for the New GUI (#8189) 2023-11-08 02:44:22 +01:00
Adam Obuchowicz
3b12b6e17b
Refactor Input class to be composable (#8244)
Part of #7926

I found myself wanting to use graph store in the `Input` class. As I learned about composables recently, I decided to refactor the class into a composable, to be more vue-like. Putting it in a separate PR because [other task may wanting to do the same](8066)

Also contains some preparations for my actual implementation.
2023-11-07 17:07:44 +00:00
Adam Obuchowicz
579d83a450
Magnet algorithm when dragging nodes. (#8224)
Fixes #8070

When dragging a node, it is snapped to any axis being an extension to another node's boundary. This helps user keeping their nodes neatly aligned.

https://github.com/enso-org/enso/assets/3919101/36dd4d5f-55d3-4f3c-ba49-e8425fae8270

# Important Notes
* Now the position is saved to Yjs doc only when drag is finished.
* Node structure in graph store has two position fields: one representing what is currently stored in the node's metadata, and where the node is displayed. `nodeRects` use the visible rectangles.
2023-11-07 15:51:30 +00:00
Michael Mauderer
faf8cb715a
Added editable node functionality integrated with the Component Browser. (#8183)
Fixes #7786

[Peek 2023-10-30 14-21.webm](https://github.com/enso-org/enso/assets/1428930/9acca794-4b08-4c8a-a9f3-4bdbfdbf66e5)
2023-11-06 15:02:44 +00:00
somebody1234
168e222fcc
Read custom visualizations (#8180)
- Closes #8077

# Important Notes
Tests are still WIP
2023-11-03 20:09:45 +00:00
Ilya Bogdanov
fb3d65df2d
Upload files by drag and drop (#8214)
The first part of #8158. No progress indication for the user implemented.


https://github.com/enso-org/enso/assets/6566674/2d8157d4-748f-4442-a9c3-a96ba0029056

# Important Notes
A few notable changes:
- A fix for `DataServer/writeBytes`
- Using `@noble/hashes` instead of `sha3` because the latter only works with node. I also tried using `js-sha3`, but it does not work well with Vite (see https://github.com/emn178/js-sha3/issues/36)
- Fixed initialization of the ID map for new nodes. Also, all new nodes are prepended by four spaces to have proper indentation inside the `main` function.
- Fixed random pattern name generation because the previous approach sometimes produces identifiers starting with a number.
2023-11-02 15:32:14 +00:00
somebody1234
8bc17bd370
Fix flaky partitionPoint test (#8198)
The tests for `partitionPoint` were previously failing when `NaN` or duplicates were present in the array.

# Important Notes
None
2023-11-01 13:07:18 +00:00
Ilya Bogdanov
f37ec96149
Avoid crash when new directory created in project root (#8199)
While working on #8158, I noticed a crash when the `data` directory is created at the project root. Turns out it is the issue in the `ydoc-server`, which thinks every filesystem event is about files. Unfortunately, we don‘t have the needed info available, so we need to make the `file/info` request.
2023-11-01 12:22:49 +00:00
Ilya Bogdanov
660f4b35ce
Preserve error code in the error message from RPC (#8191)
Needed for #8158
2023-10-31 15:01:54 +00:00
Kaz Wesley
487241317b
Synchronize execution mode (#8157)
Implements #8073.
2023-10-30 15:08:08 +00:00
somebody1234
ad4f738b02
Fix node color (#8177)
The qualified name for nodes was incorrect, resulting in the suggestion entry never being found.

# Important Notes
Should double-check that the issue is present on develop but not this PR. I've checked locally but it doesn't hurt to be extra sure.
2023-10-30 15:05:56 +00:00
Ilya Bogdanov
4de51b25ff
Navigating documentation panel with breadcrumbs (#8176)
Closes #8131

https://github.com/enso-org/enso/assets/6566674/69609307-d5f5-4185-af65-aed1f6b85978
2023-10-30 12:31:33 +00:00
somebody1234
7019de70b7
New node placement (#8112)
- Closes #8069

# Important Notes
None
2023-10-30 08:08:29 +00:00
Ilya Bogdanov
523a32471e
Documentation Panel (#8118)
Implementing most parts of the Documentation Panel in the new GUI.

Known issues:
- Links do not work (yet, covered by #7992)
- Some pages are entirely empty – I’m investigating. Missing doc sections likely cause this, so we probably want to add some placeholder.
- Tags do not look as in design. I tried implementing them correctly but didn't have enough time to finish everything. Some initial implementation is in place, though. I will create a separate task for them.


https://github.com/enso-org/enso/assets/6566674/a656ae78-5d4c-45f4-a0a5-e07fa573253e
2023-10-30 00:27:40 +00:00
somebody1234
f2651d58e4
[gui2] Component demos (#7945)
- Closes #7916

# Important Notes
None
2023-10-29 19:02:07 +00:00
Michael Mauderer
53ecaf44ae
Hook up Play Button and Execution Mode selector to Language Server. (#8037)
Implements #7990
2023-10-25 17:34:37 +00:00
Kaz Wesley
ea487a9b1b
Edge interactions and rendering (#8138)
[vokoscreenNG-2023-10-23_06-35-31.webm](https://github.com/enso-org/enso/assets/1047859/d8a5ffc5-4677-4264-a246-8def4418505a)

- Implement disconnected edges and edge interactions (#7864).
- Port edge layout from Rust.
- Implement output ports, hover extensions, backward-edge arrows, hover-splitting.

# Important Notes
- A new `currentInteraction` API supports mutually-exclusive interactions; this is used to cancel edge creation when the CB is opened. We can use it more generally to ensure only one major interaction is ongoing at a time.
- Remaining details to reach parity with gui1 edges: #8139
2023-10-25 15:36:16 +00:00
Paweł Grabarz
10f44b52e9
Use Enso AST in graph editor (#8123)
The graph is now properly constructed only from the main function body, and rendered nodes are using real Enso AST.

<img width="459" alt="image" src="https://github.com/enso-org/enso/assets/919491/e0106ee7-aaea-40aa-a42b-fc91c9d8740e">
2023-10-24 14:05:12 +00:00
Adam Obuchowicz
675fff07de
Local scope filtering (#8109)
The "Local scope filtering" button works now.

![image](https://github.com/enso-org/enso/assets/3919101/6cf6858f-0fdb-4f39-925d-9973e1ef9659)
2023-10-23 10:18:10 +02:00
somebody1234
8fc720a1a2
Move Rect to util/ (#8121)
`rect.ts` is not a store, and hence does not belong in `stores/`

# Important Notes
None
2023-10-20 15:20:09 +00:00
Adam Obuchowicz
1391dd93f4
Applying suggestions in the Component Browser (#8036)
Fixes #7993 

Added code for applying selected suggestion.

https://github.com/enso-org/enso/assets/3919101/c5ff116c-3fa9-4a98-ba03-cba404e96c82

### Important Notes

Found one issue in reading AST children and fixed it.

---------

Co-authored-by: Paweł Grabarz <frizi09@gmail.com>
2023-10-20 13:08:35 +02:00
somebody1234
895326d4ed
Highlight matches in CB (#8098)
- Closes #8062

# Important Notes
- This PR uses a completely separate implementation from the regexes used for the existing filtering. AFAICT, this is unavoidable, since this needs to retrieve matched text.
- I've come across a couple minor bugs related to the Component Browser:
- When deleting text (backspacing), the full list of unfiltered entries momentarily reappear because the filtering is reset.
- Things like `h.m` match `HTTP_Method` - if this is not intentional, it seems like it might be more difficult to fix, unfortunately.
- Note that highlighting (I assume correctly?) *does not* highlight any part of `HTTP_Method`.
2023-10-19 15:08:56 +00:00
Kaz Wesley
2edd2bd7ff
Ensure all spans have document offsets (#8039)
- Validate spans during existing lexer and parser unit tests, and in `enso_parser_debug`.
- Fix lost span info causing failures of updated tests.

# Important Notes
- [x] Output of `parse_all_enso_files.sh` is unchanged since before #7881 (modulo libs changes since then).
- When the parser encounters an input with the first line indented, it now creates a sub-block for lines at than indent level, and emits a syntax error (every indented block must have a parent).
- When the parser encounters a number with a base but no digits (e.g. `0x`), it now emits a `Number` with `None` in the digits field rather than a 0-length digits token.
2023-10-19 12:36:42 +00:00
Adam Obuchowicz
24b9a1179e
Fix (#8099)
A bug was discovered during my development of a (later discarded) branch.
2023-10-19 12:28:36 +00:00
Kaz Wesley
1a5437d388
Tree traversal API (#8096)
Implements #8025: `LazyObject` now has a `visitChildren` method that observes each direct-child `LazyObject`. `childrenAstNodes` is now a simple function that flattens non-Tree nodes out of the hierarchy; `validateSpans` visits both `Tree`s and `Token`s the same way we would use the `ItemVisitor` Rust API.
2023-10-19 11:08:07 +00:00
Ilya Bogdanov
cec115d25b
Snap CB position to pixel boundary (#8095)
* Snap CB position to pixel boundary

* Apply review comments
2023-10-18 14:33:45 +02:00
somebody1234
1fd3a037ad
Avoid relative imports whenever possible (#8074)
- Change imports from `'./'` relative imports to `@/` or `shared/` whenever possible
- Imports in `shared/` and `ydoc-server` have been avoided for now in case they don't work with `@/` imports.
- Deduplicate `events.ts`, remove `useDocumentEvent` in favor of `useEvent(document,` (and same for `useDocumentEventConditional`
- Replace incorrect doc comments (`//*` and `///`) with correct doc comments (`/**`)

# Important Notes
None
2023-10-16 15:56:24 +00:00
somebody1234
209f4deb3e
CodeMirror highlighting (#8075)
- Closes #8041
- Integrates parser with CodeMirror
- Adds extensions builtin to CodeMirror
- Highlight text matching the selection
- Adds PoC CodeMirror extensions
- Basic syntax highlighting
- Code folding
- Hover tooltips

# Important Notes
As there is currently no way to get the corresponding node based on a position, the hover tooltip currently iterates through every node in `graphSotre.nodes`. This is potentially VERY SLOW and should be changed eventually, or disabled completely until an efficient implementation is possible.
2023-10-16 14:04:43 +00:00
Ilya Bogdanov
67bcf6ae07
ReactiveDb and ReactiveIndex (#8052)
SuggestionDb refactoring to facilitate documentation panel development and other features.

Now SuggestionDb uses `ReactiveDb` + `ReactiveIndex`es under the hood. There are no visual changes to the IDE. Everything still works the same.

You can now use two reactive indexes built on top of the SuggestionDb:
1. `db.nameToId` is a `QualifiedName→SuggestionId` relation. Reverse lookup allows you to get the qualified name by ID.
2. `db.parent` is a `SuggestionId→SuggestionId` relation, representing parent-children relations between entries. The rules are the following:
- If the `memberOf` field is present, it is used as a parent.
- Otherwise, a parent’s qualified name is used (through the `qnParent` function)
You can use reverse lookup to get the children of the entry.

You can easily add your own indexes if needed.
2023-10-16 13:35:16 +00:00
somebody1234
79d8354848
Fixed node icons and colors, derived from suggestions DB groups (#8031)
- Closes #8015
- Note that the (few) fallback icons are still present, as most CB entries are still missing icons. *However*, now the `iconName` from the libraries take priority over the fallback icon names.
- Also fixes a minor regression, where nodes pending execution were no longer faded out. This was introduced in #7988 because the wrong CSS variable was set.

# Important Notes
None
2023-10-13 00:54:06 +00:00
Adam Obuchowicz
0783618276
Interpreting CB input using AST. (#8022)
Fixes #7784

Instead of some heuristic, we now parse the CB's input and get the pattern and qualified name. Also we keep the "context" structure which may be used to apply suggestions properly.

# Important Notes
I created several helpers for AST. One of them is very hacky: we traverse AST tree by reading all getters in JS. Instead, we could generate it basing on schema.
2023-10-12 14:00:48 +00:00
Paweł Grabarz
bf76be6e6b
[GUI2] use DataView directly in generated parser code (#8028)
- Removed `Cursor` and moved all accessors to standalone functions, reducing the generated code size significantly (especially after minification).
- Removed unnecessary `seek`s from everywhere. Now the offseting is part of each `read` implementation.
- Removed unnecessary differences between `read`s on abstract and concrete types. Now abstract types do the pointer access internally in their `read`.
2023-10-11 21:28:29 +00:00
somebody1234
62019f6334
Filter visualization types based on node type (#8004)
- Closes #7925

# Important Notes
The type -> matching visualization lookup is populated using a `Promise`, so there is a race condition where the selector will incorrectly show the full list of visualizations if it is opened before the `Promise` resolves.
2023-10-11 15:27:03 +00:00