Skip to content

Commit

Permalink
feat: support array extends for tsconfig
Browse files Browse the repository at this point in the history
close #2344
  • Loading branch information
johnsoncodehk committed Feb 22, 2023
1 parent 4134866 commit b059d63
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/vue-language-core/src/utils/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,23 @@ function createParsedCommandLineBase(
extendsSet: Set<string>,
): ParsedCommandLine {

let extendsVueOptions = {};
extendsSet.add(tsConfigPath);

const folder = path.dirname(tsConfigPath);
const extendsArr = Array.isArray(content.raw.extends)
? content.raw.extends
: (content.raw.extends ? [content.raw.extends] : []);

extendsSet.add(tsConfigPath);
let extendsVueOptions = {};

if (content.raw.extends) {
for (let extendsPath of extendsArr) {
try {
const extendsPath = require.resolve(content.raw.extends, { paths: [folder] });
extendsPath = require.resolve(extendsPath, { paths: [folder] });
if (!extendsSet.has(extendsPath)) {
extendsVueOptions = createParsedCommandLine(ts, parseConfigHost, extendsPath, extraFileExtensions, extendsSet).vueOptions;
extendsVueOptions = {
...extendsVueOptions,
...createParsedCommandLine(ts, parseConfigHost, extendsPath, extraFileExtensions, extendsSet).vueOptions,
};
}
}
catch (error) {
Expand Down

0 comments on commit b059d63

Please sign in to comment.