Skip to content

Commit 33defc4

Browse files
authored
Merge pull request #593 from bohdan-harniuk/diagnostic-improvement
Diagnostic improvement
2 parents 9fbde76 + d1ebb94 commit 33defc4

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

resources/fileTemplates/code/GitHub New Bug Issue Body Template.txt.ft

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ If applicable, add screenshots to help explain your problem.
2424

2525
**Please complete the following information:** (*)
2626

27-
- OS: [e.g. MacOS or Ubuntu Linux 20.04]
28-
- PhpStorm/Intellij version: [e.g. 2019.3.3]
29-
- Plugin Version: [e.g. 1.0.0]
27+
#set($os = "#if(${OS_VERSION})${OS_VERSION}#else[e.g. MacOS or Ubuntu Linux 20.04]#end")
28+
#set($intellijVersion = "#if(${INTELLIJ_VERSION})${INTELLIJ_VERSION}#else[e.g. 2019.3.3]#end")
29+
#set($pluginVersion = "#if(${PLUGIN_VERSION})${PLUGIN_VERSION}#else[e.g. 1.0.0]#end")
30+
- OS: $os
31+
- PhpStorm/Intellij version: $intellijVersion
32+
- Plugin Version: $pluginVersion
3033

3134
**Additional context**
3235

src/com/magento/idea/magento2plugin/project/diagnostic/github/GitHubNewIssueBodyBuilderUtil.java

+38
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
import com.intellij.ide.fileTemplates.FileTemplate;
99
import com.intellij.ide.fileTemplates.FileTemplateManager;
10+
import com.intellij.ide.plugins.IdeaPluginDescriptor;
11+
import com.intellij.ide.plugins.PluginManagerCore;
12+
import com.intellij.openapi.application.ApplicationInfo;
13+
import com.intellij.openapi.extensions.PluginId;
1014
import com.intellij.openapi.project.Project;
15+
import com.intellij.openapi.util.SystemInfo;
1116
import java.io.IOException;
1217
import java.net.URLDecoder;
1318
import java.net.URLEncoder;
@@ -76,6 +81,9 @@ private static String buildTemplate(
7681
final Properties properties = new Properties();
7782
properties.setProperty("BUG_DESCRIPTION", bugDescription);
7883
properties.setProperty("STACK_TRACE", stackTrace);
84+
properties.setProperty("OS_VERSION", getOsVersion());
85+
properties.setProperty("INTELLIJ_VERSION", getIntellijVersion());
86+
properties.setProperty("PLUGIN_VERSION", getPluginVersion());
7987

8088
try {
8189
return errorReportTemplate.getText(properties);
@@ -124,4 +132,34 @@ private static String encode(final @NotNull String value) {
124132
private static String decode(final @NotNull String value) {
125133
return URLDecoder.decode(value, StandardCharsets.UTF_8);
126134
}
135+
136+
/**
137+
* Get OS version.
138+
*
139+
* @return String
140+
*/
141+
private static String getOsVersion() {
142+
return SystemInfo.OS_NAME + " " + SystemInfo.OS_VERSION;
143+
}
144+
145+
/**
146+
* Get Intellij Idea version.
147+
*
148+
* @return String
149+
*/
150+
private static String getIntellijVersion() {
151+
return ApplicationInfo.getInstance().getFullVersion();
152+
}
153+
154+
/**
155+
* Get plugin version.
156+
*
157+
* @return String
158+
*/
159+
private static String getPluginVersion() {
160+
final IdeaPluginDescriptor magento2pluginDescriptor =
161+
PluginManagerCore.getPlugin(PluginId.getId("com.magento.idea.magento2plugin"));
162+
163+
return magento2pluginDescriptor == null ? null : magento2pluginDescriptor.getVersion();
164+
}
127165
}

0 commit comments

Comments
 (0)