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": [ 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/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( 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); });