-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
This page lists the problems that most often look like parser, generator, or editor bugs.
Cause: leading spaces.
Lexicon hierarchy uses tabs. Spaces in leading indentation are ignored for hierarchy.
Fix:
- Configure the editor to use hard tabs for
.lexicon. - Run the LSP and fix indentation diagnostics.
- Use
lexicon treeto confirm the parsed hierarchy.
swift run lexicon tree commerce.lexicon commerce --depth 5 --metadataCause: imports are relative to the importing file or LSP config context, not to the shell's current directory.
Fix:
- Keep imports relative.
- Run validation from the repository root.
- Check the root lexicon path in
lexicon-lsp.json.
swift run lexicon validate lexicons/commerce.lexiconCause: two imported branches declare incompatible concrete nodes or references no longer resolve after grafting.
Fix:
- Run
lexicon inspecton the conflicting path. - Move shared vocabulary into a shared import.
- Replace duplicate local spellings with synonyms where they really mean the same thing.
- Re-run generation.
swift run lexicon inspect commerce.lexicon commerce.ui.product.cardCause: output path confusion.
-o is a path without the extension. This command:
swift run lexicon-generate commerce.lexicon --type rust -o src/lexiconwrites:
src/lexicon.rs
If two selected generators share an extension, one can overwrite the other. Generate those targets separately.
Cause: invalid Go package identifier.
Fix:
swift run lexicon-generate commerce.lexicon \
--type go \
--go-package commerce \
-o internal/commerce/lexiconAvoid keywords and punctuation in --go-package.
Use the exact-path macro when lexical spelling matters:
let node = lexicon::l!(test.type.even.bad);Use raw identifiers in the typed API:
let node = lexicon::l().test().r#type().even().bad();Check:
-
lexicon-lspwas built withswift build -c release --product lexicon-lsp. - the editor path points to the executable, not the build directory.
- the binary is executable.
-
lexicon-lsp.jsonexists under the workspace root. - the editor log shows the server command being launched.
Direct smoke test:
.build/release/lexicon-lsp --helpCheck:
- the opened file is under the configured
scope - the configured
lexiconpath exists - imports compose successfully
- the cursor is inside a supported reference context
Supported contexts:
node:
+ commerce.
alias:
= commerce.
default:
? @ commerce.
l("commerce.l!(commerce.Run:
swift run lexicon validate lexicons/commerce.lexicon
swift run lexicon tree lexicons/commerce.lexicon commerce --depth 3 --inheritedCause: the embedding cache is being built.
Fix:
- Let the first run finish.
- Reuse the default cache.
- Pass
--embedding-cachefor CI or a shared local path. - Pass
--rebuild-embeddingsonly when the cache should be regenerated.
swift run --traits MLXSearch lexicon search commerce.lexicon "customer refund" \
--mode semantic \
--embedding-provider mlx \
--embedding-cache .lexicon-cacheUse a narrower mode:
swift run lexicon search commerce.lexicon checkout button --mode token --names-onlyOr limit the root:
swift run lexicon search commerce.lexicon checkout --root commerce.ui --mode hybridThe README should stay a short overview. The wiki is the source for step-by-step setup and language/editor pages. If a detailed instruction appears in the README, move it to the wiki and leave a link.