ryu1kn / vscode-text-marker

Visual Studio Code Extension. Select text in your code and mark all matches. The marking colour is configurable
https://marketplace.visualstudio.com/items?itemName=ryu1kn.text-marker
MIT License
87 stars 17 forks source link

Automatically save highlights after any change #10

Open Otiel opened 6 years ago

Otiel commented 6 years ago

Would it be possible to save the highlights automatically, after any change done to the highlights list?

Since there are actually two options for the "Save All Highlights" command (Global or Workspace), I guess that this request could be implemented with an option like "textmarker.automaticallySaveHighlights" = "global","workspace","off".

ryu1kn commented 6 years ago

I got what you mean. Keep the saved highlights and current highlights in sync... that's probably better in terms of the user experience 👍 Let me think about the configurations.

3dots commented 5 years ago

Yes yes, please : ).

I spent about an hour highlighting my todo list with category colors; then went to look at it today and ... was somewhat perplexed that my work disappeared xD.

3dots commented 5 years ago

Also, apparently "Save Highlights" -> "Workspace" doesn't work when you have just individual files open. I re-highlighted stuff, and today it's gone again.

I've looked a bit into "On Save" hooks in vscode and it looks like something external like watch tasks might actually be an answer.

Maybe do a gulp file change watch that triggers some code inside vscode? As for the save process itself; can the highlights be saved alongside the file or folder/workspace you're working with? Like if you're highlighting a file named todo.txt; then when you enable auto saving; you end up writing another file named todo.txt.highlight.json which specifies all the highlights?

I'm just thinking out loud as it were. This extension is brilliantly written and the idea of coding some of this myself is more and more appealing every day :).

ryu1kn commented 5 years ago

Hi @3dots , thanks for your comments & input! and sorry that you've lost the highlights twice...

Also, apparently "Save Highlights" -> "Workspace" doesn't work

I've just confirmed it. We should at least tell the user that highlights cannot be saved to workspace if workspace is not opened. Thank you for finding/reporting it, I'll raise a ticket.

I'm just thinking out loud

I like this. This way, we can examine possible solutions and refine our ideas 😉

Maybe we should first define ideal behaviours with this auto save feature then think about how we define necessary configs.