Skip to content

Commit

Permalink
Merge pull request #140 from tshino/update-script-for-active
Browse files Browse the repository at this point in the history
Update wrapper generator scripts to use kb-macro.active
  • Loading branch information
tshino authored Jan 8, 2023
2 parents 79e6dcc + 9885e9d commit bd346e3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion generator/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion generator/gen_wrapper_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '') {
Expand Down
6 changes: 3 additions & 3 deletions generator/verify_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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(
Expand Down
26 changes: 13 additions & 13 deletions test/suite/gen_wrapper_util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand All @@ -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);
});
Expand All @@ -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);
});
Expand All @@ -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);
});
Expand All @@ -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);
});
Expand All @@ -445,15 +445,15 @@ describe('gen_wrapper_util', () => {
command: 'command1',
"await": 'await1'
},
when: 'kb-macro.recording && cond1 && context1'
when: 'kb-macro.active && cond1 && context1'
},
{
key: 'key1',
command: 'kb-macro.wrap',
args: {
command: 'command1'
},
when: 'kb-macro.recording && !cond1 && context1'
when: 'kb-macro.active && !cond1 && context1'
}
];
assert.deepStrictEqual(makeWrapper(input, awaitOption), expected);
Expand All @@ -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',
Expand All @@ -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);
Expand All @@ -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',
Expand All @@ -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);
Expand All @@ -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);
});
Expand Down

0 comments on commit bd346e3

Please sign in to comment.