wakatime / xcode-wakatime

Xcode plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/xcode
BSD 3-Clause "New" or "Revised" License
393 stars 28 forks source link

Does not track time spent working on Playgrounds #22

Closed coproduto closed 3 years ago

coproduto commented 7 years ago

Time spent working on Playgrounds does not get counted as Swift, it is simply ignored instead. I'm not sure if this would be an issue with the XCode plugin or the WakaTime backend, but I'm reporting it here.

pavankataria commented 7 years ago

I also have this issue. I was mortified to see wakatime not tracking my programming done in playgrounds. I spend at least half a day mocking many views before dragging the working solutions into my production projects. Tracking playground time is vital.

pavankataria commented 7 years ago

Any update on this?

alanhamlett commented 7 years ago

Can you add this line to your $HOME/.wakatime.cfg file:

debug=true

Then edit a playground and share any log messages that appear in your $HOME/.wakatime.log file?

pavankataria commented 6 years ago

Hi sorry it took me so long. This is what I get at the moment, the REviews.playground is the project I created in playgrounds.

{"now": "2017/09/28 15:50:11 +0100", "version": "8.0.3", "plugin": "xcode/9.0-13247 xcode-wakatime/2.0.9", "time": 1506610211.684607, "level": "WARNING", "message": "Traceback (most recent call last):\n  File \"/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/offlinequeue.py\", line 68, in push\nOperationalError: unable to open database file\n"}
{"now": "2018/03/19 10:03:07 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453786.172136, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/dependencies/__init__.py", "lineno": 122, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Parsing dependencies not supported for objective.SwiftParser"}
{"now": "2018/03/19 10:03:07 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453786.172136, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 53, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"}
{"now": "2018/03/19 10:03:07 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453786.172136, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 59, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "[{'is_write': True, 'entity': u'/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift', 'dependencies': [], 'language': u'Swift', 'lines': 7, 'project': None, 'cursorpos': None, 'lineno': None, 'branch': None, 'time': 1521453786.172136, 'type': 'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}]"}
{"now": "2018/03/19 10:03:10 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453790.467119, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/dependencies/__init__.py", "lineno": 122, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Parsing dependencies not supported for objective.SwiftParser"}
{"now": "2018/03/19 10:03:10 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453790.467119, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 53, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"}
{"now": "2018/03/19 10:03:10 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453790.467119, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 59, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "[{'is_write': True, 'entity': u'/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift', 'dependencies': [], 'language': u'Swift', 'lines': 7, 'project': None, 'cursorpos': None, 'lineno': None, 'branch': None, 'time': 1521453790.467119, 'type': 'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}]"}
{"now": "2018/03/19 10:03:11 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.004707, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/dependencies/__init__.py", "lineno": 122, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Parsing dependencies not supported for objective.SwiftParser"}
{"now": "2018/03/19 10:03:11 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.004707, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 53, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"}
{"now": "2018/03/19 10:03:11 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.004707, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 59, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "[{'is_write': True, 'entity': u'/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift', 'dependencies': [], 'language': u'Swift', 'lines': 8, 'project': None, 'cursorpos': None, 'lineno': None, 'branch': None, 'time': 1521453791.004707, 'type': 'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}]"}
{"now": "2018/03/19 10:03:12 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.742097, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/dependencies/__init__.py", "lineno": 122, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Parsing dependencies not supported for objective.SwiftParser"}
{"now": "2018/03/19 10:03:12 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.742097, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 53, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"}
{"now": "2018/03/19 10:03:12 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.742097, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 59, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "[{'is_write': True, 'entity': u'/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift', 'dependencies': [], 'language': u'Swift', 'lines': 8, 'project': None, 'cursorpos': None, 'lineno': None, 'branch': None, 'time': 1521453791.742097, 'type': 'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}]"}
{"now": "2018/03/19 10:03:34 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.004707, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 165, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "{'response_code': 202, 'results': [[{u'data': {u'id': u'e9f86ce1-5269-4d17-8497-003ed7b6a91b'}}, 201]]}"}
{"now": "2018/03/19 10:03:34 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453786.172136, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 165, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "{'response_code': 202, 'results': [[{u'data': {u'id': u'8774ab6c-bce1-4bdf-92f8-dd1c3adfda33'}}, 201]]}"}
{"now": "2018/03/19 10:03:34 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453786.172136, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 53, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"}
{"now": "2018/03/19 10:03:34 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.004707, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 53, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "Sending heartbeats to api at https://api.wakatime.com/api/v1/users/current/heartbeats.bulk"}
{"now": "2018/03/19 10:03:34 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453786.172136, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 59, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "[{'is_write': True, 'entity': u'/Users/pavankataria/Documents/weshop/iOS/CommonUI/CommonUI/Classes/BulletedListView.swift', 'dependencies': [], 'language': u'Swift', 'lines': 130, 'project': u'iOS', 'cursorpos': None, 'lineno': None, 'branch': u'TravelDetailPage', 'time': 1521450055.856792, 'type': u'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}, {'is_write': True, 'entity': u'/Users/pavankataria/Documents/weshop/iOS/CommonUI/CommonUI/Classes/Cells/AmenitySectionCellViewModel.swift', 'dependencies': [], 'language': u'Swift', 'lines': 79, 'project': u'iOS', 'cursorpos': None, 'lineno': None, 'branch': u'TravelDetailPage', 'time': 1521221671.721055, 'type': u'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}, {'is_write': True, 'entity': u'/Users/pavankataria/Documents/weshop/iOS/CommonUI/CommonUI/Classes/Cells/AmenitySectionCellViewModel.swift', 'dependencies': [], 'language': u'Swift', 'lines': 80, 'project': u'iOS', 'cursorpos': None, 'lineno': None, 'branch': u'TravelDetailPage', 'time': 1521221604.879804, 'type': u'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}]"}
{"now": "2018/03/19 10:03:34 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.004707, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 59, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "[{'is_write': True, 'entity': u'/Users/pavankataria/Documents/weshop/iOS/CommonUI/CommonUI/Classes/BulletedListView.swift', 'dependencies': [], 'language': u'Swift', 'lines': 131, 'project': u'iOS', 'cursorpos': None, 'lineno': None, 'branch': u'TravelDetailPage', 'time': 1521450056.804782, 'type': u'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}, {'is_write': True, 'entity': u'/Users/pavankataria/Documents/weshop/iOS/CommonUI/CommonUI/Classes/BulletedListView.swift', 'dependencies': [], 'language': u'Swift', 'lines': 127, 'project': u'iOS', 'cursorpos': None, 'lineno': None, 'branch': u'TravelDetailPage', 'time': 1521221754.678181, 'type': u'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}, {'is_write': True, 'entity': u'/Users/pavankataria/Documents/weshop/iOS/CommonUI/CommonUI/Classes/BulletedListView.swift', 'dependencies': [], 'language': u'Swift', 'lines': 126, 'project': u'iOS', 'cursorpos': None, 'lineno': None, 'branch': u'TravelDetailPage', 'time': 1521221319.464766, 'type': u'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}, {'is_write': True, 'entity': u'/Users/pavankataria/Documents/weshop/iOS/CommonUI/CommonUI/Classes/Cells/AmenitySectionCellViewModel.swift', 'dependencies': [], 'language': u'Swift', 'lines': 79, 'project': u'iOS', 'cursorpos': None, 'lineno': None, 'branch': u'TravelDetailPage', 'time': 1521221616.979758, 'type': u'file', 'user_agent': u'wakatime/10.0.5 (Darwin-16.7.0-x86_64-i386-64bit) Python2.7.10.final.0 xcode/9.2-13772 xcode-wakatime/2.0.9'}]"}
alanhamlett commented 6 years ago

That looks good, it was able to log your work to the playground according to this line:

{"now": "2018/03/19 10:03:34 +0000", "version": "10.0.5", "plugin": "xcode/9.2-13772 xcode-wakatime/2.0.9", "time": 1521453791.004707, "caller": "/Users/pavankataria/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/api.py", "lineno": 165, "is_write": true, "file": "/Users/pavankataria/Documents/Experiments/REviews.playground/Contents.swift", "level": "DEBUG", "message": "{'response_code': 202, 'results': [[{u'data': {u'id': u'e9f86ce1-5269-4d17-8497-003ed7b6a91b'}}, 201]]}"}
RGero215 commented 5 years ago

Hello @alanhamlett, I am having the same issue with playground here is my log.

{"now": "2019/02/02 13:31:57 -0800", "version": "10.8.0", "plugin": "atom-wakatime/7.0.4", "time": 1549143116.1706612, "caller": "/Users/rgero215/.atom/packages/wakatime/lib/wakatime-master/wakatime/api.py", "lineno": 169, "is_write": true, "file": "/Users/rgero215/.wakatime.cfg", "level": "DEBUG", "message": "{'response_code': 202, 'results': [[{'data': {'id': '5584de4e-da97-4535-8bed-fab25f70cc92'}}, 201]]}"}
{"now": "2019/02/02 13:32:30 -0800", "version": "10.4.2", "plugin": "xcode/10.1-14460.46 xcode-wakatime/2.1.0", "time": 1549143150.480538, "caller": "/Users/rgero215/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/main.py", "lineno": 52, "file": "/Users/rgero215/Downloads/CodableStarterPlayground/Codable.playground/Pages/Handling Foundation Types.xcplaygroundpage", "level": "DEBUG", "message": "File does not exist; ignoring this heartbeat."}
{"now": "2019/02/02 13:32:33 -0800", "version": "10.4.2", "plugin": "xcode/10.1-14460.46 xcode-wakatime/2.1.0", "time": 1549143153.269926, "caller": "/Users/rgero215/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/main.py", "lineno": 52, "is_write": true, "file": "/Users/rgero215/Downloads/CodableStarterPlayground/Codable.playground/Pages/Handling Foundation Types.xcplaygroundpage", "level": "DEBUG", "message": "File does not exist; ignoring this heartbeat."}
{"now": "2019/02/02 16:00:42 -0800", "version": "10.4.2", "plugin": "xcode/10.1-14460.46 xcode-wakatime/2.1.0", "time": 1549152042.879145, "caller": "/Users/rgero215/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/main.py", "lineno": 52, "file": "/Users/rgero215/Downloads/CodableStarterPlayground/Codable.playground/Pages/Handling Foundation Types.xcplaygroundpage", "level": "DEBUG", "message": "File does not exist; ignoring this heartbeat."}
{"now": "2019/02/02 16:00:43 -0800", "version": "10.4.2", "plugin": "xcode/10.1-14460.46 xcode-wakatime/2.1.0", "time": 1549152043.937226, "caller": "/Users/rgero215/Library/Application Support/Developer/Shared/Xcode/Plug-ins/WakaTime.xcplugin/Contents/Resources/wakatime-master/wakatime/main.py", "lineno": 52, "is_write": true, "file": "/Users/rgero215/Downloads/CodableStarterPlayground/Codable.playground/Pages/Handling Foundation Types.xcplaygroundpage", "level": "DEBUG", "message": "File does not exist; ignoring this heartbeat."}
elpheen commented 3 years ago

Experiencing this in 2021.

The same playground tracks just fine in VS code (but why.gif) -- so the culprit is likely the xcode plugin, and not wakatime itself.

{"now": "2021/08/23 18:30:59 -0500", "version": "13.0.7", "plugin": "xcode/12.5.1-18212 xcode-wakatime/2.1.0", "time": 1629761459.791307, "caller": "wakatime/main.py", "lineno": 68, "is_write": true, "file": "/Users/spazure/c0de/MyPlayground.playground/Pages/test.xcplaygroundpage", "level": "DEBUG", "message": "File does not exist; ignoring this heartbeat."}

alanhamlett commented 3 years ago

Please re-install the plugin since this has been fixed in the latest release.

elpheen commented 3 years ago

Please re-install the plugin since this has been fixed in the latest release.

Confirmed, tyvm!