Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Invalid regular expression (svelte) #995

Closed
5chulzi opened this issue Aug 29, 2023 · 4 comments · Fixed by #1001
Closed

SyntaxError: Invalid regular expression (svelte) #995

5chulzi opened this issue Aug 29, 2023 · 4 comments · Fixed by #1001
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@5chulzi
Copy link

5chulzi commented Aug 29, 2023

Describe the bug
The regex for matching i18n expression in Svelte is invalid. The bug was introduced here 5ba4582

Extension Version
i18n Ally (v2.11.0)

Framework/i18n package you are using
svelte-i18n

To Reproduce
Steps to reproduce the behavior:

  1. Open any .svelte file that includes an i18n expression (like $_ or $t).
  2. Check i18n Ally extension output.

Device Infomation

  • OS: Linux
  • Version: 6.1.49-1-MANJARO
  • VS Code Version: 1.81.1

Extension Log

🈶 Activated, v2.11.0

――――――

💼 Workspace root changed to "<<<masked>>>"
📦 Packages file "package.json" found
🕳 Packages file "pubspec.yaml" not exists
🕳 Packages file "composer.json" not exists
🕳 Packages file "Gemfile" not exists
🌞 Enabled
🧩 Enabled frameworks: Svelte, General
🧬 Enabled parsers: json, yaml, json5

📈 Telemetry id: 8ae726fc-cbb9-4f06-823e-6f235931a293
🚀 Initializing loader "<<<masked>>>"
📂 Directory structure: file
🗃 Path Matcher Regex: /^(?<locale>[\w-_]+)\.(?<ext>json|ya?ml|json5)$/

📂 Loading locales under <<<masked>>>
	📑 Loading (de) de.json [1692916224747.1167]
	📑 Loading (en) en.json [1692916134640.0662]

👀 Watching change on <<<masked>>>
✅ Loading finished


――――――

🐛 ERROR: SyntaxError: Invalid regular expression: /(\$(_|t|format)|(get)\(s*(_|t|format)s*\))(s*['"`]([\w\d\. \-\[\]\/:]*?)['"`]/: Unterminated group
SyntaxError: Invalid regular expression: /(\$(_|t|format)|(get)\(s*(_|t|format)s*\))(s*['"`]([\w\d\. \-\[\]\/:]*?)['"`]/: Unterminated group
	at new RegExp (<anonymous>)
	at <<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:320348:24
	at Array.map (<anonymous>)
	at normalizeUsageMatchRegex (<<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:320344:16)
	at Global.getUsageMatchRegex (<<<masked>>>.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:311651:123)
	at KeyDetector.getKeys (<<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:312078:109)
	at KeyDetector.getUsages (<<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:312117:32)
	at update (<<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:314411:77)
	at annotation (<<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:314443:5)
	at m (<<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:314838:68)
	at <<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:315389:97
	at Array.map (<anonymous>)
	at activate (<<<masked>>>/.vscode/extensions/lokalise.i18n-ally-2.11.0/dist/extension.js:315389:88)
	at async p.n (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:6206)
	at async p.m (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:6169)
	at async p.l (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:5626)
@5chulzi 5chulzi added the bug Something isn't working label Aug 29, 2023
@terales
Copy link
Collaborator

terales commented Aug 30, 2023

@ZerdoX-x seems to be a regression related to #826

Can you look into it, please?

@terales terales added the help wanted Extra attention is needed label Aug 30, 2023
@ZerdoX-x
Copy link
Contributor

Sorry for the inconvenience

Fixed and explained in #1001 @terales

@5chulzi
Copy link
Author

5chulzi commented Aug 30, 2023

Thank you guys!

@terales
Copy link
Collaborator

terales commented Sep 23, 2023

Published another fix in v2.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Development

Successfully merging a pull request may close this issue.

3 participants