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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ideas welcome. 馃コ #13

Closed
lytex opened this issue Jan 30, 2023 · 1 comment
Closed

Ideas welcome. 馃コ #13

lytex opened this issue Jan 30, 2023 · 1 comment
Labels
question Further information is requested

Comments

@lytex
Copy link

lytex commented Jan 30, 2023

Bookmark are realized by storing the file name and line number where the bookmark is added.
If the buf changes, the line number where the bookmark content is located may not match the real situation, the bookmark still points to the old one. Some time ago, I recorded the hash value of the line text where the bookmark is located. When the buf is saved, it will traverse all the bookmarks of the current buf, relative to the change of the total number of lines in the buf, look up or down for the line content equal to the bookmark hash value, and update the bookmark position, which works somewhat, but often fails. The fix_enable option is set to false by defalut.
I'm thinking of a better way to do it. 馃
Ideas welcome. 馃コ

Why not anchor bookmarks to a tree-sitter query?
Maybe as an optional requirement since I guess not everyone would want a bookmark plugin depending on tree-sitter

@crusj
Copy link
Owner

crusj commented Jan 31, 2023

Bookmark are realized by storing the file name and line number where the bookmark is added.
If the buf changes, the line number where the bookmark content is located may not match the real situation, the bookmark still points to the old one. Some time ago, I recorded the hash value of the line text where the bookmark is located. When the buf is saved, it will traverse all the bookmarks of the current buf, relative to the change of the total number of lines in the buf, look up or down for the line content equal to the bookmark hash value, and update the bookmark position, which works somewhat, but often fails. The fix_enable option is set to false by defalut.
I'm thinking of a better way to do it. 馃
Ideas welcome. 馃コ

Why not anchor bookmarks to a tree-sitter query? Maybe as an optional requirement since I guess not everyone would want a bookmark plugin depending on tree-sitter

I don't know about tree-sitter, I'm going to check the relevant documentation to see if it's possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants