From 5146fb12d73ce3bb0535b856fbf17482d86aa468 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Fri, 12 Dec 2025 10:03:27 +0100 Subject: [PATCH] Restrict herestring bindings 1. don't trigger within comments 2. trigger only directly after `@` character, as otherwise typing quotation mark after `@foo` would also trigger the chain command. 3. trigger only if not directly followed by corresponding quotation or at-sign. --- Default.sublime-keymap | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Default.sublime-keymap b/Default.sublime-keymap index 3f1c2c7..e79b3f3 100644 --- a/Default.sublime-keymap +++ b/Default.sublime-keymap @@ -16,8 +16,9 @@ }, "context": [ { "key": "selection_empty", "match_all": true }, - { "key": "selector", "operand": "source.powershell - string", "match_all": true }, - { "key": "preceding_text", "operator": "regex_contains", "operand": "@", "match_all": true }, + { "key": "selector", "operand": "source.powershell - comment - string", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "@$", "match_all": true }, + { "key": "following_text", "operator": "not_regex_contains", "operand": "^[\"@]", "match_all": true }, ] }, { @@ -37,8 +38,9 @@ }, "context": [ { "key": "selection_empty", "match_all": true }, - { "key": "selector", "operand": "source.powershell - string", "match_all": true }, - { "key": "preceding_text", "operator": "regex_contains", "operand": "@", "match_all": true }, + { "key": "selector", "operand": "source.powershell - comment - string", "match_all": true }, + { "key": "preceding_text", "operator": "regex_contains", "operand": "@$", "match_all": true }, + { "key": "following_text", "operator": "not_regex_contains", "operand": "^['@]", "match_all": true }, ] }, ]