←back to thread

631 points cratermoon | 1 comments | | HN request time: 0.211s | source
Show context
chrismorgan ◴[] No.44462001[source]
> Like, just to calibrate here: you know how some code editors will automatically fill in a right bracket or quote when you type a left one? You type " and the result is "|"? Yeah, that drives me up the wall. It saves no time whatsoever, and it’s wrong often enough that I waste time having to correct for it.

I have not yet figured out why anyone would choose this behaviour in a text editor. You have to press something to exit the delimited region anyway, whether that be an arrow key or the closing delimiter, so just… why did the first person even invent the idea, which just complicates things and also makes it harder to model the editor’s behaviour mentally? Were they a hunt-and-peck typist or something?

In theory, it helps keep your source valid syntax more of the time, which may help with syntax highlighting (especially of strings) and LSP/similar tooling. But it’s only more of the time: your source will still be invalid frequently, including when it gets things wrong and you have to relocate a delimiter. In practice, I don’t think it’s useful on that ground.

replies(13): >>44462030 #>>44462032 #>>44462150 #>>44462206 #>>44462213 #>>44462300 #>>44462368 #>>44462389 #>>44462450 #>>44463659 #>>44463863 #>>44464038 #>>44466698 #
1. kqr ◴[] No.44464038[source]
I've never noticed some editors do this because I always type both opening and closing symbols at the same time, and then back up into them if I want to fill them out. I think I learned it from my father and just anecdotally I make mistakes of unbalanced symbols nowhere near as often as others.