alefragnani / vscode-bookmarks

Bookmarks Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=alefragnani.Bookmarks
GNU General Public License v3.0
1.7k stars 163 forks source link

[BUG] - Bookmark immediately disappears after I format my code using Prettier #486

Closed bassamanator closed 2 years ago

bassamanator commented 2 years ago

Environment/version

Steps to reproduce

  1. Add a bookmark.
  2. Format code using Prettier.
alefragnani commented 2 years ago

Hi @bassamanator ,

Could you provide more details about what is not working, preferably providing step by step and/or a video displaying the issue, and Prettier and Bookmarks extension settings too?

I don't use Prettier that much, but just like other formatters, the extension were working just fine.

Thank you

bassamanator commented 2 years ago

Hi @alefragnani,

My code formatter, Prettier, formats the code on save. I'm new to VSCode, so it's possible that this bookmarks behaviour is normal. My previous bookmarks plugin in atom would not delete bookmarks when the code was formatted.

This is what happens:

  1. I make a change to the code.
  2. I add a bookmark.
  3. The bookmark is added.
  4. I hit save.
  5. The code formats.
  6. The bookmark disappears.

Here's a video: https://user-images.githubusercontent.com/61985779/143672908-b2e3abf9-1c5d-4c24-85bc-9d24eb143ce6.mp4

Thanks!

alefragnani commented 2 years ago

Hi @bassamanator ,

In this case, the Bookmark is working as expected.

I mean, you added a bookmark to an empty line, and the formatter removed that line. So the bookmark is removed as well.

On the other hand, if you add a bookmark to a line with content, the bookmark move with that line.

Hope this helps