Skip to content

Commit 4a24e91

Browse files
committed
0.3.1
2 parents 37969fc + cd97ee2 commit 4a24e91

File tree

8 files changed

+48
-24
lines changed

8 files changed

+48
-24
lines changed

.vscodeignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.json/**
33
flowchart/**
44
test/**
5-
**/node_modules/**
65
cSpell.json
76
jsconfig.json
87
TODO.md

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## CHANGELOG
22

3+
### 0.3.1
4+
5+
0. **fixed the local server severe bug.**
6+
**(because vscode install extension would not resolve dependencies and I forgot a dependency)**
7+
1. fixed the wrong coding time record because some feature since VSCode 1.9.0
8+
2. fixed could not upload tracking data in non-project context since VSCode 1.9.0
9+
3. remove some redundant git merge files
10+
311
### 0.3.0
412

513
0. **Added local server mode. So you could use this extension easily.**

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ In this situation, the database file are located in `$HOME/.coding-tracker/`
4242

4343
0. Set your vscode configuration `codingTracker.localServerMode` to `false`
4444
1. Open a terminal/command line
45-
2. Change path to `%HOME%/.vscode/extensions/hangxingliu.vscode-coding-tracker-0.3.0`
46-
- In Windows OS, enter command: `cd %HOME%/.vscode/extensions/hangxingliu.vscode-coding-tracker-0.3.0`
47-
- In Linux/Mac OS, enter command: `cd $HOME/.vscode/extensions/hangxingliu.vscode-coding-tracker-0.3.0`
48-
3. Launch tracker server by using command: `npm start -- -t ${REPLACE_TO_YOUR_TOKEN}`
45+
2. Change path to `%HOME%/.vscode/extensions/hangxingliu.vscode-coding-tracker-0.3.1`
46+
- In Windows OS, enter command: `cd %HOME%/.vscode/extensions/hangxingliu.vscode-coding-tracker-0.3.1`
47+
- In Linux/Mac OS, enter command: `cd $HOME/.vscode/extensions/hangxingliu.vscode-coding-tracker-0.3.1`
48+
3. Execute `npm i`
49+
4. Launch tracker server by using command: `npm start -- -t ${REPLACE_TO_YOUR_TOKEN}`
4950
- Such as `npm start -- -t test_token`, means your upload token is `test_token`
5051
- And you can get more configurations and descriptions by using command `npm start -- --help`
5152
- Be care! It is necessary to add `--` following to `npm start` to passing following arguments to tracker server
52-
4. And your tracking data is under `./database` in default.
53+
5. And your tracking data is under `./database` in default.
5354

5455
#### Remote server
5556

@@ -91,6 +92,14 @@ Or, just open browser and enter `http://${YOUR_SERVER_HOST_NAME}:${PORT}/report/
9192

9293
## Current Version
9394

95+
### 0.3.1
96+
97+
0. **fixed the local server severe bug.**
98+
**(because vscode install extension would not resolve dependencies and I forgot a dependency)**
99+
1. fixed the wrong coding time record because some feature since VSCode 1.9.0
100+
2. fixed could not upload tracking data in non-project context since VSCode 1.9.0
101+
3. remove some redundant git merge files
102+
94103
### 0.3.0
95104

96105
0. **Added local server mode. So you could use this extension easily.**

TODO.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
# TODO
22

3-
- [x] Modified README.md content
43
- [ ] Add lines count and character count tracking.(How many lines you modify and how many characters you modify)
5-
- [x] Config: `codingTracker.localServerMode` (start a local server)
6-
- [x] Action: `codingTracker.startLocalServer` (localMode: restart local server)
7-
- [x] Action: `codingTracker.stopLocalServer` (localMode: stop local server)
8-
- [x] Action: `codingTracker.showReport` (localMode: show local analyze report)

extension.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ const CODING_SHORTEST_UNIT_MS = 5 * SECOND_IN_MS,
2424
//if you have time below not coding(pressing your keyboard), the coding track record will be upload and re-track
2525
MAX_CODING_WAIT_TIME = 30 * SECOND_IN_MS;
2626

27+
//If there a event onFileCoding with scheme in here, just ignore this event
28+
const INVALID_CODING_DOCUMENT_SCHEMES = [
29+
//there are will be a `onDidChangeTextDocument` with document scheme `git-index`
30+
//be emitted when you switch document, so ignore it
31+
'git-index',
32+
//when you just look up output channel content, there will be a `onDidChangeTextDocument` be emitted
33+
'output',
34+
//This is a edit event emit from you debug console input box
35+
'input'
36+
];
37+
2738
var activeDocument,
2839
uploadObjectGenerator,
2940
//Tracking data, record document open time, first coding time and last coding time and coding time long
@@ -81,6 +92,7 @@ var EventHandler = {
8192
}
8293
},
8394
onActiveFileChange: (doc) => {
95+
log.d('onActiveFileChange: ', doc);
8496
var now = Date.now();
8597
// If there is a TextEditor opened before changed, should upload the track data
8698
if (activeDocument) {
@@ -99,11 +111,12 @@ var EventHandler = {
99111
trackData.codingLong = trackData.lastCodingTime = trackData.firstCodingTime = 0;
100112
},
101113
onFileCoding: (doc) => {
102-
//ignore event emit from vscode `git-index`
103-
// `vscode.workspace.onDidChangeTextDocument`
104-
//because it is not a coding action
105-
if (!doc || doc.uri.scheme == 'git-index')
106-
return;
114+
log.d('onFileCoding: ', doc);
115+
116+
//Ignore the invalid coding file schemes
117+
if (!doc || INVALID_CODING_DOCUMENT_SCHEMES.indexOf(doc.uri.scheme) >= 0 )
118+
return;
119+
107120
var now = Date.now();
108121
//If time is too short to calling this function then just ignore it
109122
if (now - CODING_SHORTEST_UNIT_MS < trackData.lastCodingTime)

lib/LocalServer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ const DEFAULT_PORT = 10345;
1414
const SILENT_START_SERVER = true;
1515

1616
//som parameters for start local server
17-
const EXECUTE_CWD = `${__dirname}/..`,
18-
EXECUTE_BIN_FILE = 'npm',
19-
EXECUTE_PARAMETERS = ['start', '--',
17+
const EXECUTE_CWD = `${__dirname}/../node_modules/vscode-coding-tracker-server/`,
18+
EXECUTE_BIN_FILE = 'node',
19+
EXECUTE_PARAMETERS = ['./app',
2020
'--local',
2121
'--debug',
2222
'--public-report',
23-
`-o`,`${process.env.HOME}/.coding-tracker/`,
23+
`-o`,`${process.env.USERPROFILE||process.env.HOME}/.coding-tracker/`,
2424
`--port={0}`,
2525
`--token={1}`
2626
];

lib/UploadObjectGenerator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var baseUploadObject = {
1515

1616
module.exports = function (projectPath) {
1717
var uploadObject = cloneSimpleMapObject(baseUploadObject);
18-
uploadObject.proj = projectPath;
18+
uploadObject.proj = projectPath || 'unknown';
1919

2020
this.setComputerId = computerId => uploadObject.pcid = computerId;
2121

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-coding-tracker",
33
"displayName": "Coding Tracker",
44
"description": "A coding activities tracker(time, file, type)",
5-
"version": "0.3.0",
5+
"version": "0.3.1",
66
"license": "GPL-3.0",
77
"publisher": "hangxingliu",
88
"author": "hangxingliu",
@@ -61,7 +61,6 @@
6161
"url": "https://github.com/hangxingliu/vscode-coding-tracker"
6262
},
6363
"scripts": {
64-
"postinstall": "node ./node_modules/vscode/bin/install",
6564
"install-tsd": "npm install @types/request",
6665
"start": "./node_modules/.bin/coding-tracker-server"
6766
},
@@ -74,6 +73,7 @@
7473
"dependencies": {
7574
"fs-extra": "*",
7675
"tree-kill": "*",
77-
"vscode-coding-tracker-server": "^0.3.0"
76+
"request": "*",
77+
"vscode-coding-tracker-server": "^0.3.1"
7878
}
7979
}

0 commit comments

Comments
 (0)