Skip to content

Commit 6f6e4cf

Browse files
paulacamargo25wesm
authored andcommitted
Use new report issue command api (microsoft/vscode-python#23033)
Use new report issue command api microsoft/vscode-python-debugger#237 Modify the template, information about the installed extensions was added
1 parent 31bd010 commit 6f6e4cf

File tree

10 files changed

+149
-116
lines changed

10 files changed

+149
-116
lines changed

extensions/positron-python/package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"testObserver",
2424
"quickPickItemTooltip",
2525
"terminalDataWriteEvent",
26-
"terminalExecuteCommandEvent"
26+
"terminalExecuteCommandEvent",
27+
"contribIssueReporter"
2728
],
2829
"author": {
2930
"name": "Posit Software, PBC",
@@ -1272,6 +1273,11 @@
12721273
}
12731274
],
12741275
"menus": {
1276+
"issue/reporter": [
1277+
{
1278+
"command": "python.reportIssue"
1279+
}
1280+
],
12751281
"commandPalette": [
12761282
{
12771283
"category": "Python",
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!-- Please fill in all XXX markers -->
22
# Behaviour
3-
## Expected vs. Actual
43

54
XXX
65

@@ -12,13 +11,9 @@ XXX
1211
**After** creating the issue on GitHub, you can add screenshots and GIFs of what is happening. Consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ for GIF creation.
1312
-->
1413

15-
<!-- **NOTE**: Everything below except Python output panel is auto-generated; no editing required. Please do provide Python output panel. -->
14+
<!-- **NOTE**: Please do provide logs from Python Output panel. -->
1615
# Diagnostic data
1716

18-
- Python version (& distribution if applicable, e.g. Anaconda): {0}
19-
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): {1}
20-
- Value of the `python.languageServer` setting: {2}
21-
2217
<details>
2318

2419
<summary>Output for <code>Python</code> in the <code>Output</code> panel (<code>View</code>→<code>Output</code>, change the drop-down the upper-right of the <code>Output</code> panel to <code>Python</code>)
@@ -32,16 +27,3 @@ XXX
3227

3328
</p>
3429
</details>
35-
36-
<details>
37-
38-
<summary>User Settings</summary>
39-
40-
<p>
41-
42-
```
43-
{3}{4}
44-
```
45-
46-
</p>
47-
</details>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
- Python version (& distribution if applicable, e.g. Anaconda): {0}
2+
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): {1}
3+
- Value of the `python.languageServer` setting: {2}
4+
5+
<details>
6+
<summary>User Settings</summary>
7+
<p>
8+
9+
```
10+
{3}{4}
11+
```
12+
</p>
13+
</details>
14+
15+
<details>
16+
<summary>Installed Extensions</summary>
17+
18+
|Extension Name|Extension Id|Version|
19+
|---|---|---|
20+
{5}
21+
</details>

extensions/positron-python/src/client/common/application/commands/reportIssueCommand.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { EventName } from '../../../telemetry/constants';
1919
import { EnvironmentType } from '../../../pythonEnvironments/info';
2020
import { PythonSettings } from '../../configSettings';
2121
import { SystemVariables } from '../../variables/systemVariables';
22+
import { getExtensions } from '../../vscodeApis/extensionsApi';
2223

2324
/**
2425
* Allows the user to report an issue related to the Python extension using our template.
@@ -48,6 +49,8 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ
4849

4950
private templatePath = path.join(EXTENSION_ROOT_DIR, 'resources', 'report_issue_template.md');
5051

52+
private userDataTemplatePath = path.join(EXTENSION_ROOT_DIR, 'resources', 'report_issue_user_data_template.md');
53+
5154
public async openReportIssue(): Promise<void> {
5255
const settings: IPythonSettings = this.configurationService.getSettings();
5356
const argSettings = JSON.parse(await fs.readFile(this.argSettingsPath, 'utf8'));
@@ -86,6 +89,7 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ
8689
}
8790
});
8891
const template = await fs.readFile(this.templatePath, 'utf8');
92+
const userTemplate = await fs.readFile(this.userDataTemplatePath, 'utf8');
8993
const interpreter = await this.interpreterService.getActiveInterpreter();
9094
const pythonVersion = interpreter?.version?.raw ?? '';
9195
const languageServer =
@@ -97,14 +101,25 @@ export class ReportIssueCommandHandler implements IExtensionSingleActivationServ
97101
hasMultipleFolders && userSettings !== ''
98102
? `Multiroot scenario, following user settings may not apply:${os.EOL}`
99103
: '';
104+
105+
const installedExtensions = getExtensions()
106+
.filter((extension) => !extension.id.startsWith('vscode.'))
107+
.sort((a, b) => a.packageJSON.displayName.localeCompare(b.packageJSON.displayName))
108+
.map(
109+
(extension) =>
110+
`|${extension.packageJSON.displayName}|${extension.id}|${extension.packageJSON.version}|`,
111+
);
112+
100113
await this.commandManager.executeCommand('workbench.action.openIssueReporter', {
101114
extensionId: 'ms-python.python',
102-
issueBody: template.format(
115+
issueBody: template,
116+
data: userTemplate.format(
103117
pythonVersion,
104118
virtualEnvKind,
105119
languageServer,
106120
hasMultipleFoldersText,
107121
userSettings,
122+
installedExtensions.join('\n'),
108123
),
109124
});
110125
sendTelemetryEvent(EventName.USE_REPORT_ISSUE_COMMAND, undefined, {});

extensions/positron-python/src/client/common/vscodeApis/extensionsApi.ts

+5
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ export function isExtensionDisabled(extensionId: string): boolean {
3232
export function isInsider(): boolean {
3333
return vscode.env.appName.includes('Insider');
3434
}
35+
36+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
37+
export function getExtensions(): readonly vscode.Extension<any>[] {
38+
return vscode.extensions.all;
39+
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!-- Please fill in all XXX markers -->
22
# Behaviour
3-
## Expected vs. Actual
43

54
XXX
65

@@ -12,13 +11,9 @@ XXX
1211
**After** creating the issue on GitHub, you can add screenshots and GIFs of what is happening. Consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ for GIF creation.
1312
-->
1413

15-
<!-- **NOTE**: Everything below except Python output panel is auto-generated; no editing required. Please do provide Python output panel. -->
14+
<!-- **NOTE**: Please do provide logs from Python Output panel. -->
1615
# Diagnostic data
1716

18-
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.0
19-
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
20-
- Value of the `python.languageServer` setting: Pylance
21-
2217
<details>
2318

2419
<summary>Output for <code>Python</code> in the <code>Output</code> panel (<code>View</code>→<code>Output</code>, change the drop-down the upper-right of the <code>Output</code> panel to <code>Python</code>)
@@ -32,22 +27,3 @@ XXX
3227

3328
</p>
3429
</details>
35-
36-
<details>
37-
38-
<summary>User Settings</summary>
39-
40-
<p>
41-
42-
```
43-
Multiroot scenario, following user settings may not apply:
44-
45-
experiments
46-
• enabled: false
47-
48-
venvPath: "<placeholder>"
49-
50-
```
51-
52-
</p>
53-
</details>

extensions/positron-python/src/test/common/application/commands/issueTemplateVenv1.md

-56
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.0
2+
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
3+
- Value of the `python.languageServer` setting: Pylance
4+
5+
<details>
6+
<summary>User Settings</summary>
7+
<p>
8+
9+
```
10+
11+
experiments
12+
• enabled: false
13+
• optInto: []
14+
• optOutFrom: []
15+
16+
venvPath: "<placeholder>"
17+
18+
pipenvPath: "<placeholder>"
19+
20+
```
21+
</p>
22+
</details>
23+
24+
<details>
25+
<summary>Installed Extensions</summary>
26+
27+
|Extension Name|Extension Id|Version|
28+
|---|---|---|
29+
|Python|ms-python.python|2020.2|
30+
</details>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
- Python version (& distribution if applicable, e.g. Anaconda): 3.9.0
2+
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
3+
- Value of the `python.languageServer` setting: Pylance
4+
5+
<details>
6+
<summary>User Settings</summary>
7+
<p>
8+
9+
```
10+
Multiroot scenario, following user settings may not apply:
11+
12+
experiments
13+
• enabled: false
14+
15+
venvPath: "<placeholder>"
16+
17+
```
18+
</p>
19+
</details>
20+
21+
<details>
22+
<summary>Installed Extensions</summary>
23+
24+
|Extension Name|Extension Id|Version|
25+
|---|---|---|
26+
|Python|ms-python.python|2020.2|
27+
</details>

0 commit comments

Comments
 (0)