Skip to content

Include range of attributes in parent (implementation files) #11495

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

Merged
merged 8 commits into from
Apr 30, 2021

Conversation

nojaf
Copy link
Contributor

@nojaf nojaf commented Apr 28, 2021

Fixes #11486.
In this PR I tried to take attributes into account when constructing the range of SynBinding and others.
Most likely some tests outside of FCS might break due to corrected ranges.
I'll tackle those if they pop up.

@@ -651,11 +651,11 @@ type T() =
"""
=> [ (2, 5, 11, 12), (2, 7, 11, 12)
(3, 4, 4, 12), (3, 7, 4, 12)
(3, 4, 4, 12), (4, 8, 4, 12)
(3, 4, 4, 12), (3, 10, 4, 12)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@auduchinok I winged this test a bit 😅.
In the parser I updated the range of SynMemberDefn.Member(SynBinding (None, SynBindingKind.Normal, false, false, $1, grabXmlDoc(parseState, 3), valSynData, declPat, None, expr, mWholeBindLhs, DebugPointAtBinding.NoneAtInvisible), m) (see line 1988) to only included the lhs of the SynBinding and not the entire range m.
This is the case with all the other SynBindings, so I thought I could fix this and make it consistent.

So, that leads to a change in getOutliningRanges (in ServiceStructure.fs) where at this point I'm not really sure what I did is correct. Any thoughts here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We ignore some of these ranges in ServiceStructure in Rider, and from a glance it looks like it won't affect us. Not sure about other users, though.

@nojaf nojaf force-pushed the include-range-attributese branch 2 times, most recently from 0de1c85 to 555a5f3 Compare April 28, 2021 19:35
@nojaf nojaf closed this Apr 29, 2021
@nojaf nojaf reopened this Apr 29, 2021
@nojaf
Copy link
Contributor Author

nojaf commented Apr 29, 2021

Ready for review.

@nojaf nojaf force-pushed the include-range-attributese branch from 555a5f3 to de3588c Compare April 29, 2021 19:12
@nojaf nojaf closed this Apr 29, 2021
@nojaf nojaf reopened this Apr 29, 2021
@nojaf nojaf force-pushed the include-range-attributese branch from de3588c to 5cd90a9 Compare April 30, 2021 05:58
Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cartermp
Copy link
Contributor

I believe this should also fix a problem in the quick fixer that removes unused bindings where the attribute(s) could be left dangling.

@cartermp cartermp merged commit 2b64f21 into dotnet:main Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attributes not included in the range of the parent node
3 participants