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.