Skip to content

Commit

Permalink
update parseVueCompilerOptions arg
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Dec 20, 2024
1 parent 8e632b8 commit dc94be0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/language-core/lib/parsers/vueCompilerOptions.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Sfc, VueCompilerOptions } from '../types';
import type { VueCompilerOptions } from '../types';

const syntaxReg = /^\s*@(?<key>.+?)\s+(?<value>.+?)\s*$/m;

export function parseVueCompilerOptions(sfc: Sfc): Partial<VueCompilerOptions> | undefined {
const entries = sfc.comments
export function parseVueCompilerOptions(comments: string[]): Partial<VueCompilerOptions> | undefined {
const entries = comments
.map(text => {
try {
const match = text.match(syntaxReg);
Expand Down
2 changes: 1 addition & 1 deletion packages/language-core/lib/plugins/vue-tsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function createTsx(
: 'js';
});
const vueCompilerOptions = computed(() => {
const options = parseVueCompilerOptions(_sfc);
const options = parseVueCompilerOptions(_sfc.comments);
return options
? resolveVueCompilerOptions(options, ctx.vueCompilerOptions)
: ctx.vueCompilerOptions;
Expand Down

0 comments on commit dc94be0

Please sign in to comment.