Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Update JS Function Name on every Call #10302

Open
O4D opened this issue Jan 3, 2015 · 4 comments
Open

Update JS Function Name on every Call #10302

O4D opened this issue Jan 3, 2015 · 4 comments

Comments

@O4D
Copy link

O4D commented Jan 3, 2015

Hello,

Would it be possible to add the feature to update all the call of a js function when we change his name ?

For example, on this code...
1 function MyFunction(){return true;}
2
3 MyFunction();
4
5 if(true){MyFunction();}

...if I change " function MyFunction " to " function DaFunction ", the line 3 and 5 would be automatically be updated.

Regards,

O4D

@sbruchmann
Copy link

Hello @O4D,

there are currently two extensions that implement a slightly different behaviour, but are the closest you can get:

I personally recommend to install ternific if you want better autocompletion for JavaScript.

@marcelgerber
Copy link
Contributor

Also, what you can do without extensions:

  • Replace all occurrences using Replace (Ctrl+H)
  • Select all occurrences (using Find all and select (Alt+F3) or Add next match to selection (Ctrl+B)) and override them

It may not be that comfortable, but it's still pretty quick

@peterflynn
Copy link
Member

It's essentially impossible to make a 100% reliable version of this feature for JavaScript -- unlike statically-typed languages such as Java. Type inference can give pretty accurate results, and ask the user to confirm in cases where the correct action is ambiguous -- I believe that's what the few tools that do offer this for JS (like WebStorm) do. Question is whether the Tern type inference engine inside Brackets could do that well enough for this feature to feel much better than the simple Replace commands we have today.

@O4D
Copy link
Author

O4D commented Apr 24, 2015

Thank you for your answer. I were very busy these last month but it helps me to know the real capacity of Brackets.

I think today I'll use " Select all occurrences (using Find all and select (Alt+F3)) ", and I already begin to use Ctrl+E to find the original function's definition.

But i'm a little sad to not find equals features than in Visual Studio (C#)...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants