Where are bookmarks stored? How do I keep them if I copy the script file elsewhere? How do I add them to version control?

One of the features I miss the most from Spyder is recognising lines starting with "#--- Part A of my code" as a bookmark, and showing "Part A of my code" in a kind of project explorer, for easy navigation.

 

Will PyCharm ever introduce something similar?

 

Right now, I can add bookmarks:

  • F11 to toggle a bookmark
  • Shit + F11 to open the vookmark windows
  • CTRL + Enter to add a description

 

Slightly more convoluted, but it works. However:

  • Where exactly are the bookmarks stored? The .idea folder has some xml files but I couldn't find the bookmarks there
  • If I want to copy the file to another folder (e.g. to start a new project based on an existing one), how can I keep the bookmarks? Which files would I need to copy together with the Python script file?
  • How do I ensure that, wherever the files with the bookmarks are stored, they are added to version control? I am using git locally. Is the answer different if I use PyCharm's version control and if I use an external tool like GitKraken? Eg maybe Pycharm knows where these other files are and commits them automatically, whereas GitKraken won't know?
4 comments
Comment actions Permalink

Hi,

Bookmark export seems to have been deprecated quite a while ago: https://youtrack.jetbrains.com/issue/IDEA-111619

Bookmarks are stored in .idea/workspace.xml , so you could copy that between projects or using VCS.

0
Comment actions Permalink

Are you sure that bookmarks are stored in workspace.xml?

 

If I open it,I see text matching the comments of my git commits, but nothing related to bookmarks. I have 6 bookmarks, to which I have added a description, but I can't find any of these 6 descriptions.

 

Also, since workspace.xml contains data on git commits, wouldn't I mess things up by copying that to another file?

 

Come on, JetBrain, just copy the bookmark functionality from Spyder, it makes so much more sense!

1
Comment actions Permalink

My apologies, I based my answer off another answer from https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000394030-exporting-Bookmarks-possible-

But now that I went and checked it, it seems to be no longer true. The bookmarks are currently stored in <pycharm_config>/workspace/<workspace_id>.xml , under the following:

<component name="BookmarkManager">
...
</component>

You could copy-paste that from one workspace file to another, but I understand it might be cumbersome to deal with those IDs.

P.S. PyCharm config directory can be located according to https://intellij-support.jetbrains.com/hc/en-us/articles/206544519

0
Comment actions Permalink

Thank you for your reply.

 

So somewhere in the Pycharm config directory there are files with information on all my projects!!! This is crazy, it is incredibly poor design, and it poses a number of issues:

 

  • backup: exactly what files do I need to backup?

  • restore: say there is a hard drive failure. I restore my project folder with all my code. But how do I restore a PyCharm configuration with all the bookmarks etc?

  • version control: similar to the above, what files need to be added to version control? Does restoring a previous version restore the correct bookmarks or is there a risk everything will get messed up?

  • moving files: what if I need to move my project to a new folder? How do I ensure that the data in the config directory now points to the right location?

  • confidentiality: it doesn't really affect me, but imagine some kind of freelance consultants working on projects subject to non-disclosure agreements. Are they aware that PyCharm stores bookmarks for ALL projects in its config directory? Even if the consultant hands back the code to the client, bookmarks could let you reconstruct some of the key steps. Imagine telling a law firm that Microsoft Word will store the bookmarks for all the contracts they work on, for all their clients, in the Word config directory - they'd go ballistic, and rightly so!

 

It's also very hard to make sense of these xml files. Yesterday I worked only on one project; based on 'date modified', I found 2 xml files, and opening them I found the one with the bookmarks, but the file names are something like "1swQrt159" etc etc.

2

Please sign in to leave a comment.