View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038559 | Lazarus | IDE | public | 2021-02-28 18:53 | 2021-03-27 22:42 |
Reporter | Juha Manninen | Assigned To | Mattias Gaertner | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 2.1 (SVN) | ||||
Summary | 0038559: Renaming a unit does not update its references in other units | ||||
Description | Renaming a unit with "File -> Save As ..." its unit name is changed correctly. Its references in other units should be updated after asking from user but it does not happen. It has worked sometimes. I remember seeing a question : 'The unit %s is used by other files.' 'Update references automatically?'; function ReplaceUnitUse() in unit SourceFileManager has code for it. It seems that a Codetools function GatherUnitReferences(Files,OldCode,false,IgnoreErrors,true,PascalReferences); raises an exception internally and does not return a unit list as it should. | ||||
Steps To Reproduce | Open the attached project and rename the HelperUnit. It is used by the MainUnit but the reference is not updated. | ||||
Additional Information | I went almost 3 years back in revision history. The feature does not work even there. I have seen it working however. Is there another way to rename a unit so that it works? Any information? I tested with Linux 64-bit but this does not depend on platform. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 64704. | ||||
LazTarget | - | ||||
Widgetset | |||||
Attached Files |
|
|
|
|
I still have 2.0.4 loaded on this PC and using still because it has 3.0.4 compiler, but I have lots of patches in it and have no plans to move upward, yet. it all works for me. That file name change feature works ok here because it always ask me if I want to update the references and I say yes and it works. Hope that gives you some clues.. |
|
Lazarus 2.1.0 r64344:64369 FPC 3.2.0 i386-win32-win32/win64 If I have uses unit1 in main prgram file ans I rename unit1.pas to unit11.pas (file save as), the IDE then updates the uses clause of the main program to uses unit11. It does not ask me though, it simply does. |
|
> If I have uses unit1 in main prgram file ans I rename unit1.pas to unit11.pas (file save as), > the IDE then updates the uses clause of the main program to uses unit11. > It does not ask me though, it simply does. Here also this don't work. Also "Save as" of units of packages aren't working. Lazarus 2.1.0 r64695 FPC 3.0.4 i386-win32-win32/win64 |
|
Thanks for the fix Mattias. Bart, yes, there is an option to turn the question dialog off. I don't know why updating references worked sometimes. Maybe unitname case had to match with filename case or something. I did not study more. In r64707 I fixed the unit name shown in editor tab right after rename. For some reason procedure UpdateSourceNames did not work. SourceName:=CodeToolBoss.GetCachedSourceName(AnUnitInfo.Source); returned an empty string for the newly renamed unit. Anyway we don't need to update all source names here. The renamed one is enough. |
|
CodeToolBoss.GetCachedSourceName returns only a value, if the unit was already parsed. After renaming the unit needs parsing. If you want to parse the unit use CodeToolBoss.GetSourceName. |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-02-28 18:53 | Juha Manninen | New Issue | |
2021-02-28 18:53 | Juha Manninen | File Added: project1.zip | |
2021-02-28 18:55 | Juha Manninen | Description Updated | View Revisions |
2021-02-28 18:55 | Juha Manninen | Steps to Reproduce Updated | View Revisions |
2021-02-28 18:55 | Juha Manninen | Additional Information Updated | View Revisions |
2021-02-28 18:55 | Juha Manninen | LazTarget | => - |
2021-02-28 21:33 | jamie philbrook | Note Added: 0129256 | |
2021-02-28 22:37 | Bart Broersma | Note Added: 0129257 | |
2021-02-28 22:39 | Bart Broersma | Note Edited: 0129257 | View Revisions |
2021-02-28 23:04 | Michl | Note Added: 0129259 | |
2021-03-01 00:34 | Mattias Gaertner | Assigned To | => Mattias Gaertner |
2021-03-01 00:34 | Mattias Gaertner | Status | new => resolved |
2021-03-01 00:34 | Mattias Gaertner | Resolution | open => fixed |
2021-03-01 00:34 | Mattias Gaertner | Fixed in Revision | => 64704. |
2021-03-01 10:30 | Juha Manninen | Note Added: 0129266 | |
2021-03-01 10:46 | Mattias Gaertner | Note Added: 0129267 | |
2021-03-27 22:42 | Juha Manninen | Status | resolved => closed |