Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 601296a

Browse files
committed
Workaround dodgy TextEdits with u64 max character values
1 parent 682aa55 commit 601296a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,20 @@ class RustLanguageClient extends AutoLanguageClient {
671671

672672
return provide
673673
}
674+
675+
// Workaround #133 that affects stable rust 1.35.0
676+
async getCodeFormat(...args) {
677+
const edits = await super.getCodeFormat(...args)
678+
for (const edit of edits) {
679+
const end = edit && edit.oldRange && edit.oldRange.end
680+
if (end && end.column > 18e18) {
681+
end.row += 1
682+
end.column = 0
683+
edit.newText += (process.platform === "win32" ? "\r\n" : "\n")
684+
}
685+
}
686+
return edits
687+
}
674688
}
675689

676690
// override windows specific implementations

0 commit comments

Comments
 (0)