Skip to content

Commit

Permalink
fix: don't ignore volar.config.js error
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Oct 17, 2022
1 parent 10d1a6a commit d0bb3da
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/language-server/src/utils/config.ts
@@ -1,14 +1,20 @@
import { LanguageServicePlugin } from '@volar/language-service';

export function loadCustomPlugins(dir: string) {
let configPath: string | undefined;
try {
const configPath = require.resolve('./volar.config.js', { paths: [dir] });
const config: { plugins?: LanguageServicePlugin[]; } = require(configPath);
// console.warn('Found', configPath, 'and loaded', config.plugins?.length, 'plugins.');
return config.plugins ?? [];
configPath = require.resolve('./volar.config.js', { paths: [dir] });
} catch { }

try {
if (configPath) {
const config: { plugins?: LanguageServicePlugin[]; } = require(configPath);
return config.plugins ?? [];
}
}
catch (err) {
// console.warn('No volar.config.js found in', dir);
return [];
console.log(err);
}

return [];
}

0 comments on commit d0bb3da

Please sign in to comment.