88import 'vs/css!./media/actions' ;
99
1010import URI from 'vs/base/common/uri' ;
11- import * as collections from 'vs/base/common/collections' ;
1211import { TPromise } from 'vs/base/common/winjs.base' ;
1312import { Action } from 'vs/base/common/actions' ;
1413import { IWindowService , IWindowsService , MenuBarVisibility } from 'vs/platform/windows/common/windows' ;
@@ -21,7 +20,7 @@ import { IMessageService, Severity } from 'vs/platform/message/common/message';
2120import { IWorkspaceContextService , WorkbenchState } from 'vs/platform/workspace/common/workspace' ;
2221import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
2322import { IConfigurationService , ConfigurationTarget } from 'vs/platform/configuration/common/configuration' ;
24- import { IExtensionManagementService , LocalExtensionType , ILocalExtension , IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement' ;
23+ import { IExtensionManagementService , LocalExtensionType , IExtensionEnablementService } from 'vs/platform/extensionManagement/common/extensionManagement' ;
2524import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration' ;
2625import paths = require( 'vs/base/common/paths' ) ;
2726import { isMacintosh , isLinux , language } from 'vs/base/common/platform' ;
@@ -46,7 +45,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
4645import { IExtensionService , ActivationTimes } from 'vs/platform/extensions/common/extensions' ;
4746import { getEntries } from 'vs/base/common/performance' ;
4847import { IEditor } from 'vs/platform/editor/common/editor' ;
49- import { IIssueService } from 'vs/platform/issue/common/issue' ;
48+ import { IIssueService , IssueReporterData } from 'vs/platform/issue/common/issue' ;
5049import { IThemeService } from 'vs/platform/theme/common/themeService' ;
5150import { textLinkForeground , inputBackground , inputBorder , inputForeground , buttonBackground , buttonHoverBackground , buttonForeground , inputValidationErrorBorder , foreground , inputActiveOptionBorder } from 'vs/platform/theme/common/colorRegistry' ;
5251import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme' ;
@@ -750,7 +749,7 @@ export class CloseMessagesAction extends Action {
750749
751750export class OpenIssueReporterAction extends Action {
752751 public static readonly ID = 'workbench.action.openIssueReporter' ;
753- public static readonly LABEL = nls . localize ( 'openIssueReporter ', "Open Issue Reporter ") ;
752+ public static readonly LABEL = nls . localize ( { key : 'reportIssueInEnglish ', comment : [ 'Translate this to "Report Issue in English" in all languages please!' ] } , "Report Issue ") ;
754753
755754 constructor (
756755 id : string ,
@@ -782,7 +781,7 @@ export class OpenIssueReporterAction extends Action {
782781 zoomLevel : webFrame . getZoomLevel ( ) ,
783782 extensions
784783 } ;
785- const issueReporterData = {
784+ const issueReporterData : IssueReporterData = {
786785 styles,
787786 zoomLevel : webFrame . getZoomLevel ( ) ,
788787 enabledExtensions
@@ -795,109 +794,6 @@ export class OpenIssueReporterAction extends Action {
795794 }
796795}
797796
798- export class ReportIssueAction extends Action {
799-
800- public static readonly ID = 'workbench.action.reportIssues' ;
801- public static readonly LABEL = nls . localize ( { key : 'reportIssueInEnglish' , comment : [ 'Translate this to "Report Issue in English" in all languages please!' ] } , "Report Issue" ) ;
802-
803- constructor (
804- id : string ,
805- label : string ,
806- @IIntegrityService private integrityService : IIntegrityService ,
807- @IExtensionManagementService private extensionManagementService : IExtensionManagementService ,
808- @IExtensionEnablementService private extensionEnablementService : IExtensionEnablementService ,
809- @IEnvironmentService private environmentService : IEnvironmentService
810- ) {
811- super ( id , label ) ;
812- }
813-
814- private _optimisticIsPure ( ) : TPromise < boolean > {
815- let isPure = true ;
816- let integrityPromise = this . integrityService . isPure ( ) . then ( res => {
817- isPure = res . isPure ;
818- } ) ;
819-
820- return TPromise . any ( [ TPromise . timeout ( 100 ) , integrityPromise ] ) . then ( ( ) => {
821- return isPure ;
822- } ) ;
823- }
824-
825- public run ( ) : TPromise < boolean > {
826- return this . _optimisticIsPure ( ) . then ( isPure => {
827- return this . extensionManagementService . getInstalled ( LocalExtensionType . User ) . then ( extensions => {
828- extensions = extensions . filter ( extension => this . extensionEnablementService . isEnabled ( extension . identifier ) ) ;
829- const issueUrl = this . generateNewIssueUrl ( product . reportIssueUrl , pkg . name , pkg . version , product . commit , product . date , isPure , extensions , this . environmentService . disableExtensions ) ;
830-
831- window . open ( issueUrl ) ;
832-
833- return TPromise . as ( true ) ;
834- } ) ;
835- } ) ;
836- }
837-
838- private generateNewIssueUrl ( baseUrl : string , name : string , version : string , commit : string , date : string , isPure : boolean , extensions : ILocalExtension [ ] , areExtensionsDisabled : boolean ) : string {
839- // Avoid backticks, these can trigger XSS detectors. (https://github.com/Microsoft/vscode/issues/13098)
840- const osVersion = `${ os . type ( ) } ${ os . arch ( ) } ${ os . release ( ) } ` ;
841- const queryStringPrefix = baseUrl . indexOf ( '?' ) === - 1 ? '?' : '&' ;
842- const body = encodeURIComponent (
843- `<ul>
844- <li>VSCode Version: ${ name } ${ version } ${ isPure ? '' : ' **[Unsupported]**' } (${ product . commit || 'Commit unknown' } , ${ product . date || 'Date unknown' } )</li>
845- <li>OS Version: ${ osVersion } </li>
846- <li>${ areExtensionsDisabled ? 'Extensions: Extensions are disabled' : this . generateExtensionTable ( extensions ) } </li>
847- </ul>
848-
849- ---
850-
851- Steps to Reproduce:
852-
853- 1.
854- 2.` + ( extensions . length ? `
855-
856- <!-- Launch with \`code --disable-extensions\` to check. -->
857- Reproduces without extensions: Yes/No` : '' )
858- ) ;
859-
860- return `${ baseUrl } ${ queryStringPrefix } body=${ body } ` ;
861- }
862-
863- private generateExtensionTable ( extensions : ILocalExtension [ ] ) : string {
864- const { nonThemes, themes } = collections . groupBy ( extensions , ext => {
865- const manifestKeys = ext . manifest . contributes ? Object . keys ( ext . manifest . contributes ) : [ ] ;
866- const onlyTheme = ! ext . manifest . activationEvents && manifestKeys . length === 1 && manifestKeys [ 0 ] === 'themes' ;
867- return onlyTheme ? 'themes' : 'nonThemes' ;
868- } ) ;
869-
870- const themeExclusionStr = ( themes && themes . length ) ? `\n(${ themes . length } theme extensions excluded)` : '' ;
871- extensions = nonThemes || [ ] ;
872-
873- if ( ! extensions . length ) {
874- return 'Extensions: none' + themeExclusionStr ;
875- }
876-
877- let tableHeader = `Extension|Author (truncated)|Version
878- ---|---|---` ;
879- const table = extensions . map ( e => {
880- return `${ e . manifest . name } |${ e . manifest . publisher . substr ( 0 , 3 ) } |${ e . manifest . version } ` ;
881- } ) . join ( '\n' ) ;
882-
883- const extensionTable = `<details><summary>Extensions (${ extensions . length } )</summary>
884-
885- ${ tableHeader }
886- ${ table }
887- ${ themeExclusionStr }
888-
889- </details>` ;
890-
891- // 2000 chars is browsers de-facto limit for URLs, 400 chars are allowed for other string parts of the issue URL
892- // http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
893- if ( encodeURIComponent ( extensionTable ) . length > 1600 ) {
894- return 'the listing length exceeds browsers\' URL characters limit' ;
895- }
896-
897- return extensionTable ;
898- }
899- }
900-
901797export class ReportPerformanceIssueAction extends Action {
902798
903799 public static readonly ID = 'workbench.action.reportPerformanceIssue' ;
0 commit comments