-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Template Interpolation Issue - First letter not recognized in event variable assignment #1319
Comments
I just copied & pasted your reproducible case but cannot reproduce on my local. Could you provide full contained repro by cloning and modifying Veturpack? |
So using a Veturpack repo I could not reproduce the issue above. Then I tried my example above again and I didn't have the issue anymore. Then I tried everything I could do to get that error in a new project and couldn't... So probably another interaction issue. Not really sure how else to test. However, incase this does come up later, I have made a couple more observations. The issue above can be removed in a couple ways:
Both are really strange, so I hope you can see a link between those observations and the vetur code I don't! |
That's weird... Even there is multi-lined attribute element, its v-on handler works fine for me. By the way, what can you see when you execute a command |
OK I found the command vetur.showCorrespondingVirtualFile... But just for fun let's pretend I don't know how to run that command - how would I do that? |
I have the exact same problem. Would be happy to help if there is any additional information i could provide |
This may be solved by this PR #1335 |
Still same problem. Using vuetify. Doesnt seem to be the same problems in other projects, weirdly enough. |
I have the same problem. Running
The 3 extra errors seem to be the "off-by-first character" errors. (They are shown when opening the file with the my "normal" VSCode) Edit: expected and actual are in the wrong order (https://github.com/vuejs/vetur/blob/master/test/interpolation/diagnostics/helper.ts#L17) |
The problem is related to the configured line endings. Switching VS Code to |
I got a repro while trying to reenable Windows CI: https://dev.azure.com/octref/Vetur/_build/results?buildId=960&view=logs&j=022b0a5d-2698-5f72-7610-a845972a8b4c&t=af0b5d72-a8ff-57fd-7b7c-b5fc756da7a6 |
vuejs/vue-eslint-parser#59 is the upstream issue. expression is off by 1 when using CRLF. I can only suggest using LF now, I don't have a whole afternoon to dive into the eslint parser... |
I tried to force LF in a project I was setting up at work and it's problematic. Mainly because Git will by default change line endings to CRLF on Windows even if they were saved as LF during cloning the repo. I haven't been able to override these Git settings using a config file commited to the repo (eg. .gitattributes). It's supposedly possible to do |
Waiting for the upstream PR: vuejs/vue-eslint-parser#74 |
Before upstream fixes this, another workaround could be wrapping the assignment in a function. If you don't want to write a dedicated vue method for your statement, you can wrap your statement inside a lambda, for example <span
@click="() => eg = false"
/> |
I have this issue as well. Would be happy to help or post code if needed. I am Vetur v0.28.0 and VS Code 1.49.3 |
I'll merge vuejs/vue-eslint-parser#74 to my branch and publish it, so I can depend on it. @ota-meshi Thanks for your work! Do you think we can keep a fork active together until @mysticatea is less busy and can get back to vue-eslint-parser? |
Does this still repro for you? I cannot repro in latest version. CI cannot detect this error as well: https://github.com/vuejs/vetur/runs/1218328035 This file with CRLF: https://github.com/vuejs/vetur/blob/1319/test/interpolation/fixture/diagnostics/crlf/crlf.vue Triggers this error: [
{
"severity": "Error",
"message": "Property 'egg' does not exist on type 'CombinedVueInstance<Record<never, any> & Vue, object, object, object, Record<never, any>>'.",
"range": [
{
"line": 1,
"character": 16
},
{
"line": 1,
"character": 19
}
],
"source": "Vetur",
"code": 2339
}
] |
@octref Sure. |
I was able to contact him. https://www.npmjs.com/package/vue-eslint-parser/v/7.1.1 This is my first release so please let me know if you have any issues. |
@ota-meshi Thanks a ton! I pulled it in and it works great during my test. Thanks for reviving vue-eslint-parser. |
I'm still having an issue with this.
|
This fix is not release now. |
Using a lambda work nicely to avoid the error and keep readability, thanks. |
Info
Problem
When entering a data property into an event, it ignores the first letter and so persistently reports that the property does not exist. This error can be removed by surrounding the statement in curly brackets, but that creates a bigger Vue error.
Reproducible Case
Turn Template Interpolation Service on and write the following code:
The text was updated successfully, but these errors were encountered: