Skip to content

Commit

Permalink
fix(language-core): remove mapping for v-model
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed May 13, 2024
1 parent e779822 commit 01f64ee
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions packages/language-core/lib/codegen/template/elementProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ export function* generateElementProps(
&& (prop.name === 'model' || prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION)
&& (!prop.exp || prop.exp.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION)
) {
let propName =
prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
? prop.arg.constType === CompilerDOM.ConstantTypes.CAN_STRINGIFY
? prop.arg.content
: prop.arg.loc.source
: getModelValuePropName(node, options.vueCompilerOptions.target, options.vueCompilerOptions);
let propName: string | undefined;

if (prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
propName = prop.arg.constType === CompilerDOM.ConstantTypes.CAN_STRINGIFY
? prop.arg.content
: prop.arg.loc.source;
}
else {
propName = getModelValuePropName(node, options.vueCompilerOptions.target, options.vueCompilerOptions);
}

if (
propName === undefined
Expand Down Expand Up @@ -110,26 +114,26 @@ export function* generateElementProps(
prop.loc.start.offset,
prop.loc.end.offset,
ctx.codeFeatures.verification,
...generateObjectProperty(
options,
ctx,
propName,
prop.arg
? prop.arg.loc.start.offset
: prop.loc.start.offset,
...(
prop.arg
? {
...ctx.codeFeatures.withoutHighlightAndCompletion,
navigation: ctx.codeFeatures.withoutHighlightAndCompletion.navigation
? {
resolveRenameNewName: camelize,
resolveRenameEditText: shouldCamelize ? hyphenateAttr : undefined,
}
: false,
}
: ctx.codeFeatures.withoutHighlightAndCompletion,
(prop.loc as any).name_2 ?? ((prop.loc as any).name_2 = {}),
shouldCamelize,
? generateObjectProperty(
options,
ctx,
propName,
prop.arg.loc.start.offset,
{
...ctx.codeFeatures.withoutHighlightAndCompletion,
navigation: ctx.codeFeatures.withoutHighlightAndCompletion.navigation
? {
resolveRenameNewName: camelize,
resolveRenameEditText: shouldCamelize ? hyphenateAttr : undefined,
}
: false,
},
(prop.loc as any).name_2 ?? ((prop.loc as any).name_2 = {}),
shouldCamelize,
)
: [propName]
),
`: (`,
...genereatePropExp(
Expand Down

0 comments on commit 01f64ee

Please sign in to comment.