FAQ & Debugging Tips
Debugging Methods
Extension Development Host
Press F5 in VS Code to launch the Extension Development Host. Set breakpoints, view Debug Console logs, and reload with Ctrl+Shift+P → Developer: Reload Window.
Output Channel
The plugin outputs logs in VS Code's Output panel under the i18n Ally Next channel.
typescript
import { Log } from '~/utils'
Log.info('Current key:', key)
Log.warn('Node not found:', keypath)Quick Package and Verify
bash
pnpm vsce:pack
code --install-extension ./i18n-ally-next-*.vsix --forceFAQ
Inline display works but Go to Definition fails
annotation.tsusesKeyDetector.getUsages()→getKeys()(with namespace)definition.tsmust also usegetKeys()(notgetKey()which lacks namespace)- Check:
getFilepathByKey(key)finds file →getPathWithoutNamespace(key)strips prefix →parser.navigateToKey()locates key
Keys not detected after adding a new framework
- Verify
usageMatchRegexmatches source code key calls - Verify
detectionrules detect the framework via package.json - Verify
rewriteKeys()doesn't accidentally lose namespace info
Key lookup fails in flat keystyle + namespace
- Flat keys are full paths (e.g.,
"common.stackTrace") getTreeNodeByKeymust try flatten style lookup in namespace subtreessplitKeypathmust distinguish namespace delimiter (:) from key path delimiter (.)
rewriteKeys unexpectedly modifies keys
rewriteKeysruns afterhandleRegexMatchwhich may have auto-concatenated namespace- Use
context.hasExplicitNamespaceto only deduplicate when namespace is explicit
E2E test snapshots don't match
bash
pnpm test:e2e:update # Review diffs first, then updateDevelopment Checklist
When modifying key detection/concatenation/lookup/navigation, verify:
- [ ] No namespace scenario (
namespace: false) - [ ] Namespace + nested keystyle
- [ ] Namespace + flat keystyle
- [ ] With
defaultNamespace - [ ] With scope (e.g.,
useTranslation("ns")) - [ ] Explicit namespace (e.g.,
t("ns:key")) - [ ] Multiple namespace delimiters (
:,/)
Adding a New Framework
- Create file under
src/frameworks/, extendFrameworkbase class - Define
id,display,detection,usageMatchRegex - Register in
src/frameworks/index.ts - Create example project under
examples/by-frameworks/ - Add E2E tests (optional)
Path Aliases
The project uses ~ as path alias pointing to src/:
typescript
import { Config } from '~/core' // → src/core/index.tsConfigured in both tsconfig.json and webpack.config.js.
