2022-06-14 11:17 AM
In Visual Studio there is. I found there is the "Implement method" option in the IDE context menu, but it does nothing.
My project is properly configured, IDE knows where's the header and the source file. I can switch between them quickly. It's pretty annoying I have to type entire implementation by hand (or copy and paste it from the header) instead of some automatic function. It would be the best if all methods from the header would be automatically implemented as empty methods. Is it possible in STM32CubeIDE, or maybe I need a plugin for that?
2022-06-15 03:30 AM
Another surprise: I tried it on another class that contains only static members. It worked. I tried that on any other class in my project and it doesn't work. Maybe it's because multiple inheritance, but IDK, views inherit only from one base class. It works only on one class that doesn't inherit from anything and contains only static members.
OK, I played a little with this feature in Visual Studio Code. It doesn't have that function at all and it's even unable to switch between headers and sources despite the feature exists in the menu.
However - I installed first extension for a search "header source" and it works flawlessly. So then I installed "C++ Helper" extension that claims to have "Implement method" option. It does and it works. Just not as expected. It creates the implementation IN THE SAME FILE. As I discovered in its options: it does that when it can't find the source file for the header.
And here's the exact IDE BUG location - both functions (in STM32CubeIDE and VSCode extension) are not aware of the code structure. They look for the source in certain "default" (guessed) locations, and if the file structure of the project is not obvious - they just fail to find the source file. As I can forgive it to the third party extension that may not have entire knowledge about the project structure - for a built-in IDE feature it's a bug. It knows where the source is. Also, the "header / source" extension for VSCode also seems to know where the source file is. The algorithm for it can be braindead simple - just find the file in the project root with the same base name and extension .c / .cpp. I know, there can be more than one such file, but it's rare and then it could fail. It fails even when there's only 1 such file.