-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xxx is not a valid value for v-model. Expected: v-model #79
Comments
@piotrtomiak Please take a look, thank you |
@anyesu - thanks for taking time to analyze the issue. The problem is that WebStorm at the moment does not have support for validating types with |
@piotrtomiak Thank you for your reply.
I tried this and it does fix the warning. {
- "name": "v-model",
+ "name": "modelValue",
"default": "`false`",
"description": "是否触发下拉刷新",
"value": {
"type": "boolean",
"kind": "expression"
}
} But the hint of web-types/packages/vue/vue@3.0.0.web-types.json Lines 606 to 614 in 2c07137
If I apply the workaround I mentioned above, hint for - "type": "boolean"
+ "type": "boolean " |
In addition, can you help confirm whether attributeValue?.let { other ->
it.required = other.required
it.default = other.default
it.type = other.type
+ it.kind = other.kind
} |
@anyesu - I've made this on purpose, this is a conversion from an older Web Types format (1.x, which was only for Vue). In new format, you would specify a Vue component under Regarding the documentation on |
Is there a link to the relevant documentation? I don't know much about this. Or do you know of a Vue library that has a complete As far as I can see, in the web-types/packages/vue/vue@3.0.0.web-types.json Lines 1 to 15 in 2c07137
Sorry, this is my problem. Let me explain: In the screenshot above, the documentation {
"name": "nut-pull-refresh",
"slots": [],
"events": [],
"attributes": [
{
"name": "v-model",
"default": "`false`",
"description": "是否触发下拉刷新", // This line will appear in the "v-model" hint
"value": {
"type": "boolean",
"kind": "expression"
}
}
]
} In youzan/vant#12787 , I've fixed https://youtrack.jetbrains.com/issue/WEB-52219 using the workaround below:
Before After I have only verified locally that the fix works for these versions of the IDE ( IntelliJ IDEA 2021.2.3 to IntelliJ IDEA 2023.3.2 ). Due to some compatibility issues, I still need to use IntelliJ IDEA 2021.2.3 in some projects. |
First of all, I'm sorry. This bug should belong to the intellij-community project, but I don't know how to test it in that project. I see that the author of the relevant code is also you, so I came here.
ref: https://youtrack.jetbrains.com/issue/WEB-52219
Environment
Steps to reproduce
Create an empty project and install dependencies.
Create a
Vue
file.Then you can see a warning appearing on the
refresh
.Temporary workaround
Below is the definition of
nut-pull-refresh
in the web-types.json file:https://cdn.jsdelivr.net/npm/@nutui/nutui@4.3.2/dist/smartips/web-types.json
A key point here is that the value of
type
isboolean
.If you modify the
type
as follows, the warning disappears:But this approach is obviously unrealistic, because the web-types.json is generated by a third-party library and is syntactically correct.
Debugging and analysis
First, the warning is generated by the following code:
https://github.com/JetBrains/intellij-community/blob/1d4c2a0bf89a28abb2a469bdb5fee511ef05f52c/xml/xml-psi-impl/src/com/intellij/html/webSymbols/attributes/WebSymbolAttributeDescriptor.kt#L56-L60
The
enumValues
is a non-null value and is assigned in the following code:https://github.com/JetBrains/intellij-community/blob/1d4c2a0bf89a28abb2a469bdb5fee511ef05f52c/xml/xml-psi-impl/src/com/intellij/html/webSymbols/attributes/impl/WebSymbolHtmlAttributeInfoImpl.kt#L67-L70
Since the value of
attrValue?.kind
isnull
, thekind
is assigned the default valueKind.PLAIN
, causingisHtmlBoolean
to becomeThreeState.YES
.After debugging I found the following code:
https://github.com/JetBrains/intellij-community/blob/1d4c2a0bf89a28abb2a469bdb5fee511ef05f52c/platform/webSymbols/src/com/intellij/webSymbols/webTypes/impl/WebTypesJsonContributionAdapter.kt#L250-L260
When copying
attributeValue
toHtmlAttributeValue()
here, thekind
field is missing.So I guess the problem is caused here. If you modify it like the following, it may be able to fix the problem:
attributeValue?.let { other -> it.required = other.required it.default = other.default it.type = other.type + it.kind = other.kind }
As said before I don't know how to test it in the intellij-community , so I changed the value during the breakpoint to test the effect.
The test result is that after modification, there will be no more warnings.
The text was updated successfully, but these errors were encountered: