leanprover-community / leanprover-community/lean
Capitalising filenames breaks imports between files
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 434
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Checked that your issue isn't already filed.
- Specifically, check out the wishlist, open RFCs,
or feature requests.
- Specifically, check out the wishlist, open RFCs,
- Reduced the issue to a self-contained, reproducible test case.
- Checked that your issue isn't already filed.
Description
Changing the filename of a .lean file by just capitalising or uncapitalising is not picked up by the lean server (in vs code at least), and this results in it not recognising when the contents of an imported file have changed.
Steps to Reproduce
This was only tested in VS code. I don't know how to use emacs.
leanproject new bugtest- create
src/file1.Leanandsrc/file2.lean(pay attention to capitalisation) - in
file2.leanputimport file1 - Rename
file1.Leantofile1.lean(remove the capitalisation), either in vs-code's browser or elsewhere - Observe vs-code does not detect this change in the opened tab-name (this can be fixed by reopening the tab, but regardless the following issues still occur)
- Put
def foo : ℕ := 3infile1.lean - do
#check fooinfile2.leanand observe it doesn't recognise it. - Restart the lean server and observe it now recognises it
- Make any change to
file1.lean(like change the type offooor just deletefoo) and observe it doesn't update infile2.leanuntil the lean server or vs code is restarted (after which the problem still persists upon further changes).
There seems to be nothing you can do to fix this broken import relationship. I got it working again by changing the file name of file1.lean beyond capitalisation, say to file0.lean, and then the import relationship is fixed again, once the import is changed to import file0.
This issue also occurs when capitalising or uncapitalising other parts of the filename, say File1.lean vs file1.lean, which is arguably more likely to occur. Even after changing import File1 to import file1, the same problems occur.
Note also that the Infoview tab says the old, capitalised filename at the top throughout this process.
Expected behavior: [What you expect to happen]
Changes in file1.lean to be seen by the lean server.
Actual behavior: [What actually happens]
No changes recognised until lean server is restarted
Reproduces how often: [What percentage of the time does it reproduce?]
100% of the time
Versions
Lean (version 3.15.0, commit 56f8877f1efa, Release)
Mac OS Catalina 10.15.5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with leanproject new bugtest in VS Code, using src/file1.Lean, src/file2.lean, and the import file1 relationship described in the report. Start by tracing how the Lean server tracks renamed files and imports; done means capitalization-only renames update the open tab and imported-file changes without restarting the server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100