I am writing a library for showing comments, say github code review comments. Users will be able to see which lines have comments and call show_comments()
to display comments on that line. What is the best way to keep track of the location of comments after users edit the file?
I am thinking of using extmarks
, however, because comments may be in files that haven’t been opened, I am using uri_from_fname
to “reserve” buf number and setting extmarks with that number. But the problem is that we can’t set extmarks in unloaded buffers. Is there any way to get over this problem?
I also notice that signs
do not suffer from this problem. Is it possible to set sign without showing it in the sign column so that I can use it to track the position of comments?