dendron icon indicating copy to clipboard operation
dendron copied to clipboard

Auto-Commit & Auto-Sync onSave

Open Pymous opened this issue 3 years ago • 4 comments

Please select if your request is either something new or an enhancement

  • [ ] Enhancement of an existing Feature.
  • [x ] Request of a new feature.

Please select the area your request applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

  • [ x] Workspace - VSCode workspace, vaults, Intellisense/autocomplete, Dendron settings
  • [ ] Lookup - Dendron's Lookup Command
  • [ ] Views - Dendron Preview, Tree View, Side Panels in the UI
  • [ ] Schema - Dendron Schemas
  • [ ] Pod - Data import from / export to Dendron
  • [ ] Publish - External Site Publish
  • [ ] Markdown - Markdown features, such as syntax support and features

Is your feature request related to a problem? Please describe

When working on a note on a remote vault (or just a synced up Dendron root file), you either need to commit and push changes yourself, or use the Dendron commands "Workspace : Add and commit" and "Workspace : Sync" to commit with the current time, and push.

That's a time loss right there ! :)

Describe the solution you'd like

As a lazy dev, it would save me and my team a lot of time if a setting could be added to trigger those command onSave.

ie : I'm working on note.project.summary, I'm manually saving it, the commands are triggered and my work is synced automatically.

Describe alternatives you've considered

I can keep doing it manually, eh !

Pymous avatar Jul 18 '22 15:07 Pymous

Thanks for the request. The on-save behavior is definitely something we should explore more to provide a better experience using Dendron. Hope the workaround we discussed in Discord works out for you in the meantime. We'll keep you posted if we make any progress on this.

hikchoi avatar Jul 18 '22 16:07 hikchoi

@Pymous, you don't need to run both commands--running Dendron: Workspace: Sync will both commit and sync, so no need for separate Add and commit unless you want to commit without syncing. In any case, you only need to run a single command.

I had a somewhat related issue opened a while ago asking for automatic index reloading after a sync because the tree view sometimes would not get updated properly:

  • https://github.com/dendronhq/dendron/issues/1451

I ended up using the ryuta46.multi-command extension to bind Dendron sync (plus some extra commands) to Ctrl + K S:

// settings
"multiCommand.commands": [
  {
      "command": "multiCommand.dendronSyncAndReload",
      "sequence": [
                "workbench.action.files.saveFiles", // to avoid issue when unsaved changes are not synced
                "dendron.sync",
                "dendron.reloadIndex", // to make sure the tree view is properly updated
                "notifications.clearAll" // to clear Dendron's notification after the sync
            ]
  }
]

// keybindings.json
  {
      "key": "ctrl+k s",
      "command": "extension.multiCommand.execute",
      "args": { "command": "multiCommand.dendronSyncAndReload" }
  }

In the end, it's still a manual action, but at least it's fast.

I think you can also use the Power Tools extension to trigger the sync command on save.

aleksey-rowan avatar Jul 18 '22 18:07 aleksey-rowan

Possible duplicate of #2075

carmenbianca avatar Aug 11 '22 17:08 carmenbianca

@carmenbianca, I don't think it's an exact duplicate as this issue talks about triggering a sync based on an event while the one you linked is about periodic sync. Close, but I think there is enough difference to keep both open.

aleksey-rowan avatar Aug 12 '22 03:08 aleksey-rowan