From e8e5333cbb42cdcf295a0c1cefe9fe644661ef90 Mon Sep 17 00:00:00 2001 From: Aiday Marlen Kyzy Date: Wed, 6 Nov 2024 17:45:54 +0100 Subject: [PATCH] Add comment on next line when not at the end of the line comment in onEnter rules (#233219) adding line comment when not at the end of a line --- .../javascript-language-configuration.json | 13 +++++++++++++ .../typescript-basics/language-configuration.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/extensions/javascript/javascript-language-configuration.json b/extensions/javascript/javascript-language-configuration.json index f7c332337cb..46ee043c52c 100644 --- a/extensions/javascript/javascript-language-configuration.json +++ b/extensions/javascript/javascript-language-configuration.json @@ -228,5 +228,18 @@ "appendText": "\t", } }, + // Add // when pressing enter from inside line comment + { + "beforeText": { + "pattern": "\/\/.*" + }, + "afterText": { + "pattern": "^(?!\\s*$).+" + }, + "action": { + "indent": "none", + "appendText": "// " + } + }, ] } diff --git a/extensions/typescript-basics/language-configuration.json b/extensions/typescript-basics/language-configuration.json index 024cec29cef..876c11e8143 100644 --- a/extensions/typescript-basics/language-configuration.json +++ b/extensions/typescript-basics/language-configuration.json @@ -252,7 +252,7 @@ "pattern": "\/\/.*" }, "afterText": { - "pattern": ".*" + "pattern": "^(?!\\s*$).+" }, "action": { "indent": "none",