Skip to content

Commit 38f8e45

Browse files
committed
Update documentIndex.ts
1 parent 25ef372 commit 38f8e45

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/utils/documentIndex.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,11 @@ export function inferDocName(uri: vscode.Uri): string | undefined {
448448
// do not contribute to the name of the documents contained within
449449
const containingPaths: Set<string> = new Set();
450450
index.uris.forEach((docName, docUriStr) => {
451-
const docNameExt = docName.slice(-4);
452-
if (exts.includes(docNameExt)) {
451+
const docExt = docName.slice(-4);
452+
if (exts.includes(docExt)) {
453453
const docUri = vscode.Uri.parse(docUriStr);
454454
// This entry is for a class or routine so see if its name and file system path match
455-
const docNamePath = `/${docName.slice(0, -4).replaceAll(".", "/")}${docNameExt}`;
455+
const docNamePath = `/${docName.slice(0, -4).replaceAll(".", "/")}${docExt}`;
456456
// Make sure the file extension is lowercased in the path before matching
457457
const startOfDocName = (docUri.path.slice(0, -3) + docUri.path.slice(-3).toLowerCase()).lastIndexOf(docNamePath);
458458
if (startOfDocName > -1) {
@@ -461,8 +461,8 @@ export function inferDocName(uri: vscode.Uri): string | undefined {
461461
}
462462
}
463463
});
464-
if (!containingPaths.size) return; // We couldn't learn anyhting from the documents in the index
465-
// Sort the values in the Set by number of segments descending so we check the longest paths first
464+
if (!containingPaths.size) return; // We couldn't learn anything from the documents in the index
465+
// Sort the values in the Set by number of segments descending so we check the deepest paths first
466466
const containingPathsSorted = Array.from(containingPaths).sort((a, b) => b.split("/").length - a.split("/").length);
467467
let result: string;
468468
for (const prefix of containingPathsSorted) {

0 commit comments

Comments
 (0)