File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ export class Document {
170170 cfnType : this . cfnFileType ,
171171 languageId : this . languageId ?? '' ,
172172 version : this . version ?? 0 ,
173- lineCount : this . lineCount ?? 0 ,
173+ lineCount : this . lineCount ?? - 1 ,
174174 } ;
175175 }
176176
Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ export class ResourceStateImporter {
420420 : { line : resourcesSection . endPosition . row + 1 , character : 0 } ;
421421 } else {
422422 // Find the last non-empty line
423- let lastNonEmptyLine = ( document . lineCount ?? 1 ) - 1 ;
423+ let lastNonEmptyLine = document . lineCount ? document . lineCount - 1 : 0 ;
424424 while ( lastNonEmptyLine >= 0 && document . getLine ( lastNonEmptyLine ) ?. trim ( ) . length === 0 ) {
425425 lastNonEmptyLine -- ;
426426 }
@@ -434,7 +434,11 @@ export class ResourceStateImporter {
434434 } ;
435435 }
436436
437- let line = resourcesSection ? resourcesSection . endPosition . row : ( document . lineCount ?? 1 ) - 1 ;
437+ let line = resourcesSection
438+ ? resourcesSection . endPosition . row
439+ : document . lineCount
440+ ? document . lineCount - 1
441+ : 0 ;
438442
439443 // For JSON without Resources section, check if file is essentially empty
440444 if ( ! resourcesSection ) {
You can’t perform that action at this time.
0 commit comments