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.


  1. Delphi Coder3:29 am

    Have you seen this and my answer about hovering the mouse on a unit name?

  2. 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.

  3. Delphi Coder6:37 pm

    I guess, the answer to your question is Yes!


Post a Comment

Comments are very welcome, but please don't comment here if:

1) You have a query about, or a bug report for, one of my programs or libraries. Most of my posts contain a link to the relevant repository where there will be an issue tracker you can use.

2) You have a query about any 3rd party programs I feature, please address them to the program's developer(s) - there will be a link in the post.

3) You're one of the tiny, tiny minority who are aggressive or abusive - in the bin you go!


Popular posts from this blog

Focus On: Deleaker - a Delphi, C++ & C# Memory Leak Detector

Embarcadero Announce RAD Studio 11 Is Coming

Some Features of the Upcoming Delphi 11 (probably)