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

feat: add require code action #375

Merged
merged 5 commits into from
Feb 24, 2024

Conversation

NJichev
Copy link
Collaborator

@NJichev NJichev commented Feb 22, 2024

This adds a require code action that adds require Module to your module whenever a macro is used without requiring it beforehand.
It tries to insert the require after all the top level Elixir macros(moduledoc, alias, require, import).

end
end
"""
text =
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We get the text as a list of lines, which for the unused variable code isn't a problem but it's better to be consistent if anyone copies simple tests from other files like me.

name =
alias
|> Module.concat()
|> to_string()
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you use Macro.to_string it doesn't include the Elixir. prefix

NJichev and others added 5 commits February 24, 2024 17:00
This adds a require code action that adds `require Module` to your module whenever a
macro is used without requiring it beforehand.
It tries to insert the require after all the top level Elixir
macros(moduledoc, alias, require, import).
@mhanberg mhanberg enabled auto-merge (squash) February 24, 2024 22:16
@mhanberg mhanberg merged commit 1d5ba4f into elixir-tools:main Feb 24, 2024
13 checks passed
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