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

workspace command: extract an expression to a function #438

Open
NJichev opened this issue Apr 24, 2024 · 0 comments
Open

workspace command: extract an expression to a function #438

NJichev opened this issue Apr 24, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers workspace-command

Comments

@NJichev
Copy link
Collaborator

NJichev commented Apr 24, 2024

A workspace command that extracts a selected expression to a private function:

Example:

defmodule Example do
  def run() do
    n = 2
    |m = n + 2
    # Calculate
    k = m + n|
    g = 3
  end
end

Selecting the specified region between the pipes should result in:

defmodule Example do
  def run(list) do
    n = 2
    fun(n)
    g = 3
  end

  defp fun(n) do
    m = n + 2
    # Calculate
    k = m + n
  end
end

Consider the following scenarios:

  • Any unbound variables in this expression should become extra arguments to the function and be passed from the caller
@NJichev NJichev added enhancement New feature or request workspace-command labels Apr 24, 2024
@NJichev NJichev mentioned this issue Apr 24, 2024
7 tasks
@NJichev NJichev added the good first issue Good for newcomers label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers workspace-command
Projects
None yet
Development

No branches or pull requests

1 participant