In October I released Bookmarks, a Delphi plugin which I’m humbled to think has been moderately successful – lots of people seem to like it. I wrote it because the bookmark implementation in Delphi could be better, and when something is not perfect, it seems good to fix it and in the process make the replacement even better. So I did. But bookmarks aren’t the only area of the IDE that could be improved or added to, far from it…
Since then I’ve been working on three other plugins, and I’m very happy to announce the release of the first of these: Parnassus Navigator. This is my first commercial plugin and one I hope you’ll find very useful.
The problem: Jumping around code
If you’re like me, you move around your code a lot. You add units to uses clauses, edit the constructor and destructor, move between related methods, and even want to navigate based on more meta-level stuff like “I have property Foo, and I want to go to whatever handles how it’s set.”
But how do you do this in plain old Delphi?
If you’re lucky you can control-click, which still requires moving from keyboard to mouse. More often you need to hunt: say, find a constructor by using Ctrl-Alt-Up to get to the class definition, scroll scroll, public, constructor, move the cursor to the line, Ctrl-Alt-Down to jump down. When you break this down, it’s a lot of steps. Or, find ‘uses’ by pressing Ctrl-F, type ‘uses’, F3 F3 F3 through various comments and code, rotate around to the top of the unit, F3 again to skip the interface uses, and finally arrive at the implementation uses.
Navigation shouldn’t be like that. It’s inefficient, slow, and (personally) distracts me from the code I’m holding in my mind while I parse the search results.
Or, depending on the IDE, sometimes you can find a method by moving to the top of the editor, clicking a dropdown, scrolling, finding the method and clicking again, which is even worse because your hands move between keyboard and mouse and you lose your concentration, plus it’s not smart enough to show you what you’re actually interested in (and how could it?)
That was great in Visual C++ 6 in 1998, but… combo boxes? In 2015, I feel sure there must be a better way.
Press Ctrl+G (g to Go.) A window appears showing everything in your unit – the uses and implementation and type and const clauses (etc), the types you’ve defined, the methods and properties and fields in those types, the property setters and getters. Just type to filter. Press Enter. You’re there.
Want to go to TMyClass’s constructor? Type it in – but simply ‘Tmyc con’ will probably get you there, because it filters as you type and shows only matches. Want to go to property Foo? ‘Prop foo’. What about Foo’s setter? ‘prop Foo set’ or ‘prop foo write’, or, depending on your code, even ‘p f wr’ will probably be enough. Want to go to the uses clause? ‘Uses’.
It is fast, simple, keyboard-based, and takes no mental concentration away from what you’re holding in your head.
But that’s not all…
A while ago on Google Plus, people were mentioning minimaps and wishing that Delphi had one. A minimap is a miniature representation of your code in a thin column near to or replacing the scrollbar. It shows the entire unit, the subsection that’s currently visible in the editor, can be used for navigation and provides a really nice visual overview of your code.
So I wrote one.
Navigator includes a minimap with Delphi and C++ syntax highlighting. You can click and drag the selection to scroll the editor, mouseover to show a syntax-highlighted hint showing the code at that part of the unit, double-click to jump straight there. Editor responsiveness is absolutely essential so it does all its parsing and rendering work in a secondary thread – like Bookmarks the processing work is never done in the same thread as the one used when you’re typing. It follows the IDE’s colour scheme, and unlike, say, Visual C#’s minimap, is antialiased and rendered pixel-perfectly.
(Side note here: Does antialiasing matter? No, but perfection is important and the entire plugin has had that kind of attention paid to it, not just in the UI but inside too. I even wrote a custom antialiased progress bar with rounded corners for the minimap to use as it does its initial processing. Was it necessary? No. Does it add to the quality and feel of the product? Yes it does. Even if you don’t see if often or for long, I know those pixels are there.)
When the Go To window is open, the matching results are shown highlighted in the minimap, too. Beta testers have also requested an API for this part (coming soon) so that third-party plugins can indicate things in the minimap’s overview.
While this blog post has been a casual, “this is the problem I encountered, this is what I’ve written to make my life easier and which you can use too” kind post, it’s worth noting that the plugin is very configurable. Don’t like the minimap? Turn it off. Want it bigger or smaller? That’s changeable. Want to change what’s shown in the Go To window? There are detailed controls. Want a different shortcut? You can change it. And while I wrote a lot about using Navigator’s Go To window solely from the keyboard, if you’re a mouse-based user it can of course be invoked through a button too.
I am very happy to finally release Navigator, after several months of development. It contains:
- Keyboard navigation
- Ctrl+G to Go. Type, the results are filtered, press Enter. It’s fast, simple, doesn’t break you away from what you’re thinking about. I find myself using this all the time, and for me Ctrl+G is now an ingrained habit. I hope you will find it just as useful too.
- Minimap: visual overview of your code, a nice bonus feature.
Parnassus Navigator costs 40 euros, and the download is fully functional even without entering your license key. (You’ll see some visual notices saying it’s in trial mode after the first hour or two of use.) With that you also get a year’s worth of updates and new versions and support. Navigator supports Delphi XE3, 4, 5, 6, 7 and 8.
I’d like to thank my beta testers for their patience and feedback, and great suggestions, especially Nicholas Ring and Roman Yankovsky who were prolific in their correspondence. Great stuff guys: thank you.