I'm developing a vscode extension, and I want to find all files under the current workspace folder, that match the ".ts" extension but exclude node_modules
I'm using fast-glob but is not retuning all the expected ".ts" files
import * as vscode from 'vscode';
import * as fg from 'fast-glob';
export class ReferenceManager {
private suportedExtension = ".ts";
public projectFolder: vscode.Uri;
public async updateWorkspaceReferences() {
let message: string;
let folders = vscode.workspace.workspaceFolders;
if (folders && folders.length > 0) {
this.projectFolder = folders[0].uri;
console.log(`Updating references for: ${this.projectFolder}`);
let filepaths = await this.getWorkspaceFilePaths();
filepaths.forEach(fp => {
console.log(fp);
});
message = '>>> nav-code extension is ready <<<';
}
else {
message = '>>> nav-code extension requires an open workspace to work';
}
console.log(message);
}
public async getWorkspaceFilePaths(): Promise<string[]> {
//get all the relevant files of the workspace and convert them to full path
return (await fg(["**/*" + this.suportedExtension], { ignore: ['**/node_modules'] }) || []).map(x => this.toFullPath(x));
}
public toFullPath(relPath: string): string {
return (this.projectFolder + '/' + relPath);
}
}
The current output is this (only two files)
>>nav-code" is gettign ready
Updating references for: file:///c%3A/DATOS/repos/petrel-xml
file:///c%3A/DATOS/repos/petrel-xml/resources/app/out/vscode-dts/vscode.d.ts
file:///c%3A/DATOS/repos/petrel-xml/resources/app/extensions/html-language-features/server/lib/jquery.d.ts
>>> nav-code extension is ready <<<
But the folder contains a client and server folder that contains other .ts files
Is there something wrong with the pattern that I'm using ?