Lazarus doesn't save collapsed trees lazarus / 9-Editor ---------------------------------------------------------------------- Tommi · 2013-01-05 18:41 Hello, Very often when I open a .pas file I find all trees expanded but I saved them collapsed. So I have to manually collapse everyone. Is this a bug ? Thank you bye ---------------------------------------------------------------------- Blaazen · 2013-01-05 18:46 I had similar problems in past. It seems all right now (with SVN). What Lazarus version do you have ? ---------------------------------------------------------------------- Tommi · 2013-01-05 18:54 I have 1.02. I have seen that 1.04 has been released but in the changelog I didn't find anything about this problem. ---------------------------------------------------------------------- Blaazen · 2013-01-05 19:06 In past, when I had these problems, I was not able to reproduce, therefore I never reported it. It happened usually with larger files randomly - not always. ---------------------------------------------------------------------- Martin_fr · 2013-01-05 19:57 There are a couple of possibilities: 1) Only pascal (and ifdef/region) nodes are saved. If you fold/hide lines by making a selection this will never be saved (not implemented yet). If you fold a "begin end"or other pascal node, and then make them a comment by adding "(*" before the fold, then they will not be saved (displayed with dotted [ + ] symbol). If you remove (or close) the comment, they will be saved again. 2) The IDE must believe the session is changed. Opening a project, changing some folds, and close the project => the IDE does not currently notice. Switch tabs, and the IDE will notice. You can set the IDE to ask if it should save the session. Then at least you know, if it did not ask, that it did not save. You can also monitor the lps file for changes. 3) If you change files outside the IDE, while the IDE is closed. e.g. "svn update". Then the folds are at different lines. It may still work, but it may not. 4) In the project settings you can switch off the saving of fold info. If so, well .... Please check that setting. ----------------------------- If it is none of that, then I need an example. And exact steps to reproduce. In the meantime, and should you loose folds: There are a few helpful things. In keymapping you can assign keys, to fold all pascal nodes at a certain level. The level depend on what you configured to be foldable. e.g level 1 could be the "unit".."end" (or "program"..."end"). But if that is not foldable, it would be unit-section (interface, implementation) or var/type/const, ... ---------------------------------------------------------------------- Tommi · 2013-01-06 20:50 Thank you for the answer. It is no one of the four cases that you report. 1) I usually fold just procedure and functions. 2) I usually clos the IDE after a lot of time of use and modifications, and usually the last thing that I do is to try my software launching (and saving it) with F9. 3) I never modify my files from outside the IDE. 4) I don't know where this opstion is but I didn't modify my settings since the installation of the IDE. In any case the problem doesn't appear every time so the problem is not this option. I usually work with all functions/procedures collapsed and I expand just where I have to modify. When I open the IDE I expect to find everything like I leaved the last time, but some time it doesn't happen. ---------------------------------------------------------------------- Martin_fr · 2013-01-06 22:24 4) Menu: "Project" > " Project options" tab: "Session" But if it works most times, then it will likely be on. I assume the rest of the session is restored? That is things like which units are open, the order of tabs, the current active tabs, the position of the cared in the editor? --- In order to debug this. 1) When it happens: While the IDE is still open and without doing anything in the IDE (so the IDE will not overwrite the session info): - Find and copy the *.lps file of the project. - Attach that file, and the unit in question (You can send in private, using mantis) If you quit the IDE, and restore the lps, the issue should happen again. Then with the lps and the unit, it should be possible for me to debug. The lps file has the same name as the project (e.g. project1.lps). IT is either in the project folder, or in the primary-conf- path/projectsessions (On win: C:\Users\USERNAME\AppData\Local\lazarus\projectsessions ) If you have no lps (again see project options), then it is the lpi file that is needed. 2) In addition: Compile the IDE with SynFoldSaveDebug defined. Menu "Tools" "Configure build lazarus" There is a button "Edit defines", add SynFoldSaveDebug, and then once it is in the list set the checkbox. (alternatively you can define it in the SynEdit package) Rebuild and Restart the IDE. Then make sure you start the IDE with the command-line option   --debug-log=C:\lazlog.txt To do so, edit the properties of the desktop or start menu shortcut, which you use to start the IDE. If the IDE is started a logfile should be created and contain lots of references to fold stuff. The log keeps growing. So delete it from time to time (while the IDE is closed) Attach the (zipped) logged, once the issue happened (again together with the unit) ---------------------------------------------------------------------- Tommi · 2013-01-07 15:33 OK, I will do it and I send the zip file. Tomorrow I will do some try until the bug happens.