Skip to content

Commit

Permalink
feat: option to apply custom rg commands
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmu committed Apr 1, 2023
1 parent dc7c622 commit 7e38da9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/periscope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const periscope = () => {
function setupRgMenuActions() {
reset();

qp.placeholder = '🫧 Rg Menu Actions (Space key to check/uncheck, Enter key to continue)';
qp.placeholder = '🫧 Select actions or type custom rg options (Space key to check/uncheck)';
qp.canSelectMany = true;

// add items from the config
Expand All @@ -104,6 +104,13 @@ export const periscope = () => {

function next() {
rgMenuActionsSelected = (qp.selectedItems as QPItemRgMenuAction[]).map(item => item.data.rgOption);

// if no actions selected, then use the current query as a custom command to rg
if (!rgMenuActionsSelected.length && qp.value) {
rgMenuActionsSelected.push(qp.value);
qp.value = '';
}

setupQuickPickForQuery();
}

Expand All @@ -119,7 +126,6 @@ export const periscope = () => {
qp.items = [];
qp.canSelectMany = false;
qp.value = getSelectedText();
console.log('here');
disposables.query.push(
qp.onDidChangeValue(onDidChangeValue),
qp.onDidChangeActive(onDidChangeActive),
Expand Down

0 comments on commit 7e38da9

Please sign in to comment.