Skip to content

vscode.workspace.findFiles() no longer honors the exclude pattern  #69840

Closed

Description

@egamma
  1. use yo code to create an extension

  2. Replace the extension.ts with the code below

  3. Press F5 to run the workspace

  4. Open a project for a node module that has a node_modules folder with many modules.

  5. Execute the ´Hello World' command

--> the call workspace.findFiles returns file matches from the node_modules folder, but the node_modules folder is excluded.

Running the same extension in stable properly excludes matches in the node_modules folder.

Tagging as a candiate for February since the change of behavour impacts NPM script running and now proposes scripts from the node_modules.

The code for extension.ts

'use strict';

import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {

    let disposable = vscode.commands.registerCommand('extension.helloWorld', () => {
        const workspace = vscode.workspace.workspaceFolders![0];
        if (workspace) {
            vscode.workspace.findFiles(new vscode.RelativePattern(workspace, "**/package.json"), "**/node_modules/**").then(results => {
                console.log('results: ', results);
            });
        }
    });

    context.subscriptions.push(disposable);
}

Activity

  1. added
    candidate
    on Mar 5, 2019
  2. added
    bug
    search
    on Mar 5, 2019
  3. added a commit that references this issue on Mar 5, 2019
    9dc005d
  4. octref commented on Mar 5, 2019

    @octref
    Contributor

    Would be fixed by #69864.

  5. added a commit that references this issue on Mar 5, 2019
    10fdea2
  6. added
    verified
    on Mar 6, 2019
  7. locked and limited conversation to collaborators on Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcandidatesearchverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions