Mattias Gaertner wrote:
On Sun, 03 Feb 2013 13:13:21 +0000
Mark Morgan Lloyd <markmll.laza...@telemetry.co.uk> wrote:

Mattias Gaertner wrote:

but I now have two tabbed panes in my source editor: "DbConfigCode2" and "DbConfigCode2(2)" with the latter focussed.
And that's where you loose me. Why should /usr/local/src/inifiles/trunk/dbconfigcode2.pas be open in
the editor? From the project's point of view it is an unrelated file.
You tell me! But the IDE opens a new tab/pane, and that's the whole point I'm trying to make!
Sorry. The IDE does not resolve symlinks in paths. That means if the IDE
opens a wrong file, then it does so, even if the two directories were
copies instead of symlinks. Your talk about a problem with symlinks
mislead me.
Don't worry, it was some while before I started focusing on what the real problem was.

To add context for the error message, the error I've forced in looks like

-----8<-----
type TDbConfigInit= procedure(confFrame: TDbConfigFrame; init: boolean= true); TDbConfigRead= function(confFrame: TDbConfigFrame; mr: TModalResult): boolean;

ty pe   // Line 22

   { TDbConfigFrame }

   TDbConfigFrame = class(TFrame)
----->8-----

So, let's forget the symlinks and find out why the IDE opens the wrong
file.

Please confirm:
The messages window shows an error on the file
/usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas
/usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas(22,4) Fatal: Syntax error, "=" expected but "identifier PE" found

but the source editor opens the file
/usr/local/src/inifiles/trunk/dbconfigcode2.pas
Right?
I think so, or at the very least it opens a new tab/pane so that I've now got tabs labeled "DbConfigCode2" and "DbConfigCode2(2)". "Information about the IDE" tells me

Project.SomethingModified Session

Project units:
./../inifiles/trunk/dbconfigcode2.pas SessionModified

Is this "../../" or really "./../" ?

I'm pretty sure that was ../../ but the cut or paste operation was trimming it. However I think we've got a Heisenbug here: "Information about the IDE" -> Modified is now displaying

SourceEditorManager.SomethingModified

Source Editor:
/usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas Component=True

and the IDE now doesn't open a duplicate tab/pane when the compiler complains about the error. I think what's happened is that my action of restarting the IDE with the file closed has sorted things out. In other words this lot is still approximately valid...

Project units:
./../inifiles/trunk/dbconfigcode.pas SessionModified

which based on the project directory being /usr/local/src/heavywethers/trunk implies /usr/local/src/inifiles/trunk/dbconfigcode2.pas (I'm trying to be cautious jumping to conclusions here).

see above.

Source -> Unit Information -> General on the new DbConfigCode2(2) tab tells me /usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas [manual transcript] which is what the file should be.

ok

... Unit paths refers to /usr/local/src/heavywethers/inifiles/trunk which is OK. Source paths ditto.

ok

But Source -> Unit Information -> General on the original DbConfigCode2 tab tells me it's /usr/local/src/inifiles/trunk/dbconfigcode2.pas which is wrong.

What is this "original"? When is it opened?
In my former mails I assumed you had opened it yourself.

dbconfigcode2 is the name on the tab created when the IDE (at startup) read the project. I was assuming that dbconfigcode2(2) was the one that the IDE created when the compiler reported the error, but looking at the file paths I'm not entirely sure.

I need to be very cautious about jumping to any conclusions over this (having already been wrong once), but it looks as though the compiler is getting and reporting the right path

Compiling /usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas

yes.

but the IDE at some earlier stage has resolved it to /usr/local/src/inifiles/trunk/dbconfigcode2.pas which it shouldn't.

What is this "some earlier stage"?

When the IDE was opening the project.

That actually fits my experience that given that sort of duplicate tab it's safer to close the older one.

If I close the older tab/pane, save-all and terminate then restart, the one tab that's displayed relating to that file has the correct name /usr/local/src/heavywethers/inifiles/trunk/dbconfigcode2.pas.

..up to this point where I've just done something that makes the problem go away.

All tabs are named uniquely. If you open two units with the same name
one will get the "(2)" appended. The "(2)" vanishes when the name
becomes unique again.

Yes, but which tab gets the suffix: the one that already exists or the newly-created duplicate?

I think it's worth noting that since I updated this copy of the IDE etc. to trunk (i.e. rather than it being a couple of weeks old) I'm seeing additional startup warnings

FindMissingClass DbConfigFrame1:TDbConfigFrame IsInherited=False
TLazSourceFileManager.LoadLFM loading nested class TDbConfigFrame needed by /usr/local/src/inifiles/trunk/dbconfigcode.pas

It simply means: This form is opened and needs some frame of another
unit.

However I think that's something to do with the non-working OnClick which I'll get back to presently, this business with tab/pane duplication is at least a few weeks old.

So it looks as though it's something to do with the saved state of the project, i.e. which files are listed as to be opened when the project is loaded. The file giving the problem had been open (across multiple sessions of the IDE) ever since the unit and associated frame was created and saved, I can't remember exactly how I did the save (i.e. whether it was an explicit save-all or an implicit save when the compiler was run or the IDE shut down).

If the compilation is run and finds an error where the file isn't already open, the file is opened with the correct path and there are no further problems.

Drat- it's just started happening again. The thing that appears to have made the difference was telling the IDE to open the frame associated with the unit, I can now see both forms of the path/name stored in the .lps file:

      <Unit12>
        <Filename Value="../../inifiles/trunk/dbconfigcode2.pas"/>
        <IsPartOfProject Value="True"/>
        <ComponentName Value="DbConfigFrame"/>
..
      <Unit15>
        <Filename Value="../inifiles/trunk/dbconfigcode2.pas"/>
        <ComponentName Value="DbConfigFrame"/>

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to