Skip to content

OCaml Onboarding #1737

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

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

OCaml Onboarding #1737

wants to merge 30 commits into from

Conversation

PizieDust
Copy link
Contributor

This PR introduces a new way to onboard users into the OCaml ecosystem.
It uses a short interactive tutorial to guide the user through the various steps of setting up OCaml.

  • Installing Opam
  • Initializing Opam
  • Activating an Opam switch
  • Installing developer tools (ocaml lsp server, ocamlformat, odoc, utop, dune)
  • Verifying that ocaml is correctly setup with utop.
  • Finishing and linking to the tutorials for beginners on ocaml.org

cc @voodoos

@voodoos
Copy link
Collaborator

voodoos commented Mar 11, 2025

We should add the survey link in the onboarding. Maybe also in the status bar / command panel in a separate PR ?

@PizieDust PizieDust marked this pull request as ready for review March 11, 2025 11:26
@smorimoto smorimoto added type: feature New feature or request type: improvement labels Mar 13, 2025
@smorimoto smorimoto requested a review from voodoos March 13, 2025 10:47
@smorimoto smorimoto changed the title Ocaml Onboarding OCaml Onboarding Mar 13, 2025
Comment on lines -1337 to +1445
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diff should not exist.

@smorimoto
Copy link
Collaborator

It may be better to write the alt text more properly, or to leave it blank at all. We can come up with some ideas about that for accessibility.

PizieDust and others added 12 commits March 14, 2025 08:41
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
PizieDust and others added 5 commits March 14, 2025 09:02
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
Co-authored-by: Sora Morimoto <[email protected]>
@voodoos
Copy link
Collaborator

voodoos commented Mar 21, 2025

Is there a way to automatically check the various steps at the end of command execution ?
Ideally we would also not permit users to "install opam" if they already have opam installed...

@PizieDust
Copy link
Contributor Author

Is there a way to automatically check the various steps at the end of command execution ? Ideally we would also not permit users to "install opam" if they already have opam installed...

Indeed. I think the best way is to check if opam is installed and just move to the next step or exit the onboarding with a toast explaining opam is already installed

@PizieDust
Copy link
Contributor Author

Is there a way to automatically check the various steps at the end of command execution ?

Yes, this is now available.

package.json Outdated
{
"id": "init-opam",
"title": "Initialize opam",
"description": "After installing opam, we initialise it so as to prepare your system to use it for managing OCaml packages and compilers.\n\n[Initialize opam](command:ocaml.init-opam)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current opam init requires user interaction. We might want to fix that. If it's auto we should describe exactly what it does to the user. Else we should prepare the user to make the correct choices.

Copy link
Contributor Author

@PizieDust PizieDust Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added in the image, an explanation for each of the choices and also in the alt

package.json Outdated
{
"id": "activate-opam-switch-mac",
"title": "Activate the opam switch",
"description": "An opam switch is an isolated OCaml environment (like a Python virtual environment) where you can install different OCaml versions and packages. To activate a switch, run eval $(opam env) in your terminal.\n\n[Activate opam switch](command:ocaml.activate-opam-switch)",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should activate the switch automatically at the end of the init. Her we should explain to the user that they can choose a different switch either via the vscode command or in a terminal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to ask the user to select a sandbox. For a first time user, this ill probably just be Global

@pitag-ha
Copy link
Member

Hi @PizieDust , this looks awesome! It could significantly improve the experience of people setting up OCaml. Would it be easy to drop a quick screencast of the walkthrough here? I'll review the code next week!

Copy link
Member

@pitag-ha pitag-ha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think we should merge this rather sooner than later and see what feedback we get.

Is the following comment from above already adressed?

Ideally we would also not permit users to "install opam" if they already have opam installed...

Extension_instance.sandbox instance |> Terminal_sandbox.create
in
let _ = Terminal_sandbox.show ~preserveFocus:true terminal in
Terminal_sandbox.send terminal "winget install Git.Git OCaml.opam"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know if this works?

Extension_instance.sandbox instance |> Terminal_sandbox.create
in
let _ = Terminal_sandbox.show ~preserveFocus:true terminal in
Terminal_sandbox.send terminal "utop"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Terminal_sandbox.send terminal "utop"
Terminal_sandbox.send terminal "opam exec -- utop"

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

Successfully merging this pull request may close these issues.

4 participants