Skip to content

Commit

Permalink
check for unresponsive profile when reporting an extension issue, #60332
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Nov 26, 2018
1 parent b381d64 commit b6569f3
Showing 1 changed file with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/cont
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { renderOcticons } from 'vs/base/browser/ui/octiconLabel/octiconLabel';
import { join } from 'path';
import { onUnexpectedError } from 'vs/base/common/errors';

export const IExtensionHostProfileService = createDecorator<IExtensionHostProfileService>('extensionHostProfileService');
export const CONTEXT_PROFILE_SESSION_STATE = new RawContextKey<string>('profileSessionState', 'none');
Expand Down Expand Up @@ -517,7 +519,6 @@ class ReportExtensionIssueAction extends Action {
}

run(extension: IRuntimeExtension): Promise<any> {
clipboard.writeText('```json \n' + JSON.stringify(extension.status, null, '\t') + '\n```');
window.open(this.generateNewIssueUrl(extension));

return Promise.resolve(null);
Expand All @@ -531,13 +532,30 @@ class ReportExtensionIssueAction extends Action {
baseUrl = product.reportIssueUrl;
}

let message: string;
let reason: string;
if (extension.unresponsiveProfile) {
// unresponsive extension host caused
reason = 'Performance';
let path = join(os.homedir(), `${extension.description.id}-unresponsive.cpuprofile.txt`);
writeFile(path, JSON.stringify(extension.unresponsiveProfile.data)).catch(onUnexpectedError);
message = `:warning: Make sure to **attach** this file from your *home*-directory: \`${path}\` :warning:`;

} else {
// generic
clipboard.writeText('```json \n' + JSON.stringify(extension.status, null, '\t') + '\n```');
reason = 'Bug';
message = ':warning: We have written the needed data into your clipboard. Please paste! :warning:';
}

const osVersion = `${os.type()} ${os.arch()} ${os.release()}`;
const queryStringPrefix = baseUrl.indexOf('?') === -1 ? '?' : '&';
const body = encodeURIComponent(
`- Extension Name: ${extension.description.name}
- Extension Version: ${extension.description.version}
- OS Version: ${osVersion}
- VSCode version: ${pkg.version}` + '\n\n We have written the needed data into your clipboard. Please paste:'
`- Issue Type: \`${reason}\`
- Extension Name: \`${extension.description.name}\`
- Extension Version: \`${extension.description.version}\`
- OS Version: \`${osVersion}\`
- VSCode version: \`${pkg.version}\`\n\n${message}`
);

return `${baseUrl}${queryStringPrefix}body=${body}`;
Expand Down

0 comments on commit b6569f3

Please sign in to comment.