Joplin uses the CodeMirror editor now. Fortunately it also has an option for the behaviour you want.
Apparently it's enabled by default, but still doesn't work in Joplin, so you might find that it's more than just a setting change to get this to work. If you're serious about working on this, it would be best if you could also get it working with the TinyMCE editor.