Skip to content

Commit

Permalink
fix(language-core): syntax breaks if script options does not have tra…
Browse files Browse the repository at this point in the history
…iling comma (#3755)
  • Loading branch information
johnsoncodehk authored Nov 29, 2023
1 parent eac3fad commit 514156d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/language-core/src/generators/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,19 +600,15 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
codes.push(`(await import('${vueCompilerOptions.lib}')).defineComponent({\n`);
}

generateComponentOptions(functional);

codes.push(`setup() {\n`);
codes.push(`return {\n`);

generateSetupReturns();

if (scriptSetupRanges.expose.define) {
codes.push(`...__VLS_exposed,\n`);
}

codes.push(`};\n`);
codes.push(`},\n`);
generateComponentOptions(functional);
codes.push(`})`);
}
function generateComponentOptions(functional: boolean) {
Expand Down Expand Up @@ -734,7 +730,6 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
if (scriptSetup && scriptSetupRanges) {

codes.push(`const __VLS_internalComponent = (await import('${vueCompilerOptions.lib}')).defineComponent({\n`);
generateComponentOptions(functional);
codes.push(`setup() {\n`);
codes.push(`return {\n`);
generateSetupReturns();
Expand Down Expand Up @@ -773,6 +768,7 @@ declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?:
}
codes.push(`};\n`); // return {
codes.push(`},\n`); // setup() {
generateComponentOptions(functional);
codes.push(`});\n`); // defineComponent({
}
else if (script) {
Expand Down

0 comments on commit 514156d

Please sign in to comment.