Skip to content

Commit

Permalink
fix: wrong regex index assignment (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu authored Jul 11, 2024
1 parent fdc6e43 commit cddddc5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 1 addition & 4 deletions src/controller/immersive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { MarkdownString, Range, commands, window, workspace } from 'vscode'
import type { TextEditor } from 'vscode'
import { effect, toRefs } from '@vue/reactivity'
import { knownWords, onConfigUpdated } from '~/config'
import { REGEX_FIND_PHRASES } from '~/regex'
import { GapLinesTextDecoration } from '~/view/Interline'
import type { DecorationMatch } from '~/types'
import { clearTranslationCache, useTranslationCache } from '~/model/cache'
Expand Down Expand Up @@ -36,8 +35,6 @@ export function RegisterTranslator(ctx: Context) {

const placeholderCodeLens = usePlaceholderCodeLensProvider()

const regex = REGEX_FIND_PHRASES

async function updateDecorations() {
if (!editor)
return
Expand All @@ -56,7 +53,7 @@ export function RegisterTranslator(ctx: Context) {

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

for (const { phrase, match, translated } of extractPhrases(text)) {
for (const { phrase, match, translated, regex } of extractPhrases(text)) {
const translatedText = translated
? phrase
: translationCache.get(phrase)
Expand Down
2 changes: 0 additions & 2 deletions src/regex.ts

This file was deleted.

0 comments on commit cddddc5

Please sign in to comment.