vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Extract method/variable

Open JamesRamm opened this issue 6 years ago • 70 comments

Thanks for the great work on this; I am successfully using vscode-cpptools to work on a >2m line Qt project with no hitches so far :+1: :smile:

Refactoring is a huge task on such a project - support for extracting a method or variable would be great!

I.e select a section of code -> right click -> extract method (keybinding would be great aswell)

JamesRamm avatar Oct 24 '17 09:10 JamesRamm

bump

lambage avatar Feb 15 '18 20:02 lambage

Advanced refactoring is highly desired for my workflow. This would bring C++ up to speed with other VS code languages that support the refactoring features listed here: https://code.visualstudio.com/docs/editor/refactoring

hoffmael avatar Sep 11 '18 17:09 hoffmael

Bump again.

Doppp avatar Jul 14 '19 09:07 Doppp

bump - being able to refactor, extract methods and create definition from declaration is incredibly useful for efficiency.

Audhumbla5 avatar Aug 24 '19 08:08 Audhumbla5

bump

rockboynton avatar Oct 02 '19 02:10 rockboynton

bump

fv2018 avatar Oct 16 '19 16:10 fv2018

Now that Visual Studio has Refactoring abilities for other languages, any chances to bring it to C++?

GustavoOS avatar Dec 04 '19 20:12 GustavoOS

extract method, create declaration from implementation and change signature would be a giant plus. Great work on the C++ extension in general though, I am really liking it! Keep up the good spirit!

ferdinandhelmer avatar Dec 06 '19 20:12 ferdinandhelmer

Moving a function from .h to .cpp (or in the opposite direction) is another example of useful C++ specific refactoring. Some nice C++ refactorings implemented in QtCreator are given here.

nadya-p avatar Dec 18 '19 14:12 nadya-p

bump

n9wxu avatar Mar 18 '20 19:03 n9wxu

@sean-mcmanus Any plan about this recently?

Lennon925 avatar Mar 24 '20 08:03 Lennon925

@Lennon925 It's not on our plans yet -- it's our 10th most upvoted feature and we're currently working on some of the 9th and below most upvoted features for our 1.0 release (after 0.27.0).

sean-mcmanus avatar Mar 25 '20 21:03 sean-mcmanus

@Lennon925 It's not on our plans yet -- it's our 10th most upvoted feature and we're currently working on some of the 9th and below most upvoted features for our 1.0 release (after 0.27.0).

Thanks and Expect it very much~

Lennon925 avatar Mar 27 '20 06:03 Lennon925

bump

TherionIM avatar Apr 01 '20 14:04 TherionIM

bump

stefanstrat avatar Apr 22 '20 15:04 stefanstrat

Same here. Would live to highlight a section of code and have it extracted and turned it into a function.

FrightRisk avatar May 10 '20 22:05 FrightRisk

I had to take drastic measures to help with this and actually bought a CLion license. It is slow as dirt but the refactoring support is phenomenal. Would love to have this supported in VSCode which is my preferred IDE by far.

AnthonyParkssonos avatar May 26 '20 20:05 AnthonyParkssonos

I have some time on my hands before starting on my internship and would like to contribute if I can. How would I go about trying to implement this? I haven't really contributed to open source projects other than my own but this could be a good start?

My initial thought is to view the source for the languages where this feature is working (Java, Javascript, and others I think).

Can anyone point me in the right direction?

Thanks!

rockboynton avatar May 26 '20 20:05 rockboynton

looking forward to such a feature - I use it a lot on PyCharm, and would love to see it on vscode as well

noamgot avatar May 27 '20 08:05 noamgot

@rockboynton Our open source TypeScript code doesn't have access to the database and lexing code in the closed source cpptools process that would be necessary to implement this correctly. If you wanted to use another lexer/parser, then implementing a separate extension that provides the extract method variable feature would be another possibility. The interface with VS Code is the code actions APIs.

sean-mcmanus avatar May 28 '20 21:05 sean-mcmanus

@sean-mcmanus Thank you for the information. I will look into it.

rockboynton avatar May 28 '20 22:05 rockboynton

@sean-mcmanus So you're saying cpptools-srv is closed source? Is it possible to run cpptools extension with clangd as LSP server? Or should we look into https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd ?

Vanuan avatar Jul 19 '20 13:07 Vanuan

@Vanuan Yes, cpptools-srv (and cpptools) is closed source and covered by a more restrictive EULA, not the MIT license. Yeah, you can try https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd . We have not investigated invoking clangd from our extension.

sean-mcmanus avatar Jul 23 '20 00:07 sean-mcmanus

bump

zbz-cool avatar Aug 06 '20 07:08 zbz-cool

bump

JensWehner avatar Aug 16 '20 21:08 JensWehner

Another bump :)

guillermo-gerard avatar Sep 19 '20 18:09 guillermo-gerard

one more bump:)

BenthamWu avatar Oct 21 '20 01:10 BenthamWu

Add on bump to the list :-)

malife avatar Oct 23 '20 12:10 malife

Come on, 3 years... it's getting ridiculous

GustavoOS avatar Nov 14 '20 03:11 GustavoOS

Bump

Tudyx avatar Jan 21 '21 23:01 Tudyx