1

I've been using Delphi 11.3 for a month or two now (after many years of using Delphi since the original), and I keep running into problems with the Refactor > Rename function and the Find > References function. These functions either don't find all the references, or they are greyed out. But it's not a complete cessation of function, as the functions may subsequently work on some variables/methods/types but not others.

Sometimes a restart of the IDE helps, but after some minutes or a few uses the same problem returns. So my question is basically asking for any insight into how to get them to work reliably.

Details

A typical case is a VCL project having a single form, and only unit is the code for that form. Length 1200 lines, so not a very challenging project. The project compiles and runs fine. It has some standard VCL buttons and so on, and also happens to have TVirtualStringTree and TComPort (Winsoft).

The failure symptoms

  • Clicking on the declaration of some type, variable/field, or method, and then Context menu > Find, results in the Find submenu populating the "Find local references" item, but leaving the "plain" Find references item greyed out and populated with some previous item that I searched for. "Find local refs" is supposed to find all such refs in the same file, but in this state it finds only the one I clicked on (showing it in the Find References panel).

  • Similarly, if I click on some type, variable/field of method, the Refactor > Rename function only offers to rename the item clicked on.

In these situations, I can navigate to an instance of the identifier in question, and use the Find Declaration function and that immediately locates the declaration (ie: the declaration I clicked on earlier that Find/Rename failed on). Edit: Also, Code Completion works fine on these identifiers.

So clearly at some level the code analysis correctly links these references. It's just the Find > References and Refactor > Rename functions that fail to properly use the code analysis, it seems.

It's almost as though the Find-Refs and Refactor-Rename code hits some exception behind the scenes and simply doesn't complete the job of (a) populating the Find menu and (b) finding all the references for either Find or Rename.

But as yet I have not discovered a pattern in these failures. I'm hoping someone else has discovered the secret.

[Edit] Additional possibly-related symptom: Code regions

  • Collapsible code regions seem to pop open randomly. This is with perfectly compilable code, where a keystroke somewhere in the file (above or below the region), may cause a region to spontaneously expand. That includes keystrokes which take the code from one compilable state to another (like typing in a comment, or adding a space). Sometimes regions behave fine, other times the file gets into a state where any change seems to prompt an expand, and only for some regions, not all.
5
  • 2
    You can use GExperts GREP search instead or the renaming feature of MMX Code Explorer. Afaik, there is no solution to your original problem until Emba fixes the refactoring tools! Sep 22 at 4:43
  • 1
    Do you use inline variables? After years of IDE not working properly when using inline variables in 11.3 is relatively stable, but is having problems like you discribe it when using the onboard refactor tools
    – fisi-pjm
    Sep 26 at 20:21
  • @fisi-pjm That is a good point. Are you saying that you've definitely seen this problem in 11.3? I do know that when inline variables first came to Delphi the IDE language analysis couldn't handle them. But I thought that Delphi had acquired a new language engine, and that this was not an issue any more. However, I will check that.
    – gwideman
    Sep 27 at 1:59
  • 1
    Meanwhile everything works "normal" with inline Variables, except the Refactoring part. Ctrl + shift + a also fails from time to time when using inline variables, but could not figure out exactly when at this point.
    – fisi-pjm
    Sep 27 at 7:01
  • I added a note regarding randomly expanding code regions, which presumably also would be affected if code analysis goes wrong.
    – gwideman
    Sep 29 at 1:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.