gornostal / Modific

Highlight lines changed since the last commit (supports Git, SVN, Bazaar, Mercurial and TFS) / ST2(3) plugin
614 stars 44 forks source link

Detect changes without having to save the file #77

Open philippotto opened 10 years ago

philippotto commented 10 years ago

Would it be possible to detect changes without having to save the file? I think GitGutter does this.

I know, that there is an option for autosave, but this is not really convenient. Especially, if you got a file watcher running in your build system which listens to file changes and reacts to them. Apart from that, autosave only saves the file if I unfocus and refocus the view. Is this behavior intended?

gornostal commented 10 years ago

Could you verify GitGutter does that? If so, I'll take a look at its implementation.

Apart from that, autosave only saves the file if I unfocus and refocus the view. Is this behavior intended?

Yes. The idea was that you may edit a file (that is currently opened in Sublime) in another editor, then when you switch back to Sublime, Modific will update gutter when content updates. Turns out many users don't like that, because not all want to save a file. When I was implementing that feature, I couldn't imagine someone wouldn't want to save a file.

philippotto commented 10 years ago

Yes, GitGutter does this definitely. As far as I can tell it writes the current content of the buffer to a temporary file and diffs it against the current head of the repository. I think, this is the corresponding code part.

Narretz commented 9 years ago

The problem with doing this while editing is that the performance suffers for some people very easily. On Windows, GitGutter always added a small lag.

philippotto commented 9 years ago

As long as the diffing is asynchronous and debounced, I don't think that this is a problem. In spite of the lag, it probably will feel more immediate than having to save the file manually.