wakatime / WakaTime.novaextension

Nova plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/nova
5 stars 3 forks source link

Remote files in Nova not being tracked #2

Closed ckerr15 closed 3 years ago

ckerr15 commented 4 years ago

Hello!

I think there may be an issue with the new Nova plugin where it "ignores" heartbeats that are triggered by editing a remote file. I'm using Nova's built-in SFTP editor, and editing files in Nova through the Nova file browser.

Here's what I can see in my ~/wakatime.log: {"now": "2020/10/13 14:53:16 +0100", "version": "13.0.7", "plugin": "nova/1.2 nova-wakatime/1.0.3", "time": 1602597196.566935, "caller": "wakatime/main.py", "lineno": 68, "is_write": true, "file": "/var/www/-redacted-/html/wp-content/themes/-redacted-/searchform.php", "level": "DEBUG", "message": "File does not exist; ignoring this heartbeat."}

Also: {"now": "2020/10/13 15:04:30 +0100", "version": "13.0.7", "plugin": "nova/1.2 nova-wakatime/1.0.3", "time": 1602597870.3397892, "caller": "wakatime/main.py", "lineno": 68, "file": "/var/www/-redacted-/html/wp-content/themes/-redacted-/searchform.php", "level": "DEBUG", "message": "File does not exist; ignoring this heartbeat."}

Is there any way that your plugin can be patched to support remote file tracking too? Wakatime for Coda 2 did this, would be great to see it in Nova too. :)

Thanks! Callum

alanhamlett commented 4 years ago

This is different from wakatime/coda-wakatime#1, because there the project wasn't detected but the time still logged. Here we need to find the temporary buffer file on the local filesystem and pass that into wakatime-cli. Otherwise, if the file it gets doesn't exist locally then it just exits without logging any time.

Also, this is a duplicate of #1.

ckerr15 commented 4 years ago

Apologies for the duplicate, I completely forgot to check! If you want any extra info from me, please do let me know.

Thanks!

EllieLockhart commented 3 years ago

Also having this issue!

EllieLockhart commented 3 years ago

Incidentally, I could try to debug/fix this myself, but I'd need confirmation it's an issue with the plugin and not something deeper. Like, I suspect VSCode (which I so want to stop using) avoids this by installing what amounts to code-server on the remote host, whereas as far as I can tell, Nova just makes an SSH connection and does everything else in the local OS X installation. If VSCode's way is the only solution, I worry this may not be solvable, at least for non-OS X remotes.

EllieLockhart commented 3 years ago

A thought: could the plugin be adjusted to make a local copy of the file or even a dummy file and send that file path to the plugin for heartbeats?

alanhamlett commented 3 years ago

could the plugin be adjusted to make a local copy of the file or even a dummy file and send that file path to the plugin for heartbeats?

Good idea, that would work! We'd need to detect a remote vs local file, then copy the first 512000 bytes of the file into a local temp file before executing the wakatime-cli.

I'll get this implemented and release a new version today.

alanhamlett commented 3 years ago

Fixed with 649f560d5040749b21e30588451fb68447cab314 and released just now in v2.0.0.