This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-30
Channels
- # aleph (2)
- # announcements (8)
- # babashka (12)
- # beginners (34)
- # calva (36)
- # cherry (3)
- # cider (1)
- # clj-kondo (11)
- # clj-otel (6)
- # cljdoc (31)
- # clojure (121)
- # clojure-conj (1)
- # clojure-czech (2)
- # clojure-europe (109)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (3)
- # cursive (3)
- # datahike (1)
- # datomic (9)
- # deps-new (6)
- # docker (5)
- # emacs (21)
- # fulcro (4)
- # hoplon (16)
- # introduce-yourself (2)
- # london-clojurians (5)
- # lsp (87)
- # malli (17)
- # missionary (1)
- # nbb (27)
- # off-topic (257)
- # pathom (4)
- # portal (42)
- # practicalli (1)
- # rdf (3)
- # releases (2)
- # shadow-cljs (49)
- # slack-help (3)
- # timbre (2)
Anyone know how to make deleteWordLeft work in clojure files? It works in .html files for me but in clj files it deletes 1 char
Calva binds alt+backspace
to force delete backwards, so that you can override strict mode when it prevents you from deleting something. You basically have three options:
1. Move force-delete to some other keybinding,
2. Move deleteWordLeft
to some other keybinding.
3. Be content with Calva’s delete form backwards, which is default bound to ctrl+alt+backspace
.
Here are keybindings for option 2:
{
"key": ", backspace",
"command": "deleteWordLeft",
"when": "textInputFocus && !editorReadonly && editorLangId == 'clojure'"
},
{
"key": "alt+backspace",
"command": "-deleteWordLeft",
"when": "textInputFocus && !editorReadonly"
},
{
"command": "default:type",
"key": ", ,",
"args": {
"text": ","
},
"when": "editorTextFocus && editorLangId == clojure"
},
Moving deletWordLeft
to the slightly more inconvenient [Comma] backspace
sequence. Since 3 makes it a bit rarer that we need deleting based on words. Note that there’s also a bindning for typing an actual comma.how about editing inside strings and comments?
What are the consequences of moving Calva's force-delete-backwards somewhere else? I assume you have a great reason for putting it on that specific chord
What is: "so that you can override strict mode when it prevents you from deleting something."
See https://calva.io/paredit/ about strict mode. Most often it is fine, but in some situations it gets in the way. E.g. When there is unbalance, but Calva fails to recognize it.
"strict mode" is a calva concept or a vscode concept?
You can move Calva’s force-delete away without consequences as long as you remember where you move it. 😃
ah ok
Calva adds some contexts you can use in the when
clause for more precision. Like so:
{
"command": "default:type",
"key": ", ,",
"args": {
"text": ","
},
"when": "editorTextFocus && editorLangId == clojure && !calva:cursorInComment && !calva:cursorInString"
},
You can leave Calva’s force delete unbound and use it from the command palette. You can also select the thing you want to delete and then hit backspace.
ok i unmapped force-delete from calva and now alt-backspace works - however now alt-backspace can damage sexpr, is there a way to prevent that?
I dont think i turned strict mode off, so iiuc it should have prevented the damage?
Strict mode only watches single char deletes. You still have it on for that, but if you tell vscode to delete the word to the left, it will do so without consulting Calva about it.
You can always file a feature request about a pareditDeleteWordBackward
command. Shouldn’t be too hard to add.
I am looking for documentation for paredit, am I supposed to be on the emacs docs?
hmm ok, it doesn't define strict mode it just says it exists
i think my question is: I don't have a mental model over the calva architecture and all the modules that are running (paredit, lsp etc) and I'm not sure which products I should be on the third party documentation
googling paredit gets me here, is this the right page to understand how paredit works in calva?
like concept definitions, etc
oh, ok
I’m not aware of any formal definition of it. It goes back to old Symbolics LISP machines and even beyond, I think. Mostly defined by its various implementations. Strict mode loosely means to try help you not mess up the structure. But there’s no definition about how far that help stretches.
In Calva, strict mode is implemented by such that either Calva does the delete or VS Code does it. For Calva to do it, Calva needs to have implemented that deletion. In some cases we haven’t bothered with adding some deletes to strict mode, but rather just highjacked the keyboard shortcuts. Like with ctrl+k
. In other cases there is no equivalent Calva Paredit deletion command, like with deleteWordLeft/Right
.
There are also a setting for Hijacking more or less VS Code default shortcuts. (And no documentation about which shortcuts are affected…)
I dont know enough about vscode to understand this, but thanks
I have a configuration now that i understand
What you need to know about VS Code is that if it is told to delete something it will do so, unconditionally. While if you tell Paredit to do it, it will try to avoid destroying the structure.
> There are also a setting for Hijacking more or less VS Code default shortcuts. (And no documentation about which shortcuts are affected…) > https://github.com/BetterThanTomorrow/calva/issues/2136