Jump to content
PeterPanettone

Improvements in Uses Clause Manager Identifier Search

Recommended Posts

I have implemented a few improvements in the Uses Clause Manager Identifier Search:

 

image.thumb.png.b97c6bc1911e1e09d2de7d99961762bc.png

 

1. The number of Identifier Search filter results is now displayed.

 

2. Previously the search term was searched only at the start of the identifier names. Now you can choose between "Match anywhere" and "Match at start". If you change the match type then the filter results are updated automatically.

 

Here are the sources, so you can build GExperts with these new features yourself:

 

GX_UsesExpert5.zip

 

Fixed a small bug just now; if you have already downloaded GX_UsesExpert3.zip or GX_UsesExpert4.zip then re-download this archive.

 

Here are a few Uses Clause Manager features planned for the future:

 

• Export the list of Project Units additional option: Preformatted as uses clause.

 

• Identifier search: Fuzzy-Search option

 

• Identifier search: Optimize filter performance with TParallel.For

 

• Identifier search (or all tabs?): Multiple search terms (like in RFindUnit)

 

• Identifier search: Search the selected Identifier result in custom help files

 

• All Tabs: Button/Combobox on the bottom panel to Copy the selected List item(s) to the clipboard, or to copy the selected unit path(s) to the clipboard, or to copy the selected unit FILES to the clipboard

 

• SearchPath: Add a custom list of user paths

 

• Add a Statusbar to the UCM window which displays the file-path of a single selected unit; then a Ctrl-click on the statusbar opens Windows Explorer at the location of the selected unit and selects the unit file in Windows Explorer.

 

Edited by PeterPanettone
  • Like 2
  • Thanks 1

Share this post


Link to post

Delphi 6 (and Delphi 2007) does not have any enhanced threading library, so TParallelFor is out.

I hope the rest of your changes hasn't broken too many places.

(Mind you, I'm not complaining, I'm glad that somebody shows so much enthusiasm and contributes to GExperts, but as long as it can be done without too much hassle, I want to continue supporting Delphi 6 and 7. And Delphi 2007 is a must as long as I'm stuck with it.)

Edited by dummzeuch
  • Like 2

Share this post


Link to post

I just had a short look at the sources: They don't compile with Delphi 2007 because you prefixed many identifiers with the full unit names, e.g. Vcl.Controls.whatever. Delphi < XE does not understand this, so please don't do that.

Also, there are quite a few unknown properties, but there isn't much that you can do about this.

 

If I get it to compile I'll commit this, so you can base any additional changes on the changed code.

 

Edit: Done.

Edited by dummzeuch
  • Like 1

Share this post


Link to post
2 hours ago, dummzeuch said:

Delphi 6 (and Delphi 2007) does not have any enhanced threading library, so TParallelFor is out.

I suggest using TParallel.For with conditional compilation to restrict filter performance optimization to newer versions, so Delphi 6 and Delphi 2007 won't be affected.

Share this post


Link to post

@PeterPanettone

I have been testing the new functionality and I like it.

 

One thing I that I would change (and probably will when I find th time) is to always show the matches at the start first even in "match anywhere" mode. This might also solve the small performance problem in that mode, because it's noticably slower than "Match at start" even on my very fast computer. So searching for matches at the start could be done first and displayed immediately, searching for matches anywhere else could be moved to a background thread and appended to the list once that thread finishes.

 

Thinking about this: After that change there would be no need to distinguish between those modes...

Edited by dummzeuch
  • Confused 1

Share this post


Link to post
1 hour ago, dummzeuch said:

always show the matches at the start first even in "match anywhere" mode

That would be very CONFUSING for the user: Showing "matches at the start first even in "match anywhere" mode": The user would think: Why are there only matches at the start if the option to start matches anywhere is selected?

 

I am not sure, maybe you mean something different. You could make the "match at start" option the DEFAULT option, if you prefer that.

 

BTW, do you have a slow computer? Then why should users with a fast computer SUFFER only because the programmer has a slow computer? This seems to be ILLOGICAL. But maybe this is only a misunderstanding.

  • Like 1

Share this post


Link to post

Just to let you know: The improvements compiled with minimal changes in Delphi 6.

 

On 10/24/2019 at 7:36 PM, PeterPanettone said:

BTW, do you have a slow computer?

No, as I wrote:

On 10/24/2019 at 5:59 PM, dummzeuch said:

it's noticeably slower than "Match at start" even on my very fast computer

I tested it on two computers, one is an 8 core Intel, the other one a 6 core AMD. Both are much faster than the average computer used in our company. But I also keep a Samsung N10 Netbook with Windows XP around to test for performance issues. Delphi 2007 and most of the GExperts functionality works fine on that one. But since the new functionality is already annoyingly slow on my fast computers, I haven't checked on the netbook yet.

 

Talking about annoyances:

On 10/24/2019 at 7:36 PM, PeterPanettone said:

why should users with a fast computer SUFFER only because the programmer has a slow computer? This seems to be ILLOGICAL. But maybe this is only a misunderstanding. 

You have the habit of upper casing words in a sentence. This comes over to many as shouting which is impolite.

 

But answering the question: I prefer to solve performance issues in a way that also profits people with slower computers. After all, the above mentioned netbook is the one I take with me when I'm on vacation.

 

One option to improve performance would be to use ContainsStr rather ContainsText. This would require the list to be converted to upper (or lower) case for searching, but since it would annoy me to show the identifiers converted thus, it means to have a converted copy of the list for searching and another one with the original identifiers. I just committed GX_UnitExportList (plus unit tests) which I consider using as a the solution.

 

Another option would be to create an index as an array['a'..'z', '_', ' '] of TList which points to all entries that contain a given character (' ' for "any other character", we can have non ASCII characters in identifiers after all, but I guess they are rare). So the search could only include those entries that are in the list of all characters the user has typed. But it takes time to generate that array which may make the cure worse than the disease. I'll have to do some timing here.

Share this post


Link to post
On 10/26/2019 at 7:24 PM, dummzeuch said:

You have the habit of upper casing words in a sentence. This comes over to many as shouting which is impolite.

Writing the whole text in uppercase letters nowadays would be really stupid. This has been done in prehistoric times out of necessity to increase the visibility of text on a computer screen because there was no technical possibility to do this otherwise on the very primitive computers of that prehistoric time. Then when text styles like Bold, Italic, etc. were invented and it became possible to use different font sizes, some people continued to constantly use their caps-lock key out of habit which was justly considered as impolite to do this.

 

HOWEVER,  writing single important words in uppercase is a way to rhetorically EMPHASIZE meaningful words in a text phrase. So, using rhetoric tools to add color and diversity to a spoken or written text is a very important cultural behavior.

 

That's the reason why many people often fall asleep listening to or reading a text from a bad speaker or a bad writer.

 

EMPHASIZING is important! It has nothing to do with "shouting".

Edited by PeterPanettone

Share this post


Link to post
On 10/26/2019 at 7:24 PM, dummzeuch said:

people with slower computers

Maybe you are wrong in believing that there are many people using slower computers. I believe that there are more people using faster computers than people using slower computers. Technically advanced computers nowadays are very cheap and many people can afford them.

 

In the German Democratic Republic of Eastern Germany (GDR) there was a very funny car model: The "Trabi" ("Trabant") which was very popular because it was the only model available (from 1957 to 1990) in the communist country. It would be somewhat irrational assuming that a considerable number of people are still using the "Trabi" in their everyday life today. So a company dealing with "Trabi" replacement parts today would soon go out of business. There is much more money to be made with modern cars simply because most people are using modern cars.

 

So, supporting Delphi 6 is a kind of nostalgic behavior, but has no real business value today.

Share this post


Link to post
36 minutes ago, PeterPanettone said:

Maybe you are wrong in believing that there are many people using slower computers. I believe that there are more people using faster computers than people using slower computers. Technically advanced computers nowadays are very cheap and many people can afford them. 

As long as I use a slow computer myself that's important to me. It's not that I could not afford a faster one, I chose not to throw away anything just because something "better" comes around.

 

34 minutes ago, PeterPanettone said:

supporting Delphi 6 is a kind of nostalgic behavior

You would be surprised how many Downloads of the Delphi 6 (and 7) version there still are.

 

Personally I never used Delphi 6 but went from Delphi 5 directly to Delphi 7, so there is no nostalgia involved. I keep Delphi 6 support around because it's not much effort to keep it on top of Delphi 7 support (which is even more "popular" than Delphi 6).

 

If I were to drop support for any Delphi versions, I would drop everything below Delphi 2007. That will happen if I ever lose my installations of these older versions, they stop working because of e.g. a Windows update or some bug turns up that only exists in these versions and that I am unable to fix with reasonable effort. (Or if I just decide I'm fed up with it.)

 

40 minutes ago, PeterPanettone said:

has no real business value today.

For me GExperts is not about "business value". Otherwise I would definitely do something else in my spare time.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×