hangxingliu / vscode-coding-tracker

:clock10: A coding activities tracker(time, file, type)
GNU General Public License v3.0
169 stars 36 forks source link

Increase inactivity timeout #6

Closed rozzzly closed 7 years ago

rozzzly commented 7 years ago

I really like your project. I've tried using other tools to track the ludicrous amount of time I spend programing, but all the ones I seem to use require you to manually start/stop a timer to log the time you spend which is a pain. That's what I really like about this extension, it does it all that automatically.

However, I have one problem with it; how it determines when the user is actively programming. I don't know about you, but I spend much more time navigating, reading, and considering my code than I do physically typing. I think you'll find this holds true for more programmers.

Looking at extension.js, if you stop typing for more than a few seconds--as far as the extension is concerned--you've stopped programing. What do you think about changing how it tracks activity? This could be as simple as making the timeout longer (like a minute). But ideally the extension could not only track onDidChangeActiveTextEditor and onDidChangeTextDocument but poll TextEditor.selections (which you would use to derrive the position of the cursor).

Imagine you type some characters, pause for two minutes minutes to read the code, then scroll back up to the top of the file. With the current methodology, you've only done 30 seconds of work, I'd argue you spent two minutes programming, and so the stats should reflect that.

I'd be glad to create a PR with these changes if you're okay with what I'm suggesting. There's a few other things I think could be improved/added as well. Let me know what you think.

hangxingliu commented 7 years ago

Hi, rozzzly. Thanks for your issue.

I have the same with you. I often spend more time in watching and navigating than physically typing.

I think your idea is good. (Actually, I am very welcome to you for creating a pull request in this project. Because I am very busy in vscode-coding-tracker-server and my lesson assignments recently)

The begin with. The idea of this extension is from WakaTime. But WakaTime is a commercial project which has only 7 days free tracking data storage and storage my private project informations in their server. So I referred WakaTime to make an extension to recording my coding activities. The reason why I use onDidChangeActiveTextEditor and onDidChangeTextDocument to calculate is from WakaTime. As times goes by, I the same problem with you. So I have tried some other ways included onDidChangeTextEditorSelection even some tricks like registerDefinitionProvider.

So if you have more better ways to calculate times welcome post issues or pr to this project.

hangxingliu commented 7 years ago

I fixed a bug and modified the dependency version in latest develop branch. You could give me pull request based on latest develop branch. (avoiding unnecessary merge conflict )

hangxingliu commented 7 years ago

added config moreThinkingTime in https://github.com/hangxingliu/vscode-coding-tracker/commit/1637c9a31280d55a8a58dcecfc8f104f5cf4fb0a

you can set up this configuration to increase or decrease timeout