Skip to content

Commit

Permalink
fix(vscode): fix configExists logic (#1119)
Browse files Browse the repository at this point in the history
  • Loading branch information
QiroNT committed Jun 19, 2022
1 parent 3f5645e commit 5bfbf81
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/vscode/src/contextLoader.ts
Expand Up @@ -79,7 +79,7 @@ export class ContextLoader {
const files = await readdir(dir)
this.configExistsCache.set(dir, files.some(f => /^(vite|svelte|astro|iles|nuxt|unocss|uno)\.config/.test(f)))
}
return this.configExistsCache.has(dir)!
return this.configExistsCache.get(dir)!
}

async loadContextInDirectory(dir: string) {
Expand Down Expand Up @@ -189,13 +189,12 @@ export class ContextLoader {
if (fs.existsSync(file)) {
let dir = path.dirname(file)
while (isSubdir(this.cwd, dir)) {
if (!await this.configExists(dir))
continue

const context = await this.loadContextInDirectory(dir)
if (context?.filter(code, file)) {
this.fileContextCache.set(file, context)
return context
if (await this.configExists(dir)) {
const context = await this.loadContextInDirectory(dir)
if (context?.filter(code, file)) {
this.fileContextCache.set(file, context)
return context
}
}

const newDir = path.dirname(dir)
Expand Down

0 comments on commit 5bfbf81

Please sign in to comment.