344 resolve lean auto complete symbol aliases#354
Draft
GitLuckier wants to merge 10 commits into
Draft
Conversation
…tex commands in our generate symbols script
…d ksi, Ksi and omikron to xi Xi and omikron, updated build script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes cluttered autocomplete by consolidating symbol aliases. Instead of showing every Lean alias as a separate entry, the script now uses LaTeX as a filter: only Lean aliases that also appear in LaTeX are added, bridging Waterproof commands with standard LaTeX. For symbols with no LaTeX match, only the longest alias is kept. The
detailfield on each entry lists all other known aliases, so users can still discover them.There are still 22 symbols with aliases that share a common prefix, meaning they can still appear together in the autocomplete when a user types the first few characters. Fixing this properly would require coalescing same-symbol entries in CodeMirror itself, which may be worth raising with the CodeMirror maintainer (Marijn). The remaining problematic pairs are:
In the worst case, it can look like this:
Here, two symbols have their alias show up in the same window. This is rare enough that I am not sure if it is worth the trouble to go to Marijn.
Changes
completions/symbols.json\ksi,\Ksi, and\omikronto\xi,\Xi, and\omicronto align with LaTeX conventions. Note that\omicronand\Omicronwere previously using inconsistent spelling conventions; they now both follow LaTeX.\vee(∨) and\.(·) as entries.scripts/generate-symbols.mjsto TypeScript asgenerate-symbols.mts.generate-symbols-helpers/folder with separate files for config, types, utilities, reporting, and tests. The key file for reviewers to check isgenerate-symbols.config.mts, which contains all tunable settings: which symbol groups are shown in the panel, boost values, merge strategy, and the label deduplication strategy.latex2unicode.json, a LaTeX-to-unicode mapping derived from theunicode-mathpackage (LPPL 1.3c), used as the primary filter for Lean aliases.tsconfig.jsonfor the scripts folder.package.jsonto point to the new.mtsscript.Testing this PR
Please run the script with
--testbefore approving. The main reason is not the 13 validation checks at the end, but the detailed report it prints: what aliases were dropped, what symbols were added via LaTeX, what was added via Lean fallback, and which labels were removed by the deduplication strategy. This is the main way to audit what ended up in the output file and why.You can also add
--verboseto see additional detail, such as the full lean-fallback list and labels skipped because they contain{}, but the report from--testalone covers the most important information.Companion PR: impermeable/waterproof-editor#94
Closes #344