Commit Graph

25 Commits

Author SHA1 Message Date
Adam Obuchowicz
2384fe851d
Fix undoing node removal (#9561)
Fixes #9314

The node deletion does not remove AST node from the module, only unpin it from its parent; so undoing does not add this node, just modify it, and thus we weren't informed about metadata change.
2024-03-29 16:31:00 +00:00
Ilya Bogdanov
c44b7f2c2d
Small visualization fixes (#9130)
Closes #9009

- [x] Fixed big white space above full screen viz.
- [x] Escape closes the full screen visualization.
- [x] Viz shortcuts (Shift-Space for toggling fullscreen vis, Ctrl-Space for switching vis type) are implemented.
- [x] The width of visualizations is preserved across project reopens (do we need height as well?)

New video:


https://github.com/enso-org/enso/assets/6566674/d9036ce9-57a4-429b-9bd9-6392782136ea

Older videos:

https://github.com/enso-org/enso/assets/6566674/d7129307-0626-4343-8a76-b9bf764c6a5b


https://github.com/enso-org/enso/assets/6566674/0518d3d8-9ed1-4e6c-bbe0-b7ed00bf7db3

# Important Notes
- Metadata format changed in backward-compatible way
2024-02-29 16:37:40 +00:00
Kaz Wesley
c811a5ae8b
Enable the Code Editor, with new apply-text-edits algo. (#9055)
- Fix the UI problems with our CodeMirror integration (Fixed view stability; Fixed a focus bug; Fixed errors caused by diagnostics range exceptions; Fixed linter invalidation--see https://discuss.codemirror.net/t/problem-trying-to-force-linting/5823; Implemented edit-coalescing for performance).
- Introduce an algorithm for applying text edits to an AST. Compared to the GUI1 approach, the new algorithm supports deeper identity-stability for expressions (which is important for subexpression metadata and Y.Js sync), as well as reordered-subtree identification.
- Enable the code editor.
2024-02-19 23:57:42 +00:00
Kaz Wesley
343a644051
Syntactic synchronization, automatic parentheses, metadata in Ast (#8893)
- Synchronize Y.Js clients by AST (implements #8237).
- Before committing an edit, insert any parentheses-nodes needed for the concrete syntax to reflect tree structure (fixes #8884).
- Move `externalId` and all node metadata into a Y.Map owned by each `Ast`. This allows including metadata changes in an edit, enables Y.Js merging of changes to different metadata fields, and will enable the use of Y.Js objects in metadata. (Implements #8804.)

### Important Notes

- Metadata is now set and retrieved through accessors on the `Ast` objects.
- Since some metadata edits need to take effect in real time (e.g. node dragging), new lower-overhead APIs (`commitDirect`, `skipTreeRepair`) are provided for careful use in certain cases.
- The client is now bundled as ESM.
- The build script cleans up git-untracked generated files in an outdated location, which fixes lint errors related to `src/generated` that may occur when switching branches.
2024-02-02 10:22:18 +01:00
Kaz Wesley
f88bd90ebb
Refactor for YJs AST (#8840)
Some refactoring separated from #8825 for easier review.

# Important Notes
**ID types**

The new *synchronization IDs* will replace `ExprId` for `Ast` references in frontend logic. `ExprId` (now called `ExternalId`) is now used only for module serialization and engine communication. The graph database will maintain an index that is used to translate at the boundaries. For now, this translation is implemented as a type cast, as the IDs have the same values until the next PR.

- `AstId`: Identifies an `Ast` node.
- `NodeId`: A subtype of `AstId`.
- `ExternalId`: UUID used for serialization and engine communication.

**Other changes**:

- Immediate validation of `Owned` usage.
- Eliminate `Ast.RawCode`.
- Prepare to remove `IdMap` from yjsModel.
2024-01-24 19:22:05 +00:00
Kaz Wesley
19d0707334
Preparing for AST-based synchronization (#8625)
Further AST integration and API refinement before introducing the new synchronization mechanism.

closes #8609

# Important Notes
API changes:
- Renamed `Ast.parseExpression` / `Ast.parse` to better reflect their usage:
- `Ast.parse` returns a block or a single expression, depending on its input; this is convenient for expressions expected to be single-line.
- `Ast.parseBlock` always treats its input as a block; this is suitable for parsing a file.
- `astExtended` is no longer needed to access span information. `Ast.span` provides access to the value when appropriate (the project's committed modules have spans; uncommitted changes or other parsed expressions don't).
- `SourceRange` is now used everywhere in place of `ContentRange`--the two types had the same definition.

Features:
- Fix CodeEditor viewing.

Implementation improvements:
- Updated widget update handlers (#8545) implementation to Ast API.
- Integrated `imports` more thoroughly with new AST APIs.
- More tests.
2024-01-02 15:18:11 +00:00
Kaz Wesley
277dfb1991
Ast edits (#8576)
- The module is edited by changing the AST, not the text representation.
- `IdMap`s no longer need to be maintained in parallel with the module content; they are snapshots produced as needed from the ASTs.
- Simplistic synchronization is in place until #8237: Edits are never merged; if two edits are started from the same state, one will be overwritten.
2023-12-19 17:58:11 +00:00
somebody1234
cbf7248370
Fixes for Language Server sync server (#8514)
- Closes #8398

# Important Notes
- The original error caused by a failing `text/openFile` (`openTextFile`) is still present, but (seemingly?) harder to repro now
2023-12-19 05:41:14 +00:00
somebody1234
c60bf6e892
Fallback to default visualization based on type, when no viz has been explicitly set (#8389)
- Closes #8386
- Attempts to execute `<expr>.default_visualization` to query the engine for the *correct* fallback type
- If that is not possible, falls back to checking `inputType` - first for an exact match, then falling back to `Any` (i.e. the text/JSON visualization)
- Does not decide fallback based on the shape of the returned JSON

# Important Notes
Contains pretty significant refactors of `VisualizationMetadata` to allow it to be unset.
2023-12-01 12:41:24 +00:00
Ilya Bogdanov
8516ed5cbb
Imports in CB (#8315)
Closes #8066


https://github.com/enso-org/enso/assets/6566674/ecd3d032-286b-4bfa-8dc6-96e178f595f3
2023-11-24 14:22:26 +00:00
Adam Obuchowicz
fbe4221c46
Edges from alias analysis (#8316)
Fixes #8252

As we use proper alias analysis, we no longer display connections to overshadowed identifiers.

![Screenshot from 2023-11-16 15-50-27](https://github.com/enso-org/enso/assets/3919101/691aac6c-1951-4988-a338-4449c0413ef7)

# Important Notes
I've changed the meaning of edge's "source" - now it's expression ID of the constituted identifier, not the node ID. This will allow proper handling nodes like `[x, y] = Main.get_point` once the engine will support them.
2023-11-23 10:54:35 +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
Michał Wawrzyniec Urbańczyk
2c04b1424e
Alias Analysis for the New GUI (#8189) 2023-11-08 02:44:22 +01: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
Kaz Wesley
487241317b
Synchronize execution mode (#8157)
Implements #8073.
2023-10-30 15:08:08 +00:00
somebody1234
f2651d58e4
[gui2] Component demos (#7945)
- Closes #7916

# Important Notes
None
2023-10-29 19:02:07 +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
Michael Mauderer
10a95e43d6
Add functionality to handle Expression Updates to GUI2 (#7982)
Implements #7783. Adds functionality to handle and store expression updates, as well as show the output type of node.



https://github.com/enso-org/enso/assets/1428930/31ffff78-ff2c-4e0b-bcde-ddc507cc0226
2023-10-09 05:55:12 +00:00
somebody1234
44f2f425c0
[gui2] Language Server binary protocol, and loading of visualization data (#7873)
- Depends on #7773.

- Implements binary WebSocket protocol (data protocol)
- Performs some editor initialization (the bare minimum so that visualizations work)
- Adds event handlers to receive visualization data updates

# Important Notes
None
2023-10-07 20:57:47 +00:00
Michał Wawrzyniec Urbańczyk
2d39e644b8
New GUI/IDE build script support (#7832)
This PR adds support for the new Vue-based GUI (aka `gui2`).

The user-facing changes are primarily:
* support for `./run gui2` and `./run ide2` commands (that build just the new GUI and the whole IDE package with new GUI embedded — respectively);
* the top-level `test` and `lint` commands will now invoke the relevant commands on the new GUI

---------

Co-authored-by: Paweł Grabarz <frizi09@gmail.com>
2023-10-03 20:07:20 +02:00
Paweł Grabarz
af050f522b
[GUI2] Module contents editing and synchronization (#7938)
Added bidirectional synchronization of module edits with language server. All document edits made by any of the Yjs peers are sent to language server to apply to the file. Any local file changes cause reload, which is synchronized back to Yjs by finding a diff.
2023-10-02 12:01:03 +00:00
somebody1234
b59e7c088e
[gui2] Shortcut manager + shortcuts for selecting nodes (#7893)
- Closes #7874
- Chosen solution: Use the dashboard's shortcut manager to register keybinds and match mouse shortcuts
- Switch existing shortcuts to shortcut manager as well
- Switch visualizations to use the shortcut manager too
- Closes #7865
- Implements all shortcuts for node selection, *except* the arrow key shortcut
- Adds circle cursor selection brush
- The fade out from inactivity (which is present in the Rust source code) is currently missing

Other changes:
- Change everything to use `pointerdown` as appropriate, to ensure the event handlers are called in the right order

# Important Notes
The arrow key shortcut to navigate to the nearest node in that direction *has not* been implemented.
This may need discussion on how it should work

The implementation in general is pretty inefficient - this is intentional, performance can be optimized in the future
2023-10-02 09:03:47 +00:00
somebody1234
0a70f2edf5
Vue visualizations (#7773)
- Closes #7733
- Add infrastructure for defining custom visualizations
- Add all visualizations

# Important Notes
⚠️ Changes made:
- "Fit all" has been changed to always animate - this is because behavior was previously inconsistent:
- the scatterplot would always animate on "Fit all", but
- the histogram would never animate on "Fit all"
2023-09-26 08:14:56 +00:00
Paweł Grabarz
42a7cb2d23
[Gui2] Opening projects and language server connection (#7813)
# Important Notes
- Binary LS endpoint is not yet handled.
- The parsing of provided source is not entirely correct, as each line (including imports) is treated as node. The usage of actual enso AST for nodes is not yet implemented.
- Modifications to the graph state are not yet synchronized back to the language server.
2023-09-22 03:43:25 +00:00