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

Add "generate function" code action #4168

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

giacomocavalieri
Copy link
Member

@giacomocavalieri giacomocavalieri commented Jan 11, 2025

This PR adds a "generate function" code action. Here's an example showcasing it in various scenarios (function calls, pipelines, functions inside pipelines):

This PR is a WIP since it's based on #4167 and won't work properly until that's merged

@giacomocavalieri giacomocavalieri marked this pull request as ready for review January 11, 2025 16:40
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.

Awesome, thank you.

One small thing inline!

.named_type_name()
.map(|(_type_module, type_name)| type_name.to_snake_case())
.filter(|name| is_valid_function_name(name))
.unwrap_or(String::from("arg"));
Copy link
Member

Choose a reason for hiding this comment

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

Let's use a real word rather than arg. We don't abbreviate in Gleam.

Copy link
Member Author

Choose a reason for hiding this comment

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

Would you prefer "value" or "argument" or something else entirely?

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.

2 participants