@@ -142,14 +142,6 @@ export default class CodeFormatManager {
142
142
}
143
143
}
144
144
145
- // Checks whether contents are same in the buffer post-format, throwing if
146
- // anything has changed.
147
- _checkContentsAreSame ( before : string , after : string ) : void {
148
- if ( before !== after ) {
149
- throw new Error ( "The file contents were changed before formatting was complete." )
150
- }
151
- }
152
-
153
145
// Return the text edits used to format code in the editor specified.
154
146
_formatCodeInTextEditor ( editor : TextEditor , range ?: Range ) : Observable < Array < TextEdit > > {
155
147
return Observable . defer ( ( ) => {
@@ -270,7 +262,7 @@ export default class CodeFormatManager {
270
262
if ( edits . length === 0 ) {
271
263
return
272
264
}
273
- this . _checkContentsAreSame ( contents , editor . getText ( ) )
265
+ _checkContentsAreSame ( contents , editor . getText ( ) )
274
266
// Note that this modification is not in a transaction, so it applies as a
275
267
// separate editing event than the character typing. This means that you
276
268
// can undo just the formatting by attempting to undo once, and then undo
@@ -396,3 +388,11 @@ function isBracketPair(typedText: string): boolean {
396
388
const validBracketPairs : Array < string > = atom . config . get ( "bracket-matcher.autocompleteCharacters" ) as any
397
389
return validBracketPairs . includes ( typedText )
398
390
}
391
+
392
+ // Checks whether contents are same in the buffer post-format, throwing if
393
+ // anything has changed.
394
+ function _checkContentsAreSame ( before : string , after : string ) : void {
395
+ if ( before !== after ) {
396
+ throw new Error ( "The file contents were changed before formatting was complete." )
397
+ }
398
+ }
0 commit comments