Open ZYinMD opened 3 years ago
There's also a bug where pairs inserted by snippets behave inconsistently, if you're interested I can create an issue to reproduce it.
Please create a separate issue for that.
As for the main issue, I think this is not a bug but rather a discussion of what value should be default. I think we should wait for more feedback on this.
Hi @hediet thanks for replying after 2.5 months. I believe the said bug regarding snippets has disappeared during this time, but there are still other problems about this feature. I just re-wrote both the title and body of this issue to better describe it, you could take a look.
In general, I think the devs have worked hard on this feature, then excitedly shipped it, but things are not as simple as it seems.
I think the idea of autoClosingDelete
is to make the autoClose
feature less annoying (backspacing an opening bracket should not leave a (auto closed) closing bracket behind), not necessarily to enable the feature of balanced bracket pair deletion.
backspacing an opening bracket leaves a closing bracket behind
The current behavior of default setting for new users autoClosingDelte: auto
does exactly that, in all of the cases I mentioned. If you think that's annoying, you should set it to always
, which I think should be the default for new users, which is the whole point of this issue.
balanced bracket pair deletion
I was never referring to this features, I actually never knew it was a thing, before you showed me.
The new setting
editor.autoClosingDelete
has been introduced for several months now. It can be set toauto
,always
ornever
.For years, the default behavior was
always
, but since this feature was added, the default for new users becameauto
. After months of testing, I've come to the conclusion thatalways
is a better candidate for default, becauseauto
is not smart enough, for several reasons:foo
, then press a key to "auto surround" it, making it"foo"
or(foo)
or[foo]
, the pair is not considered auto inserted, and auto delete won't happen even if you delete immediately."bar"
, and you double click it to highlight, then try tobackspace×2
to delete it, it won't work.(|) => {|}
, the pairs are not considered auto inserted, so when you tab through them and delete, auto delete won't happen.{|}
then pressbackspace
, human brains expect a consistent outcome every time. Since human brains don't remember whether the pair of brackets was auto-inserted, the current behavior always feel inconsistent and not intuitive.1-6 happens a lot, especially 1 and 2 happens so often, that in 90% cases auto delete won't happen, so the new default settings is mostly equal to "never", which is wasting a nice feature for new users. In the rest 10% cases when auto delete does happen, it's even worse, due to the inconsistency in 7.