Skip to content

vscode.workspace.findFiles now splits comma-separated glob patterns #69862

Closed

Description

@roblourens

Use this code in an extension, run the command

'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('package.json, tsconfig.json').then(results => {
                console.log('results: ', results);
            });
        }
    });

    context.subscriptions.push(disposable);
}
  • In 1.31, it returns no results because findFiles takes a single glob pattern
  • In 1.32, it returns results because the include and exclude patterns for findFiles are split on the comma

Activity

  1. added
    bug
    search
    candidate
    on Mar 5, 2019
  2. added this to the February 2019 milestone on Mar 5, 2019
  3. self-assigned this
    on Mar 5, 2019
  4. roblourens commented on Mar 5, 2019

    @roblourens
    MemberAuthor

    This is a candidate because it would be an API change. If we want to support multiple glob patterns we should use an array like we discussed in #38545. Parsing a comma-delimited string in this API feels wrong.

  5. added a commit that references this issue on Mar 5, 2019
    c016556
  6. added a commit that references this issue on Mar 5, 2019
    b48a050
  7. locked and limited conversation to collaborators on Apr 20, 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