maurges / vim-cpp-helper

A vim plugin to ease writing c++ code
GNU General Public License v2.0
5 stars 0 forks source link

Add the ability to change function signature #8

Open Shatur opened 4 years ago

Shatur commented 4 years ago

Most IDE allows to change function signature. It's really often needed. For example, if I have the following function:

void myFunction();

I would like to have the ability to change it definition and implementation to the following:

void myFunction(const std::string &text);

Is it possible to implement?

maurges commented 4 years ago

I've been running into this thing since I started this plugin. The problem is that, in the presence of overloads, the solutions are either ugly UX-wise, or impossible without dependency on libclang (or something like that). So I got around that problem by writing good code on my first try. =) But I think I've just thought how to make it work when there are no overloads. Let's see how that works.

Shatur commented 4 years ago

Perhaps using LSP would not be a bad solution. I think many use LSP to write C++ code. For example, I use clangd along with vim-lsp.

maurges commented 4 years ago

Sorry, external dependencies are not an option: it's inconsiderate for people who can't or won't install them, and I myself also often write on a system where I'm not allowed to. BTW, doesn't LSP itself allow you to rename/redefine symbols?

Shatur commented 4 years ago

Bad to hear. Semantic implementation will be always better then regex :(

Unfortunately, clangd, for now, do not have such features. изображение ccls do not allow this too.

BTW, I tried different plugins for generating C++ implementation and you have the best one as for me :) Especially thanks for Qt features.