-
Notifications
You must be signed in to change notification settings - Fork 420
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
fixed out of bounds in line mapping #1707
Conversation
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.
@JoeRobich @david-driscoll any objections? can this be merged? |
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 am fine with this change. Just not an area I know much about. =)
if (hasMappedPath) | ||
{ | ||
SourceText source = null; | ||
if (documents != null && documents.Any() && documents.FirstOrDefault(d => d.TryGetText(out source)) != null) |
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 as familiar with line mappings. Would it be more correct to loop through the documents where you can get text and see if the mapping applies?
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.
documents.Any()
isn't necessary now that you are using FirstOrDefault
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 think this can only ever return more than 1 in case of multi targeting so the document text would be identical
Fixes dotnet/vscode-csharp#3485
Also added more comprehensive tests.
Here is the summary of the logic:
cc @NTaylorMullen as this bug affected Razor 🙈