Zulip Chat Archive
Stream: lean4
Topic: Semantic highlighting limit reached?
Mario Carneiro (May 20 2023 at 22:56):
Could someone else confirm that syntax highlighting stops about here when you open Std.Data.List.Lemmas
?
Mario Carneiro (May 20 2023 at 22:56):
I suspect the issue is that an upper bound on the number of tokens is being reached
Mario Carneiro (May 20 2023 at 22:57):
it's on line 1523, which is big but not that big, so I think we might need to bump the limit if that is the issue
Mario Carneiro (May 20 2023 at 23:00):
there are 75 files in mathlib which are longer than that
Mario Carneiro (May 20 2023 at 23:04):
for a mathlib example, highlighting peters out on line 1833 of Mathlib.Data.Fin.Basic
. (mathlib uses its tokens a bit more sparingly than std because of the #align
lines)
Kyle Miller (May 20 2023 at 23:07):
I see most syntax highlighting still, but around that line I can confirm that variables stop being blue (and deleting declarations to move things earlier causes their variables to become blue).
Mario Carneiro (May 20 2023 at 23:11):
right, that's the semantic highlighting
Mario Carneiro (May 20 2023 at 23:11):
the basic syntax highlighting is regex based and not supplied by the lean server
Mario Carneiro (May 20 2023 at 23:13):
I tried stressing the semantic highlighting by making many copies of
example (x : Nat) := [x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x]
(which should have 40 tokens if I counted correctly) but I was able to make over 4000 lines of that without losing semantic highlighting, so maybe something else is at work
Gabriel Ebner (May 21 2023 at 01:08):
Can repro in both vscode and neovim.
Gabriel Ebner (May 21 2023 at 01:08):
65 kilobytes should be enough for everyone.
def handleSemanticTokensFull (_ : SemanticTokensParams)
: RequestM (RequestTask SemanticTokens) := do
handleSemanticTokens 0 ⟨1 <<< 16⟩
Sebastian Ullrich (May 21 2023 at 08:19):
Now with special extended support for up to 2GB
Max Nowak 🐉 (May 21 2023 at 08:43):
Yeah just changing that value to something bigger fixes it.
Max Nowak 🐉 (May 21 2023 at 08:51):
I... may have gotten carried away at one point and improved the semantic highlighting (I know, should have asked whether a PR is desired first..). You can easily add more cases in the code for handleSemanticTokens
, and you can distinguish propositions from types, check whether something is structure-like or a projection function or not, etc etc etc.
Max Nowak 🐉 (May 21 2023 at 09:33):
Also whenever you add/remove imports, the semantic highlighting just stops and you have to close&open the vscode tab.
Last updated: Dec 20 2023 at 11:08 UTC