@@ -168,7 +168,8 @@ export class FormattingManager implements DocumentFormattingEditProvider, Docume
168
168
private parseDiffNewFormat ( fileToProcess : Uri , diff : string ) : RustFmtDiff [ ] {
169
169
const patches : RustFmtDiff [ ] = [ ] ;
170
170
let currentPatch : RustFmtDiff | undefined = undefined ;
171
- let currentFile : Uri | undefined = undefined ;
171
+ let currentFilePath : string | undefined = undefined ;
172
+ const fileToProcessPath = Uri . file ( fileToProcess . path + '.fmt' ) . fsPath ;
172
173
173
174
for ( const line of diff . split ( / \n / ) ) {
174
175
if ( line . startsWith ( 'Diff in' ) ) {
@@ -188,7 +189,9 @@ export class FormattingManager implements DocumentFormattingEditProvider, Docume
188
189
patches . push ( currentPatch ) ;
189
190
}
190
191
191
- currentFile = Uri . file ( matches [ 1 ] ) ;
192
+ // The .path uncanonicalizes the path, which then gets turned into a Uri.
193
+ // The .fsPath on both the current file and file to process fix the remaining differences.
194
+ currentFilePath = Uri . file ( Uri . file ( matches [ 1 ] ) . path ) . fsPath ;
192
195
currentPatch = {
193
196
startLine : parseInt ( matches [ 2 ] , 10 ) ,
194
197
newLines : [ ] ,
@@ -198,11 +201,11 @@ export class FormattingManager implements DocumentFormattingEditProvider, Docume
198
201
199
202
// We haven't managed to figure out what file we're diffing yet, this shouldn't happen.
200
203
// Probably a malformed diff.
201
- if ( ! currentFile ) {
204
+ if ( ! currentFilePath ) {
202
205
continue ;
203
206
}
204
207
205
- if ( currentFile . toString ( ) !== fileToProcess . toString ( ) + '.fmt' ) {
208
+ if ( currentFilePath !== fileToProcessPath ) {
206
209
continue ;
207
210
}
208
211
0 commit comments