summaryrefslogtreecommitdiff
path: root/cli/repl.rs
AgeCommit message (Collapse)Author
2020-11-19refactor(cli): move tooling to cli/tools/ (#8424)Bartek Iwańczuk
This commit moves following tools into a single "tools" module located at "cli/tools/mod.rs": - formatter - linter - test runner - coverage collector - installer - binary upgrader - repl
2020-11-09refactor(cli): remove unnecessary format! calls (#8315)KNnut
2020-11-05fix(cli/repl): Fixing syntax highlighting (#8202)ali ahmed
Fixes #8240
2020-10-28fix(repl): don't hang on unpaired braces (#8151)Kevin (Kun) "Kassimo" Qian
Previously, entering a single ']' would cause repl to forever accepting new lines, due to that `ValidationResult::Invalid` would actually be consumed by the editor itself while continue building the lines. Instead we should mark it as `Valid` and send the bad input for evaluation to get the proper error from V8. Before: ``` > ] (you can keep entering new line here, and it will never consume input until you Ctrl-C) ``` After: ``` > ] Uncaught SyntaxError: Unexpected token ']' > ```
2020-10-19feat(cli/repl): add tab completion (#7827)Casper Beyer
This commit adds tab completion in REPL. Currently it works only for global identifiers and object properties.
2020-10-19fix(cli/repl): ignore pair matching inside literals (#8037)Casper Beyer
2020-10-19fix(cli/repl): unterminated string literal should invalidate (#7896)Casper Beyer
This adds the grave character to the pair matching so that template string literals trigger multi-line edits.
2020-10-19fix(cli/repl): keyboard interrupt should continue (#7960)Casper Beyer
This changes the behavior of keyboard interrupts (ctrl+c) to continue, clearing the current line instead of exiting. Exit can still be done with ctrl+d or by calling close().
2020-10-19fix(cli/repl): write all results to stdout (#7893)Casper Beyer
This writes all evaluaton results to stdout regardless if the result is an error or not. This matches the behavior of other read-eval-print-loops like Node.
2020-10-18refactor(cli/repl): extract is_closing to a function (#8015)Casper Beyer
This extracts is closing into a function so that it can easily be used as the condition for the loop.
2020-10-15Reland feat(cli/console): inspect with colors regardless of Deno.noColor (#7976)Bartek Iwańczuk
2020-10-14refactor(cli/repl): clean up prelude injection (#7967)Casper Beyer
This extracts prelude injection into a helper function and moves the prelude string literal into a top level static string to help trim some of the fat out of the run function.
2020-10-13feat(cli/repl): add regex based syntax highlighter (#7811)Casper Beyer
This commit adds a simple regex replace based highlighter to the REPL editor. It tries to match the color palette of Deno.inspect()
2020-10-13refactor(cli): rename GlobalState to ProgramState (#7914)Bartek Iwańczuk
2020-10-11refactor(cli/repl): get context id from notification (#7864)Casper Beyer
This takes the execution context id from a notification which is sent on Runtime.enable rather than hard-coding it to a magic value.
2020-10-11reland JsRuntime/Worker is not a Future (#7924)Bartek Iwańczuk
2020-10-10Fix 100% CPU idling problem by reverting #7672 (#7911)Ryan Dahl
* Revert "refactor: Worker is not a Future (#7895)" This reverts commit f4357f0ff9d39411f22504fcc20db6bd5dec6ddb. * Revert "refactor(core): JsRuntime is not a Future (#7855)" This reverts commit d8879feb8c832dbb38649551b1cb0730874f7be6. * Revert "fix(core): module execution with top level await (#7672)" This reverts commit c7c767782538243ded64742dca9b34d6af74d62d.
2020-10-09refactor: Worker is not a Future (#7895)Bartek Iwańczuk
This commit rewrites deno::Worker to not implement Future trait. Instead there are two separate methods: - Worker::poll_event_loop() - does single tick of event loop - Worker::run_event_loop() - runs event loop to completion Additionally some cleanup to Worker's field visibility was done.
2020-10-07refactor(cli/inspector): use &str for post_message (#7851)Casper Beyer
This changes the signature of InspectorSession.post_message to take a &str rather than a String avoiding the need call str.to_string at each call site.
2020-10-06refactor(cli/repl): tightly integrate event loop (#7834)Casper Beyer
2020-10-02fix(cli/repl): enable colors on inspected values (#7798)Casper Beyer
2020-10-02feat(cli/repl): enable await and let re-declarations (#7784)Casper Beyer
This enables `replMode` during evaluations which allows for top level await and let re-declarations.
2020-10-02refactor(repl): use an inspector session (#7763)Casper Beyer
This ports the REPL over to Rust and makes use of an inspector session to run a REPL on top of any isolate which lets make full use of rustylines various things like validators and completors without having to introduce a bunch of hard to test internal ops and glue code. An accidental but good side effect of this is that the multiple line input we previously had is now an editable multi-line input prompt that is correctly stored in the history as a single entry.
2020-09-15refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476)Bert Belder
2020-09-06Move JSON ops to deno_core (#7336)Bert Belder
2020-08-26refactor: remove OpError, use ErrBox everywhere (#7187)Bert Belder
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-05-07Remove REPL/Windows hack (#5136)Ryan Dahl
2020-04-03clippy (#4618)Kitson Kelly
2020-02-23refactor: use OpError instead of ErrBox for errors in ops (#4058)Bartek Iwańczuk
To better reflect changes in error types in JS from #3662 this PR changes default error type used in ops from "ErrBox" to "OpError". "OpError" is a type that can be sent over to JSON; it has all information needed to construct error in JavaScript. That made "GetErrorKind" trait useless and so it was removed altogether. To provide compatibility with previous use of "ErrBox" an implementation of "From<ErrBox> for OpError" was added, however, it is an escape hatch and ops implementors should strive to use "OpError" directly.
2020-01-05Rename crates: 'deno' to 'deno_core' and 'deno_cli' to 'deno' (#3600)Ry Dahl
2020-01-02Happy new year! (#3578)Ry Dahl
2019-10-11Ensure DENO_DIR when saving the REPL history (#3106)Nayeem Rahman
2019-08-08Fix repl crash when deno dir doesn't exist (#2727)Daniel Buckmaster
2019-07-31Use system rustfmt instead of fixed binary (#2701)Ryan Dahl
2019-07-11Refactor error to use dynamic dispatch and traitsBert Belder
This is in preperation for dynamic import (#1789), which is more easily implemented when errors are dynamic.
2019-06-19Combine CLI Errors (#2487)Kitson Kelly
2019-06-18Add dyn to be rust nightly compatible (#2538)Kitson Kelly
2019-03-19Rename //src/ to //cli/ (#1962)Ryan Dahl
To better distinguish the deno_core crate from the executable deno, which will now be called "the cli" internally.