Skip to content

Commit 669f20a

Browse files
committed
fix: free _checkContentsAreSame
1 parent feef034 commit 669f20a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/CodeFormatManager.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,6 @@ export default class CodeFormatManager {
142142
}
143143
}
144144

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-
153145
// Return the text edits used to format code in the editor specified.
154146
_formatCodeInTextEditor(editor: TextEditor, range?: Range): Observable<Array<TextEdit>> {
155147
return Observable.defer(() => {
@@ -270,7 +262,7 @@ export default class CodeFormatManager {
270262
if (edits.length === 0) {
271263
return
272264
}
273-
this._checkContentsAreSame(contents, editor.getText())
265+
_checkContentsAreSame(contents, editor.getText())
274266
// Note that this modification is not in a transaction, so it applies as a
275267
// separate editing event than the character typing. This means that you
276268
// can undo just the formatting by attempting to undo once, and then undo
@@ -396,3 +388,11 @@ function isBracketPair(typedText: string): boolean {
396388
const validBracketPairs: Array<string> = atom.config.get("bracket-matcher.autocompleteCharacters") as any
397389
return validBracketPairs.includes(typedText)
398390
}
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+
}

src/legacy-provider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export function consumeLegacyProvider(provider: CodeFormatProvider): Disposable
1414
provider.priority =
1515
provider.priority != null
1616
? provider.priority
17-
: // @ts-ignore
17+
: // @ts-ignore
1818
provider.inclusionPriority != null
19-
// @ts-ignore
20-
? provider.inclusionPriority
19+
? // @ts-ignore
20+
provider.inclusionPriority
2121
: 0
2222
if ("formatCode" in provider) {
2323
return consumeRangeProvider(provider)

0 commit comments

Comments
 (0)