-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from microsoft/don/issueReporter
Support for issue reporter
- Loading branch information
Showing
6 changed files
with
137 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation and GitHub. All rights reserved. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { commands, ExtensionContext } from 'vscode'; | ||
import { getLastErrors } from './logger'; | ||
|
||
export function registerIssueReporter(context: ExtensionContext) { | ||
return commands.registerCommand('dachat.reportIssue', () => { | ||
commands.executeCommand('workbench.action.openIssueReporter', { | ||
extensionId: context.extension.id, | ||
issueBody: issueBody, | ||
data: getIssueData() | ||
}); | ||
}); | ||
} | ||
|
||
const issueBody = ` | ||
<!-- Please fill in all XXX markers --> | ||
# Behaviour | ||
XXX | ||
## Steps to reproduce: | ||
1. XXX | ||
<!-- | ||
**After** creating the issue on GitHub, you can add screenshots and GIFs of what is happening. | ||
Consider tools like https://gifcap.dev, https://www.screentogif.com/ for GIF creation. | ||
--> | ||
<!-- **NOTE**: Please do provide logs from Data Analysis Output panel. --> | ||
<!-- Use the command \`Output: Focus on Output View\`, select \`Data Analysis\` from the dropdown --> | ||
<!-- Copy the output and past it in the XXX region --> | ||
# Outputs | ||
<details> | ||
<summary>Output from Data Analysis Output Panel</summary> | ||
<p> | ||
\`\`\` | ||
XXX | ||
\`\`\` | ||
</p> | ||
</details> | ||
`; | ||
|
||
|
||
function getIssueData() { | ||
const error = getLastErrors().trim(); | ||
if (!error) { | ||
return ''; | ||
} | ||
return ` | ||
<details> | ||
<summary>Last few Errors</summary> | ||
<p> | ||
\`\`\` | ||
${error} | ||
\`\`\` | ||
</p> | ||
</details> | ||
`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation and GitHub. All rights reserved. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
|
||
/** | ||
* Tracks wall clock time. Start time is set at contruction. | ||
*/ | ||
export class StopWatch { | ||
private started = Date.now(); | ||
public get elapsedTime() { | ||
return Date.now() - this.started; | ||
} | ||
public reset() { | ||
this.started = Date.now(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters