Merge from vscode 731f9c25632dbbf01ee3a7892ad9d2791fe0260c

This commit is contained in:
ADS Merger
2020-07-24 05:27:34 +00:00
parent eccf3cf5fe
commit d965d4aef3
145 changed files with 3072 additions and 1550 deletions

View File

@@ -0,0 +1,23 @@
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data:; media-src 'none'; child-src 'self'; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https:;">
<style>
body {
display: none
}
</style>
</head>
<body aria-label="">
</body>
<!-- Init Bootstrap Helpers -->
<script src="../../../../bootstrap.js"></script>
<script src="../../../../vs/loader.js"></script>
<script src="../../../../bootstrap-window.js"></script>
<!-- Startup via issueReporter.js -->
<script src="issueReporter.js"></script>
</html>

View File

@@ -0,0 +1,19 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
/**
* @type {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options: object) => unknown }}
*/
const bootstrapWindow = (() => {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
})();
bootstrapWindow.load(['vs/code/electron-sandbox/issue/issueReporterMain'], function (issueReporter, configuration) {
issueReporter.startup(configuration);
}, { forceEnableDeveloperKeybindings: true, disallowReloadKeybinding: true });

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,278 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IssueType, ISettingSearchResult, IssueReporterExtensionData } from 'vs/platform/issue/common/issue';
import { SystemInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
export interface IssueReporterData {
issueType: IssueType;
issueDescription?: string;
versionInfo?: any;
systemInfo?: SystemInfo;
processInfo?: any;
workspaceInfo?: any;
includeSystemInfo: boolean;
includeWorkspaceInfo: boolean;
includeProcessInfo: boolean;
includeExtensions: boolean;
includeSearchedExtensions: boolean;
includeSettingsSearchDetails: boolean;
numberOfThemeExtesions?: number;
allExtensions: IssueReporterExtensionData[];
enabledNonThemeExtesions?: IssueReporterExtensionData[];
extensionsDisabled?: boolean;
fileOnExtension?: boolean;
selectedExtension?: IssueReporterExtensionData;
actualSearchResults?: ISettingSearchResult[];
query?: string;
filterResultCount?: number;
}
export class IssueReporterModel {
private readonly _data: IssueReporterData;
constructor(initialData?: Partial<IssueReporterData>) {
const defaultData = {
issueType: IssueType.Bug,
includeSystemInfo: true,
includeWorkspaceInfo: true,
includeProcessInfo: true,
includeExtensions: true,
includeSearchedExtensions: true,
includeSettingsSearchDetails: true,
allExtensions: []
};
this._data = initialData ? Object.assign(defaultData, initialData) : defaultData;
}
getData(): IssueReporterData {
return this._data;
}
update(newData: Partial<IssueReporterData>): void {
Object.assign(this._data, newData);
}
// {{SQL CARBON EDIT}}
serialize(): string {
return `
Issue Type: <b>${this.getIssueTypeTitle()}</b>
${this._data.issueDescription}
${this.getExtensionVersion()}
Azure Data Studio version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion}
OS version: ${this._data.versionInfo && this._data.versionInfo.os}
${this.getRemoteOSes()}
${this.getInfos()}
<!-- generated by issue reporter -->`;
}
private getRemoteOSes(): string {
if (this._data.systemInfo && this._data.systemInfo.remoteData.length) {
return this._data.systemInfo.remoteData
.map(remote => isRemoteDiagnosticError(remote) ? remote.errorMessage : `Remote OS version: ${remote.machineInfo.os}`).join('\n') + '\n';
}
return '';
}
fileOnExtension(): boolean | undefined {
const fileOnExtensionSupported = this._data.issueType === IssueType.Bug
|| this._data.issueType === IssueType.PerformanceIssue
|| this._data.issueType === IssueType.FeatureRequest;
return fileOnExtensionSupported && this._data.fileOnExtension;
}
private getExtensionVersion(): string {
if (this.fileOnExtension() && this._data.selectedExtension) {
return `\nExtension version: ${this._data.selectedExtension.version}`;
} else {
return '';
}
}
private getIssueTypeTitle(): string {
if (this._data.issueType === IssueType.Bug) {
return 'Bug';
} else if (this._data.issueType === IssueType.PerformanceIssue) {
return 'Performance Issue';
} else if (this._data.issueType === IssueType.SettingsSearchIssue) {
return 'Settings Search Issue';
} else {
return 'Feature Request';
}
}
private getInfos(): string {
let info = '';
if (this._data.issueType === IssueType.Bug || this._data.issueType === IssueType.PerformanceIssue) {
if (this._data.includeSystemInfo && this._data.systemInfo) {
info += this.generateSystemInfoMd();
}
}
if (this._data.issueType === IssueType.PerformanceIssue) {
if (this._data.includeProcessInfo) {
info += this.generateProcessInfoMd();
}
if (this._data.includeWorkspaceInfo) {
info += this.generateWorkspaceInfoMd();
}
}
if (this._data.issueType === IssueType.Bug || this._data.issueType === IssueType.PerformanceIssue) {
if (!this._data.fileOnExtension && this._data.includeExtensions) {
info += this.generateExtensionsMd();
}
}
if (this._data.issueType === IssueType.SettingsSearchIssue) {
if (this._data.includeSearchedExtensions) {
info += this.generateExtensionsMd();
}
if (this._data.includeSettingsSearchDetails) {
info += this.generateSettingSearchResultsMd();
info += '\n' + this.generateSettingsSearchResultDetailsMd();
}
}
return info;
}
private generateSystemInfoMd(): string {
let md = `<details>
<summary>System Info</summary>
|Item|Value|
|---|---|
`;
if (this._data.systemInfo) {
md += `|CPUs|${this._data.systemInfo.cpus}|
|GPU Status|${Object.keys(this._data.systemInfo.gpuStatus).map(key => `${key}: ${this._data.systemInfo!.gpuStatus[key]}`).join('<br>')}|
|Load (avg)|${this._data.systemInfo.load}|
|Memory (System)|${this._data.systemInfo.memory}|
|Process Argv|${this._data.systemInfo.processArgs}|
|Screen Reader|${this._data.systemInfo.screenReader}|
|VM|${this._data.systemInfo.vmHint}|`;
if (this._data.systemInfo.linuxEnv) {
md += `\n|DESKTOP_SESSION|${this._data.systemInfo.linuxEnv.desktopSession}|
|XDG_CURRENT_DESKTOP|${this._data.systemInfo.linuxEnv.xdgCurrentDesktop}|
|XDG_SESSION_DESKTOP|${this._data.systemInfo.linuxEnv.xdgSessionDesktop}|
|XDG_SESSION_TYPE|${this._data.systemInfo.linuxEnv.xdgSessionType}|`;
}
this._data.systemInfo.remoteData.forEach(remote => {
if (isRemoteDiagnosticError(remote)) {
md += `\n\n${remote.errorMessage}`;
} else {
md += `
|Item|Value|
|---|---|
|Remote|${remote.hostName}|
|OS|${remote.machineInfo.os}|
|CPUs|${remote.machineInfo.cpus}|
|Memory (System)|${remote.machineInfo.memory}|
|VM|${remote.machineInfo.vmHint}|`;
}
});
}
md += '\n</details>';
return md;
}
private generateProcessInfoMd(): string {
return `<details>
<summary>Process Info</summary>
\`\`\`
${this._data.processInfo}
\`\`\`
</details>
`;
}
private generateWorkspaceInfoMd(): string {
return `<details>
<summary>Workspace Info</summary>
\`\`\`
${this._data.workspaceInfo};
\`\`\`
</details>
`;
}
private generateExtensionsMd(): string {
if (this._data.extensionsDisabled) {
return 'Extensions disabled';
}
const themeExclusionStr = this._data.numberOfThemeExtesions ? `\n(${this._data.numberOfThemeExtesions} theme extensions excluded)` : '';
if (!this._data.enabledNonThemeExtesions) {
return 'Extensions: none' + themeExclusionStr;
}
const tableHeader = `Extension|Author (truncated)|Version
---|---|---`;
const table = this._data.enabledNonThemeExtesions.map(e => {
return `${e.name}|${e.publisher.substr(0, 3)}|${e.version}`;
}).join('\n');
return `<details><summary>Extensions (${this._data.enabledNonThemeExtesions.length})</summary>
${tableHeader}
${table}
${themeExclusionStr}
</details>`;
}
private generateSettingsSearchResultDetailsMd(): string {
return `
Query: ${this._data.query}
Literal matches: ${this._data.filterResultCount}`;
}
private generateSettingSearchResultsMd(): string {
if (!this._data.actualSearchResults) {
return '';
}
if (!this._data.actualSearchResults.length) {
return `No fuzzy results`;
}
const tableHeader = `Setting|Extension|Score
---|---|---`;
const table = this._data.actualSearchResults.map(setting => {
return `${setting.key}|${setting.extensionId}|${String(setting.score).slice(0, 5)}`;
}).join('\n');
return `<details><summary>Results</summary>
${tableHeader}
${table}
</details>`;
}
}

View File

@@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { escape } from 'vs/base/common/strings';
import { localize } from 'vs/nls';
export default (): string => `
<div id="issue-reporter">
<div id="english" class="input-group hidden">${escape(localize('completeInEnglish', "Please complete the form in English."))}</div>
<div class="section">
<div class="input-group">
<label class="inline-label" for="issue-type">${escape(localize('issueTypeLabel', "This is a"))}</label>
<select id="issue-type" class="inline-form-control">
<!-- To be dynamically filled -->
</select>
</div>
<div class="input-group" id="problem-source">
<label class="inline-label" for="issue-source">${escape(localize('issueSourceLabel', "File on"))}<span class="required-input">*</span></label>
<select id="issue-source" class="inline-form-control" required>
<!-- To be dynamically filled -->
</select>
<div id="problem-source-help-text" class="instructions hidden">${escape(localize('disableExtensionsLabelText', "Try to reproduce the problem after {0}. If the problem only reproduces when extensions are active, it is likely an issue with an extension."))
.replace('{0}', `<span tabIndex=0 role="button" id="disableExtensions" class="workbenchCommand">${escape(localize('disableExtensions', "disabling all extensions and reloading the window"))}</span>`)}
</div>
<div id="extension-selection">
<label class="inline-label" for="extension-selector">${escape(localize('chooseExtension', "Extension"))} <span class="required-input">*</span></label>
<select id="extension-selector" class="inline-form-control">
<!-- To be dynamically filled -->
</select>
<div id="extension-selection-validation-error" class="validation-error hidden" role="alert">${escape(localize('extensionWithNonstandardBugsUrl', "The issue reporter is unable to create issues for this extension. Please visit {0} to report an issue."))
.replace('{0}', `<span tabIndex=0 role="button" id="extensionBugsLink" class="workbenchCommand"><!-- To be dynamically filled --></span>`)}</div>
<div id="extension-selection-validation-error-no-url" class="validation-error hidden" role="alert">
${escape(localize('extensionWithNoBugsUrl', "The issue reporter is unable to create issues for this extension, as it does not specify a URL for reporting issues. Please check the marketplace page of this extension to see if other instructions are available."))}
</div>
</div>
</div>
<div class="input-group">
<label class="inline-label" for="issue-title">${escape(localize('issueTitleLabel', "Title"))} <span class="required-input">*</span></label>
<input id="issue-title" type="text" class="inline-form-control" placeholder="${escape(localize('issueTitleRequired', "Please enter a title."))}" required>
<div id="issue-title-length-validation-error" class="validation-error hidden" role="alert">${escape(localize('titleLengthValidation', "The title is too long."))}</div>
<small id="similar-issues">
<!-- To be dynamically filled -->
</small>
</div>
</div>
<div class="input-group description-section">
<label for="description" id="issue-description-label">
<!-- To be dynamically filled -->
</label>
<div class="instructions" id="issue-description-subtitle">
<!-- To be dynamically filled -->
</div>
<div class="block-info-text">
<textarea name="description" id="description" placeholder="${escape(localize('details', "Please enter details."))}" required></textarea>
</div>
</div>
<div class="system-info" id="block-container">
<div class="block block-system">
<input class="sendData" type="checkbox" id="includeSystemInfo" checked/>
<label class="caption" for="includeSystemInfo">${escape(localize({
key: 'sendSystemInfo',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the system information']
}, "Include my system information ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<div class="block-info hidden">
<!-- To be dynamically filled -->
</div>
</div>
<div class="block block-process">
<input class="sendData" type="checkbox" id="includeProcessInfo" checked/>
<label class="caption" for="includeProcessInfo">${escape(localize({
key: 'sendProcessInfo',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the process info']
}, "Include my currently running processes ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<pre class="block-info hidden">
<code>
<!-- To be dynamically filled -->
</code>
</pre>
</div>
<div class="block block-workspace">
<input class="sendData" type="checkbox" id="includeWorkspaceInfo" checked/>
<label class="caption" for="includeWorkspaceInfo">${escape(localize({
key: 'sendWorkspaceInfo',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the workspace information']
}, "Include my workspace metadata ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<pre id="systemInfo" class="block-info hidden">
<code>
<!-- To be dynamically filled -->
</code>
</pre>
</div>
<div class="block block-extensions">
<input class="sendData" type="checkbox" id="includeExtensions" checked/>
<label class="caption" for="includeExtensions">${escape(localize({
key: 'sendExtensions',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the enabled extensions list']
}, "Include my enabled extensions ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<div id="systemInfo" class="block-info hidden">
<!-- To be dynamically filled -->
</div>
</div>
<div class="block block-searchedExtensions">
<input class="sendData" type="checkbox" id="includeSearchedExtensions" checked/>
<label class="caption" for="includeSearchedExtensions">${escape(localize({
key: 'sendSearchedExtensions',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the searched extensions']
}, "Send searched extensions ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<div class="block-info hidden">
<!-- To be dynamically filled -->
</div>
</div>
<div class="block block-settingsSearchResults">
<input class="sendData" type="checkbox" id="includeSettingsSearchDetails" checked/>
<label class="caption" for="includeSettingsSearchDetails">${escape(localize({
key: 'sendSettingsSearchDetails',
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the search details']
}, "Send settings search details ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
<div class="block-info hidden">
<!-- To be dynamically filled -->
</div>
</div>
</div>
</div>`;

View File

@@ -0,0 +1,370 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Table
*/
table {
width: 100%;
max-width: 100%;
background-color: transparent;
border-collapse: collapse;
}
th {
vertical-align: bottom;
border-bottom: 1px solid;
padding: 5px;
text-align: inherit;
}
td {
padding: 5px;
vertical-align: top;
}
tr td:first-child {
width: 30%;
}
label {
user-select: none;
}
.block-settingsSearchResults-details {
padding-bottom: .5rem;
}
.block-settingsSearchResults-details > div {
padding: .5rem .75rem;
}
.section {
margin-bottom: .5em;
}
/**
* Forms
*/
input[type="text"], textarea {
display: block;
width: 100%;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
border: 1px solid #ced4da;
}
textarea {
overflow: auto;
resize: vertical;
}
/**
* Button
*/
.monaco-text-button {
display: block;
width: auto;
padding: 4px 10px;
align-self: flex-end;
margin-bottom: 10px;
}
select {
height: calc(2.25rem + 2px);
display: inline-block;
padding: 3px 3px;
font-size: 14px;
line-height: 1.5;
color: #495057;
background-color: #fff;
border: none;
}
* {
box-sizing: border-box;
}
textarea, input, select {
font-family: inherit;
}
html {
color: #CCCCCC;
height: 100%;
}
/* Font Families (with CJK support) */
.mac { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.mac:lang(zh-Hans) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; }
.mac:lang(zh-Hant) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }
.mac:lang(ja) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; }
.mac:lang(ko) { font-family: -apple-system, BlinkMacSystemFont, "Nanum Gothic", "Apple SD Gothic Neo", "AppleGothic", sans-serif; }
.windows { font-family: "Segoe WPC", "Segoe UI", sans-serif; }
.windows:lang(zh-Hans) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }
.windows:lang(zh-Hant) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }
.windows:lang(ja) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }
.windows:lang(ko) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }
/* Linux: add `system-ui` as first font and not `Ubuntu` to allow other distribution pick their standard OS font */
.linux { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; }
.linux:lang(zh-Hans) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }
.linux:lang(zh-Hant) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; }
.linux:lang(ja) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }
.linux:lang(ko) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
body {
margin: 0;
overflow-y: scroll;
height: 100%;
}
.hidden {
display: none;
}
.block {
font-size: 12px;
}
.block .block-info {
width: 100%;
font-size: 12px;
overflow: auto;
overflow-wrap: break-word;
margin: 5px;
padding: 10px;
}
#issue-reporter {
max-width: 85vw;
margin-left: auto;
margin-right: auto;
padding-top: 2em;
padding-bottom: 2em;
display: flex;
flex-direction: column;
height: 100%;
}
.description-section {
flex-grow: 1;
display: flex;
flex-direction: column;
flex-shrink: 0;
}
textarea {
flex-grow: 1;
min-height: 150px;
}
.block-info-text {
display: flex;
flex-grow: 1;
}
#github-submit-btn {
flex-shrink: 0;
margin-left: auto;
margin-top: 10px;
margin-bottom: 10px;
}
.two-col {
display: inline-block;
width: 49%;
}
#vscode-version {
width: 90%;
}
.input-group {
margin-bottom: 1em;
}
#extension-selection {
margin-top: 1em;
}
select, input, textarea {
border: 1px solid transparent;
margin-top: 10px;
}
.validation-error {
font-size: 12px;
margin-top: 1em;
}
input[type="checkbox"] {
width: auto;
display: inline-block;
margin-top: 0;
vertical-align: middle;
cursor: pointer;
}
input:disabled {
opacity: 0.6;
}
.list-title {
margin-top: 1em;
margin-left: 1em;
}
.instructions {
font-size: 12px;
margin-top: .5em;
}
a, .workbenchCommand {
cursor: pointer;
border: 1px solid transparent;
}
.workbenchCommand:disabled {
color: #868e96;
cursor: default
}
.block-extensions .block-info {
margin-bottom: 1.5em;
}
/* Default styles, overwritten if a theme is provided */
input, select, textarea {
background-color: #3c3c3c;
border: none;
color: #cccccc;
}
a {
color: #CCCCCC;
text-decoration: none;
}
.section .input-group .validation-error {
margin-left: calc(15% + 5px);
padding: 10px;
}
.section .inline-form-control, .section .inline-label {
display: inline-block;
}
.section .inline-label {
width: 95px;
}
.section .inline-form-control {
width: calc(100% - 100px);
}
#issue-type {
cursor: pointer;
}
#similar-issues {
margin-left: 15%;
display: block;
}
#problem-source-help-text {
margin-left: calc(15% + 1em);
}
@media (max-width: 950px) {
.section .inline-label {
width: 15%;
}
#problem-source-help-text {
margin-left: calc(15% + 1em);
}
.section .inline-form-control {
width: calc(85% - 5px);
}
}
@media (max-width: 620px) {
.section .inline-label {
display: none !important;
}
#problem-source-help-text {
margin-left: 1em;
}
.section .inline-form-control {
width: 100%;
}
#similar-issues, .section .input-group .validation-error {
margin-left: 0;
}
}
::-webkit-scrollbar {
width: 14px;
}
::-webkit-scrollbar-thumb {
min-height: 20px;
}
::-webkit-scrollbar-corner {
display: none;
}
.issues-container {
margin-left: 1.5em;
margin-top: .5em;
max-height: 92px;
overflow-y: auto;
}
.issues-container > .issue {
padding: 4px 0;
display: flex;
}
.issues-container > .issue > .issue-link {
width: calc(100% - 82px);
overflow: hidden;
padding-top: 3px;
white-space: nowrap;
text-overflow: ellipsis;
}
.issues-container > .issue > .issue-state .codicon {
width: 16px;
}
.issues-container > .issue > .issue-state {
width: 77px;
padding: 3px 6px;
margin-right: 5px;
color: #CCCCCC;
background-color: #3c3c3c;
border-radius: .25rem;
}
.issues-container > .issue .label {
margin-left: 5px;
width: 44px;
text-overflow: ellipsis;
overflow: hidden;
}

View File

@@ -0,0 +1,233 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { IssueReporterModel } from 'vs/code/electron-sandbox/issue/issueReporterModel';
import { normalizeGitHubUrl } from 'vs/platform/issue/common/issueReporterUtil';
import { IssueType } from 'vs/platform/issue/common/issue';
suite('IssueReporter', () => {
test('sets defaults to include all data', () => {
const issueReporterModel = new IssueReporterModel();
assert.deepEqual(issueReporterModel.getData(), {
allExtensions: [],
includeSystemInfo: true,
includeWorkspaceInfo: true,
includeProcessInfo: true,
includeExtensions: true,
includeSearchedExtensions: true,
includeSettingsSearchDetails: true,
issueType: 0
});
});
test('serializes model skeleton when no data is provided', () => { // {{SQL CARBON EDIT}} modify test for ads
const issueReporterModel = new IssueReporterModel({});
assert.equal(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
undefined
Azure Data Studio version: undefined
OS version: undefined
Extensions: none
<!-- generated by issue reporter -->`);
});
test('serializes GPU information when data is provided', () => { // {{SQL CARBON EDIT}} modify test for ads
const issueReporterModel = new IssueReporterModel({
issueType: 0,
systemInfo: {
os: 'Darwin',
cpus: 'Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)',
memory: '16.00GB',
vmHint: '0%',
processArgs: '',
screenReader: 'no',
remoteData: [],
gpuStatus: {
'2d_canvas': 'enabled',
'checker_imaging': 'disabled_off'
}
}
});
assert.equal(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
undefined
Azure Data Studio version: undefined
OS version: undefined
<details>
<summary>System Info</summary>
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)|
|GPU Status|2d_canvas: enabled<br>checker_imaging: disabled_off|
|Load (avg)|undefined|
|Memory (System)|16.00GB|
|Process Argv||
|Screen Reader|no|
|VM|0%|
</details>Extensions: none
<!-- generated by issue reporter -->`);
});
test.skip('serializes Linux environment information when data is provided', () => { //{{SQL CARBON EDIT}} skip test
const issueReporterModel = new IssueReporterModel({
issueType: 0,
systemInfo: {
os: 'Darwin',
cpus: 'Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)',
memory: '16.00GB',
vmHint: '0%',
processArgs: '',
screenReader: 'no',
remoteData: [],
gpuStatus: {},
linuxEnv: {
desktopSession: 'ubuntu',
xdgCurrentDesktop: 'ubuntu',
xdgSessionDesktop: 'ubuntu:GNOME',
xdgSessionType: 'x11'
}
}
});
assert.equal(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
undefined
VS Code version: undefined
OS version: undefined
<details>
<summary>System Info</summary>
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)|
|GPU Status||
|Load (avg)|undefined|
|Memory (System)|16.00GB|
|Process Argv||
|Screen Reader|no|
|VM|0%|
|DESKTOP_SESSION|ubuntu|
|XDG_CURRENT_DESKTOP|ubuntu|
|XDG_SESSION_DESKTOP|ubuntu:GNOME|
|XDG_SESSION_TYPE|x11|
</details>Extensions: none
<!-- generated by issue reporter -->`);
});
test.skip('serializes remote information when data is provided', () => { //{{SQL CARBON EDIT}} skip test
const issueReporterModel = new IssueReporterModel({
issueType: 0,
systemInfo: {
os: 'Darwin',
cpus: 'Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)',
memory: '16.00GB',
vmHint: '0%',
processArgs: '',
screenReader: 'no',
gpuStatus: {
'2d_canvas': 'enabled',
'checker_imaging': 'disabled_off'
},
remoteData: [
{
hostName: 'SSH: Pineapple',
machineInfo: {
os: 'Linux x64 4.18.0',
cpus: 'Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz (2 x 2294)',
memory: '8GB',
vmHint: '100%'
}
}
]
}
});
assert.equal(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
undefined
VS Code version: undefined
OS version: undefined
Remote OS version: Linux x64 4.18.0
<details>
<summary>System Info</summary>
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)|
|GPU Status|2d_canvas: enabled<br>checker_imaging: disabled_off|
|Load (avg)|undefined|
|Memory (System)|16.00GB|
|Process Argv||
|Screen Reader|no|
|VM|0%|
|Item|Value|
|---|---|
|Remote|SSH: Pineapple|
|OS|Linux x64 4.18.0|
|CPUs|Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz (2 x 2294)|
|Memory (System)|8GB|
|VM|100%|
</details>Extensions: none
<!-- generated by issue reporter -->`);
});
test('should normalize GitHub urls', () => {
[
'https://github.com/repo',
'https://github.com/repo/',
'https://github.com/repo.git',
'https://github.com/repo/issues',
'https://github.com/repo/issues/',
'https://github.com/repo/issues/new',
'https://github.com/repo/issues/new/'
].forEach(url => {
assert.equal('https://github.com/repo', normalizeGitHubUrl(url));
});
});
test('should have support for filing on extensions for bugs, performance issues, and feature requests', () => {
[
IssueType.Bug,
IssueType.FeatureRequest,
IssueType.PerformanceIssue
].forEach(type => {
const issueReporterModel = new IssueReporterModel({
issueType: type,
fileOnExtension: true
});
assert.equal(issueReporterModel.fileOnExtension(), true);
});
[
IssueType.SettingsSearchIssue
].forEach(type => {
const issueReporterModel = new IssueReporterModel({
issueType: type,
fileOnExtension: true
});
assert.equal(issueReporterModel.fileOnExtension(), false);
});
});
});