Skip to content
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

LSP: code action to remove redundant tuple in case subject #3057

Merged
merged 21 commits into from
May 15, 2024

Conversation

nicklimmm
Copy link
Contributor

@nicklimmm nicklimmm commented Apr 28, 2024

Closes #2982

Supports batch removal.

Also adds a basic visitor pattern to walk the typed AST.

@nicklimmm nicklimmm marked this pull request as ready for review April 29, 2024 15:03
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Very nice!!! I'm impressed with how cleanly you've done this.

I've left some comments inline, thank you.

typ: &'ast Arc<Type>,
subjects: &'ast [ast::TypedExpr],
clauses: &'ast [ast::TypedClause],
) {
Copy link
Member

Choose a reason for hiding this comment

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

Oh this is super cool! I love the approach you've taken here, and I think we could use it for lots of other things too.

Could we get more comments that detail what this class does and the approach it uses to doing it. Thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to check, are you referring to the usage of the Visit trait?

Copy link
Member

@lpil lpil May 7, 2024

Choose a reason for hiding this comment

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

Everything! Ideally all logic should have comment explaining the intent in plain English as it's not clear if you either don't have context or are a newcomer to the codebase. Being approachable is super important for Gleam's long-term maintainability as we don't have a big corporate sponsor.

compiler-core/src/ast/visit.rs Show resolved Hide resolved
compiler-core/src/ast.rs Outdated Show resolved Hide resolved
compiler-core/src/ast/visit.rs Outdated Show resolved Hide resolved
compiler-core/src/language_server/tests/action.rs Outdated Show resolved Hide resolved
@nicklimmm nicklimmm requested a review from lpil May 1, 2024 16:11
@nicklimmm nicklimmm force-pushed the remove-redundant-tuple-in-case-subject branch from c1823ab to 0be238d Compare May 7, 2024 05:16
@nicklimmm nicklimmm force-pushed the remove-redundant-tuple-in-case-subject branch from 0be238d to 65ab5b9 Compare May 7, 2024 05:24
@nicklimmm
Copy link
Contributor Author

Bumping in case you missed this @lpil

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Lovely! Really nice! I've left a few small notes inline, once done and the code has been commented I think we're good to go!

Thanks again

compiler-core/src/ast/visit.rs Outdated Show resolved Hide resolved
compiler-core/src/parse/extra.rs Outdated Show resolved Hide resolved
@nicklimmm nicklimmm requested a review from lpil May 10, 2024 05:43
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Thank you!!!

@lpil lpil enabled auto-merge (rebase) May 15, 2024 17:35
@lpil lpil merged commit a85dba1 into gleam-lang:main May 15, 2024
12 checks passed
@nicklimmm nicklimmm deleted the remove-redundant-tuple-in-case-subject branch May 16, 2024 06:45
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.

LSP: action to remove redundant tuple wrapper from case expression's subject
2 participants