From d8a989efdda2d0355b4fdc4daee383fafdb3062c Mon Sep 17 00:00:00 2001 From: Aiday Marlen Kyzy Date: Thu, 21 Mar 2024 17:30:16 +0100 Subject: [PATCH] adding rules to indent from within [], (), {} --- .../language-configuration.json | 29 ++++++++++++++++++- .../test/browser/indentation.test.ts | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/extensions/typescript-basics/language-configuration.json b/extensions/typescript-basics/language-configuration.json index 6676b50677e..8ba8fb0b860 100644 --- a/extensions/typescript-basics/language-configuration.json +++ b/extensions/typescript-basics/language-configuration.json @@ -218,6 +218,33 @@ "action": { "indent": "outdent" } - } + }, + // Indent when pressing enter from inside () + { + "beforeText": "^.*\\([^\\)]*$", + "afterText": "^[^\\(]*\\).*$", + "action": { + "indent": "indentOutdent", + "appendText": "\t", + } + }, + // Indent when pressing enter from inside {} + { + "beforeText": "^.*\\{[^\\}]*$", + "afterText": "^[^\\{]*\\}.*$", + "action": { + "indent": "indentOutdent", + "appendText": "\t", + } + }, + // Indent when pressing enter from inside [] + { + "beforeText": "^.*\\[[^\\]]*$", + "afterText": "^[^\\[]*\\].*$", + "action": { + "indent": "indentOutdent", + "appendText": "\t", + } + }, ] } diff --git a/src/vs/editor/contrib/indentation/test/browser/indentation.test.ts b/src/vs/editor/contrib/indentation/test/browser/indentation.test.ts index 793c4c33681..92423c46a70 100644 --- a/src/vs/editor/contrib/indentation/test/browser/indentation.test.ts +++ b/src/vs/editor/contrib/indentation/test/browser/indentation.test.ts @@ -838,7 +838,7 @@ suite('`Full` Auto Indent On Type - TypeScript/JavaScript', () => { }); }); - test.skip('issue #43244: indent when lambda arrow function is detected, outdent when end is reached', () => { + test('issue #43244: indent when lambda arrow function is detected, outdent when end is reached', () => { // https://github.com/microsoft/vscode/issues/43244