Fork me on GitHub
#calva
<
2021-07-17
>
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

practicalli-john10:07:00

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

pez06:07:54

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.

alpox08:07:43

^ thats my goto for deleting lines and rebalance

Cora (she/her)16:07:02

oh, huh, that's good to know

dgb2322:07:00

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}})

bringe01:07:09

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

dgb2309:07:22

Sure can do!

pez09:07:21

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

dgb2316:07:45

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

{nil       1
 "foobar" 2}

dgb2316:07:03

im using the align map formatting option

dgb2317:07:36

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}}

dgb2317:07:18

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

dgb2317:07:31

happy to open a PR if that helps

dgb2317:07:43

i mean issue

pez17:07:49

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
dgb2317:07:39

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.

pez17:07:05

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: https://www.youtube.com/watch?v=-Bx2rmD7mN0

👍 6