elixir-lsp/elixir-ls

Feature request: Quick Fix for adding function

開放

#382 建立於 2020年10月12日

 (1 則留言) (1 個反應) (0 位負責人)Elixir (226 個分叉)batch import
enhancementhelp wanted

倉庫指標

星標
 (1,772 顆星)
PR 合併指標
 (平均合併 28天 20小時) (30 天內合併 8 個 PR)

描述

One feature I miss from a previous life in Eclipse/Java is the ability to quick fix an "is undefined or private" error by adding the function at the end of the correct module. For example, if I am writing code and come across the need to get all users for a particular country, but that doesn't currently exist in the Accounts context, I might write:

assign(socket, :users_in_country, Accounts.get_all_users_for_country(country))

and then ElixirLS would complain that MyApp.Accounts.get_all_users_for_country/1 is undefined or private.

The quick fix would insert the following to the end of the MyApp.Accounts module and jump over to that file:

  def get_all_users_for_country(country) do

  end
end

with the cursor inside the function, ready to implement it.

貢獻者指南