wakatime / vim-wakatime

Vim plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/vim
BSD 3-Clause "New" or "Revised" License
1.04k stars 70 forks source link

WakaTime not working with neovim on termux #128

Closed ikrishagarwal closed 2 years ago

ikrishagarwal commented 2 years ago

I am using termux app for android downloaded from fdroid (without any proot distro)

My environment

My .wakatime.log

{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53","func":"Format","level":"warning","message":"failed to resolve real path for \"/data/data/com.termux/files/home/NERD_tree_1\": lstat /data/data/com.termux/files/home/NERD_tree_1: no such file or directory","now":"2022-01-26T09:21:40Z","version":"v1.35.0"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:36","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/NERD_tree_1\"","now":"2022-01-26T09:21:40Z","version":"v1.35.0"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: failed making request to \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": Post \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": dial tcp: lookup api.wakatime.com on [::1]:53: read udp [::1]:46309->[::1]:53: read: connection refused","now":"2022-01-26T09:21:40Z","version":"v1.35.0"}
prettified verison of the above json: ```json { "caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53", "func":"Format", "level":"warning", "message":"failed to resolve real path for \"/data/data/com.termux/files/home/NERD_tree_1\": lstat /data/data/com.termux/files/home/NERD_tree_1: no such file or directory", "now":"2022-01-26T09:21:40Z", "version":"v1.35.0" }{ "caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:36", "func":"1", "level":"error", "message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/NERD_tree_1\"", "now":"2022-01-26T09:21:40Z", "version":"v1.35.0" }{ "caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240", "func":"runCmd", "level":"error", "message":"failed to run command: sending heartbeat(s) later due to api error: failed making request to \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": Post \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": dial tcp: lookup api.wakatime.com on [::1]:53: read udp [::1]:46309->[::1]:53: read: connection refused", "now":"2022-01-26T09:21:40Z", "version":"v1.35.0" } ```
rogix commented 2 years ago

Same here. I am using neovim 0.6.1, with vim-plug, and got a similar error.

rogix commented 2 years ago

127 solved the problem for me

alanhamlett commented 2 years ago

@KrishAgarwal2811 does re-installing vim-wakatime solve it for you too?

ikrishagarwal commented 2 years ago

@alanhamlett no still the same goes for me and yeah just to mention I tried doing the same on pc i.e. using WakaTime with neovim on pc and it too wasn't updating anything on dashboard. (I did it around 12 hours ago)

alanhamlett commented 2 years ago

The wakatime.log message looks like a normal intermittent networking error:

lookup api.wakatime.com on [::1]:53: read udp [::1]:46309->[::1]:53: read: connection refused

Are there any errors echo'd at the bottom in Neovim when you turn on debug mode? :WakaTimeDebugEnable

ikrishagarwal commented 2 years ago

@alanhamlett nothing happens

alanhamlett commented 2 years ago

And no new errors in your ~/.wakatime.log file?

rogix commented 2 years ago

@KrishAgarwal2811 in my case just re-installing the plugin was not enough, even running PlugClean, but when I deleted the .Waketime folder manually and installed it again with vim-plug, it worked. Did you try this on Linux again?

ikrishagarwal commented 2 years ago

So now it works fine on my pc but the problem still persists on my phone with termux. I got a screenshot of the error IMG_20220131_084218

Actually it took me time because it was tough to capture the error because whenever it comes I mistakenly click a button and it disappears

alanhamlett commented 2 years ago
Error detected while processing function <SNR>45_NeovimAsyncExitHandler:
[WakaTime] Error 102:

Exit code 102 is from a temporary API error, which is normal sometimes:

https://github.com/wakatime/wakatime-cli/blob/fbd2f354a4ad2397d7f96c84ee2239f1cc4eef70/pkg/exitcode/exitcode.go#L8

You're seeing that because you probably have debug mode still enabled. To stop seeing that, turn off debug mode: :WakaTimeDebugDisable

ikrishagarwal commented 2 years ago

Still it does not seems to work :(

alanhamlett commented 2 years ago

What's in the ~/.wakatime.log file on the machine that doesn't work?

ikrishagarwal commented 2 years ago
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53","func":"Format","level":"warning","message":"failed to resolve real path for \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_1\": lstat /data/data/com.termux/files/home/work/krix-bot/NERD_tree_1: no such file or directory","now":"2022-01-31T11:31:58Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53","func":"Format","level":"warning","message":"failed to resolve real path for \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_2\": lstat /data/data/com.termux/files/home/work/krix-bot/NERD_tree_2: no such file or directory","now":"2022-01-31T11:31:58Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:35","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_1\"","now":"2022-01-31T11:31:58Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:35","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_2\"","now":"2022-01-31T11:31:58Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:31:59Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53","func":"Format","level":"warning","message":"failed to resolve real path for \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_2\": lstat /data/data/com.termux/files/home/work/krix-bot/NERD_tree_2: no such file or directory","now":"2022-01-31T11:32:29Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53","func":"Format","level":"warning","message":"failed to resolve real path for \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_2\": lstat /data/data/com.termux/files/home/work/krix-bot/NERD_tree_2: no such file or directory","now":"2022-01-31T11:32:29Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:35","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_2\"","now":"2022-01-31T11:32:29Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:35","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_2\"","now":"2022-01-31T11:32:29Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:32:29Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53","func":"Format","level":"warning","message":"failed to resolve real path for \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_1\": lstat /data/data/com.termux/files/home/work/krix-bot/NERD_tree_1: no such file or directory","now":"2022-01-31T11:46:36Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:35","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_1\"","now":"2022-01-31T11:46:36Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:46:36Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:48:07Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:50:23Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:52:45Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:53:09Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53","func":"Format","level":"warning","message":"failed to resolve real path for \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_1\": lstat /data/data/com.termux/files/home/work/krix-bot/NERD_tree_1: no such file or directory","now":"2022-01-31T11:53:43Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:35","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_1\"","now":"2022-01-31T11:53:43Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:53:43Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:55:50Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T11:57:55Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T12:00:03Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T12:01:36Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T12:06:16Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: failed making request to \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": Post \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": dial tcp: lookup api.wakatime.com on [::1]:53: read udp [::1]:49235->[::1]:53: read: connection refused","now":"2022-01-31T14:31:58Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: sending heartbeat(s) later due to api error: won't send heartbeat due to backoff","now":"2022-01-31T14:32:32Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/heartbeat/format.go:53","func":"Format","level":"warning","message":"failed to resolve real path for \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_1\": lstat /data/data/com.termux/files/home/work/krix-bot/NERD_tree_1: no such file or directory","now":"2022-01-31T14:32:54Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/pkg/filter/filter.go:35","func":"1","level":"error","message":"filter file: skipping because of non-existing file \"/data/data/com.termux/files/home/work/krix-bot/NERD_tree_1\"","now":"2022-01-31T14:32:54Z","version":"v1.35.1"}
{"caller":"/home/runner/work/wakatime-cli/wakatime-cli/cmd/run.go:240","func":"runCmd","level":"error","message":"failed to run command: offline sync failed: api error: failed making request to \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": Post \"https://api.wakatime.com/api/v1/users/current/heartbeats.bulk\": dial tcp: lookup api.wakatime.com on [::1]:53: read udp [::1]:41351->[::1]:53: read: connection refused","now":"2022-01-31T14:32:54Z","version":"v1.35.1"} 
alanhamlett commented 2 years ago

Those logs are too recent. The earliest one is after your comment so those logs don't contain the error we're talking about. Do you have more logs in your ~/.wakatime.log?

ikrishagarwal commented 2 years ago

nope I deleted it too while deleting .wakatime 😅

alanhamlett commented 2 years ago

Oh, then if it's still not working you can get the logs again by turning on debug mode for a while:

:WakaTimeDebugEnable

ikrishagarwal commented 2 years ago

So I installed Ubuntu in termux and now it's working. But I checked it isn't logging the project in the dashboard. How do I fix it?

alanhamlett commented 2 years ago

Is it logging time to Unknown Project or not logging any time on your dashboard? If it's not logging any time, you should re-enable debug mode and share your ~/.wakatime.log file here.

ikrishagarwal commented 2 years ago

It shows Unkown Project but i tried different projects and found out that it's only with that particular project rest all show the correct project name.

alanhamlett commented 2 years ago

Try running git init inside that project folder to have it recognized as a project going forward.

ikrishagarwal commented 2 years ago

Ok thanks! Btw do you need to fix the issue with bare termux without any distro or I should close this?

benyaminl commented 2 years ago

@alanhamlett still getting unkown project. VIM 8.2.4606 windows. hmm..

alanhamlett commented 2 years ago

@benyaminl did you run git init inside your project folder?

alanhamlett commented 2 years ago

@KrishAgarwal2811 so the "logging to Unknown Project" is fixed for you, but the "Not logging any time on termux" issue is still happening?

benyaminl commented 2 years ago

@benyaminl did you run git init inside your project folder?

Yes it's a git project, Any idea why? Or I need open a new issue regarding this? It's a csharp project.

alanhamlett commented 2 years ago

What do the logs say in ~/.wakatime.cfg after turning on debug mode with :WakaTimeDebugEnable and editing a file in that project?

benyaminl commented 2 years ago

@alanhamlett I can't debug, throwing image

Works fine with VS Code on Same machine, I think because VS Code using seperate wakatime-cli exe

well if I run wakatime.exe, I got

wakatime
Traceback (most recent call last):
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\Scripts\wakatime.exe\__main__.py", line 4, in <module>
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\__init__.py", line 17, in <module>
    from .main import execute
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\main.py", line 32, in <module>
    from .api import send_heartbeats, get_time_today
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\api.py", line 22, in <module>
    from .session_cache import SessionCache
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\session_cache.py", line 26, in <module>
    from .packages import requests
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\packages\requests\__init__.py", line 43, in <module>
    import urllib3
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\packages\urllib3\__init__.py", line 8, in <module>
    from .connectionpool import (
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\packages\urllib3\connectionpool.py", line 29, in <module>
    from .connection import (
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\packages\urllib3\connection.py", line 39, in <module>
    from .util.ssl_ import (
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\packages\urllib3\util\__init__.py", line 3, in <module>
    from .connection import is_connection_dropped
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\packages\urllib3\util\connection.py", line 3, in <module>
    from .wait import wait_for_read
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\packages\urllib3\util\wait.py", line 1, in <module>
    from .selectors import (
  File "C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\site-packages\wakatime\packages\urllib3\util\selectors.py", line 14, in <module>
    from collections import namedtuple, Mapping
ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\benli\AppData\Local\Programs\Python\Python310\lib\collections\__init__.py)
alanhamlett commented 2 years ago

Did you install wakatime-cli manually previously with pip install wakatime? You should uninstall the wakatime python package because vim-wakatime is detecting and trying to use that, but it seems broken. Try this:

pip uninstall wakatime

If that doesn't work then just delete:

benyaminl commented 2 years ago

@alanhamlett seems it's seperate issue then. Yeah I remove the python package, then it works.

ikrishagarwal commented 2 years ago

@KrishAgarwal2811 so the "logging to Unknown Project" is fixed for you, but the "Not logging any time on termux" issue is still happening?

Yes, Unknown Project shows only when I open filles insted of folder and other works absolutely fine and yeah termux issue still persists but now I am using Ubuntu inside termux so there is works absolutely fine!

alanhamlett commented 2 years ago

Closing for now, but can re-open if it occurs again.