BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.64k stars 214 forks source link

Paredit interaction with strings #1440

Open Cyrik opened 2 years ago

Cyrik commented 2 years ago

When I do “slurp sexp forward” at:

"|"somestuff

where the | is my cursor, I get ” somestuff”.

I would expect the string to not start with a space. I've tried a few other paredit commands inside of strings and they seem Ok, but I'm to a paredit expert.

According to @PEZ :

Not really intended, It’s a side effect of that strings are treated as lists and we haven’t made a special case for it. But we can consider it.

PEZ commented 2 years ago

Thanks. To clarify the strings-as-lists a bit. Since when you slurp into a list this space is cleaned away. That is because we run the formatter on the edited text, and it removes surrounding whitespace. Formatting with in a string does not do this.

We have a few more edits that behave a bit strangely around strings:

foo "|"

slurp backward =>

"foo |"

f|oo ""

drag forward down =>

"f|oo "

"" f|oo

drag backward down =>

"
f|oo"

Maybe more, but these are the ”slurpy” ones I come to think of.

Cyrik commented 2 years ago

Yes, it looks like the problem is always pulling into strings where some sort of white space is introduced.