Vscode-bookmarks: Undo messes up bookmarks

Created on 30 May 2018  ·  12Comments  ·  Source: alefragnani/vscode-bookmarks

Hi there, I'm new here, still not sure how to use Github.
But I was really looking forward to bookmark tool in coding, and that's great, great job!

I found out that, if you undo your coding, all bookmarks loses their original position. So I have to bookmark them again....
For example, just copied & pasted a bunch of lines, then I undo it. The bookmarks immediately below are lost.

bug sticky

Most helpful comment

Just noting that adding line breaks and then undoing them will move the position of the bookmark, despite which setting is enabled for useWorkaroundForFormatters. I'm not using any prettier programs or formatting. For my use case, I want to bookmark a location where a function call is made. But just through some basic editing, the bookmark will end up separating from the original location. With useWorkaroundForFormatters it sticks to the line number itself, but as code grows this doesn't serve any useful purpose. We were really excited about using this just to save time on quickly navigating to common parts of the codebase, however the problems outlined in this bug still exist and make the extension broken for our uses.

All 12 comments

Hi @insoluzioni ,

First of all, sorry for taking so long to answer you. It's been a busy period. And thanks by your kind words 👍

I already noted this, sometimes, but unfortunately didn't find a replicate behavior. Sometimes it works, sometimes not 😢 . I would say that maybe, it's because how _fast_ you type/undo.

If you could record your steps that reproduces the issue, it would help.

Thanks in advance.

Hi, I started using VSCode bookmarks yesterday and have found bookmarks frequently loses their place as lines away from bookmarks are edited. Adding and removing lines, particularly through pasting seem to cause problems.

I have managed to record a gif of some cases that cause this. Firstly I found that adding a line ending in { and pressed delete (not backspace) at this line will usually make the bookmark shift down. Then if you try hard enough with adding new lines, pressing delete and undo you will eventually get the bookmark to jump to a completely different position. Both these issues can be seen in the gif.

Interestingly I found that that first issue of pressing delete moving the bookmark is actually undone by doing undo. Possibly this explains why it jumps later when you undo.

Hope this helps you. This is very helpful plugin that is currently quite unusable due to these issues. Thanks.

vscode bookmarks

Same here, for as much as I'd love the plugin to work, it really isn't usable at all.

Spent like an hour adding bookmarks to a very large program but normally working on my code (incl copy & paste and undo/redo) messes up the lines (which I labelled with comments) - so it was all for nothing.

Since you put so much work into this, it'd be a shame if this minor bug compromises all the efforts into making it unusable.

I'd like to add that I also have this issue while using Prettier/ESLint combo for JS projects, which make use of the autoformat feature of the editor.

@alefragnani do you have a clue as to what may be causing this? (I mean, "Autoformat" should refresh bookmarks position)

@fmaiabatista, this was tracked in #118 and I added a _workaround_ until a proper API/solution is provided.

Under User Preferences, add "bookmarks.useWorkaroundForFormatters": true. The bookmarks won't be removed anymore, It will not be _sticked_ to the source code, but the line number itself.

Hope this helps

I see, I'll try it out! Thanks for the prompt response! 😄

Just noting that adding line breaks and then undoing them will move the position of the bookmark, despite which setting is enabled for useWorkaroundForFormatters. I'm not using any prettier programs or formatting. For my use case, I want to bookmark a location where a function call is made. But just through some basic editing, the bookmark will end up separating from the original location. With useWorkaroundForFormatters it sticks to the line number itself, but as code grows this doesn't serve any useful purpose. We were really excited about using this just to save time on quickly navigating to common parts of the codebase, however the problems outlined in this bug still exist and make the extension broken for our uses.

The extension is a great idea, I'd love to have my bookmarks saved but this issue makes it unusable for me, I also spent an hour or two bookmarking some project just to notice that the bookmarks were shifted when I edited the files.

I can dedicate a few hours to experiment and make a pull request if needed, but I'm not sure where to start, @alefragnani, would you have any pointers for me to start looking into this?

+1

Indeed this bug is very annoying and need to be fixed as soon as possible.
This is a bug in the CORE FEATURE of the extension,if it is not able to bookmark lines,please explain me why it is called that way?
Every hour i need to rearrange the bookmarks,and as me everyone.

It seems that is your approach,at the root,wich is wrong. It is so hard to simply attach the bookmark to a line number and constantly monitor it while the content change? If you can't do it,then save the current line text,or also 3 lines: 1 above,1 under and the bookmark line. Or else find a better approach but make it working! Look at ultraedit,it have this feature as default since 1990,and always worked perfectly. Why? Because the root approach it's correct.

@StefanoGrossiNature
How much is an UltraEdit subscription and how mcuh have you contributed to this extension?

@StefanoGrossiNature
How much is an UltraEdit subscription and how mcuh have you contributed to this extension?

Fine,then continue using a bugged extension,sorry if i bothered you all :-)
I am programmer since 25 years and when i publish something i publish something that WORK,else i prefer to change job.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

919Studios picture 919Studios  ·  4Comments

eamodio picture eamodio  ·  5Comments

vannie1 picture vannie1  ·  3Comments

pakLebah picture pakLebah  ·  3Comments

it-sha picture it-sha  ·  5Comments