-
Notifications
You must be signed in to change notification settings - Fork 58
Psi: Support auto property get set access modifiers #1007
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
Conversation
4f87705 to
802ba94
Compare
auduchinok
left a comment
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.
Great work! I've left some comments, could you take a look?
ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/AICore/FSharpFileSummarizer.fs
Outdated
Show resolved
Hide resolved
ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Parsing/FSharpTreeBuilderBase.fs
Outdated
Show resolved
Hide resolved
| x.Done(memberRange, accessorsMark, ElementType.ACCESSORS_NAMES_CLAUSE) | ||
| member x.ProcessAccessorsNamesClause(getSetKeywords) = | ||
| match getSetKeywords with | ||
| | Some getSetKeywords -> |
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.
Would be really cool to add some recovery to the compiler here and to allow having other names (e.g. coming from an error), instead of allowing parsing with the expected names only.
ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Parsing/FSharpTreeBuilderBase.fs
Outdated
Show resolved
Hide resolved
ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Impl/DeclaredElement/FSharpPropertyBase.cs
Outdated
Show resolved
Hide resolved
ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Impl/DeclaredElement/ModuleValue.cs
Outdated
Show resolved
Hide resolved
...est/data/cache/csharpResolve/Properties 22 - Accessor modifiers - Private getter - Auto.gold
Outdated
Show resolved
Hide resolved
.../test/data/cache/csharpResolve/Properties 22 - Accessor modifiers - Private getter - Auto.cs
Outdated
Show resolved
Hide resolved
...est/data/cache/csharpResolve/Properties 22 - Accessor modifiers - Private getter - Auto.gold
Outdated
Show resolved
Hide resolved
| public bool IsAutoPropertyAccessor => | ||
| ParametersDeclarationsEnumerable.IsEmpty() && EqualsToken == 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.
Would it also be true for non-auto properties in interfaces and signatures?
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.
Possibly it requires a better name. The idea is to designate accessors consisting of 'simple' names syntactically. So it should be true for properties in interfaces and signatures
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.
Maybe try something along HasParameters, IsParameterless, IsImplicit?
d338367 to
2a907e8
Compare
auduchinok
left a comment
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.
@DedSec256 This is a very nice refactoring! Thanks a lot for it 🙂
| [<Test>] member x.``Auto property 04 - Abstract``() = x.DoNamedTest() | ||
| [<Test>] member x.``Auto property 05 - With getter - Access modifier``() = x.DoNamedTest() | ||
|
|
||
| // TODO: fix in the formatter |
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.
Thanks for adding this todo here! I was going to suggest it while looking at the test data :)
| IAccessorsNamesClause | ||
| FSharpTokenType+WithTokenElement(type:WITH, text:with) | ||
| Whitespace(type:WHITE_SPACE, text: ) spaces:" " | ||
| FSharpTokenType+WithTokenElement(type:WITH, text:with) | ||
| Whitespace(type:WHITE_SPACE, text: ) spaces:" " | ||
| IAccessorDeclaration | ||
| FSharpIdentifierToken(type:IDENTIFIER, text:get) | ||
| FSharpTokenType+CommaTokenElement(type:COMMA, text:,) | ||
| Whitespace(type:WHITE_SPACE, text: ) spaces:" " | ||
| FSharpTokenType+CommaTokenElement(type:COMMA, text:,) | ||
| Whitespace(type:WHITE_SPACE, text: ) spaces:" " | ||
| IAccessorDeclaration |
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.
One small downside of this change is 'Extend Selection' would not select the accessors clause anymore. I'd suggest adding a separate rule there to prevent 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.
What do you think about doing this in the next PR?
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.
That would be fine.
No description provided.