@@ -180,28 +180,33 @@ class PSDocumentFormattingEditProvider implements DocumentFormattingEditProvider
180180
181181 let textEdits : Thenable < TextEdit [ ] > = this . executeRulesInOrder ( editor , range , options , 0 ) ;
182182 this . lockDocument ( document , textEdits ) ;
183-
184- // FIXME If the session crashes for any reason during formatting
185- // then the bar will keep displaying the previous status even after restarting the session.
186- // A fix is to restart the window
187- // AnimatedStatusBar.showAnimatedStatusBarMessage("Formatting PowerShell document", textEdits);
188183 PSDocumentFormattingEditProvider . showStatusBar ( document , textEdits ) ;
189184 return textEdits ;
190185 }
191186
192- getEditor ( document : TextDocument ) : TextEditor {
187+ setLanguageClient ( languageClient : LanguageClient ) : void {
188+ this . languageClient = languageClient ;
189+
190+ // setLanguageClient is called while restarting a session,
191+ // so this makes sure we clean up the document locker and
192+ // any residual status bars
193+ PSDocumentFormattingEditProvider . documentLocker . unlockAll ( ) ;
194+ PSDocumentFormattingEditProvider . disposeAllStatusBars ( ) ;
195+ }
196+
197+ private getEditor ( document : TextDocument ) : TextEditor {
193198 return Window . visibleTextEditors . find ( ( e , n , obj ) => { return e . document === document ; } ) ;
194199 }
195200
196- isDocumentLocked ( document : TextDocument ) : boolean {
201+ private isDocumentLocked ( document : TextDocument ) : boolean {
197202 return PSDocumentFormattingEditProvider . documentLocker . isLocked ( document ) ;
198203 }
199204
200- lockDocument ( document : TextDocument , unlockWhenDone : Thenable < any > ) : void {
205+ private lockDocument ( document : TextDocument , unlockWhenDone : Thenable < any > ) : void {
201206 PSDocumentFormattingEditProvider . documentLocker . lock ( document , unlockWhenDone ) ;
202207 }
203208
204- executeRulesInOrder (
209+ private executeRulesInOrder (
205210 editor : TextEditor ,
206211 range : Range ,
207212 options : FormattingOptions ,
@@ -267,7 +272,7 @@ class PSDocumentFormattingEditProvider implements DocumentFormattingEditProvider
267272 }
268273 }
269274
270- applyEdit (
275+ private applyEdit (
271276 editor : TextEditor ,
272277 edits : ScriptRegion [ ] ,
273278 range : Range ,
@@ -303,7 +308,7 @@ class PSDocumentFormattingEditProvider implements DocumentFormattingEditProvider
303308 }
304309 }
305310
306- getSelectionRange ( document : TextDocument ) : Range {
311+ private getSelectionRange ( document : TextDocument ) : Range {
307312 let editor = vscode . window . visibleTextEditors . find ( editor => editor . document === document ) ;
308313 if ( editor !== undefined ) {
309314 return editor . selection as Range ;
@@ -312,17 +317,7 @@ class PSDocumentFormattingEditProvider implements DocumentFormattingEditProvider
312317 return null ;
313318 }
314319
315- setLanguageClient ( languageClient : LanguageClient ) : void {
316- this . languageClient = languageClient ;
317-
318- // setLanguageClient is called while restarting a session,
319- // so this makes sure we clean up the document locker and
320- // any residual status bars
321- PSDocumentFormattingEditProvider . documentLocker . unlockAll ( ) ;
322- PSDocumentFormattingEditProvider . disposeAllStatusBars ( ) ;
323- }
324-
325- getSettings ( rule : string ) : any {
320+ private getSettings ( rule : string ) : any {
326321 let psSettings : Settings . ISettings = Settings . load ( Utils . PowerShellLanguageId ) ;
327322 let ruleSettings = new Object ( ) ;
328323 ruleSettings [ "Enable" ] = true ;
@@ -364,8 +359,6 @@ class PSDocumentFormattingEditProvider implements DocumentFormattingEditProvider
364359 private static disposeAllStatusBars ( ) {
365360 Object . keys ( this . statusBarTracker ) . slice ( ) . forEach ( ( key ) => this . disposeStatusBar ( key ) ) ;
366361 }
367-
368-
369362}
370363
371364export class DocumentFormatterFeature implements IFeature {
0 commit comments