Skip to content

Commit

Permalink
improvement: remove AdonisProject located in node_modules, close #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Apr 30, 2022
1 parent f18947d commit 7c412cb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 11 additions & 1 deletion src/Extension.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { basename } from 'path'
import { Uri } from 'vscode'
import { Uri, workspace } from 'vscode'

export interface AdonisProject {
path: string
Expand All @@ -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
*/
Expand Down
5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7c412cb

Please sign in to comment.