anaisbetts / SaveAllTheTime

SaveAllTheTime makes it so you never commit files to Git without saving ever again
MIT License
73 stars 19 forks source link

Include/Exclude files by extension #12

Open martin308 opened 11 years ago

martin308 commented 11 years ago

It would be awesome if you could set up a file extension list to include/exclude.

If I am using Grunt with VS then saving all the time triggers the grunt watcher constantly and I get errors from things that aren't finished

davemckeown commented 10 years ago

+1 for being able to manage how different file extensions are handled. Extensions such as TypeScript have features such as compile on save that are triggered when the document is saved and this can cause excessive CPU usage when a document is saved during a pause in editing.

To address this issue I would propose being able to access settings in visual studio under Tools -> Options. By adding a file extension to the options pane a user should be able to prevent auto saves against files with certain extensions.

I also think there should be two "ignore modes" for any given extension, the default mode would never try to save a file with a given extension, a secondary mode would never try and save a file with a given extension while it is the active document, but it would save unsaved changes once a user switches to another document. This secondary mode will prevent errors while you are editing, but will make sure the file is being continuously saved.

I can submit a pull request for this, however I am interested in @paulcbetts feedback first. One of the nice things about this extensions is that it doesn't require any configuration or thought, it just works. But I can see this being a useful feature and fixing a legit issue.

anaisbetts commented 10 years ago

Maybe? I'd rather put this under the right-click menu of the widget though, "Save this file type less often", where we bump the timer to 30 seconds instead of 2.

I also think there should be two "ignore modes" for any given extension

Feels a bit ham-fisted - what do you think about the above solution?

davemckeown commented 10 years ago

I like the idea of making it configurable though the widget. However one issue is that the widget will not be visible to someone who is using this on a non Git project or has clicked Hide on it. What do you think of adding a right click menu to the widget with the ability to go to the options pane to modify? A hide toggle setting could also be added to this page.

I agree that having multiple ignore nodes probably isn't the best solution, but I'm not sure about bumping the timer to X number of seconds will fix the original issue. When I am editing something like a TypeScript file the save triggers the compiler, so if I pause for a moment to think and a save occurs then I am going to be bothered by compiler errors because of syntax errors or incomplete refactorings. Increasing the timer will reduce the frequency but I think it will still be an issue. I think in this case it would just be better to ignore the file outright or to only save it once it no longer becomes the active document.

Maverik commented 10 years ago

I'd really like this feature as well please. I was working with EF Designer (VS2013) with this extension (with db connection over a vpn if it matters) and EF Designer was unusable because every move I make in EF was causing it regenerate model (like nudging diagram by one pixel for example). I finally disabled the extension to be able to work with EF temporarily.

davemckeown commented 10 years ago

@paulcbetts I think the right-click menu on the widget would be be good, but I think the option should be to ignore the file or file type completely instead of bumping the timer. The issue I've had is with TypeScript where save triggers the compiler and spikes the CPU, it sounds like @Venomed is running into the same problem.

In this case I would prefer the option to ignore a file type by right clicking on the widget and having a ignore option that can be toggled for the file type.

anaisbetts commented 10 years ago

I think the right-click menu on the widget would be be good, but I think the option should be to ignore the file or file type completely instead of bumping the timer

Yeah, I think that's okay, but what's the scope of that? Per-solution? Global? Does it save a file in the solution root?

davemckeown commented 10 years ago

I am thinking that should saved in the solution user options file (suo) file per solution.

Maverik commented 10 years ago

I'd like it to be per solution based as well. I normally like having it on and only turn it off as an exception.

pltaylor commented 10 years ago

Just wanted to add that this feature would be great with .TT files as well. Re-generating T4 templates as I am typing leads to some frustrating experiences.

davemckeown commented 10 years ago

I would also like to get this implemented. My original thought was that it made sense for the exclusion file types to be saved in the suo file for the solution.

I looked at implementing this feature that way but the VS SDK IVsPersistSolutionOpts interface seems to depend on the extension being a VSPackage and SaveAllTheTime is a MEF Editor Extension. There is probably a way to make it work, but I was not able to make it work when I was experimenting with it.

On second thought however, as a user I probably would want to disable auto saving .TT files, TypeScript files, EF Designer files, etc. across all of my solutions without needing to flag these files for each solution I open.

That should make this easier to implement since we can just save the file types in the json config file that already exists.

@paulcbetts unless you have any different ideas I will implement this by making the disable of auto save global with file types being saved in the json config file

pltaylor commented 10 years ago

I'll just add one more vote for global config instead of per project. I never want it to work with T4 files.