Skip to content

Conversation

@DedSec256
Copy link
Contributor

No description provided.

@DedSec256 DedSec256 force-pushed the ber.a/autoPropertyModifiers branch 3 times, most recently from 4f87705 to 802ba94 Compare November 14, 2025 01:58
@DedSec256 DedSec256 changed the title Psi: Support get set access modifiers Psi: Support auto property get set access modifiers Nov 14, 2025
@DedSec256 DedSec256 marked this pull request as ready for review November 14, 2025 03:51
Copy link
Member

@auduchinok auduchinok left a 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?

x.Done(memberRange, accessorsMark, ElementType.ACCESSORS_NAMES_CLAUSE)
member x.ProcessAccessorsNamesClause(getSetKeywords) =
match getSetKeywords with
| Some getSetKeywords ->
Copy link
Member

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.

Comment on lines 78 to 79
public bool IsAutoPropertyAccessor =>
ParametersDeclarationsEnumerable.IsEmpty() && EqualsToken == null;
Copy link
Member

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?

Copy link
Contributor Author

@DedSec256 DedSec256 Nov 19, 2025

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

Copy link
Member

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?

^ Conflicts:
^	ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Impl/DeclaredElement/FSharpProperty.cs
^	ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Tree/IAccessorDeclaration.cs
@DedSec256 DedSec256 force-pushed the ber.a/autoPropertyModifiers branch from d338367 to 2a907e8 Compare December 9, 2025 12:33
Copy link
Member

@auduchinok auduchinok left a 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
Copy link
Member

@auduchinok auduchinok Dec 11, 2025

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 :)

Comment on lines -37 to +43
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
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

That would be fine.

@DedSec256 DedSec256 merged commit 1053af3 into main Dec 12, 2025
1 check passed
@DedSec256 DedSec256 deleted the ber.a/autoPropertyModifiers branch December 17, 2025 14:19
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.

3 participants