cancel
Showing results for 
Search instead for 
Did you mean: 

Does CubeIDE refactor methods in class between header and source ?

Matth1
Associate III

When developing a class, can CubeIDE update a method's name in the .cpp file when it's modified in the .h (the sme the other way around)? Or do we have to modify both files?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Yes it will. Use Refactor -> Rename (Alt+Shift+R)

Any calls to it are also updated, assuming your index is valid.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

8 REPLIES 8
TDK
Guru

Yes it will. Use Refactor -> Rename (Alt+Shift+R)

Any calls to it are also updated, assuming your index is valid.

If you feel a post has answered your question, please click "Accept as Solution".
Matth1
Associate III

OK, so I must be doing something wrong.

[a few minutes later] : Ooh I found the "implement method" tool. Ok.

So if I don't use this "implement method" tool, how can I make the indexer link the method's declaration and definition?

TDK
Guru

You don't need to do anything special. Type the header and class definitions correctly, make sure they're used (or at least compiled) in your project, make sure it builds correctly. You can rebuild the index but shouldn't need to.

If you feel a post has answered your question, please click "Accept as Solution".
Matth1
Associate III

So I need to build it (hammer icon) and that's when they get linked?

No, but if it builds, it means you don’t have typos and the IDE can interpret the code.

Edit: or hit F3 on the declaration and ensure it jumps to the definition.

If you feel a post has answered your question, please click "Accept as Solution".
mattias norlander
ST Employee

Did you solve the issue?

Is the header file only setup as an include path but not as a resource (folder/file) visible in the project explorer?

If so, the CDT Indexer will not keep track of changes inside the include path directory.

Consequently many CDT features like refactoring will not work well.

Yes, I think the issue was that I need to save a file for the indexer to acknowledge a method written within (it then appears in the autocomplete tool).

I don't think UM2609 mentions anything about that. Is there another UM for CubeIDE?

Another question on the subject: are there tools that helps with deleting a member variable or a method cleanly?