←back to thread

627 points cratermoon | 2 comments | | HN request time: 0.526s | 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. 8n4vidtmkvmk ◴[] No.44462450[source]
I hated this feature until I realized I could just type the closing quote anyway and it wouldn't double up. Doesn't seem to bother me now that I'm used to it. Once in awhile my editor tries to get too clever and messes things up, but not often
replies(1): >>44463009 #
2. whoisyc ◴[] No.44463009[source]
That’s what GP said about “harder to model the editor’s behaviour mentally” though. In a dumb editor you type a quote and you get a quote, in a “smart” editor whether or not you get two quotes, one quote, or no quote at all is context dependent and more confusing.