Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
Alan Hamlett | c100213351 | |
Alan Hamlett | 43237a05c5 | |
Alan Hamlett | c34eccad4a | |
Alan Hamlett | 5077c5e290 | |
Carlos Henrique Guardão Gandarez | a387c08b44 | |
Carlos Henrique Guardão Gandarez | 3c2947cf79 | |
Alan Hamlett | 0744d7209b | |
Alan Hamlett | 54e6772a80 | |
Alan Hamlett | b576dfafe6 | |
Alan Hamlett | 5299efd6fa |
14
HISTORY.rst
14
HISTORY.rst
|
@ -3,6 +3,20 @@ History
|
|||
-------
|
||||
|
||||
|
||||
11.1.0 (2022-11-12)
|
||||
++++++++++++++++++
|
||||
|
||||
- Support for api key vault cmd config.
|
||||
`#117 <https://github.com/wakatime/sublime-wakatime/pull/117>`_
|
||||
|
||||
|
||||
11.0.8 (2022-08-23)
|
||||
++++++++++++++++++
|
||||
|
||||
- Bugfix to prevent using empty selection object.
|
||||
`#116 <https://github.com/wakatime/sublime-wakatime/issues/116>`_
|
||||
|
||||
|
||||
11.0.7 (2022-06-25)
|
||||
++++++++++++++++++
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
[WakaTime][wakatime] is an open source Sublime Text plugin for metrics, insights, and time tracking automatically generated from your programming activity.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install [Package Control](https://packagecontrol.io/installation).
|
||||
|
@ -19,12 +18,10 @@
|
|||
|
||||
6. Use Sublime and your coding activity will be displayed on your [WakaTime dashboard](https://wakatime.com).
|
||||
|
||||
|
||||
## Screen Shots
|
||||
|
||||
![Project Overview](https://wakatime.com/static/img/ScreenShots/Screen-Shot-2016-03-21.png)
|
||||
|
||||
|
||||
## Unresponsive Plugin Warning
|
||||
|
||||
In Sublime Text 2, if you get a warning message:
|
||||
|
@ -35,7 +32,6 @@ To fix this, go to `Preferences → Settings - User` then add the following sett
|
|||
|
||||
`"detect_slow_plugins": false`
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
First, turn on debug mode in your `WakaTime.sublime-settings` file.
|
||||
|
|
39
WakaTime.py
39
WakaTime.py
|
@ -8,7 +8,7 @@ Website: https://wakatime.com/
|
|||
==========================================================="""
|
||||
|
||||
|
||||
__version__ = '11.0.7'
|
||||
__version__ = '11.1.0'
|
||||
|
||||
|
||||
import sublime
|
||||
|
@ -186,6 +186,7 @@ class ApiKey(object):
|
|||
self._key = key
|
||||
return self._key
|
||||
|
||||
configs = None
|
||||
try:
|
||||
configs = parseConfigFile(CONFIG_FILE)
|
||||
if configs:
|
||||
|
@ -197,8 +198,38 @@ class ApiKey(object):
|
|||
except:
|
||||
pass
|
||||
|
||||
key = self.api_key_from_vault_cmd(configs)
|
||||
if key:
|
||||
self._key = key
|
||||
return self._key
|
||||
|
||||
return self._key
|
||||
|
||||
def api_key_from_vault_cmd(self, configs):
|
||||
vault_cmd = SETTINGS.get('api_key_vault_cmd')
|
||||
if not vault_cmd and configs:
|
||||
try:
|
||||
if configs.has_option('settings', 'api_key_vault_cmd'):
|
||||
vault_cmd = configs.get('settings', 'api_key_vault_cmd')
|
||||
except:
|
||||
pass
|
||||
|
||||
if not vault_cmd or not vault_cmd.strip():
|
||||
return None
|
||||
|
||||
try:
|
||||
process = Popen(vault_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
stdout, stderr = process.communicate()
|
||||
retcode = process.poll()
|
||||
if retcode:
|
||||
log(ERROR, 'Vault command error ({retcode}): {stderr}'.format(retcode=retcode, stderr=u(stderr)))
|
||||
return None
|
||||
return stdout.strip() or None
|
||||
except:
|
||||
log(ERROR, traceback.format_exc())
|
||||
|
||||
return None
|
||||
|
||||
def write(self, key):
|
||||
global SETTINGS
|
||||
self._key = key
|
||||
|
@ -422,7 +453,7 @@ def append_heartbeat(entity, timestamp, is_write, view, project, folders):
|
|||
'lines_in_file': view.rowcol(view.size())[0] + 1,
|
||||
}
|
||||
selections = view.sel()
|
||||
if selections:
|
||||
if selections and len(selections) > 0:
|
||||
rowcol = view.rowcol(selections[0].begin())
|
||||
row, col = rowcol[0] + 1, rowcol[1] + 1
|
||||
heartbeat['lineno'] = row
|
||||
|
@ -571,12 +602,12 @@ class SendHeartbeatsThread(threading.Thread):
|
|||
process = Popen(cmd, stdin=stdin, stdout=PIPE, stderr=STDOUT)
|
||||
output, _err = process.communicate(input=inp)
|
||||
retcode = process.poll()
|
||||
if (not retcode or retcode == 102) and not output:
|
||||
if (not retcode or retcode == 102 or retcode == 112) and not output:
|
||||
self.sent()
|
||||
else:
|
||||
update_status_bar('Error')
|
||||
if retcode:
|
||||
log(DEBUG if retcode == 102 else ERROR, 'wakatime-core exited with status: {0}'.format(retcode))
|
||||
log(DEBUG if retcode == 102 or retcode == 112 else ERROR, 'wakatime-core exited with status: {0}'.format(retcode))
|
||||
if output:
|
||||
log(ERROR, u('wakatime-core output: {0}').format(output))
|
||||
except:
|
||||
|
|
Loading…
Reference in New Issue