|
| Key | Action |
|---|---|
Ctrl+F / Cmd+F |
Focus the search box |
Escape |
Clear the search (while the box is focused) |
↑ ↓ |
Move through the visible rows |
→ |
Open a closed row, or step into its first child |
← |
Close an open row, or step out to its parent |
Home / End |
Jump to the first / last row |
Enter / Space |
Open or close the focused row |
Keys typed into a field belong to the field, not to the tree.
The tree is a single tab stop with the arrow keys moving inside it, which is how an ARIA tree behaves. Everything interactive has a name, nothing animates when your system asks it not to, and the signals that are colours also carry a word or a number.
⚙️ Settings
| Setting | Type | Default | Effect |
|---|---|---|---|
xliffViewer.baseFile |
string |
"" |
An explicit base-file path or glob. Empty means "work it out" — see below |
xliffViewer.showDeveloperNotes |
boolean |
true |
Show Developer notes, and the suggestion they make for the file's language |
xliffViewer.showGeneratorNotes |
boolean |
false |
Show the Xliff Generator note, rebuilt from the tree |
xliffViewer.defaultExpandDepth |
number |
1 |
How many levels of real structure a file opens to |
xliffViewer.editMode |
boolean |
false |
Open files with editing already on, instead of read-only |
xliffViewer.stateOnEdit |
string |
translated |
The state a target moves to when it is edited. Clearing a target always sets needs-translation |
xliffViewer.validation.enabled |
boolean |
true |
Show the validation hints. Malformed XML is rejected regardless — that is not a hint |
xliffViewer.validation.sameAsSource |
boolean |
false |
Also hint when a target repeats its source. Off by default: proper nouns, identifiers and captions legitimately read the same in both languages |
How the base file is found
For <App>.<lang>.xlf, in order, first hit wins:
xliffViewer.baseFile— absolute path, workspace-relative path, or globxliffSync.baseFile, if the XLIFF Sync extension has it set — read defensively, never written- The sibling
<App>.g.xlf - Any
*.g.xlfin the same folder - Any
*.g.xlfunder aTranslations/folder in the workspace, preferring the one named after this app
In Restricted Mode a workspace's own xliffViewer.baseFile and XLIFF Sync's workspace value are ignored; your user settings still count.
Not finding one is a normal state, not an error: the viewer works fully without a base file and the affordances that need one say why they are disabled. NAB AL Tools has no base-file setting to read — it uses the same convention steps 3–5 already implement.
How "Go to source" finds the AL source
- Where it looks. It searches the app the translation file belongs to: the nearest folder above it that holds an
app.json, else the workspace folder.node_modules,.alpackages,.snapshotsand hidden folders are skipped. The app'spreprocessorSymbolsdecide which side of an#ifcounts. - How it matches. The numbers in a trans-unit id are AL's hash of each name. Every candidate declaration is checked against them, so a match is exact, never a guess by name.
- Several equally good matches — two apps in one workspace, say — are offered to choose from.
- Your edits count. An AL file open with unsaved edits is read as it stands in the editor.
- Always fresh. The index of objects is built on the first click and kept current as files change.
📦 Installing
Install XLIFF Viewer from the Visual Studio Marketplace or from Open VSX, or from the command line:
code --install-extension Florian-Noever.xliff-viewer
Every GitHub release also carries its VSIX, for Extensions → … → Install from VSIX…. npm run package builds one from source as xliff-viewer-<version>.vsix.
The VSIX carries the two host bundles, the webview bundle and its HTML shell, and nothing else — no sources and no tests.
🧩 Repository
GitHub: Florian-Noever/xliff-viewer
Bug reports and feature requests are welcome via Issues.
🛠️ Developer Notes
Architecture
| Layer | Technology | Purpose |
|---|---|---|
| Extension host | TypeScript, esbuild → two CJS bundles | Parses the XLIFF, resolves the base file, scans the app's AL source, owns navigation. One entry, built for both node and browser, so the same source runs on the desktop and on the web |
| Shared | TypeScript | The model, the state domain, the DTOs and both message unions — imported by both runtimes, so there is one definition rather than two |
| Webview | Vue 3, Vite, @tanstack/vue-virtual |
The tree, virtualised. Rolls up state, searches and filters over the DTOs already in memory; no round trip to the host for a keystroke |
The XML is parsed once, in the host — the webview never sees it. The whole document is read and written as one string with a format-faithful serialiser, verified byte-identical against a fixture corpus written in the exact shape the AL compiler emits.
Build commands
npm, and nothing else — packaging needs it regardless, since vsce shells out to it.
npm ci # install exactly what package-lock.json pins
npm run compile # check-types + lint + esbuild (both targets) + vite build
npm run watch # all four watchers, which is what F5 starts
npm run check-types # tsc for the host and tests, vue-tsc for the webview
npm run lint # eslint src, with no warning allowed
npm test # build, then vitest: data, host, webview, repo and the perf budgets
npm run test:integration # build, then @vscode/test-electron and @vscode/test-web
npm run dev:webview # the webview alone, against a fixture document
npm run package # vsce package
npm run dev:webview serves the UI with no extension host behind it, rendering a projection of the largest fixture file. A drift test rebuilds that document from the file and fails if it has been hand-edited, so the dev server always shows what the extension actually sends.
Install scripts are opt-in. npm 11 runs a dependency's install script only when allowScripts in package.json approves it. Two are: @playwright/browser-chromium, which downloads the browser the web integration tests run in, and esbuild. Without the first, those tests cannot start — and they hang rather than fail, so if they ever sit silent after a dependency update, check npm install-scripts ls first. @vscode/vsce-sign is denied: packaging does not need it, and releases are published by CI. So is unrs-resolver, whose script only re-checks a native binding that already arrives as a locked optional package.
Tests
Five Vitest projects: data (pure, and deliberately without a vscode alias, so a data test that imports it fails to resolve), host (a hand-written vscode mock), webview (jsdom), repo (checks on the repository rather than the code: the manifest, the docs, the webview's sources and what the package ships, which needs a build), and perf (the wall-clock budgets, run serially so they measure the code rather than the load).
The XLIFF the tests read is invented. src/test/fixtures/corpus.ts generates every file in src/test/fixtures/xliff/ in the exact shape the AL compiler writes, along with the AL source of its apps in src/test/fixtures/al/, and the dev server's documents in src/webview/fixtures/ are built from the same corpus. A test fails if a committed file drifts from what is generated. After changing a generator, rewrite the files with the command below; the data project writes them once, before any of its tests run (in PowerShell, set $env:UPDATE_FIXTURES = '1' first and run the command without the prefix):
UPDATE_FIXTURES=1 npx vitest run --project data
CI & Releases
CI runs on every push and pull request through the shared workflows of Florian-Noever/Florian-Noever. One job runs npm run ci:check, which type-checks, lints and builds, then runs the data, host, webview and repo tests; a second runs the integration tests in the desktop and the web host; a third packs a preview VSIX. The perf budgets stay out of CI, since shared runners are slower and noisier than the machines the budgets were set on, so run npm test locally before a release.
To release, bump the version with npm version x.y.z --no-git-tag-version and publish a GitHub release vx.y.z from a commit whose CI is green. The publish workflow builds and tests the tag, attaches the VSIX to the release and publishes it to the Visual Studio Marketplace and Open VSX.
📜 License
Licensed under the MIT License.
The in-GUI icons are from @vscode/codicons, licensed under CC BY 4.0.
