diff --git a/src/EditorSuggester.ts b/src/EditorSuggester.ts index 908904e..2cecc22 100644 --- a/src/EditorSuggester.ts +++ b/src/EditorSuggester.ts @@ -124,29 +124,30 @@ export function getSuggestionsFromQuery( const verseEndNumber = numbers.length === 3 ? parseInt(numbers[2]) : undefined; - return booksUrl - .flatMap((bookUrl) => - settings.bibleVersions.map((version) => { - if (isLink) { - return new VerseLink( - version, - bookUrl, - bookName, - chapterNumber, - verseNumber, - verseEndNumber - ); - } else if (verseNumber !== undefined) { - return new VerseEmbed( - version, - bookUrl, - bookName, - chapterNumber, - verseNumber, - verseEndNumber - ); - } - }) - ) - .filter((v) => v !== undefined); + return booksUrl.flatMap( + (bookUrl) => + settings.bibleVersions + .map((version) => { + if (isLink) { + return new VerseLink( + version, + bookUrl, + bookName, + chapterNumber, + verseNumber, + verseEndNumber + ); + } else if (verseNumber !== undefined) { + return new VerseEmbed( + version, + bookUrl, + bookName, + chapterNumber, + verseNumber, + verseEndNumber + ); + } + }) + .filter((v) => v !== undefined) as Verse[] + ); } diff --git a/src/GenerateLinks.ts b/src/GenerateLinks.ts index 4e0774a..5495d52 100644 --- a/src/GenerateLinks.ts +++ b/src/GenerateLinks.ts @@ -14,11 +14,15 @@ export default function GenerateLinks( const match = [...line.matchAll(linkRegex)]; match.forEach((match) => { - const suggestions = getSuggestionsFromQuery(match[0], settings); - suggestions.forEach((s) => { + const suggestions = getSuggestionsFromQuery( + match[0], + true, + settings + ); + suggestions.forEach(async (s) => { if (match.index === undefined) return; editor.replaceRange( - s.toLink(), + await s.toReplace(), { line: i, ch: match.index,