You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CPU usage with vscode and the petrol library #1489
I am currently working with the library petrol while coding in vscode and I have encountered a strange issue with ocamllsp: Indeed, whenever I try to code SQL queries using Petrol's Query and Expr modules, my whole editor seems to slow down quite substantially and code correction stops working altogether.
When I check my processes, it appears that the ocamllsp process has a CPU usage of 100%. The only "workaround" is found is to kill the process and use the short time window where everything works fine before it starts again.
I figured I should open this issue as you might have better solutions,
Thank you for your time, Gwen
I stumbled upon an issue that seems to be of the same origin, so I crafted a minimal piece of code that triggers the bug:
type'item list =
| []
| ( :: ) of ('item*'itemlist)
moduleList=structtype'item t = 'itemlist(* start typing some new definition here, for example reverse_concat *)end
Specs
EndeavourOS Linux 6.14.10-arch1-1
OCaml v5.3.0
ocamllsp v1.22.0
Visual Studio Code v1.100.3 (258e40fedc6cb8edf399a463ce3a9d32e7e1f6f3)
Thanks a lot @qexat, this is a surprisingly minimal example !
So far I have not been able to reproduce, I must be missing some context. Could you share the dune file and other relevant configuration information ? Or better, an archive with a minimum project ?
Huh, weird, my folder repro is literally just a file Repro.ml containing the code I have sent
Have you started typing a new definition? The code as is does not trigger it
I am not able to produce a stuck 100% cpu usage ocamllsp in the way you describe.
Could you enable verbose logging in the settings ? ocaml.trace.server is the name of the setting.
Then could you reload the window, bring it to the buggy state and share with us the content of the OCaml Language Server section in the OUTPUT panel ?
Activity
voodoos commentedon Feb 27, 2025
Thanks to Gwen's guidance I was able to reproduce the issue consistently. It is to the
codeActionsrequest that enters a seamingly infinite loop.There is workaround in vscode: disable the display of the code action lightbulb 💡
qexat commentedon Jun 11, 2025
I stumbled upon an issue that seems to be of the same origin, so I crafted a minimal piece of code that triggers the bug:
Specs
EndeavourOS Linux 6.14.10-arch1-1
OCaml v5.3.0
ocamllsp v1.22.0
Visual Studio Code v1.100.3 (258e40fedc6cb8edf399a463ce3a9d32e7e1f6f3)
voodoos commentedon Jun 12, 2025
Thanks a lot @qexat, this is a surprisingly minimal example !
So far I have not been able to reproduce, I must be missing some context. Could you share the dune file and other relevant configuration information ? Or better, an archive with a minimum project ?
qexat commentedon Jun 12, 2025
Huh, weird, my folder
reprois literally just a fileRepro.mlcontaining the code I have sentHave you started typing a new definition? The code as is does not trigger it
voodoos commentedon Jun 13, 2025
I am not able to produce a stuck 100% cpu usage ocamllsp in the way you describe.
Could you enable
verboselogging in the settings ?ocaml.trace.serveris the name of the setting.Then could you reload the window, bring it to the buggy state and share with us the content of the
OCaml Language Serversection in theOUTPUTpanel ?qexat commentedon Jun 13, 2025
Okay, I figured the issue with my reproduction sample. The new definition needs to involve pattern matching specifically.
voodoos commentedon Jun 24, 2025
Thanks, I was able to reproduce and make the example even more minimal:
Placing the cursor on
xhere make the server loop. 🤦♂️Pprintast hangs when printing some patterns
[new release] merlin (4 packages) (5.5-503)
qexat commentedon Jun 24, 2025
Nice, thank you!
Pprintast hangs when printing some patterns