SearchInWorkspaceService Sanity Check

I’m trying to use the SearchInWorkspaceService but I can’t seem to get it to list any or all files in my workspace. Anyone know how to use this, or have a simple test I could do? Below is my test code for a react widget. The only logs I get are:

INFO DSAC: Searching Specs
INFO DSAC: Searching Done: 0

I was hoping to see “DSAC: Got Result”

componentDidMount(): void {

async searchWSForSpecs(clearAll: boolean): Promise<void> {
    console.log("DSAC: Searching Specs");
    const searchOpts: SearchInWorkspaceOptions = {
        matchCase: false,
        matchWholeWord: false,
        useRegExp: false,
        includeIgnored: false,
        include: [],
        exclude: [],
        maxResults: 2000

    if (clearAll) {
        this.setState({WSSpecUris: []});

    const searchTerm = "";, {
        onDone: (searchId: number, error?: string) => {
            // Do nothing for now
            console.log("DSAC: Searching Done: ", searchId.toString(), error ? error : "");
        onResult: (searchId: number, result: SearchInWorkspaceResult) => {
            console.log("DSAC: Got Result");
            const uri = new URI(result.fileUri);
            this.setState({WSSpecUris: [...this.state.WSSpecUris, uri]});

[original thread by shortwavedave]


I’ve tried all sorts of globs in the searchTerm, include, and enabling regex


well when I removed the async from the searchWSForSpecs function I got a different behavior…like 300 each of every file was listed.


and the only way so far I get any response is if the searchTerm is empty, hence “”


one bug in my code, I didn’t pass the opts to the search function. So now it is limiting the results at least, still duplicating results though


reading through the code it appears this is a grep operation, so the search term is actually looking inside all the files. I thought the search term was the file name. I’m not too clear on the syntax for the glob yet, but I think I understand how to use this now

You could try to debug what is passed to SearchInWorkspaceService via UI.

@vince-fugnitto @jbicker maybe you can help