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

vscode-java allows you to attempt to rename words in comments #2873

Closed
datho7561 opened this issue Jan 11, 2023 · 4 comments
Closed

vscode-java allows you to attempt to rename words in comments #2873

datho7561 opened this issue Jan 11, 2023 · 4 comments
Assignees

Comments

@datho7561
Copy link
Contributor

If you have a line or block comment:

// this is a comment|

and you place your cursor on a word and attempt to rename it with F2, it shows the pop up to allow you to rename it, but renaming it doesn't do anything (the word stays the same).

In TypeScript, it prevents you from opening the pop up in locations where it doesn't make sense, such as words in comments or on empty lines. I also checked the Lua and Rust extensions to see if it's an LSP limitation, but they also seem to prevent the pop up.

Environment
  • Operating System: RHEL 8.7
  • JDK version: packaged JDK
  • Visual Studio Code version: 1.74.3
  • Java extension version: v1.14.2023011003
Steps To Reproduce
  1. Make a java file with a comment
  2. Try to rename one of the words in the comment with F2
Current Result

It opens the pop up to rename the word

Expected Result

It prevents the pop up from appearing and says there's nothing to rename

Additional Informations
@rgrunber rgrunber added the bug label Jan 12, 2023
@datho7561
Copy link
Contributor Author

I'm interested in working on this.

I think the way to resolve this is implementing textDocument/prepareRename support in eclipse.jdt.ls. Angelo recently made a PR to do something similar in lemminx: eclipse-lemminx/lemminx#1435

@hopehadfield
Copy link
Contributor

I'm interested in working on this

@hopehadfield
Copy link
Contributor

Took a look and found that attempting to rename a comment now results in a "Renaming this element is not supported." pop-up. I couldn't find any relevant fixes in vscode-java or eclipse.jdt.ls, so I'm assuming updates to some other dependency fixed the issue.

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in IDE Cloudaptors Jun 16, 2023
@rgrunber
Copy link
Member

Yup, it looks fixed for me also. David reported it at the start of 2023. The only thing I can think of is maybe eclipse-jdtls/eclipse.jdt.ls#2417 fixed it since that touched the prepareRename logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants