wakatime / vscode-wakatime

Visual Studio Code plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/vs-code
BSD 3-Clause "New" or "Revised" License
1.23k stars 137 forks source link

Azure Data Studio - Non Saved Files - Not Recording Time #266

Closed leemcmullen closed 2 years ago

leemcmullen commented 2 years ago

Hey,

Just wanted to let you know about an issue with working in temporary files in Azure Data Studio.

While developing, I often spend time in Azure Data Studio (ADS) working in a new query window, however I often don't ever end up saving the contents of the query window when I'm finished, I just close and don't save when I'm done.

This doesn't end up getting tracked in Wakatime. Checking out the log from within ADS and I see lots of the following:

{"caller":"/Users/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:35","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/SQLQuery_4\"","now":"2022-03-22T09:54:15Z","version":"v1.38.0"}

So I'm guessing maybe the cli doesn't track time for non existing files?

I wonder if it's possible to check for the existence of a file and if not, still track the time spent but just send the name it has access to (i.e. SQLQuery_4 in this case) rather than not tracking anything?

Thanks for this taking the time to build this excellent tool, it's really useful 🔥

EDIT Just realised I'm in the vscode-wakatime repo, which I think is probably how the ADS integration works so I think I'm in the right place. Happy to move to another repo (CLI maybe?) if it makes more sense though.

alanhamlett commented 2 years ago

We could this functionality. Do filenames for sql queries always follow the pattern SQLQuery_\d+? We should only force tracking for SQL Queries, and still skip tracking normal files that don't exist on disk.

leemcmullen commented 2 years ago

@alanhamlett Yes that's correct, they're always titled SQLQuery_1, SQLQuery_2 and so on.

alanhamlett commented 2 years ago

Added support for tracking ^SQLQuery_[\d]+$ files in release v18.1.0.

Once https://github.com/microsoft/azuredatastudio/pull/18989 is merged you'll be able to upgrade the plugin.

leemcmullen commented 2 years ago

Awesome, thanks Alan 🔥