diff --git a/vscode-cairo/language-configuration.json b/vscode-cairo/language-configuration.json index e91d695daa1..96ccb6100a7 100644 --- a/vscode-cairo/language-configuration.json +++ b/vscode-cairo/language-configuration.json @@ -40,4 +40,27 @@ "end": "^\\s*// endregion\\b", }, }, + "onEnterRules": [ + { + // Carry indentation from the previous line if it's only whitespace. + "beforeText": "^\\s+$", + "action": { "indent": "none" }, + }, + { + // After the end of a function/field chain, with the semicolon on the same line. + "beforeText": "^\\s+\\..*;", + "action": { "indent": "outdent" }, + }, + { + // After the end of a function/field chain, with semicolon detached from the rest. + "beforeText": "^\\s+;", + "previousLineText": "^\\s+\\..*", + "action": { "indent": "outdent" }, + }, + { + // Doc single-line comment e.g. ///| + "beforeText": "^\\s*\\/{3}.*$", + "action": { "indent": "none", "appendText": "/// " }, + }, + ], }