Forum > IDE/CodeTools

Find in files... Lazarus IDE improvement

(1/4) > >>

lagprogramming:
Lazarus IDE has a menu entry at Search/Find in files ... Clicking the entry will make a Find in Files window appear. In this window, the default file mask is *.pas;*.pp;*.inc.
The improvement is to replace that default mask text with *.pas;*.pp;*.inc;*.lpr because libraries are saved using the lpr extension. For example, now, when you search in directories for "library" you'll notice that the libraries won't appear, as their file extension is ignored.

wp:
I almost never search in libraries, and the default is fine for me.

But did you know that you can extend the search list? Simply add ";*.lpr" and you have the .lpr extension in the search mask list. Anything you type here goes into the history list of the combobox. You can select any previously used search mask settings from the combobox dropdown. Since all this is stored in the user profile, it will be available in the next session as well. What more can you want?

lagprogramming:

--- Quote from: wp on August 10, 2023, 10:40:31 am ---I almost never search in libraries, and the default is fine for me.

But did you know that you can extend the search list? Simply add ";*.lpr" and you have the .lpr extension in the search mask list. Anything you type here goes into the history list of the combobox. You can select any previously used search mask settings from the combobox dropdown. Since all this is stored in the user profile, it will be available in the next session as well. What more can you want?

--- End quote ---
Why would the default mask ignore the lpr files!? It's the default extension when writing libraries and these files are created by Lazarus, too.
If you ask somebody to search for library xxx in a directory, most likely you'll have a false negative answer. This means that you also have to say that the search should be done by another application(not the Lazarus IDE), or you have to say that the default file mask of Lazarus has to be modified by adding the lpr extension.
Why would Lazarus developers force another developer to give additional instructions for such a simple task!? It complicates something that should be done straight forward, using default settings.

Martin_fr:
It's a catch 22...

If you edit a project with forms (GUI / project type "Application") then the ".lpr" contains pascal code generated by the IDE. So in this case many people don't wont to search in the lpr file. It isn't code they wrote.

Of course, as soon as the search includes lcl (or any package the user did not wrote themself), then the lpr file would be of interest.

And if you create a non-gui "simple program" or a "library", then the lpr also contains your code.

So there are cases were lpr is better not in the list, and cases were it should be...


-----EDIT
Clarification: This is meant to say, there likely was some though (the lpr for gui app) in setting the current default.

I do not say anything about, if this reason is(still)/was proper.

lagprogramming:
Regarding the default file mask, I still don't see a reason why lpr files should be treated differently than pas files. Here is why.
Searching for the text "This file was automatically created by Lazarus. Do not edit!" in the lazarus directory shows many pas files. If these files are not obsolete, it means that the default file mask doesn't protect the search results against automatically inserted data in files by the IDE. However, because the IDE ignores by default the lpr files, the code written by developers won't be found using default settings, which leads to having false negative search results by default. This can't be something good.

Navigation

[0] Message Index

[#] Next page

Go to full version