@@ -44,60 +44,46 @@ export function activate(context: vscode.ExtensionContext) {
4444 ExtensionServer . getInstance ( ) . start ( ) ;
4545 performVersionsCheck ( context ) ;
4646
47- let runCommand = ( project : ns . NSProject , options : string [ ] ) => {
47+ let runCommand = ( project : ns . NSProject ) => {
4848 if ( vscode . workspace . rootPath === undefined ) {
4949 vscode . window . showErrorMessage ( 'No workspace opened.' ) ;
5050 return ;
5151 }
5252
53- vscode . window . showQuickPick ( options )
54- . then ( target => {
55- if ( target == undefined ) {
56- return ; // e.g. if the user presses escape button
57- }
58-
59- // Move the selected option to be the first element in order to keep the last selected option at the top of the list
60- options . splice ( options . indexOf ( target ) , 1 ) ;
61- options . unshift ( target ) ;
53+ // Show output channel
54+ let runChannel : vscode . OutputChannel = vscode . window . createOutputChannel ( `Run on ${ project . platform ( ) } ` ) ;
55+ runChannel . clear ( ) ;
56+ runChannel . show ( vscode . ViewColumn . Two ) ;
6257
63- // Show output channel
64- let runChannel : vscode . OutputChannel = vscode . window . createOutputChannel ( `Run on ${ project . platform ( ) } ` ) ;
65- runChannel . clear ( ) ;
66- runChannel . show ( vscode . ViewColumn . Two ) ;
58+ AnalyticsService . getInstance ( ) . runRunCommand ( project . platform ( ) ) ;
6759
68- // Execute run command
69- let emulator : boolean = ( target === 'emulator' ) ;
70- AnalyticsService . getInstance ( ) . runRunCommand ( project . platform ( ) , emulator ) ;
71- return project . run ( emulator )
72- . then ( tnsProcess => {
73- tnsProcess . on ( 'error' , err => {
74- vscode . window . showErrorMessage ( 'Unexpected error executing NativeScript Run command.' ) ;
75- } ) ;
76- tnsProcess . stderr . on ( 'data' , data => {
77- runChannel . append ( data ) ;
78- } ) ;
79- tnsProcess . stdout . on ( 'data' , data => {
80- runChannel . append ( data ) ;
81- } ) ;
82- tnsProcess . on ( 'exit' , exitCode => {
83- tnsProcess . stdout . removeAllListeners ( 'data' ) ;
84- tnsProcess . stderr . removeAllListeners ( 'data' ) ;
85- } ) ;
86- tnsProcess . on ( 'close' , exitCode => {
87- runChannel . hide ( ) ;
88- } ) ;
60+ return project . run ( )
61+ . then ( tnsProcess => {
62+ tnsProcess . on ( 'error' , err => {
63+ vscode . window . showErrorMessage ( 'Unexpected error executing NativeScript Run command.' ) ;
64+ } ) ;
65+ tnsProcess . stderr . on ( 'data' , data => {
66+ runChannel . append ( data ) ;
67+ } ) ;
68+ tnsProcess . stdout . on ( 'data' , data => {
69+ runChannel . append ( data ) ;
70+ } ) ;
71+ tnsProcess . on ( 'exit' , exitCode => {
72+ tnsProcess . stdout . removeAllListeners ( 'data' ) ;
73+ tnsProcess . stderr . removeAllListeners ( 'data' ) ;
74+ } ) ;
75+ tnsProcess . on ( 'close' , exitCode => {
76+ runChannel . hide ( ) ;
8977 } ) ;
9078 } ) ;
9179 } ;
9280
93- let iosRunOptions = [ 'device' , 'emulator' ] ;
9481 let runIosCommand = vscode . commands . registerCommand ( 'nativescript.runIos' , ( ) => {
95- return runCommand ( new ns . IosProject ( vscode . workspace . rootPath ) , iosRunOptions ) ;
82+ return runCommand ( new ns . IosProject ( vscode . workspace . rootPath ) ) ;
9683 } ) ;
9784
98- let androidRunOptions = [ 'device' , 'emulator' ] ;
9985 let runAndroidCommand = vscode . commands . registerCommand ( 'nativescript.runAndroid' , ( ) => {
100- return runCommand ( new ns . AndroidProject ( vscode . workspace . rootPath ) , androidRunOptions ) ;
86+ return runCommand ( new ns . AndroidProject ( vscode . workspace . rootPath ) ) ;
10187 } ) ;
10288
10389 context . subscriptions . push ( runIosCommand ) ;
0 commit comments