Commit graph

185 commits

Author SHA1 Message Date
Jonatan Kłosko 6615422613
Restructure frame output (#857)
* Restructure frame output

* Reboot JSComponent when ref changes

* Prune outputs from LV, handle frame and stdout updates via component messaging

* Keep ANSI modifiers as keyword list

* Don't re-render pruned outputs

* Improve empty frame styling

* Use more specific id

* Add clarification on trailing CR

* Handle output group borders with CSS

* Keep only relevant outputs in memory

* Adjust borders

* Update lib/livebook/live_markdown/import.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Apply review comments

Co-authored-by: José Valim <jose.valim@dashbit.co>
2022-01-16 20:37:00 +01:00
Jonatan Kłosko 67952b07be
Fix unique task test race condition (#863) 2022-01-13 12:47:24 +01:00
Milo Lee 8ba0857369
Show deprecated and since doc metadata on mouse over (#852)
* Show deprecated and since doc metadata on mouse over

* Make deprecated indication stronger

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2022-01-11 19:18:47 +01:00
Jonatan Kłosko 118cf05d0a
Introduce broadcast communication from runtime (#845)
* Introduce broadcast communication from runtime

* Return broadcast target from group leader

* Increase timeout

* Make the channel test async

* Decouple base topic and ref
2022-01-10 18:38:08 +01:00
Daniel Kukula 618593158d
Set page name when notebook is renamed (#844)
* override tab name when notebook is renamed

* set page_title in after operation function

* add custom page title to all live pages

* Revert "override tab name when notebook is renamed"

This reverts commit 90303e08a8.

* add test for update
2022-01-06 18:37:55 +01:00
Jonatan Kłosko 19baf013d5
Introduce a dedicated channel for JS widget communication (#843)
* Introduce a dedicated channel for JS widget communication

* Handle payload serialization errors

* Tie channel lifetime to the session

* Catch serialization errors instead of encoding twice

* Merge JS static and dynamic outputs

* Authenticate socket connection from session

* Update JS output format

* Remove unused helper

* Apply review comments
2022-01-06 16:31:26 +01:00
Jonatan Kłosko 6d82e9e53d
Remove output border from dynamic JS widgets (#842)
* Remove output border from dynamic JS widgets

* Show borders on regular text outputs only

* Increase assertion timeout
2022-01-04 13:28:31 +01:00
Jonatan Kłosko 8622ae2ec3
Add support for exporting JS output (#826) 2021-12-27 13:56:55 +01:00
Jonatan Kłosko 844242ba80
Add support for JS output widgets (#818)
* Add support for JS output widgets

* Don't block session when fetching assets and batch calls

* Improve path component sanitisation

* Move fetching check to session caller

* Attach origin to connect and event messages
2021-12-24 14:18:34 +01:00
Jonatan Kłosko 87a17f1fc5 Respect \r in individual stdout results 2021-12-22 15:48:35 +01:00
José Valim 4badf40afc Add TODOs 2021-12-17 23:24:17 +01:00
Jonatan Kłosko 877ab913c8
Display full module name in hover docs (#798)
* Display full module name in hover docs

* Use inspect

* Return atom names from identifier matcher
2021-12-12 21:34:16 +01:00
Max Veytsman 4aa5447e9d
Add completion for struct keys (#793)
* Add completion for struct keys

Largely ported from `IEx.Autocomplete`.

* Add test for __exception__ field in struct

* Fix exception test

* Fix exceptions assetion

* Create `:in_struct_field` identifier

Along with a refactor

* Fix typespecs for `:map_field`

* Address feedback

* Update lib/livebook/intellisense/identifier_matcher.ex

Co-authored-by: José Valim <jose.valim@gmail.com>

* Use markdown snippet for both docs

* Fix tests

Co-authored-by: José Valim <jose.valim@gmail.com>
2021-12-12 21:19:17 +01:00
Jonatan Kłosko 6f53e3db6a
Add support for form control (#790)
* Add support for form control

* Handle report_changes map

* Assert on input/control events
2021-12-12 00:09:35 +01:00
José Valim 67e73b6f89 Remove autocompletion to deprecated operator 2021-12-10 23:39:30 +01:00
Stephen Ball 8c4ef89685
Update the vim modeline comment to not error (#774)
The currently suggested vim modeline formatting string to allow .livemd
files to render as markdown on GitHub works, but confuses vim itself.

```
<!-- vim: syntax=markdown -->
```

When opening a .livemd file with the suggested modeline in vim it errors
when it tries to parse `-->` as a modeline option.

e.g.

```
"2021/day2.livemd" 81L, 1616B
Error detected while processing modelines:
line    1:
E518: Unknown option: -->
```

The fix is to replace the suggested vim modeline

```
<!-- vim: syntax=markdown -->
```

With a modeline declaration format that indicates when the modeline
options are complete, allowing vim to ignore the rest of the line.

```
<!-- vim: set syntax=markdown: -->
```

Reference
- vim issue: https://github.com/vim/vim/issues/1648
- especially this comment: https://github.com/vim/vim/issues/1648#issuecomment-296386153

Fixes #773
2021-12-08 16:15:07 +01:00
Jonatan Kłosko 89ea67861f
Improve "changed" indicator and batch evaluation shortcuts (#766)
* Make cell status italic when content changed

* Add Ctrl+Shift+Enter for evaluating all cells

* Improve the behaviour of evaluating all cells

* Fix typo
2021-12-07 19:14:32 +01:00
Jonatan Kłosko b97cde0879
Improve completion (#756)
* Don't show variable value in intellisense

* Don't complete quoted atoms
2021-12-05 16:49:51 +01:00
Jonatan Kłosko d909272746
Improve completion (#747)
* Add keywords to completion

* Fix signature request caching for call without parentheses

* Don't insert parentheses for def* macros

* Don't trigger missing runtime message when auto completion is enabled

* Don't insert parentheses for keyword macros

* Improve completion of env macros

* Apply review comments

* Update locals without parentheses

* Apply suggestions from code review

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Format

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-12-05 14:58:30 +01:00
Jonatan Kłosko 4b5ea87b3d
Include notebook name in the autosaved notebook path (#748)
* Include notebook name in the autosaved notebook path

* Add test for persisting unsaved notebooks
2021-12-05 14:58:19 +01:00
Jonatan Kłosko ab0a237ab6
Completion adjustments (#740)
* Show exceptions at the end of completion list

* Don't complete hidden functions
2021-12-03 23:28:34 +01:00
Jonatan Kłosko e2490c0f7f
Implement signature intellisense (#640)
* Remove Code.Fragment backport

* Fix tests compatibility with Elixir 1.13

* Implement signature intellisense

* Don't show signatures on module attributes

* Add tests for calls with do-end block

* Unify spec formatting

* Insert parentheses when completing a function call

* Send all text until cursor in signature request

* Add configuration for completion/signature popups (#693)

* Add editor settings form

* Add configuration for intellisense defaults

* Read fresh settings when editor mounts

* Scope attribute names

* Fix disabled button styling

* Simplify signature box and enable by default

* Split settings into system and user sections

* Update lib/livebook_web/live/settings_live.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Update lib/livebook_web/live/settings_live.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Fix spacing in documentation tests

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-12-03 21:57:21 +01:00
Jonatan Kłosko 47d29cb389
Require Elixir 1.13 (#737)
* Bump required Elixir version to 1.13 and fix TODOs

* Fix tests

* Remove the deprecated URI.parse/1

* Bump Docker base image

* Bump Elixir on CI
2021-12-03 21:47:20 +01:00
Jonatan Kłosko ac6b423e79
Fix frame rendering (#735)
* Fix frame rendering

* Add test for the dynamic frame
2021-12-03 18:59:08 +01:00
Jonatan Kłosko 264d6c3ff2
Add support for controls output type (#710)
* Add support for controls output type

* Split controls into individual widgets

* Adjust ids

* Improve widget and controls garbage collection

* Allow arbitrary functions as object release hook

* Add type to button and input events

* Add keyboard status event

* Change release hooks into monitor messages

* Rename pointer to reference and return an error on bad monitor
2021-12-02 16:45:00 +01:00
Jonatan Kłosko c2636b8220
Migrate inputs to Kino (#714)
* Migrate inputs to Kino

* Update lib/livebook/session/data.ex

Co-authored-by: José Valim <jose.valim@dashbit.co>

* Try parsing numbers as integers

* Garbage collect input values

* Adjust tests

* Remove unused variable

* Fix frame rendering

* Wrap inputs in border depending on its type

* Add textarea

* Reorder

* Update tests

Co-authored-by: José Valim <jose.valim@dashbit.co>
2021-11-25 18:43:42 +01:00
Jonatan Kłosko f64dd0ea90
Restructure j/k navigation to support headlines (#707)
* Accessibility fixes

* Restructure j/k navigation to support headlines

* Focus modal content when open

* Further focus adjustments

* Fix tests

* Remove unused functions
2021-11-16 21:57:10 +01:00
Jonatan Kłosko 4d92aeba2e
Support file scheme when importing from URL (#706)
* Add test

* Support file scheme when importing from URL
2021-11-12 15:49:22 +01:00
Jonatan Kłosko e72a606dd2
Warn on invalid sequence of notebook comments (#687) 2021-11-08 13:14:55 +01:00
Jonatan Kłosko 982a345ddc
Improve notebook file locking to work across nodes (#675)
* Improve notebook file locking to work across nodes

* Add node check for local file system opreations

* Replace node with host id

* Refactor process down cleanup

* Scope local file system with node

* local? -> type
2021-11-05 00:29:04 +01:00
Jonatan Kłosko 5e5bc2597a
Document how to render notebooks on GitHub (#677)
* Document how to render notebooks on GitHub

* Keep any comments before the notebook title heading
2021-11-04 18:50:53 +01:00
Cocoa a15ec1ca1d
Save static vegalite plot to livemd (#676)
* save static vegalite plot to livemd

* cleanup debug code

* using `vega-lite` as the type in the fenced code block

* wrap the text output in `{:text, output}` in take_outputs/2

* ignore :vega_lite_static when it is empty

* add import and export tests

* using `spec`

* format code

* keep the test focused

* improve tests for not including outputs

* always dump vage_lite spec

* Apply suggestions from code review

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-11-04 12:17:03 +01:00
Jonatan Kłosko 021d6ac42e
Improve icon buttons accessibility and navigation (#667)
* Rename tooltip source attribute

* Add aria-label to icon buttons/links

* Actually focus cell content when navigating around

* Add some descriptions

* Fix dynamically computed tooltips
2021-11-01 18:20:56 +01:00
Jonatan Kłosko 2694007c0e
Compute cell snapshots when an existing notebook is given (#666) 2021-11-01 13:59:04 +01:00
Jonatan Kłosko dbccadfdcf
Redesign save to file modal (#663)
* Redesign save to file

* Always show Save when a file is present

* Fix indentation
2021-10-30 12:02:26 +02:00
Jonatan Kłosko ac1a4a5ffb Add action for clearing evaluation and outputs (#661)
* Move notebook export menu item

* Add action for clearing evaluation and outputs

* Test data operation

* Update wording

* Update wording

* Reorder menu items
2021-10-29 16:34:44 +02:00
Jonatan Kłosko 4493a60380
Improve runtimes UI (#655)
* Show reconnect for all runtime types when applicable

* Make it clear which runtime is the default

* Show Mix.install restart suggestion only for standalone runtimes

* Fix tests not to rely on the default runtime tab
2021-10-28 19:41:07 +02:00
Jonatan Kłosko 394c6daef1
Improve validity check when input changes during evaluation (#651) 2021-10-27 15:36:50 +02:00
Jonatan Kłosko c1a6bc1aa8
Remove reactive inputs (#649) 2021-10-27 13:35:24 +02:00
gpopides 5c0267b547
Added automatic cell evaluation (#637)
* Added automatic evaluation

* apply review changes

* persist reevaluate_automatically and update test

* test for automatic reevaluation

* formatting

* Add import test

* Always show if a cell automatically reevaluates and link to settings

* Evaluate automatically reevaluating cells after queuing

* Always show evaluate button when cell is fresh

* Update icon

* Add test ensuring that fresh cells don't evaluate automatically

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-10-26 20:38:30 +02:00
Jonatan Kłosko 9da44fd541
Fix root directory listing on S3 when empty (#646) 2021-10-26 15:39:24 +02:00
Matheus Cumpian c6d7c81ee9
New import info flash (#630)
* adding a new info flash on imported notebooks

* changing the imported notebook error flashes to warning level

* Update lib/livebook_web/live/session_helpers.ex

Co-authored-by: José Valim <jose.valim@gmail.com>

* adding unit tests for the flash messages and fixing put_import_flash/1 call location

* changing name of put_import_flash_messages/2 to put_import_warnings

* Update lib/livebook_web/live/home_live.ex

* formating code

Co-authored-by: José Valim <jose.valim@gmail.com>
Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-10-21 23:21:54 +02:00
Jonatan Kłosko 3ae67ede33
Add support for importing notebook from URL query parameter (#598)
* Add support for importing notebook from URL query

* Update desc

* Update URL and redirect to import form on error

* Update tests

* Remove URL scope
2021-10-16 12:23:08 +02:00
Jonatan Kłosko 5dea204fc9
Fix intermittent test failures (#596)
* Bump Elixir on the CI

* Start permanent node manager in tests

* Adjust timeouts

* Make sure random node cookies are alphanumeric
2021-10-13 22:25:33 +02:00
gpopides d2cdf0a2cb
Display creation date of a session in home (#593)
* add created_at to Session struct

* test + doc enhcncement

* change format creation date function name

* use helper function to format created_at

* use mix format

* apply review suggested  changes and 2 more tests

* Store creation time in session state and sort by date by default

Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
2021-10-10 12:29:45 +02:00
Jonatan Kłosko 25d90eabf1
Add public function for converting .livemd to .exs (#573) 2021-10-05 00:26:41 +02:00
Jonatan Kłosko a57927ec2a
Extend ANSI code parser to handle multiple arguments (#569)
* Extend ANSI code parser to handle multiple arguments

* Update changelog
2021-09-30 17:57:14 +02:00
Jonatan Kłosko fad9301ad4
Fix branching section evaluation when the parent section is empty (#560)
* Fix branching section evaluation when the parent section is empty

* Update changelog
2021-09-23 13:20:49 +02:00
Jonatan Kłosko 4ff1ff0d5a
Use Phoenix.Tracker to keep track of sessions within the cluster (#540)
* Use Phoenix.Tracker to keep track of sessions within the cluster

* Apply review comments

* Cleanup topics and updates

* Update lib/livebook_web/live/session_live.ex
2021-09-04 19:16:01 +02:00
Jonatan Kłosko cfb719cbb0 Fix dialyzer warnings 2021-08-31 22:19:52 +02:00