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

Please add renaming

Open tinganho opened this issue 10 years ago • 142 comments

It would be very useful if this tool also supported renaming of variables.

tinganho avatar Oct 18 '16 16:10 tinganho

@yamcenutzer maybe I am missing the references, but this was exactly what I was thinking. so don't put people that ask this into the corner. Would you be so kind and provide some references to your claim, which I indeed believe that they are right; but I would love to understand the reasoning of not utilizing clangd/LLVM API for implementing C++ IntelliSense in VS Code. :-)

christianparpart avatar Aug 04 '19 18:08 christianparpart

Each engine has pros and cons. The Visual C++ team (whose engine we reuse) evaluates using Clang for IntelliSense from time to time, but as of the last investigation the data didn't sway us to replace our current engine based on EDG's front end compiler with a new one.

But I can envision a world where clangd is added as an intelliSenseEngine at some point. I can't promise any dates for that though.

bobbrow avatar Aug 05 '19 16:08 bobbrow

so once again it was confirmed that MS will stick to EDG. feel better now? Let's just not distract the team from actually getting this feature released using whatever means they prefer.

yamcenutzer avatar Aug 05 '19 19:08 yamcenutzer

In the meantime you could explore ccls https://github.com/MaskRay/ccls

bhack avatar Aug 05 '19 20:08 bhack

We added Find All References -- see the comment at https://github.com/microsoft/vscode-cpptools/issues/15#issuecomment-519758952 for the details on how try it out. If you find bugs with that, it could also impact Rename, so let us know. Rename will take a few more weeks (?) -- in particular, overloads are currently not treated as a reference, which VS deals with via having users opt-in to add them via a special Rename UI that VS Code doesn't support yet.

sean-mcmanus avatar Aug 09 '19 03:08 sean-mcmanus

How do I upvote this feature request?

ghost avatar Aug 11 '19 21:08 ghost

@george-code You can click the thumbs up image in the initial post (that has 425+ thumbs up currently. This is the next major feature we plan to implement.

sean-mcmanus avatar Aug 12 '19 18:08 sean-mcmanus

Status update: we have V1 rename, but it only renames "confirmed" references and just shows the other non-confirmed references in the Output window (similar to what Find All References does). Would people find that useful to release in an Insiders next week? Our current plan is to not release this V1 until we're able to add a Tree Container with a Preview that allows users to add non-confirmed references to the rename operation, similar to what VS C++ has, which might take a couple more weeks (not sure), e.g.

image

But instead of the checkboxes (which VS Code doesn't support), we're planning to put the "checked" items in a "pending rename" group at the top (similar to Staged changes with the Source Control UI), which defaults to the confirmed references, and unchecked items would go in a "rename candidates" group at the bottom, which defaults to the "other" references, with + and - buttons for moving references between the 2 groups. Showing a doc preview of the rename might go into a V3 (similar to what Search/Replace shows).

One reason this more complicated UI would be desirable is for enabling renaming of all the overloads of a method -- V1 only renames the one particular overload, although that matches what the C# extensions does. A similar issue occurs with renames of a base class method not applying to method overrides in the derived classes by default (related to https://github.com/microsoft/vscode-cpptools/issues/4078) -- in which case VS allows users to select which derived classes they want the rename to apply to.

However, the preview UI would require clicking another UI element to complete the rename -- is that okay or would people prefer a different "Rename Symbol (With Preview)" command?

Let us know if anyone has feedback on this.

sean-mcmanus avatar Sep 04 '19 01:09 sean-mcmanus

It's great to see some real progress on this. I think a release that only renames "confirmed" references could be very useful, since I would guess that's what I want at least 90% of the time anyway.

ScottHutchinson avatar Sep 04 '19 01:09 ScottHutchinson

@sean-mcmanus

Sorry to be a pain, but which version is this feature released in? (if it is in a release) or do I need to compile it myself (I think I would rather wait though!), thanks : )) ... been looking forward to this one for an ages - but other than this feature VS code is one of the best, if no the best, free IDE out there - thanks to you and your team : ))

code-fodder avatar Sep 13 '19 14:09 code-fodder

@code-fodder It hasn't been released yet. We're still working on the UI (and bug fixes). We're planning for an Insider release this week, but it may be get delayed to next week.

sean-mcmanus avatar Sep 16 '19 19:09 sean-mcmanus

Rename is available to try out with https://github.com/microsoft/vscode-cpptools/releases/tag/0.26.0-insiders . If you find bugs, please file new issues so we can fix them before the final release.

sean-mcmanus avatar Oct 02 '19 02:10 sean-mcmanus

@sean-mcmanus VC showing progress bar running continuously while renaming a variable. Sometimes this case happens immediately, and sometimes it works fine. 🤔 When the progress bar is running continuously then I have to restart the full VC code to work it again. Getting Error: Connection to server got closed. Server will not be restarted.

karan-k-deepr avatar Oct 07 '19 09:10 karan-k-deepr

@karan-k-deepr "Connection to server got closed" means our main process has crashed. We have some known crashes we plan to fix in our pending 0.26.0-insiders3. By "progress bar" do you mean the progress bar in the document or the progress in the bottom right? If the rename side panel is open, then the progress bar in the document is expected until the rename is confirmed.

sean-mcmanus avatar Oct 07 '19 18:10 sean-mcmanus

@sean-mcmanus Today I tried several times but got this error again after some trial. And progress bar at the upper side of window, Also it doesn't open any rename window this time. image

I believe it is something related to the parsing of files because I can see it is printing some lines within Problems tab when it switches files for parsing, and got stuck. Is there any way to provide logs for this?

karan-k-deepr avatar Oct 08 '19 08:10 karan-k-deepr

@karan-k-deepr If you can attach a debugger to the crashing process to get a call stack or provide more repro details. 0.26.0-insiders2 has a known crash when a document is opened related to the Outline view, but we haven't been able to repro any crash involving rename yet.

sean-mcmanus avatar Oct 09 '19 00:10 sean-mcmanus

I'm using 1.39.0 full info from about below and I get the dancing document status with C++ RENAME bar on the left-hand-side. There's content in there that's valid (Pending Rename items and Candidates for Rename items). The problem is, I have no idea what to click or press to get anything to apply. Eventually, if I click in the document and press a key, everything goes away, but the rename NEVER works. Was working fine up until I updated a day or two ago. :'(

I'm on Ubuntu 16.04 LTS.

Version: 1.39.0 Commit: 9df03c6d6ce97c6645c5846f6dfa2a6a7d276515 Date: 2019-10-09T06:58:03.188Z Electron: 4.2.10 Chrome: 69.0.3497.128 Node.js: 10.11.0 V8: 6.9.427.31-electron.0 OS: Linux x64 4.15.0-65-generic

monkeycoder99 avatar Oct 12 '19 20:10 monkeycoder99

@monkeycoder99, if you hover over the "PENDING RENAME" title menu bar, controls for the rename list will appear, see screenshot below. Use the checkmark button to commit or apply pending rename items. Editing a file will cause rename to cancel automatically.

The rename view container will only appear if there are other references results or non-confirmed references like a string reference. If you do a rename on a symbol with results that are all confirmed references then rename will be applied automatically.

image

michelleangela avatar Oct 14 '19 16:10 michelleangela

Thanks. When I hover, I can see some useful tooltips but in dark mode, these buttons are invisible. vscode rename (3)_LI

monkeycoder99 avatar Oct 14 '19 17:10 monkeycoder99

@monkeycoder99 , I am not able to repro the issue of the buttons being invisible on dark theme with 0.26.0-insiders3. Is there a particular theme you're using that could be causing this? Can you verify if the buttons are also invisible for other dark themes?

michelleangela avatar Oct 14 '19 17:10 michelleangela