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

Feature Request: Add refactor functionality #436

Closed
eddy147 opened this issue Dec 12, 2020 · 16 comments
Closed

Feature Request: Add refactor functionality #436

eddy147 opened this issue Dec 12, 2020 · 16 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@eddy147
Copy link

eddy147 commented Dec 12, 2020

Environment

Ubuntu 20.04

  • Elixir & Erlang versions (elixir --version):
    Erlang/OTP 23 [erts-11.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
    Elixir 1.11.2 (compiled with Erlang/OTP 23)

  • Operating system:
    Distributor ID: Ubuntu
    Description: Ubuntu 20.04.1 LTS
    Release: 20.04
    Codename: focal

  • Editor or IDE name (e.g. Emacs/VSCode):
    VSCode and neovim

  • Editor Plugin/LSP Client name:
    neovim: elixir-editors/vim-elixir + https://github.com/elixir-lsp/coc-elixir
    vscode: elixirLS 0.6.2

For other language servers I am used to the refactor/rename functionality, where I can rename functions/variables and the plugin will rename it smartly (other than find and replace).

I am missing that in elixirLS or I can not find it in the documentation. I have tried it in vscode and in (neo)vim.

@axelson axelson changed the title RFC: Add refactor functionality Feature Request: Add refactor functionality Dec 12, 2020
@axelson axelson added enhancement New feature or request help wanted Extra attention is needed labels Dec 12, 2020
@axelson
Copy link
Member

axelson commented Dec 12, 2020

Hi, thanks for the request. Indeed ElixirLS does not currently support refactoring/renaming, but if someone were to tackle it we'd be glad to help get it merged. (I renamed the title of your request to make it more obviously a feature request).

@HaleTom
Copy link

HaleTom commented Apr 27, 2021

Building the web one link at a time...

I was directed here by this StackOverflow question.

@garrettmichaelgeorge
Copy link

Hi, thanks for the request. Indeed ElixirLS does not currently support refactoring/renaming, but if someone were to tackle it we'd be glad to help get it merged. (I renamed the title of your request to make it more obviously a feature request).

@axelson I'd love to see this feature as well as other refactoring capabilities. If you could point me in the right direction, I'd love to take a crack at this.

I'm guessing refactoring commands would go in apps/language_server/lib/language_server/providers/execute_command, perhaps in a nested refactoring directory. Am I on the right track here?

@axelson
Copy link
Member

axelson commented May 23, 2021

@garrettmichaelgeorge yes, you are on the right track.

#521 is finishing up the implementation of ManipulatePipes which is the only thing that would fall under refactoring at this point. In the future we could add a refactoring directory, but I don't think we need that yet since there's only a small handful of commands currently supported.

@garrettmichaelgeorge
Copy link

garrettmichaelgeorge commented Sep 3, 2021

Sorry I haven't had a chance to follow up on this yet.

I know there's been a lot of (edit: exciting!) discussion lately about recent efforts like Rfx and Sourceror.

While I was focusing on building Sourceror to be this foundation, folks like Andy Leak started working on a framework to build refactoring operations called Rfx. It's nicely coming together and it will soon be ready enough to be able to use Sourceror to perform complex refactoring operations and integrate with existing tooling like ElixirLS or Credo, so check it out too!
https://dorgan.netlify.app/posts/2021/07/preparing-the-ground-for-source-code-manipulation/

With those libraries tackling Elixir source code manipulation at a deeper level, I'm wondering if I should hold off on attempting something here and instead support their development.

@Sleepful
Copy link

Sleepful commented Aug 4, 2022

Hi, I would love to see this implemented.
But I imagine this is not currently possible with the "find all references" as it currently is, seems like "find all references" is really clunky, sometimes it works and gives me a list of references on my lsp-mode buffer, sometimes it just doesn't do anything. Gotta find the references first before being able to rename them.

@GGuinea
Copy link

GGuinea commented Aug 12, 2022

@lukaszsamson do you have any thoughts about it? Is it possible? :)

@nichita-pasecinic
Copy link

any updates on it ?
would be really nice to have it and to refactor (at least rename) without pain )

@axelson
Copy link
Member

axelson commented Sep 5, 2022

Hi all, if you'd like this to be built please just leave a 👍 on the issue itself. Comments asking for this to be implemented are not helpful and end up just making noise for the maintainers.

If you're interested, please contribute to some of the tools that are operating in this space. Once one of them is stable and can handle all the edge cases for a given refactoring we can consider bringing it in. Here's some refactoring tools that I'm aware of that you can checkout, try, and submit PRs to:

@lukaszsamson
Copy link
Collaborator

I'm definitely in favour of introducing refactor functionality. Let's divide it into separate and actionable items. "Add refactor" is simply not actionable

@timgent
Copy link

timgent commented Oct 21, 2022

@lukaszsamson any thoughts on what the separate items would be?

I'm happy to create an issue for rename functionality if that is helpful? I've started trying to pick up from the POC here - Tuxified#1 (his original PR here - #676)

@lukaszsamson
Copy link
Collaborator

Refactoring is not high on my priority list. I'd be happy if someone from the community was wiling to continue the work started by others in the experimental server

@eddy147
Copy link
Author

eddy147 commented Jun 8, 2023

I'm definitely in favour of introducing refactor functionality. Let's divide it into separate and actionable items. "Add refactor" is simply not actionable

If 'Add refactor' is not actionable, pls add feature requests that are, and ask the the community to pick that up, before you close this request.

@lukaszsamson
Copy link
Collaborator

If 'Add refactor' is not actionable, pls add feature requests that are, and ask the the community to pick that up, before you close this request.

That's not how it works. How can the maintainers guess what exactly the community wants. There are already a few ones open e.g. #765, #676 #861 #803. If you have ideas pleas onen new issues/PRs. The progress on those has slowed down though since @scohen stopped contributting

@scohen
Copy link
Contributor

scohen commented Jun 12, 2023

The progress on those has slowed down though since @scohen stopped contributting

@lukaszsamson I'd like to talk to you about what's going on here, can we schedule some time on slack?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

11 participants