diff --git a/src/Extension.ts b/src/Extension.ts index 70baa9a..45bc34f 100644 --- a/src/Extension.ts +++ b/src/Extension.ts @@ -1,5 +1,5 @@ import { basename } from 'path' -import { Uri } from 'vscode' +import { Uri, workspace } from 'vscode' export interface AdonisProject { path: string @@ -13,6 +13,16 @@ export default class Extension { */ public static adonisProjectPaths: string[] = [] + /** + * Scan the whole workspace(s) for existing Adonis projects + */ + public static async loadAdonisProjects() { + let files = await workspace.findFiles('**/ace', '**/node_modules/**', undefined) + files.map((file) => + Extension.adonisProjectPaths.push(file.path.split('/').slice(0, -1).join('/')) + ) + } + /** * Returns the directories */ diff --git a/src/index.ts b/src/index.ts index a2c9299..8545070 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,10 +11,7 @@ import { EdgeFormatterProvider } from './languages' import Extension from './Extension' export async function activate(context: ExtensionContext) { - let files = await workspace.findFiles('**/ace', undefined) - files.map((file) => - Extension.adonisProjectPaths.push(file.path.split('/').slice(0, -1).join('/')) - ) + await Extension.loadAdonisProjects() /** * Commands