Fork me on GitHub
Cora (she/her)04:07:27

is there a way to delete the contents of a line without unbalancing parens?

Cora (she/her)04:07:48

I'm using vim-mode, which probably throws a huge wrench in things

Cora (she/her)04:07:54

but I'm used to other editors where I can just dd and delete lines and not unbalance things


I use calva.selectCurrentForm command and then use x to cut the unwanted expression. Its not as useful as the smartparens commands, but it does keep the parens balanced


Not really. If your code is properly formatted, you can sometimes get away with the command Infer parens (default bound to shift+tab) after you have deleted the line.


^ thats my goto for deleting lines and rebalance

Cora (she/her)16:07:02

oh, huh, that's good to know


calva doesn’t quite seem to know how to deal with this in terms of formatting and syntax:

(def lexer-single
  {nil  {:state :end
         :out   ::token/eof}
   \( {:state :single
       :out   ::token/left-paren}
   \) {:state :single
       :out   ::token/right-paren}
   \{ {:state :single
       :out   ::token/left-brace}
   \} {:state :single
       :out   ::token/right-brace}
   \, {:state :single
       :out   ::token/comma}
   \. {:state :single
       :out   ::token/dot}
   \- {:state :single
       :out   ::token/minus}
   \+ {:state :single
       :out   ::token/plus}
   \; {:state :single
       :out   ::token/semicolon}
   \* {:state :single
       :out   ::token/star}
   \! {:state :bang}})


A GitHub issue with details about what issues you see would be helpful.


Sure can do!


You could begin with describing here what you think doesn’t work. 😃


two things: the formatter shifts the map value too far when using nil as the key. reproduce like this:

{nil       1
 "foobar" 2}


im using the align map formatting option


secondly the syntax highlighting doesn’t handle character literals that are parens right. The map value here is highlighted as if it as the first part of list (a function):

{\( {:bar :baz}}


this part {:bar is colorised as it was in function position of a list


happy to open a PR if that helps


i mean issue


Thanks! The align map is experimental, quite quirky and likely to be removed. The syntax highlight we should be able to fix. Both issue and PR welcome. 😃

👍 3

would you recommend I stop using the align map formatting? I like it and I saw some people use it, but it seems not to be very common.


It is a very tricky situation. I know it has a lot of users (hopefully not the majority, but anyway) and hesitate a lot removing the feature. But as it is now it holds us back in upgrading to latest cljfmt. Which makes other users disappointed. … I doubt we will decide to remove the feature without replacing it with something. It’s a perfect example of what @U051BLM8F is trying to warn against here:

👍 6