-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paredit: delete # character before opening delimiter #1122
Comments
So translating this to Paredit tests, one way to solve this would be to make these tests pass (without breaking any existing tests, naturally). it('Deletes open paren prefix characters', () => {
// https://github.com/BetterThanTomorrow/calva/issues/1122
const a = docFromTextNotation('#|(foo)');
const b = docFromTextNotation('|(foo)');
paredit.backspace(a);
expect(textAndSelection(a)).toEqual(textAndSelection(b));
});
it('Deletes open map curly prefix/ns characters', () => {
const a = docFromTextNotation('#:same|{:thing :here}');
const b = docFromTextNotation('#:sam|{:thing :here}');
paredit.backspace(a);
expect(textAndSelection(a)).toEqual(textAndSelection(b));
});
it('Deletes open set hash characters', () => {
// https://github.com/BetterThanTomorrow/calva/issues/1122
const a = docFromTextNotation('#|{:thing :here}');
const b = docFromTextNotation('|{:thing :here}');
paredit.backspace(a);
expect(textAndSelection(a)).toEqual(textAndSelection(b));
});
it('Moves cursor past entire open paren, including prefix characters', () => {
const a = docFromTextNotation('#(|foo)');
const b = docFromTextNotation('|#(foo)');
paredit.backspace(a);
expect(textAndSelection(a)).toEqual(textAndSelection(b));
}); Note that of these, the _ Deletes open map curly prefix/ns characters_ already passes. My rationale behind this particular solution is that if you place the cursor somewhere ”in” a multi-character |
Hmm, then I guess the same thing should happen with any other prefix character, like '(quotes)
~@(splicing unquotes)
~'#?@(:clj [un-syntax-quoted splicing reader conditional]) ; 💥 I didn't notice this before but all these prefixes currently behave the same as And should it distinguish the sequence #_(|foo)
#_|(foo)
#|(foo)
|(foo) |
Please see if you think this behaves like you want it to, @yuhan0 : https://12910-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.189-1122-paredit-backspace-in-open-token-d4b4134d.vsix |
Yes, Calva lumps together all sorts of opening ”prefix” characters. So the VSIX should now behave consistently in the new way. 😄 And the ignore marker is not considered an opening prefix so also that should work as you suggest there. |
Yup, it handles all those cases exactly how I'd expect them too 👍 |
Thanks for being super quick in testing and responding here. It helps tons! |
Calva treats
#(
and#{
as single units and refuses to delete the#
character alone.This can be annoying when eg. refactoring a
#(..)
into a(fn ..)
or when deleting the#_
ignore macro one character at a time.@PEZ suggested
Alt-backspace
as a temporary workaround which ignores paredit and forces deletion.The text was updated successfully, but these errors were encountered: