Close / Open Files belonging to projects (automatically)

For PHP, I use an IDE called WeBuilder. Its project handling is mostly inferior to Delphi. But it has one nice feature. When you change projects it closes files (tabs) not part of the project and opens files that do belong to it.

It would be really useful at the moment where I am working on the VCL server, TMS webapp and FMX mobile app at the same time, with some shared units.

Is there any such feature or addon for Delphi?

Hey Rohit,

I think what you need is to enable the Autosave - Project desktop setting (in D10: Tools, Options, Environment Options, Autosave options, Project desktop and in D12: Tools, Options, IDE, Saving and Recovering, Save project desktop when closing).

After that you can just re-open a different project (I just use the Open drop-down button on the toolbar and choose a different project). It will remember and restore the files that you had open, the cursor position in the files, and any bookmarks that you had. The state is stored in the .dsk file.

Cheers,
Jarrod

1 Like

I already have those settings on. I was referring to a project group. When you switch from one project to another, it does not close or open any files.

What you are suggesting would work, if each project group had only one project.

Since you don’t want to see other project’s files, you would be better off forgetting about the project group, and run one IDE instance per project.

For me that’s the worse of the two evils. Maybe one day I will write an IDE-Expert to do it.

The issue is that I have too many files open, and its tedious to keep scrolling or selecting from the dropdown. Even if the tabs displayed the tail end of the filenames (to make them smaller) it would work. Or if it omitted the namespace (until hovered/focused), that would work.

I am curious what your use case is here.
If I need to jump to another file 99% of the time it’s a Ctrl+click on an item that takes me directly there. I have a look at the item of interest then either close the file or leave it open in the medium-term until the issue is resolved.

Do you mind expanding on your requirement?

All along I have been talking about the creating/opening knowing its accessed make exclusive and make changes and closing

I do not want to be mucking around testing what I have at a windows level
Delphi runs objects example TFileStream and should have worked all the issues to make its self RAD and ready to go -.basic simple staff to get projects done
I do not have windows file open or create help pages to work out windows issues
I’m stuffing around because of it and TFileStream is a core Delphi object

All along I have been talking about the creating/opening knowing its
accessed make exclusive and make changes and closing

What does this mean?

To create a TFileStream with a file - how do you identify it has file access or not?
you don’t - you stuff around tracing your code to find you do not

@PaulM : Lex has an issue with TFileStream … (separate thread)

@lexdeanair : this thread is about source files open in the Delphi IDE

It is a brand new suite - web-server, form-server, webapp, mobile app. I am working on all of them at the same time. It is not like bug fixing, where you deal with one item at a time. There is heavy refactoring in progress as well. Changes are not limited to just pas and dfm files, there are html and css files as well as the database. So, I cant just close the files all the time.

In VCL, when there are global changes to say CRUD screens, I can fix much because of form inheritance, in the template. With TMS Webcore, I do use form inheritance for the pas and dfm. Unfortunately, the html file is not inherited. This means that I can have 20-30 html files open for days. I find affected ones using GEExperts.grep, but I have to make changes by hand. And I have to test each screen. And I cant close them until I am done, otherwise I will forget to fix/test all the files. Subsequent grep is not going to find them.

I can close all the files, when I reach a milestone. Which is when I am happy with the alpha testing on my machine and beta testing on a dup of the live site. Which is perhaps twice a month. But in the middle of this work on the feature/milestone, I have to fix urgent issues for the clients.

Hmmm… I am getting ideas,

  1. Maybe I can use a separate GIT repo to keep groups of files together by archiving only the .dsk file.
  2. Use a different windows user to run a separate copy of Delphi on a duplicate copy of the code.