Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] - "Sticky" bookmarks that move if lines are inserted or removed in file. #652

Open
robross0606 opened this issue Oct 15, 2023 · 5 comments

Comments

@robross0606
Copy link

This tool is really useful, but seems to be missing bookmarks that stay in sync with edited files. Removing or adding lines to a bookmarked file leaves the bookmarks where they are placed, which means they're out of sync with where they were intended. The line # is usually less important than the content on the line which was bookmarked.

@alefragnani
Copy link
Owner

Hi @robross0606 ,

The bookmarks will (should) move up/down based on the edits you do in the text. If you add a new line, the bookmarks goes down. If you remove a line, the bookmarks goes up. But, if you edit the files outside VS Code, pull changes from remotes, or change branches in git, these changes are not loaded, and the bookmarks will remain in the original line.

If you are editing the file in VS Code and the bookmarks are not updated please, provide more details about your steps. It should work. Sure, there are a few scenarios where this is not perfect, but it works in most cases.

If you are editing outside VS Code, I'm sorry to say, but these changes aren't recognized. At least not without a reenginering on how the extension works.

Hope this helps

@robross0606
Copy link
Author

I’m really surprised to hear this because I am not editing outside vsCode and I don’t think I have ever seen a bookmark move with code changes. I’ll do some more specific tests next week. A couple possibilities:

  • Could another extension be getting in the way?
  • What about changes due to reformatting “on save” like prettier?
  • What about larger bulk changes like copy/cut/paste?
  • Is there a certain way you have to create the bookmark for this to work?
  • Could OS matter? I’m using Windows.
  • Was this introduced in a specific extension release?

@alefragnani
Copy link
Owner

The bookmarks extension depends entirely on the editor changes events, fired by VS Code, and yes, other extensions may interfere. For instance, up until 2 years ago, formatters like Prettier and multi-cursor operations weren’t supported. I updated the extension and it started to work just fine. Maybe something on their side has changed and the events are not firing as expected, and since I don’t use prettier, I didn’t noticed. The other possibilities you listed, doesn’t affect how the extension work.

Is the sticky behavior bullet proof? No, it isn’t. There are some edge cases where it doesn’t work as expected, and still needs improvement. But it should work most of the times.

Hope this helps

@robross0606
Copy link
Author

Thanks for the info. I'll keep this in mind and see if I can better qualify the behavior I'm seeing.

@robross0606
Copy link
Author

robross0606 commented Nov 22, 2023

Just double checked this and I cannot get the bookmark to be "sticky" at all on any type of file. Mostly I'm working with Javascript files but I also tried a simple README.md file and the bookmark stays put on the line where it was marked in every file I've tried.

If it helps, here is a list of all the extension I have installed right now:

alefragnani.Bookmarks
alphabotsec.vscode-eclipse-keybindings     
andrewmarkle.primer-light
asciidoctor.asciidoctor-vscode
assisrMatheus.sidebar-markdown-notes       
dbaeumer.vscode-eslint
devwright.vscode-terminal-capture
eamodio.gitlens
epivision.vscode-file-header
esbenp.prettier-vscode
fabiospampinato.vscode-open-in-application 
formulahendry.code-runner
GitLab.gitlab-workflow
GraphQL.vscode-graphql
GraphQL.vscode-graphql-execution
GraphQL.vscode-graphql-syntax
Gruntfuggly.todo-tree
HookyQR.JSDocTagComplete
janjoerke.jenkins-pipeline-linter-connector
jebbs.plantuml
marlon407.code-groovy
mathiasfrohlich.Kotlin
maxlath.vscode-convert-cjs-to-esm
MikeCluck.file-count
mikestead.dotenv
mitchdenny.ecdc
monotykamary.vscode-aql
moshfeu.compare-folders
moshfeu.diff-merge
ms-azuretools.vscode-docker
ms-kubernetes-tools.vscode-kubernetes-tools
ms-python.python
ms-python.vscode-pylance
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack
ms-vscode.live-server
ms-vscode.remote-explorer
ms-vscode.remote-server
ms-vscode.vscode-js-profile-flame
nick-rudenko.back-n-forth
NicolasVuillamy.vscode-groovy-lint
njpwerner.autodocstring
octref.vetur
oouo-diogo-perdigao.docthis
paragdiwan.gitpatch
pflannery.vscode-versionlens
redhat.java
redhat.vscode-commons
redhat.vscode-xml
redhat.vscode-yaml
renatorodrigues.json-to-js
richie5um2.vscode-sort-json
rioj7.command-variable
roehling.eclipse-color-theme
ronnidc.nunjucks
rust-lang.rust-analyzer
ryanluker.vscode-coverage-gutters
saurabh.terminal-manager
SonarSource.sonarlint-vscode
techer.open-in-browser
Tim-Koehler.helm-intellisense
tlent.jest-snapshot-language-support
tomoki1207.pdf
tomoyukim.vscode-mermaid-editor
uctakeoff.vscode-counter
VisualStudioExptTeam.intellicode-api-usage-examples
VisualStudioExptTeam.vscodeintellicode
vscjava.vscode-gradle
vscjava.vscode-java-debug
vscjava.vscode-java-dependency
vscjava.vscode-java-pack
vscjava.vscode-java-test
vscjava.vscode-maven
vscode-icons-team.vscode-icons
well-ar.plantuml
yoshinorin.current-file-path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants