scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.07k stars 323 forks source link

Support rename for global symbols #290

Closed olafurpg closed 5 years ago

olafurpg commented 6 years ago

Following up from offline discussions at ScalaSphere.

Currently, metals supports rename for local symbols only. This means it's possible to rename a variable inside a block, but not possible to rename a top-level class/object/def.

The way I imagine rename will work is that we'll use the symbol index to find all references to the symbol being renamed. We already have a symbol index, however several challenges need to be addressed first before we blindly start using it

@ShaneDelmore would you be interested to take on this ticket?

ShaneDelmore commented 6 years ago

I'll take this ticket.

olafurpg commented 6 years ago

The current VS Code milestone has a proposal to allow WorkspaceEdit to create/rename/delete files https://code.visualstudio.com/updates/v1_25#_workspaceedit-can-createrenamedelete-files

WorkspaceEdit can create/rename/delete Files We have added a proposed API that extends WorkspaceEdit so that it can be used to create, rename, and delete files or folders. This is useful for complex refactorings, for example renaming a file when a type is being renamed, but should also enable other scenarios.

I suspect this will eventually make it into LSP once validated.

ShaneDelmore commented 6 years ago

I completely forgot about this, so sorry! I’m not working on LSP this quarter and won’t be tackling this after all, or at least not in the next few months.

olafurpg commented 5 years ago

Metals doesn't support rename anymore. Rename may get added back in the future but for now I think it's best to close this ticket to keep the issue tracker focused. We can revisit this once we have solid "find all references" working.