Skip to content

updated lean symbol generation to be based on the npm package#338

Open
Tammo0987 wants to merge 3 commits intomappingfrom
feat/move-symbol-gen-to-npm-package
Open

updated lean symbol generation to be based on the npm package#338
Tammo0987 wants to merge 3 commits intomappingfrom
feat/move-symbol-gen-to-npm-package

Conversation

@Tammo0987
Copy link
Copy Markdown

@Tammo0987 Tammo0987 commented Mar 31, 2026

Description

In this issue I removed the lean abbreviations file and replaced by using it directly from the lean Unicode package. I updated all necessary scripts.

Testing this PR

Test the script by following the steps in scripts/README.md for the symbol generation. Possibly just run the project as well.

Closes #324

Copilot AI review requested due to automatic review settings March 31, 2026 10:47
@Tammo0987 Tammo0987 linked an issue Mar 31, 2026 that may be closed by this pull request
@Tammo0987 Tammo0987 requested a review from pimotte March 31, 2026 10:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates Lean Unicode symbol generation away from a vendored JSON file / GitHub download, and instead sources the abbreviation table from the pinned @leanprover/unicode-input npm package.

Changes:

  • Remove committed/generated Lean symbol artifacts (completions/symbols+lean.json, completions/lean-abbreviations.json) and ignore the generated output going forward.
  • Update scripts/generate-symbols.mjs to read the Lean abbreviation table from node_modules/@leanprover/unicode-input.
  • Add @leanprover/unicode-input and wire symbol generation into the build via npm run generate-symbols and an updated esbuild script.

Reviewed changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/update-symbols.sh Removed the old curl-based download script.
scripts/README.md Updated symbol generation docs to reference npm-based source and new commands.
scripts/generate-symbols.mjs Loads abbreviations from the npm package and uses robust path resolution.
package.json Adds @leanprover/unicode-input, adds generate-symbols script, runs it before esbuild.
package-lock.json Locks @leanprover/unicode-input@0.1.9.
completions/symbols+lean.json Removed previously committed generated output.
completions/lean-abbreviations.json Removed previously committed Lean abbreviation table.
.gitignore Ignores generated completions/symbols+lean.json.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

package.json Outdated
Comment on lines 572 to 575
"vscode:prepublish": "npm run typecheck && npm run esbuild -- --minify --sourcemap=no",
"esbuild": "node esbuild.mjs",
"generate-symbols": "node scripts/generate-symbols.mjs",
"esbuild": "npm run generate-symbols && node esbuild.mjs",
"typecheck": "tsc -b",
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

completions/symbols+lean.json is now generated and gitignored, but npm run typecheck (and vscode:prepublish, which runs typecheck first) does not generate it. On a fresh clone/CI this will fail because editor/src/index.ts imports ../../completions/symbols+lean.json and the file won't exist yet. Fix by running generate-symbols before typecheck (e.g., make typecheck run npm run generate-symbols && tsc -b, or add a pretypecheck script; you may also want the same for lint if eslint resolves imports).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid claim of the problem. I updated the typecheck script which seems to be the easiest solution. This does actually mean, that in case of the prepublish script we run it twice. But its fast and otherwise we have to change a lot more in the build process, where I think this is an okay tradeoff to make, but let me know if I should change it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm totally fine with running generate-symbols twice.

It is in my opinion a bit strange to have to run it before the typechecker.
@Tammo0987 Remark: Can we add a placeholder file, maybe? That way typechecking does not fail and we still build the file in the build step.

Copy link
Copy Markdown
Contributor

@DikieDick DikieDick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat!

Added one remark under one of Copilots comments.

Can be merged after discussing my remark :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Chore] Move symbol generation source to npm package

3 participants