Background

When using the Jetbrains IDE, I like to use the bookmark feature, especially when I’m new to a project, I’ll use it to mark some key code, but the problem with this feature is that it can’t be backed up, even I lost a bookmark of a project that I’ve been following for more than a week, it’s very heartbreaking, so I’m looking for a way to save the bookmark.

vscode

In fact, when using vscode, I found a good plugin: inline bookmark, which allows you to write markup directly in the comments of the code, so it’s easier, the code is the document. But this way is not perfect, for example, these comments submitted to the code base is not very suitable (or I can not spend so much time to write these comments well), so I often need to cut a review branch out, used to save these comments, so this will be code disconnected, not very convenient.

Then again, this plug-in can only be used in vscode. vscode has many features that I like, but it’s not perfect when writing Go (maybe I’m not using the right posture), for example

So I ended up using Goland as my main IDE.

Saving bookmarks

When I started using the bookmarks feature I searched if there was an export configuration in the IDE settings, but unfortunately I didn’t find it.

Then after a lost bookmark, I searched for how to save it, and saw the following tirade.

It seems that Jetbrains products used to have the ability to export bookmarks, but the reason for removing it doesn’t seem so make sense: > Bookmarks management is a good feature.

Bookmarks management is a good feature but there are two important notes about that:

  1. There is no much sense in providing export without import.
  2. It looks like bookmarks should be not a standalone feature but a part of common ‘task management’ functionality;

Okay, so you still have to do it yourself. Also in the above tirade someone mentioned that bookmarks are saved in the workspace directory, so I abstracted directly to the following two commands so I could quickly back them up.

  1. [[email protected].io]# PROJECT_ID=$(cat .idea/workspace.xml | grep ProjectId | awk '{print $3}' | awk 'BEGIN {FS="="} {print $2}' | tr -d '"')
  2. [[email protected].io]# cp ~/.config/JetBrains/GoLand2022.1/workspace/$PROJECT_ID.xml bookmark-backup.xml