How to make VSCode automatically insert 'end' on enter press after 'do'

I found a workaround that suffices for now. Using Code -> Preferences -> User Snippers -> Ruby I added the following snippets

"Do block": {
    "prefix": "dob",
    "body": [
        "do",
        "\t$0",
        "end"
    ],
    "description": "Do block"
},
"Do block with params": {
    "prefix": "dobwp",
    "body": [
        "do |${1:param}|",
        "\t$0",
        "end"
    ],
    "description": "Do block with params"
}

The first one inserts a

do

end

without any parameters. The second one inserts a

do |param|

end

and you can choose the param value.

The downside is that when writing do you have to move down and choose dob or dobwp and it's not the default behaviour of do like in sublime.


Did you try https://github.com/rubyide/vscode-ruby ? It states that

This extension provides rich Ruby language and debugging support for VS Code.

including Autocomplete. Maybe worth a try.