tommyme / vscode-bookmark-x

Drag-and-drop, grouping, sorting bookmarklet plugin
GNU General Public License v3.0
18 stars 3 forks source link

[bmx] [feat] Bookmarks misplaced after code modification #27

Closed zhourrr closed 6 days ago

zhourrr commented 1 month ago

Hello, I'd like to thank you for this wonderful plugin. It has been incredibly useful in my development workflow.

I'm aware that bookmarks might be misplaced after code modification or git pull, and sometimes this is impossible to resolve automatically. But most of the time the bookmarks are only a few lines away from their intended positions. In such cases, I can manually remove the old bookmark and add a new one that points to the correct position. But this process of removing and then adding is a bit tedious, especially when there are multiple bookmarks to reset.

I was wondering how you guys cope with this? Is there some existing features to improve experience? Say a command to move a bookmark down or up a line? Thank you!

tommyme commented 1 month ago

First of all, thank you for your love and support for bmx.

I'm aware that bookmarks might be misplaced after code modification or git pull, and sometimes this is impossible to resolve automatically.

Yes, It's very diffcult to track git actions for bookmark plugins.

But most of the time the bookmarks are only a few lines away from their intended positions. In such cases, I can manually remove the old bookmark and add a new one that points to the correct position. But this process of removing and then adding is a bit tedious, especially when there are multiple bookmarks to reset.

It's important to have the ability to modify the bookmarks affected by git pull. I'll think of a solution later and you can share your idea with us.

I was wondering how you guys cope with this? Is there some existing features to improve experience? Say a command to move a bookmark down or up a line? Thank you!

For my use case, bookmarks are used to understand a repo or a system. I don't bookmark modules/files that change frequently. In fact, I am deliberately avoiding the defects of bookmark plugins.

tommyme commented 1 month ago

For now, you can try to do the following step to make it less tedious.

  1. save bookmarks to json using command save state of all workspace
  2. backup the bookmark json file.
  3. edit bookmark in bookmark json, you can edit line number directly.
  4. load bookmarks json to make modification work.
zhourrr commented 1 month ago

For now, you can try to do the following step to make it less tedious.

  1. save bookmarks to json using command save state of all workspace
  2. backup the bookmark json file.
  3. edit bookmark in bookmark json, you can edit line number directly.
  4. load bookmarks json to make modification work.

Thank you, this works. It would also be very handy if there is a command similar to "Alt+Up Arrow" or "Alt+Down Arrow" to move a bookmark. This way, I could easily move a bookmark pinned at line 10 to line 9, for instance.

tommyme commented 1 month ago

Look good to me and easy to realize, I'll notify you once I've done.

tommyme commented 1 month ago

there is a command >toggle label bookmark force which can make your work easier

this command can make a bookmark to overwrite the bookmark with same name

tommyme commented 2 weeks ago

Work in process #29

zhourrr commented 1 week ago

Work in process #29

Thanks!

I've noticed another issue: after some bookmarks were misplaced, when I run the "reveal bookmark in current line" command on those misplaced bookmarks, Bookmark X hangs for several minutes and eventually restarts.

I suspect this happens because the "line text" and "line number" do not match any records in the bookmark's state. It would be helpful if Bookmark X could return a message saying "Current bookmark not found." and exit the searching loop.

tommyme commented 1 week ago

This is an important bug, thanks alot, I'll fix it soon.

tommyme commented 1 week ago

This is an important bug, thanks alot, I'll fix it soon.

I can't reproduce this error, could you give me an example?

May be you can open an new issue to discuss the problem.😊

tommyme commented 1 week ago

the feat is implemented in #29 and #32. the beta version plugin will be published later.😊