diff --git a/src/controller/immersive.ts b/src/controller/immersive.ts index df84ca2..2e66f8b 100644 --- a/src/controller/immersive.ts +++ b/src/controller/immersive.ts @@ -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' @@ -36,8 +35,6 @@ export function RegisterTranslator(ctx: Context) { const placeholderCodeLens = usePlaceholderCodeLensProvider() - const regex = REGEX_FIND_PHRASES - async function updateDecorations() { if (!editor) return @@ -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) diff --git a/src/regex.ts b/src/regex.ts deleted file mode 100644 index 2eba9f5..0000000 --- a/src/regex.ts +++ /dev/null @@ -1,2 +0,0 @@ -// 查找词组 -export const REGEX_FIND_PHRASES = /[\w|-]{2,}/g