-
Notifications
You must be signed in to change notification settings - Fork 48
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
fix: fixed for:each error on hover #491
Conversation
Addressed an issue where a for:each was not available, and was causing an undefined error. vscode #3929
this.indexer.customData.forEach(t => { | ||
t.classMembers.forEach(cm => { | ||
this.indexer.customData?.forEach(t => { | ||
t.classMembers?.forEach(cm => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a unit test for this condition? One to cover where customData isn't defined and one for when t.classMembers isn't defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew you were gonna ask for it 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a unit test for the case when t.classMembers is undefined.
For indexer.customData, indexer.customData() is a wrapper around ComponentIndexer.tags
, and tags can never be null (in the body of the class, it's defined as readonly tags: Map<string, Tag> = new Map();
).
@@ -116,7 +116,7 @@ it('transform throws exceptions on syntax errors', async () => { | |||
// verify err has the info we need | |||
const message = extractMessageFromBabelError(err.message); | |||
expect(message).toMatch('Unexpected token (4:17)'); | |||
expect(err.location).toEqual({ line: 4, column: 17 }); | |||
expect(err.location).toEqual({ line: 4, column: 17, index: 110 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this was failing, but the addition of the index is now expected here.
What does this PR do?
Addressed an issue where a for:each was not available, and was causing an undefined error.
To reproduce, hover over an item that doesn't have associated information with it, like the value of a for:each or a class name.
What issues does this PR fix or reference?
@W-10857157@, vscode #3929