From ee35d91fdc8d0e21ebce3ac1f9c7f590c2278705 Mon Sep 17 00:00:00 2001 From: tshino Date: Wed, 17 Aug 2022 00:32:56 +0900 Subject: [PATCH 1/3] Use kb-macro.active in wrappers --- generator/gen_wrapper_util.js | 2 +- test/suite/gen_wrapper_util.test.js | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/generator/gen_wrapper_util.js b/generator/gen_wrapper_util.js index 66d566f0..aa54fafe 100644 --- a/generator/gen_wrapper_util.js +++ b/generator/gen_wrapper_util.js @@ -254,7 +254,7 @@ function makeWrapperArgs(keybinding) { } function makeWrapperWhen(keybinding) { - return addWhenContext(keybinding.when, 'kb-macro.recording'); + return addWhenContext(keybinding.when, 'kb-macro.active'); } function makeWrapper(keybinding, awaitOption, recordOption = '') { diff --git a/test/suite/gen_wrapper_util.test.js b/test/suite/gen_wrapper_util.test.js index e8226765..1523fa36 100644 --- a/test/suite/gen_wrapper_util.test.js +++ b/test/suite/gen_wrapper_util.test.js @@ -352,9 +352,9 @@ describe('gen_wrapper_util', () => { }); describe('makeWrapperWhen', () => { const makeWrapperWhen = genWrapperUtil.makeWrapperWhen; - it('should append recording context to the "when" field', () => { + it('should append active context to the "when" field', () => { const input = { key: 'key1', command: 'command1', when: 'context1' }; - const expected = 'kb-macro.recording && context1'; + const expected = 'kb-macro.active && context1'; assert.strictEqual(makeWrapperWhen(input), expected); }); }); @@ -372,7 +372,7 @@ describe('gen_wrapper_util', () => { args: { command: 'command1' }, - when: 'kb-macro.recording && context1' + when: 'kb-macro.active && context1' } ]; assert.deepStrictEqual(makeWrapper(input), expected); }); @@ -390,7 +390,7 @@ describe('gen_wrapper_util', () => { command: 'command1', args: { opt1: 'arg1' } }, - when: 'kb-macro.recording && context1' + when: 'kb-macro.active && context1' } ]; assert.deepStrictEqual(makeWrapper(input), expected); }); @@ -408,7 +408,7 @@ describe('gen_wrapper_util', () => { args: { command: 'command1' }, - when: 'kb-macro.recording && context1' + when: 'kb-macro.active && context1' } ]; assert.deepStrictEqual(makeWrapper(input), expected); }); @@ -426,7 +426,7 @@ describe('gen_wrapper_util', () => { command: 'command1', "await": "await1 await2" }, - when: 'kb-macro.recording && context1' + when: 'kb-macro.active && context1' } ]; assert.deepStrictEqual(makeWrapper(input, awaitOption), expected); }); @@ -445,7 +445,7 @@ describe('gen_wrapper_util', () => { command: 'command1', "await": 'await1' }, - when: 'kb-macro.recording && cond1 && context1' + when: 'kb-macro.active && cond1 && context1' }, { key: 'key1', @@ -453,7 +453,7 @@ describe('gen_wrapper_util', () => { args: { command: 'command1' }, - when: 'kb-macro.recording && !cond1 && context1' + when: 'kb-macro.active && !cond1 && context1' } ]; assert.deepStrictEqual(makeWrapper(input, awaitOption), expected); @@ -473,7 +473,7 @@ describe('gen_wrapper_util', () => { command: 'command1', "await": "await1 await2" }, - when: 'kb-macro.recording && cond1 && context1' + when: 'kb-macro.active && cond1 && context1' }, { key: 'key1', @@ -482,7 +482,7 @@ describe('gen_wrapper_util', () => { command: 'command1', "await": "await1" }, - when: 'kb-macro.recording && !cond1 && context1' + when: 'kb-macro.active && !cond1 && context1' } ]; assert.deepStrictEqual(makeWrapper(input, awaitOption), expected); @@ -502,7 +502,7 @@ describe('gen_wrapper_util', () => { command: 'command1', "await": "await1 await2" }, - when: 'kb-macro.recording && !cond1 && context1' + when: 'kb-macro.active && !cond1 && context1' }, { key: 'key1', @@ -511,7 +511,7 @@ describe('gen_wrapper_util', () => { command: 'command1', "await": "await1" }, - when: 'kb-macro.recording && cond1 && context1' + when: 'kb-macro.active && cond1 && context1' } ]; assert.deepStrictEqual(makeWrapper(input, awaitOption), expected); @@ -531,7 +531,7 @@ describe('gen_wrapper_util', () => { command: 'command1', record: 'side-effect' }, - when: 'kb-macro.recording && context1' + when: 'kb-macro.active && context1' } ]; assert.deepStrictEqual(makeWrapper(input, awaitOption, recordOption), expected); }); From 3fba18b18276cb76527be767352566cda4c5d404 Mon Sep 17 00:00:00 2001 From: tshino Date: Wed, 17 Aug 2022 20:52:10 +0900 Subject: [PATCH 2/3] Update verify_wrapper.js for kb-macro.active introduction --- generator/verify_wrapper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generator/verify_wrapper.js b/generator/verify_wrapper.js index e5ed2165..507f13a3 100644 --- a/generator/verify_wrapper.js +++ b/generator/verify_wrapper.js @@ -69,7 +69,7 @@ const unwrapCommon = function(keybinding) { delete keybinding.args; } } - keybinding.when = removeWhenContext(keybinding.when, 'kb-macro.recording'); + keybinding.when = removeWhenContext(keybinding.when, 'kb-macro.active'); return keybinding; }; const unwrapForWindows = function(keybinding) { @@ -251,8 +251,8 @@ async function verifyWrapper() { for (const wrapper of wrappers) { assert.ok( - containsWhenContext(wrapper.when, 'kb-macro.recording'), - '"when" in a wrapper should contain "kb-macro.recording &&" context' + containsWhenContext(wrapper.when, 'kb-macro.active'), + '"when" in a wrapper should contain "kb-macro.active &&" context' ); if (isWrapped(wrapper)) { assert.strictEqual( From 9885e9dba35b23fe25b228ce2c59cf0f65199390 Mon Sep 17 00:00:00 2001 From: tshino Date: Wed, 17 Aug 2022 21:05:52 +0900 Subject: [PATCH 3/3] Update config.json for kb-macro.active introduction --- generator/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator/config.json b/generator/config.json index a8361a75..b7a20048 100644 --- a/generator/config.json +++ b/generator/config.json @@ -76,7 +76,7 @@ "text": "\n" } }, - "when": "kb-macro.recording && editorTextFocus && !editorReadonly && !suggestWidgetVisible && !renameInputVisible && !codeActionMenuVisible" + "when": "kb-macro.active && editorTextFocus && !editorReadonly && !suggestWidgetVisible && !renameInputVisible && !codeActionMenuVisible" } ], "footer": [