Zulip Chat Archive
Stream: lean4
Topic: Autocompletion can't find `CategoryStruct`
Jovan Gerbscheid (Aug 03 2025 at 20:21):
I often rely on the autocompletion in https://leanprover-community.github.io/mathlib4_docs/ when I search for a lemma or definition. It works great, but every now and then it can be a bit annoying. A good example of this is that I searched for CategoryStruct, hoping to get the result CategoryTheory.CategoryStruct. But instead I only got results about CategoryTheory.StructuredArrow. Is this something that could be improved?
This seems to be the same autocompletion as the one in the Lean language server, which is why I put this in the lean4 channel.
Marc Huisinga (Aug 04 2025 at 08:19):
Jovan Gerbscheid said:
This seems to be the same autocompletion as the one in the Lean language server, which is why I put this in the lean4 channel.
How did you come to that conclusion?
Jovan Gerbscheid (Aug 04 2025 at 10:19):
I went in a Lean file and wrote
import Mathlib
#check CategoryStruct
And to me the autocomplete suggestions looked the same as the suggestions in the mathlib docs website.
Marc Huisinga (Aug 04 2025 at 11:02):
Auto-completion finds CategoryTheory.CategoryStruct as the first result in the MWE you posted, though?
Jovan Gerbscheid (Aug 04 2025 at 11:05):
Ah yes
Marc Huisinga (Aug 04 2025 at 11:05):
It's the first result in your screenshot
Jovan Gerbscheid (Aug 04 2025 at 11:06):
Oops. I was thrown off by the highlighting
Jovan Gerbscheid (Aug 04 2025 at 11:09):
So I guess then my question is, can the website use the same autocompletion as the Lean server?
Henrik Böving (Aug 05 2025 at 07:33):
At the time when this was written the precise completion algorithm of the server used to be far more computationally intense than today so we implemented a differen one that could be used for interactive web applications with less computational resources and higher interactivity requirements. I think nowadays we could actually port what the LSP is now using to doc-gen, I would be happy to review a PR for that.
Last updated: Dec 20 2025 at 21:32 UTC