Skip to content

Commit

Permalink
Merge branch 'dev' into rayat-amperity/issue610
Browse files Browse the repository at this point in the history
  • Loading branch information
riotrah committed Apr 7, 2022
2 parents 6c5a74a + d13bc3e commit 308d3e7
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 159 deletions.
18 changes: 9 additions & 9 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
"label": "Calva Watch CLJS",
"type": "npm",
"script": "watch",
"script": "watch-cljs",
"isBackground": true,
"group": {
"kind": "build",
Expand All @@ -48,7 +48,7 @@
}
},
{
"label": "Calva Test Watch",
"label": "Calva Watch Test TS",
"type": "npm",
"script": "unit-test-watch",
"isBackground": true,
Expand Down Expand Up @@ -81,7 +81,7 @@
}
},
{
"label": "Calva Lint Watch",
"label": "Calva Watch Lint",
"type": "npm",
"script": "eslint-watch",
"isBackground": true,
Expand All @@ -96,7 +96,7 @@
}
},
{
"label": "Calva Prettier Format Watch",
"label": "Calva Watch TS Format",
"type": "npm",
"script": "prettier-format-watch",
"isBackground": true,
Expand All @@ -109,17 +109,17 @@
}
},
{
"label": "Calva Watch",
"label": "Calva Watchers",
"group": {
"kind": "build",
"isDefault": false
},
"dependsOn": [
"Calva Prettier Format Watch",
"Calva Watch TS Format",
"Calva Watch TS",
"Calva Watch CLJS",
"Calva Test Watch",
"Calva Lint Watch"
"Calva Watch Test TS",
"Calva Watch Lint"
]
},
{
Expand All @@ -129,7 +129,7 @@
"isDefault": true
},
"dependsOrder": "sequence",
"dependsOn": ["Calva Compile", "Calva Watch"]
"dependsOn": ["Calva Compile", "Calva Watchers"]
}
]
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
Changes to Calva.

## [Unreleased]

## [2.0.263] - 2022-04-06
- [Improve kondo configuration documentation](https://github.com/BetterThanTomorrow/calva/issues/1282)
- [Require VS Code 1.66+ (and update project node version to 16+)](https://github.com/BetterThanTomorrow/calva/issues/1638#issuecomment-1086726236)
- Maintenance: [Upgrade TS + some ts eslint plugins + fix any necessary changes thereof](https://github.com/BetterThanTomorrow/calva/issues/1639)
- Fix: [Command not working: sync the Output/REPL window namespace with the current file](https://github.com/BetterThanTomorrow/calva/issues/1503)


## [2.0.262] - 2022-04-02
- Tech debt mortgage: [Cleanup/removal of EditableDocument.selectionLeft/Right APIs](https://github.com/BetterThanTomorrow/calva/issues/1607)]
Expand Down
3 changes: 1 addition & 2 deletions docs/site/formatting.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ Not a fan of some default setting? The formatter is quite configurable.

You configure Calva's formatting using [cljfmt's configuration EDN](https://github.com/weavejester/cljfmt#configuration). This means that you can adjust the above mentioned defaults, including the indenting.

This configuration can either be provided via a file or via clojure-lsp (see [Clojure LSP Settings]
(https://clojure-lsp.io/settings/)).
This configuration can either be provided via a file or via clojure-lsp (see [Clojure LSP Settings](https://clojure-lsp.io/settings/)).

??? Note "Only use the clojure-lsp config option if you need it"
The option to read formatting config from clojure-lsp is there to let teams where some members use clojure-lsp for formatting, share the config. To provide the settings via clojure-lsp, set `calva.fmt.configPath` to `CLOJURE-LSP` (case sensitive). However, there are limitations:
Expand Down
86 changes: 43 additions & 43 deletions docs/site/parinfer.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,57 @@
---
title: Parinfer
description: Learn how to leverage Calva Parinfer Mode for structural editing
description: Use Calva v2.0.227 to test the experimental and reverted Parinfer Mode for structural editing
---

# Calva Parinfer Mode
# Calva Parinfer Mode is Reverted

!!! Note "Reverted in Calva v2.0.228"
The changes in v2.0.227 seemed to cause problems for some users. Unclear yet if and why. But to not risk causing problems for more users these changes where reverted and Calva v2.0.228 does not contain them. **Please consider using v2.0.227 and help find what the problems are about!**
!!! Failure "Reverted in Calva v2.0.228"
The changes in v2.0.227 seemed to cause problems for some users. Unclear yet if and why. But to not risk causing problems for more users these changes where reverted and Calva v2.0.228 does not contain them. **Please consider using v2.0.227 and help find what the problems are about!** Please note: Even in v2.0.227 this feature is currently disabled by default.

[Parinfer](https://shaunlebron.github.io/parinfer/) is a system for editing the structure of LISP text without explicit commands. The structure can be regarded as already being expressed through indentation. With Parinfer you can use your intuition about the structure _inferred_ from the indentation to perform surprisingly many structural edits.

!!! Note "Experimental"
This feature is currently disabled by default and should be considered experimental. There are known [quirks](#quirks). Especially beginners should take note. Parinfer is not as beginner friendly as it might seem, and with the quirks it might be extra ”dangerous”.
## Quirks

There are some known quirks, of varying severity, with this feature. Some of them will need to be fixed before we move this feature out of **Experimental** status.

For the most times you can always *Undo* to get back to where the document was fine. You just need to pay some attention and be aware when undo is needed.

### No multi-cursor support

The bracket inference will remove all cursors but the first one. So for instance if you edit with multiple cursors and it causes brackets to move, you'll end up with just one cursor and the subsequent edits will not be what you intended. This is particularly important to note when you have cursors that are not in the viewport. In such cases it might be better to turn Parinfer off while you do the edits, fix formatting and such manually and then switch Parinfer on again.

### Wrong inferences

For yet unknown reasons an edit such as the following does the wrong thing (the cursor indicated by the vertical bar):

```clojure
(foo| (bar)
(baz))
```

<kbd>backspace</kbd> =>

```clojure
(fo| (bar
(baz)))
```

That is `(baz)` is slurped. When what should happen is:

```clojure
(fo| (bar)
(baz))
```

### Lag causing errors when fast typing

The way that Calva Parinfer works is that for any edit of the document it first reformats the code around the cursor, then infer brackets. Currently these two steps are not atomic to VS Code, so if you type fast bracket inference might happen on the yet unformatted code, and thus not be correct. You might also see the cursor end up at the wrong position at times.

## Infer Parens

!!! Mote "This is no longer available in Calva"
See above about how to try this build anyway, warts and all.

When you enable Calva's Parinfer it is all about infering brackets from indentation. There are no further Parinfer modes. Calva's auto-formatter will take care of keeping the code correctly indented.

Enable it with from this setting: `calva.fmt.experimental.inferParensAsYouType` or from the status bar item.
Expand Down Expand Up @@ -74,43 +111,6 @@ In Calva, Parinfer and [Paredit](paredit.md) are designed to coexist and both be

If you want to have Parinfer you are probably best served by Calva's built-in version. It is designed, and will continue to be improved to function well together with Calva's other structural editing and formatting features. _It will also probably conflict with the Parinfer Extension._

## Quirks

There are some known quirks, of varying severity, with this feature. Some of them will need to be fixed before we move this feature out of **Experimental** status.

For the most times you can always *Undo* to get back to where the document was fine. You just need to pay some attention and be aware when undo is needed.

### No multi-cursor support

The bracket inference will remove all cursors but the first one. So for instance if you edit with multiple cursors and it causes brackets to move, you'll end up with just one cursor and the subsequent edits will not be what you intended. This is particularly important to note when you have cursors that are not in the viewport. In such cases it might be better to turn Parinfer off while you do the edits, fix formatting and such manually and then switch Parinfer on again.

### Wrong inferences

For yet unknown reasons an edit such as the following does the wrong thing (the cursor indicated by the vertical bar):

```clojure
(foo| (bar)
(baz))
```

<kbd>backspace</kbd> =>

```clojure
(fo| (bar
(baz)))
```

That is `(baz)` is slurped. When what should happen is:

```clojure
(fo| (bar)
(baz))
```

### Lag causing errors when fast typing

The way that Calva Parinfer works is that for any edit of the document it first reformats the code around the cursor, then infer brackets. Currently these two steps are not atomic to VS Code, so if you type fast bracket inference might happen on the yet unformatted code, and thus not be correct. You might also see the cursor end up at the wrong position at times.

## See also

* [Paredit](paredit.md)
Expand Down
Loading

0 comments on commit 308d3e7

Please sign in to comment.