BigBahss / vscode-cmantic

C/C++ code generation for VS Code: Generate Definitions, Getters, Setters, and much more.
https://bigbahss.github.io/vscode-cmantic/
MIT License
84 stars 9 forks source link

Change function signature #35

Closed BigBahss closed 3 years ago

BigBahss commented 3 years ago

This feature adds a code-action to synchronize a function's signature between it's declaration and definition. After changing a function's signature, the light-bulb will pop up to prompt you to update the declaration/definition of the function (if that function had a matching declaration/definition). This feature automatically detects changes to function signatures as you type, which makes editing feel natural as there is no need to indicate beforehand that you want to change a function's signature.

BigBahss commented 3 years ago

There's a couple limitations with this feature.

First, it only tracks changes to a single function signature. That means (for example) if you change one function signature and then start editing another, the changes to the first will be forgotten. This limitation probably won't be a big deal, but might be annoying if you forget to update the signature before editing another.

Second, there might be some problems when parameters do not have names, or if the names between declaration/definition are inconsistent. This is a difficult problem to solve.

BigBahss commented 3 years ago

Another limitation that I forgot to mention is that other references to the function will not be changed, this feature only synchronizes the definition and declaration.