Skip to content
This repository has been archived by the owner on Sep 22, 2020. It is now read-only.

Commit

Permalink
Update w/ old repl window replaced by new one
Browse files Browse the repository at this point in the history
  • Loading branch information
PEZ committed Aug 9, 2020
1 parent 317c63d commit 6386857
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 40 deletions.
14 changes: 7 additions & 7 deletions docs/commands-top10.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ There are not all that many Calva commands, you can learn them all. But there ar
* **Evaluate current top-level form**: `alt+ctrl+c space`: inline evaluate the current top-level form. This also works inside `(comment)` forms. Use it to (re)define vars and then inside comment forms you can verify that they do what you want them to do.
* **Dismiss the display of results**: `escape`: (VIM Extension users should read [Using Calva with the VIM Extension](vim.md)).

The evaluation commands often have an equivalent for when you want to use the REPL window for further exploration. (Basically you add the `ctrl+alt` modifier to the second chord in the shortcuts):
There are also two commands for bringing over the current form and the current top level form over to the repl window:

* `alt+ctrl+c ctrl+alt+e`: to evaluate the current form in the REPL window.
* `alt+ctrl+c ctrl+alt+space`: to evaluate the current top-level form in this window
* **Load current namespace in the REPL window** `alt+ctrl+c ctrl+alt+n`
* `alt+ctrl+c ctrl+alt+e`: to paste the current form in the REPL window.
* `alt+ctrl+c ctrl+alt+space`: to paste the current top-level form in this window

You can also switch the name space of the output/repl window to that of the current file: `alt+ctrl+c alt+n`

* **Toggle pretty printing** of results on and off: `ctrl+alt+c p`. It's on by default. There is a status bar button showing the status and that also can be used to toggle the setting.

Expand All @@ -22,9 +23,8 @@ The evaluation commands often have an equivalent for when you want to use the RE
- Evaluate code and add as comment: `ctrl+alt+c c` (current form), `ctrl+alt+c ctrl space` (current _top level_ form)
- Evaluate code and replace it in the editor, inline: `ctrl+alt+c r`
- Integrated REPLs
- Load current namespace in the REPL window: `ctrl+alt+c ctrl+alt+n`
- Evaluate current editor form in the REPL window: `ctrl+alt+c ctrl+alt+e` (`ctrl+alt+c ctrl+alt+v` on Windows)
- Evaluate current editor top level form in the REPL window: `ctrl+alt+c ctrl+space`
- Send current editor form to the REPL window: `ctrl+alt+c ctrl+alt+e` (`ctrl+alt+c ctrl+alt+v` on Windows)
- Send current editor *top level* form to the REPL window: `ctrl+alt+c ctrl+space`
- Running tests and mark failures and errors in the Problems pane
- Run namespace tests: `ctrl+alt+c t`
- Run all tests: `ctrl+alt+c shift+t`
Expand Down
2 changes: 1 addition & 1 deletion docs/custom-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The `calva.customREPLCommandSnippets` is an object/dictionary with the following
* `name`: The name of the snippet as it will appear in the picker menu
* `snippet`: The code that will be evaluated
* `ns`: (optional) Namespace to evaluate the command in. If omitted the command will be executed in the namespace of the current editor.
* `replType`: Which REPL window to use for the evaluation. Either `"clj"` or `"cljs"`
* `repl`: Which repl session to use for the evaluation. Either `"clj"` or `"cljs"`

E.g. with these settings:

Expand Down
21 changes: 0 additions & 21 deletions docs/customizing.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,6 @@ See [Formatting] for information on how to configure this.

Jack-in and Connect are very customizable through [Custom Connect Sequences](connect-sequences.md).

## The REPL Window

If you don't want the REPL window to open automatically on jack-in/connect, set `calva.openREPLWindowOnConnect` to `false`. Please note, that if the [Connect Sequence](connect-sequences.md) you are using has `afterCLJReplJackInCode`, then the CLJ REPL window will open anyway in order to evaluate that code for you in a visible way.

### Default Key Bindings

The REPL Window prompt is a multi line editor, and the keyboard shortcuts facilitate this by default. The shortcuts can be configured however you like, and there are two preconfigured maps for it as well. You set this via the `calva.REPLWindowPromptKeyMap` setting:

| Prompt command | multi-line | single-line
| -------------- | ---------- | -----------
| **Submit** | <kbd>alt+enter</kbd> | <kbd>enter</kbd>
| **New line** | <kbd>enter</kbd> | <kbd>alt+enter</kbd>
| **Cursor Up** | <kbd>up</kbd> | <kbd>alt+up</kbd>
| **Cursor Down** | <kbd>down</kbd> | <kbd>alt+down</kbd>
| **History Up** | <kbd>alt+up</kbd> | <kbd>up</kbd>
| **History Down** | <kbd>alt+down</kbd> | <kbd>down</kbd>

As you might see, the simple pattern here is that in multi-line mode you move the cursor and enter new lines as in the regular editor, and use `alt` modifier to navigate the history and submit evaluations. In single-line mode it is the other way around.



## Key bindings

Here are a collection of custom keybindings from here and there.
Expand Down
2 changes: 1 addition & 1 deletion docs/debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Adding `#dbg` before a form then evaluating the form with `ctrl+alt+c space` wil

### Evaluating Code in the Paused Context

When execution is paused at a breakpoint, you can evaluate code in that context. This can be done in the editor or in the REPL window, as usual. In the REPL window, the prompt changes to `<<debug-mode>>=>` to show that evaluations will occur in the debug context.
When execution is paused at a breakpoint, you can evaluate code in that context. This can be done in the editor or in the REPL window, as usual.

![Evaluating code in the paused context from the editor](images/debugger/eval-editor.gif "Evaluating code in the paused context from the editor")

Expand Down
9 changes: 1 addition & 8 deletions docs/eval-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,4 @@ This works regardless if you have evaluated in a file editor or in a REPL window

## Evaluating in a REPL window

To evaluate code in the REPL window either send a form from the editor (as mentioned above) or type it at the prompt and submit it. There is also a repl history that you can access with `alt+up/down`.

Note that the repl prompt is a _multiline_ mini Clojure editor. So if you press `enter` while the cursor is not at the end of the line, it will create a new line. To submit the code at the prompt you have three options:

1. Place the cursor at the end of the all the code, `end` (`fn+right` on Macs lacking an `end` key).
2. Press `alt+enter`. This submits and prints the results un-altered.

See also above about sending forms from the file editors to the REPL window for evaluation.
Since the REPL Window is mostly just a regular file, things work pretty similar at the REPL prompt. You use `alt+enter` to evaluate. Selecting the current form (default key binding `ctrl+w` after evaluating will select the result.
3 changes: 3 additions & 0 deletions docs/output.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# The Output/REPL Window/File

!!! Note
As of version **v2.0.109** the old REPL Window was replaced by the new one described below. Read [this article on ClojureVerse](https://clojureverse.org/t/calva-summer-of-bugs-2020/) for some of the rationale behind the change.

When Calva evaluates Clojure/ClojureScript code, the results are displayed inline as well as printed to the results output window/file. This file is created and opened when Calva is connected to a REPL.

In ClojureScript projects the window will be associated with the `cljs` REPL once this one is connected. It will then look something like so:
Expand Down
2 changes: 0 additions & 2 deletions docs/paredit.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,4 @@ Care has been put in to making the default keybindings somewhat logical, easy to

Note: You can choose to disable all default key bindings by configuring `calva.paredit.defaultKeyMap` to `none`. (Then you probably also want to register your own shortcuts for the commands you often use.)

If you add your own key bindings, please be aware that [shortcuts with typable characters will work badly in the the REPL window](https://github.com/microsoft/vscode/issues/85879). Please avoid.

Happy Editing! ❤️

0 comments on commit 6386857

Please sign in to comment.