sniffer icon indicating copy to clipboard operation
sniffer copied to clipboard

Sniffer runs twice after saving file in vim.

Open MrMino opened this issue 9 years ago • 4 comments

Scenario: with vim, open a python file that contains test cases. Hit :w. Sniffer runs tests twice.

This makes the output flash, which really gets on my nerves while jumping through the t/c/r cycle.

Is it problem with my .vimrc or is this a known bug? Is it possible that it is tripping up due to .swp files?

MrMino avatar Sep 27 '16 10:09 MrMino

Hey @MrMino,

It's a known issue. It's because vim is writing to the .swp file and then renames the file into its original filename. Sniffer causes this to detect two changes (one rename from the original, and another rename from the new file).

I'd love a pull request if you know a good way to resolve it 😄

  • Jeff

jeffh avatar Oct 04 '16 05:10 jeffh

@jeffh Wouldn't it be logical to implement a sanity delay when rerunning tests? I.e. an interval of time between two consecutive tests firings, in which file change events are ignored? Or a file ignoring settings, possibly based on .gitignore?

Or even overhaul the file change detection part, so that it only detects a change inside a project when git says that a file changed?

Rationale: I won't be able to read the tests output in tenth of a second anyway, I probably wouldn't care about the files specified in .gitignore, and every change that git detects has a possibility of breaking the tests.

MrMino avatar Oct 04 '16 13:10 MrMino

Yeah, that all makes sense. I'll be willing to merge a PR for that.

On Oct 4, 2016, 6:59 AM -0700, MrMino [email protected], wrote:

@jeffh (https://github.com/jeffh) Wouldn't it be logical to implement a sanity delay when rerunning tests? I.e. an interval of time between two consecutive tests firings, in which file change events are ignored? Or a file ignoring settings, possibly based on .gitignore?

Or even overhaul the file change detection part, so that it only detects a change inside a project when git says that a file changed?

Rationale: I won't be able to read the tests output in tenth of a second anyway, I probably wouldn't care about the files specified in .gitignore, and every change that git detects has a possibility of breaking the tests.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/jeffh/sniffer/issues/35#issuecomment-251395844), or mute the thread (https://github.com/notifications/unsubscribe-auth/AAEMCLO5ZiQxdeIMUl-74lGp9NfiJp-vks5qwlvAgaJpZM4KHfdy).

jeffh avatar Oct 05 '16 16:10 jeffh

A simple vim-side fix for this is to change the backupcopy setting from auto/no to yes (run set backupcopy=yes in .vimrc, details here).

BenDoan avatar Jan 26 '17 23:01 BenDoan

Looks dead / won't fix. Closing.

MrMino avatar Jun 17 '24 09:06 MrMino