Skip to content

Commit

Permalink
1.0.13
Browse files Browse the repository at this point in the history
 - fixed task creation issue that randomly occured
  • Loading branch information
DeeJayTC committed Aug 12, 2019
1 parent 43b0693 commit 71f7800
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Change Log
## 1.0.13
- Fixed an issue with task creation that randomly occured

## 1.0.12
- Workaround for VSCode GlobalState not always updating.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"url": "https://twitter.com/Teamwork"
}
],
"version": "1.0.12",
"version": "1.0.13",
"engines": {
"vscode": "^1.33.0"
},
Expand Down
32 changes: 19 additions & 13 deletions src/teamworkProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,24 @@ export class TeamworkProjects{

let gitLink = "";
let gitBranch = "";
const gitExtension = vscode.extensions.getExtension('vscode.git');
if( !isNullOrUndefined(gitExtension) ){
const gitExtension = vscode.extensions.getExtension('vscode.git').exports;
const api = gitExtension.getAPI(1);
if(api && api.repositories.length > 0){
let repo = api.repositories[0];
let remote = repo.state.remotes[0];
gitBranch = repo.state.HEAD.name;
gitLink = remote.fetchUrl.replace(".git","") + "/blob/" + gitBranch + fileName + "#L" + line;
gitLink = gitLink.replace("ssh://git@","https://");
}
}
let taskDescription = "Task added from VSCode: \n";
try{
const gitExtension = vscode.extensions.getExtension('vscode.git');
if( !isNullOrUndefined(gitExtension) ){
const gitExtension = vscode.extensions.getExtension('vscode.git').exports;
const api = gitExtension.getAPI(1);
if(api && api.repositories.length > 0){
let repo = api.repositories[0];
let remote = repo.state.remotes[0];
gitBranch = repo.state.HEAD.name;
gitLink = remote.fetchUrl.replace(".git","") + "/blob/" + gitBranch + fileName + "#L" + line;
gitLink = gitLink.replace("ssh://git@","https://");
}
}
}catch(exception){

}

let taskDescription = "Task added from VSCode: \n";
taskDescription += "File: " + fileName + "\n";
taskDescription += "Line: " + line + "\n";
if(gitBranch.length > 1) {taskDescription += "Branch:" + gitBranch + "\n";}
Expand All @@ -226,6 +231,7 @@ export class TeamworkProjects{
}
var content = taskDetails.content;
var responsible = taskDetails["responsible-party-names"];
if(isNullOrUndefined(responsible)) { responsible = "anyone"; }
editor.edit(edit => {
edit.setEndOfLine(vscode.EndOfLine.CRLF);
edit.insert(new vscode.Position(line, cursor), commentWrapper + "Task: " + content + "\r\n");
Expand Down
Binary file renamed twp-1.0.10.vsix → twp-1.0.13.vsix
Binary file not shown.
Binary file removed twp-1.0.9.vsix
Binary file not shown.

0 comments on commit 71f7800

Please sign in to comment.