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] Prefill rename dialog with current symbol name #106

Closed
sebthom opened this issue Apr 15, 2022 · 7 comments · Fixed by #156
Closed

[feature] Prefill rename dialog with current symbol name #106

sebthom opened this issue Apr 15, 2022 · 7 comments · Fixed by #156
Labels
bug Something isn't working

Comments

@sebthom
Copy link
Member

sebthom commented Apr 15, 2022

When using ALT+SHIFT+R to rename e.g. a field or method, the rename dialog does not prefill the current name nor has any context information on what is going to be renamed:
image

It would be nice to have the current name in the New Name field as default instead of the newName placeholder.

@sebthom sebthom added the enhancement New feature or request label Apr 15, 2022
@PyvesB
Copy link
Contributor

PyvesB commented Jun 3, 2022

I implemented this a while back in ade065d. The language server must support the prepareRename request. You can test this out with the Eclipse Ruby integration for example. 😉

@mickaelistria
Copy link
Contributor

@sebthom How happy are you with @PyvesB 's answer? If this can work for you, then please close.

@sebthom
Copy link
Member Author

sebthom commented Jun 7, 2022

In theory yes, practically not really as it does not even seem to work for typescript files in Wild Web Developer, so either the adoption rate of prepareRename request in language servers is low or something is still broken.

@mickaelistria
Copy link
Contributor

it does not even seem to work for typescript files in Wild Web Developer

The typescript-language-server used by Wild Web Developer is not a very hot project. As VSCode and most "official" TypeScript tools to directly rely on tsserver (which does not support LSP microsoft/TypeScript#39459 ), the typescript-language-server doesn't really catch on as fast and misses some features of LSP.
Some other language servers (eg Ruby integration linked by @PyvesB , rust-analyzer used by Corrosion) do use prepareRename successful.
So unless you can give it a try and confirm this is broken, I think we can close the issue.

@sebthom
Copy link
Member Author

sebthom commented Jun 7, 2022

Ok, thanks for the explanation.

@sebthom sebthom closed this as completed Jun 7, 2022
@sebthom sebthom reopened this Jun 23, 2022
@sebthom
Copy link
Member Author

sebthom commented Jun 23, 2022

The RenameCapabilities configured in LanguageServerWrapper are not indicating support for prepareRename. That's why the rename dialog is not prefilled. This however is required by the spec, see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/

/**
 * The server provides rename support. RenameOptions may only be
 * specified if the client states that it supports
 * `prepareSupport` in its initial `initialize` request.
 */
renameProvider?: boolean | RenameOptions;

@mickaelistria
Copy link
Contributor

Thanks @sebthom . Do you plan to provide a PR for that?

@sebthom sebthom added bug Something isn't working and removed enhancement New feature or request labels Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants