Vscode: Control Exclude checkbox in search from extension

Created on 28 Sep 2020  路  8Comments  路  Source: microsoft/vscode

When executing search from extension api 2 checkboxes are not exposed:

  • Preserve Case
  • Use Exclude Settings and Ignore Files
vscode.commands.executeCommand('workbench.action.findInFiles', {
  query: regexStr,
  isRegex: true,
  triggerSearch: true,
});

Screenshot (341)

bug good first issue help wanted insiders-released search verified

Most helpful comment

@roblourens genuinely didn't notice the existing PR, apologies @dhairyanadapara

All 8 comments

Hey @usernamehw , Can you please explain a little more about the issue?

@dhairyanadapara It's possible to trigger a search from extension by using this api:

vscode.commands.executeCommand('workbench.action.findInFiles', {
  query: 'example',
});

And it has a good amount of options:

export interface IFindInFilesArgs {
    query?: string;
    replace?: string;
    triggerSearch?: boolean;
    filesToInclude?: string;
    filesToExclude?: string;
    isRegex?: boolean;
    isCaseSensitive?: boolean;
    matchWholeWord?: boolean;
}

But 2 of them are missing:

  1. Preserve Case
  2. Use Exclude Settings and Ignore Files

Thank @usernamehw, got the idea. I will raise a PR to fix the issue ASAP :)

@usernamehw @roblourens I have raised the PR. If you get time please review :)

@roblourens genuinely didn't notice the existing PR, apologies @dhairyanadapara

Thanks @roblourens :). No problem @rotem-bar.

It great now that it's possible to control it 馃憤 but why does it called excludeSettingAndIgnoreFiles? Would it possible to have the same name as in label:

- excludeSettingAndIgnoreFiles
+ useExcludeSettingsAndIgnoreFiles

Updated to useExcludeSettingsAndIgnoreFiles as per @usernamehw's suggestion and for consistency with search editor post #108750. Also added these to the keybindings intellisense registry.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trstringer picture trstringer  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

v-pavanp picture v-pavanp  路  3Comments

sirius1024 picture sirius1024  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments