Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to troubleshoot destruct when "No code actions for 'destruct' available"? #1301

Open
mbarbin opened this issue Jun 6, 2024 · 4 comments

Comments

@mbarbin
Copy link

mbarbin commented Jun 6, 2024

Hi!

I notice the recent post about the amazing destruct on ocaml discuss, and I am excited to try it out.

When I type Alt+d on a pattern '_' in vscode, I see a message saying: "No code actions for 'destruct' available". This is from within an editor, while a dune build @all @runtest -w is running in that repo, and reached a Success, waiting for filesystem changes... state.

Here are some info about the environment under which this happens:

ocaml 5.2.0
dune 3.15.3
ocaml-lsp-server 1.18.0~5.2preview
merlin 5.0-502

Could you give me some pointers as to how to troubleshoot my installation, or things I need to upgrade, enable, configure, etc.

Thank you!

@dalps
Copy link

dalps commented Jun 6, 2024

Not a maintainer, but I believe your installation is fine. That message simply warns you that destruct can't infer any constructor from your pattern, or that it is already exhaustive. Maybe share the code snippet with the pattern you tried running destruct on?

Here's an example
image

@mbarbin
Copy link
Author

mbarbin commented Jun 6, 2024

Hi, and thanks for your help!
That's helpful for you to confirm the installation is fine. This prompted me to try further.

I'm trying with simple cases first, just to see if things are working.

let _f (a : int option) = match a with _ -> ()
;;

no-code-actions-for-destruct

However, I am now noticing that the clickable More Actions menu proposes actions that do work (Destruct-line, and Destruct).

more-actions

This narrows it down to the use of the shortcut Alt + d, perhaps.

Back to my question, are there some logs I could try to access ? (vscode+ocaml-platform newbie here, relatively recently switch from another editor !!!)

Thank you

@dalps
Copy link

dalps commented Jun 6, 2024

Strange, I can't replicate the behavior shown by your screenshots; on my end Alt + d works well on your example code, however I don't get those two actions in the More actions menu... quirky, but I can't help much further in that regard.

VS Code has an "Output" panel wherein you can inspect messages sent by extensions, the OCaml platform docs explains how to enable them for ocaml-lsp.

@dalps
Copy link

dalps commented Jun 11, 2024

Turns out I was using an older version of ocaml-lsp. After updating my installation to ocaml-lsp-server 1.18.0~5.2preview, the destruct option is no longer available through the Alt + d shortcut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants