teal-language / vscode-teal

Teal language support for Visual Studio Code
MIT License
76 stars 11 forks source link

Automatic insertion of `end` keyword #18

Open pdesaulniers opened 4 years ago

pdesaulniers commented 4 years ago

It would be nice if end tokens were inserted automatically when we press Return after then, record, etc.

See https://github.com/kaiwood/vscode-endwise for reference.

pdesaulniers commented 3 years ago

It seems like we could implement this with onEnterRules.action.appendText in language-configuration.json: https://code.visualstudio.com/api/language-extensions/language-configuration-guide#on-enter-rules

EDIT: Nevermind, I think this wouldn't work. Pressing Enter might generate superfluous end tokens. We need to insert the matching end token ONLY if it is missing in the document.