The main README covers installation and basic contribution steps. This document keeps the diagnostic workflow and pitfalls discovered while building the Windows input method.
The platform-independent Rust engine lives under core/. platforms/windows/tsf is the in-process TSF adapter, and platforms/windows/updater performs network work in a separate process. apps/settings-egui is the standalone Windows settings application. The former Flutter implementation under apps/settings is retained as a reference and asset source; it is no longer built or packaged. See settings development, ARCHITECTURE.md and the ADRs for design decisions.
The input thread must not perform network calls, file I/O, dictionary loading, or wait on locks across calls. The local first pass remains usable when optional external services fail; asynchronous candidate updates must not remove text already displayed.
retype-diag runs the same input engine and dictionary as TSF, with text output and stdin instead of a candidate window and keyboard callbacks. It is the fastest way to inspect candidate ordering before testing in a desktop host.
cargo run -p retype-diag --release -- --dict data/dict/retype-dict.tsv
cargo run -p retype-diag --release -- --dict data/dict/retype-dict.tsv --explain nihaomashijie
cargo run -p retype-diag --release -- --bench --dict data/dict/retype-dict.tsvUse :help in the tool for its interactive commands. The dictionary build command is:
cargo run -p retype-dict-build --release -- --out data/dict/retype-dict.tsv- The
windows0.62 crate does not expose animplementfeature. The#[implement]macro needswindows-coreas a direct dependency. - The feature is
Win32_UI_Input_Ime, notWin32_UI_Input_Methods. AdviseKeyEventSinkbelongs toITfKeystrokeMgr, which must be queried from the thread manager.- In this version of the bindings, use
windows_core::BOOL;Param<T, InterfaceType>accepts a borrow, for exampleAdviseKeyEventSink(tid, &sink, true). - The
pinyincrate can returnlü; normalize it tolvbefore matching the syllable table. - K-best traceback cannot rely on
(position, slot index)because top-k insertion and truncation change indexes. The engine uses anRcchain and a regression test. - Unigram scoring can favor implausible segmentations. The current formula and its limits are in dictionary notes; historical tuning is in performance notes.
- Inno Setup scripts containing Chinese must be saved with a UTF-8 BOM. Without it, the compiler can silently write garbled profile names.
- A TSF DLL may remain loaded in another application during an upgrade. Install into a new version directory, then update registration; see automatic updates.
The editable app mark is assets/logo.svg. After changing its geometry, update the matching drawing commands in tools/scripts/generate-logo.ps1 and run that script to regenerate the Windows icon, Flutter PNG, and Android launcher icons.