←back to thread

627 points cratermoon | 1 comments | | HN request time: 0s | 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 #
matsemann ◴[] No.44462389[source]
> and it’s wrong often enough

How is it ever wrong, though? If I insert a (, and then a {, and the editor appends so that it's ({}), that's always ?correct. Can it ever not be.

Maybe because on a Norwegian keyboard { is a bit awkward, but I like it. Then even if we're 5 levels deep with useEffect(() => {(({[{[ I can just press ctrl+shift+enter and it just magically finishes up everything and put my caret at the correct place, instead of me trying to write ]}]})) in the correct order.

replies(5): >>44462525 #>>44462659 #>>44462725 #>>44465211 #>>44478008 #
1. charles_f ◴[] No.44478008[source]
I can't count how many } I've deleted across the years because of that feature