How to disable lightbulb feature in VSCode's OCaml-Platform extension

I’m using OCaml configuration in VSCode.

For some time now, I’ve noticed a certain feature of this extension : a lightbulb pops up now and then when I’m writing OCaml code, perturbating the text window and suggesting some weird ways of rewriting the code, and usually finding fault in perfectly correct and clear OCaml code, as shown in the example below.


I see no use for this feature (perhaps it’s targeted towards Reason-ML users ?) and I would really like to disable it. But I couldn’t find anything about it in the Settings.

Difficult to help without knowing the exact extension you are using. And out of curiosity, what is the lightbulb suggesting?

AFAIK, the full name of my extension is “Ocaml platform” as in

That pretentious, troublesome lightbulb calls itself “Show Fixes” :


And if I yield to its pressure, I get the unspeakable, nonsensical code as below :


Interesting. Well, this is the official OCaml Platform VSCode extension, it’s not targeted at ReasonML users specifically. Looking through the extension’s repo, I don’t see any mention of ‘Show Fixes’, so not sure where that could be coming from. Perhaps the extension developers will chime in.

I think that is associated to codeAction which is implemented in the lap server:

Looks like it’s using merlin destruct, for whatever that’s worth.

There is a VSCode setting to disable the lightbulb:

"editor.lightbulb.enabled": false

Or if you only want to disable it for OCaml:

"[ocaml]": {
	"editor.lightbulb.enabled": false

The first destructuring decribed in the file you link seems to be the one that is being suggested in the post. Maybe there is something broken in the logic or in the way those suggestions work right now.

Does the bulb suggest to destruct with a match any destructurable object — even when you just want to define or apply a function to it — @jonathandoyle ?

Yes, that’s how it seems to be. It considers every list expression as part of a pattern matching.

I’m not sure where I should write this- I see lots of specific .json files for a specific extension, but is there a global “.json” ?

Anyway, I finally found out where the feature is located in Settings - it’s called Editor:Lightbulb and it’s under Text Editor ; the reason I didn’t see it the first time is that it’s not under Ocaml. I unchecked the box, that should do it …

Thanks a lot !

I forgot to mention you can do it by searching for the setting like you did.

The JSON snippets I mentioned would go into your settings.json, which you can access by clicking on a button in the settings tab:

The UI you used is just a way to edit the settings without manually editing JSON.

Glad you got it working!