In RAD Studio 10.3.1, we've added two new really useful productivity tools to the IDE, which improve navigation: finding your code, and moving around within your code. These were previously third-party tools that were very popular with thousands of Delphi and C++Builder developers, and which we're glad to integrate into the IDE itself to bring these useful features to every customer today.
These features are provided via GetIt: open the Tools menu and choose GetIt Package Manager, and then once it's loaded click the IDE Plugins section on the left. Or, you can use the search box to locate and install them. There are two, Bookmarks and Navigator, and this post discusses Bookmarks.
When you code, one very common thing is to move around in a unit between a few related places, to compare code or write code in multiple areas. The IDE has allowed you to do this viaits bookmark feature for many years, which allows you to mark a location by number 0-9 and which is then shown by a small yellow marker in the editor gutter (the area to the left of the code, where breakpoints etc are located.) To do create a marker, press Ctrl+Shift+[number], eg Ctrl+Shift+1, and then to jump back to it from anywhere else in the same unit, press Ctrl+[number], eg Ctrl+1. Note that 0 is not always available due to Windows settings for that keyboard shortcut, and there are also Wordstar shortcuts for this if you use them too.
This feature had a number of ways it could be improved, not least of which is that after setting half a dozen bookmarks, you might forget which one you've set, and overwrite one. For that matter, there was no list of bookmarks, so no easy way to see where they were and which were set, and it was limited to only nine or ten locations accessible by the keyboard.
The new bookmarks in RAD Studio 10.3.1 resolve these and add a number of useful features that help you move around your unit.
When you install the new Bookmarks, you'll find that all your old ones are still present, but a rendered using a red bookmark ribbon icon. The old shortcuts (Ctrl+Shift+n to add, Ctrl+n to jump to) still work, but there is a key new shortcut: Ctrl+B. Press Ctrl+B to add a new bookmark. This will automatically add one with the first available shortcut number (eg 1-9 and 0 being the tenth, following keyboard layout). This means there's only one shortcut to remember to mark a location, and you never overwrite one.
If your cursor is on a line where a shortcut already exists, the same shortcut, Ctrl+B, will remove it.
Bookmarks also have a small animation to visually show adding or removing a shortcut. This can be disabled in the settings (more on settings later), but animation is a useful tool to visually show something like addition or removal - you don't need to look to check your keypress did something, but instead the movement will show you.
Bookmarks are also shown in folded code:
Here you can see in the gutter a "..." bookmark icon, indicating multiple bookmarks, and the folded code representation has been extended to list all three that are in this constructor.
The old bookmark implementation let you set a bookmark just by pressing Ctrl+Shift+[number], with no indication whether that number had already been used. This made it easy to accidentally overwrite a bookmark. The new bookmarks solves this by having a single hotkey to create a marker, and automatically allocating a number, but you can still set a specific bookmark with the same shortcut - meaning you can still overwrite a bookmark.
Bookmarks warns you when you are about to overwrite an existing bookmark. When bookmark 5 (say) is set, and you press Ctrl+Shift+5, you will not get the red new-bookmark animation above. Instead, you will see a navy blue animation appear where the existing bookmark 5 is located, and if that's offscreen, it will appear at the top or bottom of the editor. That dark blue animation is saying, "that bookmark already exists, and it's here."
If you really want to overwrite or move the bookmark, double-tap the shortcut (say, Ctrl+Shift+5) twice within a short period of time. You will see the blue animation appear for the first press, and then the red animation for new bookmark at the second press. The default time limit is 3/4 of a second, but like everything in Bookmarks, this can be customized in the settings.
Normal bookmarks are useful - find somewhere you want to come back to, drop a marker, jump back at any time. But there is a second, lesser-used type of bookmark that can also be useful. This is a caret bookmark.
Normal bookmarks remember the line (although they can also remember the cursor position and restore that - check in the settings.) A caret bookmark is different: it is a temporary bookmark that will be removed when you close the file, project, or IDE. Carets are dropped in a stack, which means that the shortcut for navigating will always take you back to the most recently dropped -- and remove it.
This is useful for laying a trail of breadcrumbs as you move through code, perhaps searching for something, and then to go backwards to follow your trail back. To drop one, press Ctrl+Shift+B, and to jump back, press Escape. To jump back and to drop a caret where you just were, press Shift+Escape.
Here you can see a caret bookmark indicated both with the cursor position where it was placed (with a small ^ symbol), and also a different symbol in the gutter pointing you at the caret.
One very neat feature this enables is to swap between two locations. Drop a caret, and move somewhere else. Press Shift+Escape, and you'll go back to the first location. Shift+Escape again and you go back to the second. Shift+Escape again, and back to the first. This is extraordinarily useful for a quick toggle between two locations, and the two locations can even be in different files.
Bookmarks also provides a dockable window that lists all the bookmarks you have set. This includes both all bookmarks in the current file (accessible by a keyboard shortcut Ctrl+n, and so indicated with the number n next to them), all bookmarks in all open files (because you may want to find a location in a different file you've already marked), and all caret bookmarks.
Open this window by clicking View > Tool Windows > Bookmarks. Drag it to dock somewhere in the IDE, and don't forget to save the desktop by clicking the window and moon icon in the IDE title bar, and Save Desktop. This means the window will be there next time the IDE redisplays windows, such as toggling between coding and debugging, or after restarting the IDE.
The list doesn't just show the location of the bookmark. Instead, for Delphi, it shows important contextual information. In the screenshot above, you can see that it knows the method the bookmark is in (and it will pick up if it is another useful code location, such as a type (eg class) declaration); whether it's in the interface or implementation section, and a syntax-highlighted preview of the line of code it marks. This allows you to browse the list and understand where a bookmark is, not in terms of only line number, but in terms of the sections of code you interact with.
Like everything else, what's shown here can be heavily customised.
You can access the Bookmarks settings by clicking the gear icon on the lower right of the docked window, or through the Tools > Options menu item. It is currently in the Third Party section, since it was recently integrated from a third party product.
Settings are very extensive and allow you to customise the animations (and size or visibility); bookmark moving / overwriting; adding and removing a bookmark by clicking in the gutter, not just through shortcut; the look and feel of the docked window, such as what elements are displayed (eg the syntax highlighted code snippet); and shortcuts.
One note is that the shortcut key control is a Windows control which has a bug for arrow keys: if it says something like "Ctrl+Shift+Num 6" for next bookmark, that really means the right arrow key.
Bookmarks also has the ability to click in the editor gutter to add or remove a bookmark as well. The initial release in GetIt did not change the gutter width wide enough for this, so if you mouse over the gutter and don't see a semitransparent bookmark-add icon, you can edit this manually in the registry (taking appropriate care.) The setting is:
HKEY_CURRENT_USER\Software\Embarcadero\BDS\20.0\Editor\OptionsThe "Gutter Width" setting should be changed from 20 (the default) to 36, both numbers in decimal not hexademical.
Useful shortcuts to remember:
Bookmarks is a fantastic addition to the IDE, and really helps you move around your code fast. Features like being able to swap between two locations by dropping a caret and pressing Shift+Escape is one of those "once you start, you can't live without" features. The list of bookmarks with context is also very useful for seeing all the locations important to you, including in all open files. And the core functionality, dropping a bookmark with Ctrl+B and navigating with Ctrl+[number], is useful for easily adding markers without worrying about the ones you've already added. A large variety of settings and tweaks help you customise it perfectly to your workflow.
To install, open the Tools menu and choose GetIt Package Manager, and then once it's loaded click the IDE Plugins section on the left and you'll see Bookmarks listed. Or, you can use the search box to locate it. Select it, and click Install.
We hope you'll find this a great addition to the IDE! Don't forget to also check out the second productivity addon in 10.3.1, Navigator.
sorry, I did not receive an email saying that you answered to me.
Yes, when the designing screen is smaller than the form. This happens when you are debugging, and the error console emerges.
In the wellcome screeen, the problem is that the hint only shows the root and the next folders but in my case the path tree is long, and I see the same in different projects.
The bookmark feature is nice, it should be installed by default. Also, would be nice once you create a bookmark the explorer for the bookmarks would appears integrated.
As suggestion I would say that it would be nice one can use the numeric table too to go to one bookmark.
What screen resolution and Windows scaling do you have?
The crash is odd, and not reproduced internally. Do you have other plugins or addons installed?
I often find myself referring to other code, or looking at one method when writing or debugging another. So a quick go to A then B then A feature is useful.
@David, you say "Features like being able to swap between two locations by dropping a caret and pressing Shift+Escape is one of those "once you start, you can't live without" features".
Could you please describe a particular use case, where this feature is worth to be used?
There are newer and *updated* steps in the following blog link. Please follow them: community.idera.com/.../troubleshooting-installing-bookmarks-and-navigator-in-10-3-rio-as-well-as-earlier-versions
I'm using Win7 Professional 64bit on a laptop with an NVIDIA Quadro M1000M and the build in Intel HD Graphics 530. Two monitors are connected. Scrolling is slow on both monitors (if different drivers would be used :-) ). My system and delphi IDE language is German. After deinstallation of that plugin, the scrolling is fast again. (can be reproduced)
By the way: after installing / removing any plugin with the GetIt-Packet-Manager, the final "restart now" crashes that delphi instance (windows message: "Embarcadero RAD Studio for windows doesn't work anymore" => close program), while the new delphi instance is starting.
It's not a known issue... Do you have any unusual graphics settings, such as no acceleration?
This plugin slows down source code scrolling (with mouse wheel) dramatically. I am using Delphi 10.3.1. Is this a known issue?
It's only available for 10.3.1, not 10.3.0.
In 10.3 update 1 no problems
Yes will do. Thanks.
Can you send me an email please?
Thanks for that info - one slight snafu - I no longer have the installs for the older version plugins && they're not available on your website. Is there anything that you can do to help?
I miss them both in Berlin and it'll be a while before I'm fully migrated over I think.