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

JavaScript refactoring Renaming a variable #8390

Open
IndependentCommunity opened this issue Apr 3, 2025 · 2 comments
Open

JavaScript refactoring Renaming a variable #8390

IndependentCommunity opened this issue Apr 3, 2025 · 2 comments
Labels
JavaScript [ci] enable web job and extra JavaScript tests (webcommon/javascript2.editor) kind:feature A feature request needs:triage Requires attention from one of the committers

Comments

@IndependentCommunity
Copy link

Description

Is there a plan to add at least a draft version of variable refactoring for JavaScript to the environment?
I think that when refactoring, a window with drains and checkboxes should be created in advance, where it is suggested to make a replacement, and the user could use checkboxes to choose where to make the replacement and where not. A regular replacement would be suitable for this approach.

Overall the JavaScript editor is lightweight and fast, but it lacks refactoring.

Use case/motivation

No response

Related issues

No response

Are you willing to submit a pull request?

No

@IndependentCommunity IndependentCommunity added kind:feature A feature request needs:triage Requires attention from one of the committers labels Apr 3, 2025
@IndependentCommunity
Copy link
Author

IndependentCommunity commented Apr 3, 2025

In fact, a lot ready in NetBeans to make refactoring. Look at the code:

Image

I select the const c and the editor highlights it correctly inside the Test1 function. That is, it does not highlight a variable with the same name in another Test2 function. Only needs to add a replacement in the highlighted places by [F2] key.

(Testing was carried out in version 15)

@troizet troizet added the JavaScript [ci] enable web job and extra JavaScript tests (webcommon/javascript2.editor) label Apr 3, 2025
@matthiasblaesing
Copy link
Contributor

What you are showing the screenshot already works. Place cursor on variable, press "CTRL + r"

Image

Make the modifications to the variable name

Image

Press enter

Image

When NetBeans talks about "Refactoring", it means the potential to rename functions, fields, classes and adjust all call sites throught the whole codebase. The problem here is, that JS has very loose coupling between related files and you can only guess when the same name means the same thing. This only becomes easier with modules, but even the globals exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScript [ci] enable web job and extra JavaScript tests (webcommon/javascript2.editor) kind:feature A feature request needs:triage Requires attention from one of the committers
Projects
None yet
Development

No branches or pull requests

3 participants