@@ -70,7 +70,7 @@ class RunFormatOnSave {
7070 const shouldScanForNestedPackages = this . config . get < Boolean > ( 'scanForNestedProjects' ) ;
7171
7272 const shouldUseCustomLineLength = customLineLength > 0 ;
73- let executable : " dart" | "dartfmt" ;
73+ const executable = ' dart' ;
7474 const args : Array < string > = [ ] ;
7575
7676 const projectPath = shouldScanForNestedPackages ? this . getProjectPath ( this . projectDir , fileName ) : this . projectDir ;
@@ -98,14 +98,13 @@ class RunFormatOnSave {
9898 // The `onDocumentSave` command will just be short-circuited if it is run on non-Dart files.
9999 }
100100
101- this . showChannelMessage ( `Running ${ this . useOverReactFormat ? 'OverReact Format' : 'dartfmt ' } ...` ) ;
101+ this . showChannelMessage ( `Running ${ this . useOverReactFormat ? 'OverReact Format' : 'dart format ' } ...` ) ;
102102
103103 if ( shouldUseCustomLineLength && shouldDetectLineLength ) {
104104 this . showChannelMessage ( `Both a custom line-length value and detectCustomLineLength set to true. Skipping line-length detection.` ) ;
105105 }
106106
107107 if ( this . useOverReactFormat ) {
108- executable = 'dart'
109108 args . push ( 'run' , 'over_react_format' , fileName ) ;
110109 if ( shouldUseCustomLineLength ) {
111110 args . push ( '-l' , `${ customLineLength } ` ) ;
@@ -118,16 +117,17 @@ class RunFormatOnSave {
118117 }
119118 } else {
120119 // TODO add logic to detect line-length from dart_dev's config.dart
121- executable = 'dartfmt' ;
122- args . push ( '-w' , fileName ) ;
120+ args . push ( 'format' , fileName ) ;
123121 if ( shouldUseCustomLineLength ) {
124122 args . push ( '-l' , `${ customLineLength } ` ) ;
125123 }
126124 }
127125
128126 const command = `${ executable } ${ args . join ( ' ' ) } ` ;
129127 this . showChannelMessage ( command ) ;
130- return process . execFile ( executable , args , { cwd : this . currentProjectDir } ) ;
128+ return process . execFile ( executable , args , { cwd : this . currentProjectDir } ) . on ( 'error' , ( e ) => {
129+ this . showChannelMessage ( `error encountered: ${ e } ` ) ;
130+ } ) ;
131131 }
132132
133133 getProjectPath ( contentRoot : string , fileName : string ) : string {
0 commit comments