Skip to content

Commit e13720e

Browse files
committed
fix: fix success check of applyTextEditsToBuffer
1 parent 51c2f7f commit e13720e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/CodeFormatManager.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ export default class CodeFormatManager {
4545
// Make sure we halt everything when the editor gets destroyed.
4646
const edits = await this._formatCodeInTextEditor(editor)
4747
try {
48-
applyTextEditsToBuffer(editor.getBuffer(), edits).forEach((result) => {
49-
if (!result) {
50-
throw new Error("No code formatting providers found!")
51-
}
52-
})
48+
const success = applyTextEditsToBuffer(editor.getBuffer(), edits) as boolean
49+
if (!success) {
50+
throw new Error("No code formatting providers found!")
51+
}
5352
} catch (err) {
5453
atom.notifications.addError(`Failed to format code: ${err.message}`, {
5554
detail: err.detail,

0 commit comments

Comments
 (0)