Skip to content

Commit cddddc5

Browse files
authored
fix: wrong regex index assignment (#13)
1 parent fdc6e43 commit cddddc5

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

src/controller/immersive.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { MarkdownString, Range, commands, window, workspace } from 'vscode'
22
import type { TextEditor } from 'vscode'
33
import { effect, toRefs } from '@vue/reactivity'
44
import { knownWords, onConfigUpdated } from '~/config'
5-
import { REGEX_FIND_PHRASES } from '~/regex'
65
import { GapLinesTextDecoration } from '~/view/Interline'
76
import type { DecorationMatch } from '~/types'
87
import { clearTranslationCache, useTranslationCache } from '~/model/cache'
@@ -36,8 +35,6 @@ export function RegisterTranslator(ctx: Context) {
3635

3736
const placeholderCodeLens = usePlaceholderCodeLensProvider()
3837

39-
const regex = REGEX_FIND_PHRASES
40-
4138
async function updateDecorations() {
4239
if (!editor)
4340
return
@@ -56,7 +53,7 @@ export function RegisterTranslator(ctx: Context) {
5653

5754
const tokens = await parseDocumentToTokens({ textDocument: editor.document })
5855

59-
for (const { phrase, match, translated } of extractPhrases(text)) {
56+
for (const { phrase, match, translated, regex } of extractPhrases(text)) {
6057
const translatedText = translated
6158
? phrase
6259
: translationCache.get(phrase)

src/regex.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)