New Unit2NS Application Released in Beta

Since the introduction of namespaces to Delphi I've been struggling to remember which namespaces some units belong to. I like this feature and would rather provide the fully qualified unit name in my source code rather than specifying a list of assumed namespaces in project options, but I do need some help finding the correct namespace.

Years ago Dr Bob had a little utility on his website that did this, but I wanted a little app to run locally. After drawing a blank casting around for something that could help me I bit the bullet and cobbled together a little app myself. It's called Unit2NS.

If you give it a unit name it displays a list of one or more namespaces the unit could belong to. Once you've chosen a namespace you can copy the fully qualified unit name to the clipboard for pasting into your code editor. It also lets you display all the units belonging to a given namespace, a bit like the Delphi IDE (sometimes!) does.

OK, "How does it know about the namespaces and units" I hear you ask. Well it doesn't. Not straight out of the box. You have to tell it. Now this isn't as tedious as it sounds because you can point the app at a source code folder and it will read all the pascal units from the folder, and all its sub-folders, and get the information from the file names. If you give it, for example, the source folder of your Delphi installation, Unit2NS will read all the units in there. That may be more than you need, but at least what you do need should be in there. The program stores the information so this is a one off activity. You can also enter the information manually, but you really don't want to!

The program can store more than one "mapping" of units to namespaces. You can choose between these mappings from the UI, and the program remembers the last one you used. This means you can store a mapping for each version of Delphi you use.

How to get the program

The program is developed on GitHub in the delphidabbler/unit2ns project. You can download the latest version of the executable code in either 32 or 64 bit format from the project Releases section.

Further info

Unit2NS is a portable application. There is no installer.

There's a Unit2NS page on my website.

A brief explanation of how to use the program can be found in the project's read-me file.

Be warned at the time of writing the program is at v0.1.0-beta, so there will likely be bugs and there may may be features you would like to see added. In either case please use the project's issue tracker to tell me.

The program is released under the MIT License.

Comments

Delphi Coder said…
Have you seen this and my answer about hovering the mouse on a unit name? https://stackoverflow.com/questions/58989285/find-fully-qualified-unit-names-quickly
Delphidabbler said…
Nope - I'd not seen that during my searches. Thx

Anyway, first bug fix is to stop using the word "Namespaces"!

That tip about hovering the mouse and seeing the full name doesn't work for me always. Does the unit in question have to appear in one of the unit scopes that appear in project options for this to work?

I was trying to use a unit that wasn't in one of those when the pop-ups failed to help.

Popular posts from this blog

Embarcadero Announce RAD Studio 11 Is Coming

System Information Unit v5.5.0 released