Java Message Key Navigator

Java Message Key Navigator is a VS Code extension designed to supercharge your Java internationalization (I18N) workflow. Hover over any I18N method call to instantly preview the corresponding value from your .properties files, and use ⌘/Ctrl + click to jump straight to the exact message-key definition. When a key is missing, you’ll see an automatic warning plus a one-click quick fix that inserts the new key in the correct sorted order—no more manual file edits or guesswork. With automatic key-context inference and support for multiple property-file globs, this extension keeps your message keys organized and your development flow uninterrupted.
🚀 Key Features
This extension provides powerful features to streamline your Java internationalization workflow:
Hover Previews
Place your cursor on any call like
infrastructureLogger.log("PLF1001");
and instantly see the localized message inline.
Go to Definition
Use ⌘ Click (macOS) or Ctrl Click to jump directly to the exact message key in your .properties file.
Undefined Key Detection & Quick Fixes
When you use a key that doesn’t exist in any of your .properties files, a warning will appear automatically. The extension offers a quick fix that:
- Resolves your configured
propertyFileGlobs to actual .properties files.
- Reads each file line by line, strips comments and blank lines, and builds a list of existing keys.
- Checks for duplicate keys, aborting with a warning if the key already exists.
- Determines the correct insertion position by finding the first existing key lexicographically greater than your new key — for example, inserting
PLF4997 before PLF4998 if needed.
- Splices the new key-value entry into the file, preserving the original line endings (CRLF/LF), rewrites the file in one go, reopens it, and moves your cursor directly to the inserted line.
- If multiple
.properties files are present, prompts you with a dialog so you can select which file to add the new key to, giving you precise control over key organization.
Automatic Key Context Inference
The extension infers message-key call and annotation contexts directly from Java source and loaded .properties keys.
messageSource.getMessage(...) is always recognized automatically.
Multi-File Support
The extension supports multiple .properties files specified using glob patterns, for example:
"java-message-key-navigator.propertyFileGlobs": [
"src/main/resources/message*.properties",
"src/main/resources/validation/**/*.properties"
]
Placeholder Count Validation
Detects when the number of {0}, {1}, … placeholders in your .properties value does not match the number of arguments you pass in code.
🔍 Supports array literals like new Object[] {…}, new String[] {…}, etc.
🔍 Also supports varargs calls such as
infrastructureLogger.log("KEY", arg1, arg2, …);
🔍 Treats common exception arguments (e.g. e, ex, exceptionObj) as non-placeholder arguments in logger-style calls
❌ Highlights any mismatch with a red squiggly underline in the editor for immediate correction
⚙️ Configuration
Add these to your User or Workspace settings.json:
{
// Which .properties files to read & write (glob patterns)
"java-message-key-navigator.propertyFileGlobs": [
"src/main/resources/message*.properties",
"src/main/resources/validation/**/*.properties",
],
}
| Setting |
Description |
propertyFileGlobs (array) |
Glob patterns for your .properties files to include in look-up and auto-insertion |
📖 Usage
Hover
Hover over any supported method call to see the message value inline.
Definition
⌘ Click / Ctrl Click to jump to the exact message key in the .properties file.
Quick Fix
When you see “Undefined message key” warnings, click the lightbulb or press ⌨️ Cmd/Ctrl + . to add the missing key in the correct sorted position of your chosen file.
Choose Target Property File
If multiple property files are available, a dialog will appear letting you select which file the new key should be added to. This helps you manage multiple .properties files without manually editing each one.




Completion for Existing Keys
As you type inside supported method calls, existing keys are suggested as completion candidates, letting you quickly select an existing key.
Validate All Java Files
Run command palette: Java Message Key Navigator: Validate All Files to validate all src/main/java/**/*.java files at once.

🛠 Maintenance
Clone & install
git clone https://github.com/y-ok/java-message-key-navigator.git
cd java-message-key-navigator
npm install
Build & package
npm run build
Run in VS Code
- Open this folder in VS Code
- Press F5 to launch a fresh Extension Development Host
Or install the VSIX
code --install-extension java-message-key-navigator-(version).vsix
Run benchmark-based regression checks (for maintainers)
This benchmark is for maintainers changing Java file detection, validation, and cache update logic.
Its purpose is to catch performance regressions in large workspaces, especially accidental fallbacks
from incremental revalidation to full rescans.
It exercises the extension integration path with real files on disk:
activate
validateAll
- Java file change handling
.properties save handling
It does not measure a real VS Code Extension Host session or end-user editor latency.
npm run benchmark
npm run benchmark:strict
- What it checks:
- full-workspace validation cost at
5000 and 10000 Java files
- incremental Java change stays incremental instead of degrading to a full rescan
.properties save revalidates cached Java files through the expected path
- Measured metrics:
- wall time / CPU time
- memory delta (RSS / heap)
- disk I/O bytes and call counts (read/write)
- open Java document count (to detect accidental full rescans)
- Scenarios:
integration_validate_all_5000_java
integration_validate_all_10000_java
integration_incremental_java_change_10000
integration_property_save_revalidate_10000
- Threshold config:
benchmark/thresholds.json
- Result JSON:
dist/benchmark/last-result.json
- Cleanup:
npm run clean removes the benchmark result JSON as well
GitHub Actions
- CI workflow: .github/workflows/ci.yml
- runs on
push and pull_request
- executes
npm ci, npm run lint, npm test, and npm run build
- uploads coverage and generated VSIX as workflow artifacts
- Release workflow: .github/workflows/release.yml
- runs only when a version tag such as
v1.0.14 is pushed
- requires the pushed tag to match
package.json version
- reruns lint, tests, and
npm run benchmark:strict before release upload
- creates the GitHub Release if it does not exist yet, then uploads the generated VSIX
- publishes the extension to Visual Studio Marketplace using
VSCE_PAT
Required repository secret:
VSCE_PAT: Personal Access Token for Visual Studio Marketplace publishing
🛡 License
This project is released under the MIT License.
Feel free to fork, adapt, and share!
Credits
This extension is a fork of TOMATOofGOHAN/java-i18n-ally (MIT License).
Thank you TOMATOofGOHAN for the original work!