File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -450,14 +450,14 @@ export function inferDocName(uri: vscode.Uri): string | undefined {
450450 index . uris . forEach ( ( docName , docUriStr ) => {
451451 const docExt = docName . slice ( - 4 ) ;
452452 if ( exts . includes ( docExt ) ) {
453- const docUri = vscode . Uri . parse ( docUriStr ) ;
454453 // This entry is for a class or routine so see if its name and file system path match
455454 const docNamePath = `/${ docName . slice ( 0 , - 4 ) . replaceAll ( "." , "/" ) } ${ docExt } ` ;
456455 // Make sure the file extension is lowercased in the path before matching
457- const startOfDocName = ( docUri . path . slice ( 0 , - 3 ) + docUri . path . slice ( - 3 ) . toLowerCase ( ) ) . lastIndexOf ( docNamePath ) ;
458- if ( startOfDocName > - 1 ) {
456+ let fullPath = vscode . Uri . parse ( docUriStr ) . path ;
457+ fullPath = fullPath . slice ( 0 , - 3 ) + fullPath . slice ( - 3 ) . toLowerCase ( ) ;
458+ if ( fullPath . endsWith ( docNamePath ) ) {
459459 // The document name is the trailing substring of the file system path with different delimiters
460- containingPaths . add ( docUri . path . slice ( 0 , startOfDocName + 1 ) ) ;
460+ containingPaths . add ( fullPath . slice ( 0 , - docNamePath . length + 1 ) ) ;
461461 }
462462 }
463463 } ) ;
You can’t perform that action at this time.
0 commit comments