Skip to content

Commit 07e9f9a

Browse files
PizieDustsmorimotopitag-ha
authored
Opam Onboarding (#1737)
* images and gifs for onboarding * new onboarding commands * ocaml onboarding sequence of steps * add instructions and new images * add link for ocaml survey * better utop screenshot * add changelog * Update src/extension_commands.ml Co-authored-by: Sora Morimoto <[email protected]> * Update src/extension_commands.ml Co-authored-by: Sora Morimoto <[email protected]> * Update src/extension_commands.ml Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update CHANGELOG.md Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * Update package.json Co-authored-by: Sora Morimoto <[email protected]> * better alt descriptions * fix lint * check each step upon completion of the event * check that opam is installed before proceeding * remove unusued value * changes based on reviews * explain the different choices in opam init * Update src/extension_commands.ml Co-authored-by: Sonja Heinze <[email protected]> * update changelog * update extension commands * Refactor command executions to use the same terminal instance for consistency * Update package.json Co-authored-by: Sonja Heinze <[email protected]> * Update package.json Co-authored-by: Sonja Heinze <[email protected]> * Update package.json Co-authored-by: Sonja Heinze <[email protected]> * Update package.json Co-authored-by: Sonja Heinze <[email protected]> * Update package.json Co-authored-by: Sonja Heinze <[email protected]> * get the version of opam installed * display the version of opam and ask if user wants to update if outdated --------- Co-authored-by: Sora Morimoto <[email protected]> Co-authored-by: Sonja Heinze <[email protected]>
1 parent 43fcee4 commit 07e9f9a

File tree

13 files changed

+349
-1
lines changed

13 files changed

+349
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Add OCaml onboarding welcome screen. (#1737)
56
- Add `ocaml.server.codelens.forNestedBindings` setting to control whether
67
CodeLens should be displayed for nested bindings. Defaults to `false`,
78
showing CodeLens only for top-level bindings.

assets/ocaml_survey.png

143 KB
Loading

assets/opam_init.jpg

198 KB
Loading

assets/opam_install.jpg

155 KB
Loading

assets/opam_switch.jpg

92.6 KB
Loading

assets/utop.png

28.3 KB
Loading

assets/vscode-ocaml-commands.gif

589 KB
Loading

package.json

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,114 @@
4343
"test": "vscode-test"
4444
},
4545
"contributes": {
46+
"walkthroughs": [
47+
{
48+
"id": "ocaml-onboarding",
49+
"title": "OCaml: Setup opam dev environment (manual)",
50+
"description": "A guided, terminal based, installation of OCaml and its essential tools with the opam package manager.",
51+
"steps": [
52+
{
53+
"id": "install-opam-windows",
54+
"when": "isWindows",
55+
"title": "Install opam",
56+
"description": "opam is the package manager for OCaml. Installing opam also installs the OCaml compiler. On Windows 10 or 11, install it using Winget:\n\nRun `winget install Git.Git OCaml.opam` in PowerShell.\n\n[Open a terminal and run winget](command:ocaml.install-opam)",
57+
"media": {
58+
"image": "assets/opam_install.jpg",
59+
"altText": "While installing opam, you'll be asked a series of questions: (1) Where should opam be installed? You can press enter and use the default location, unless you wish to install it somehwere else. (2) Sometimes it may request administrator write access, you should enter your password to authorize the installer."
60+
},
61+
"completionEvents": [
62+
"onCommand:ocaml.install-opam"
63+
]
64+
},
65+
{
66+
"id": "install-opam-mac",
67+
"when": "isMac",
68+
"title": "Install opam",
69+
"description": "opam is the package manager for OCaml. Installing opam also installs the OCaml compiler. Install it via opam's official script installer.\n\n[Open a terminal and run the opam install script](command:ocaml.install-opam)",
70+
"media": {
71+
"image": "assets/opam_install.jpg",
72+
"altText": "While installing opam, you'll be asked a series of questions: (1) Where should opam be installed? You can press enter and use the default location, unless you wish to install it somehwere else. (2) Sometimes it may request administrator write access, you should enter your password to authorize the installer."
73+
},
74+
"completionEvents": [
75+
"onCommand:ocaml.install-opam"
76+
]
77+
},
78+
{
79+
"id": "install-opam-linux",
80+
"when": "isLinux",
81+
"title": "Install opam",
82+
"description": "opam is the package manager for OCaml. Installing opam also installs the OCaml compiler. Install it via opam's official script installer.\n\n[Open a terminal and run the opam install script](command:ocaml.install-opam)",
83+
"media": {
84+
"image": "assets/opam_install.jpg",
85+
"altText": "While installing opam, you'll be asked a series of questions: (1) Where should opam be installed? You can press enter and use the default location, unless you wish to install it somehwere else. (2) Sometimes it may request administrator write access, you should enter your password to authorize the installer."
86+
},
87+
"completionEvents": [
88+
"onCommand:ocaml.install-opam"
89+
]
90+
},
91+
{
92+
"id": "init-opam",
93+
"title": "Initialize opam",
94+
"description": "After installing opam, we initialise it so as to prepare your system to use it for managing OCaml packages and compilers.\n\n[Open a terminal and run opam init](command:ocaml.init-opam)",
95+
"media": {
96+
"image": "assets/opam_init.jpg",
97+
"altText": "For the different options: (1) → (recommended) Updates ~/.profile to automatically configure opam for future shell sessions. (2) → Does not update shell configs; requires manual eval $(opam env) after switching. (3) → Allows selecting a different shell (e.g., zsh, fish) for configuration. (4) → Lets you specify a custom config file instead of ~/.profile.5 → No automatic setup; you must manually run eval $(opam env) when needed."
98+
},
99+
"completionEvents": [
100+
"onCommand:ocaml.init-opam"
101+
]
102+
},
103+
{
104+
"id": "activate-opam-switch",
105+
"title": "Activate the opam switch",
106+
"description": "An opam switch is an isolated OCaml environment (like a Python virtual environment) where you can install different OCaml versions and packages. \n\n[Select a switch and activate it](command:ocaml.select-sandbox)",
107+
"media": {
108+
"image": "assets/opam_switch.jpg",
109+
"altText": "An image of tiny ocaml logos arranged in the shape of a camel"
110+
},
111+
"completionEvents": [
112+
"onCommand:ocaml.select-sandbox"
113+
]
114+
},
115+
{
116+
"id": "install-platform-tools",
117+
"title": "Install OCaml Platform Tools",
118+
"description": "Now install essential development tools:\n\n- OCaml LSP server enables editor support for OCaml, odoc generates documentation, camlformat automatically formats OCaml code, utop is an interactive REPL for OCaml and dune is the official OCaml build system.\n\n[Install Platform Tools](command:ocaml.install-ocaml-dev)",
119+
"media": {
120+
"image": "assets/vscode-ocaml-commands.gif",
121+
"altText": "A gif of how to access all commands provided by the OCaml VSCode plugin, which can be accessed by pressing Ctrl+Alt+P and typing ocaml"
122+
},
123+
"completionEvents": [
124+
"onCommand:ocaml.install-ocaml-dev"
125+
]
126+
},
127+
{
128+
"id": "check-installation",
129+
"title": "Check Installation",
130+
"description": "Verify your OCaml installation by running utop. If everything is set up correctly, you should see a prompt like the image on the right. \n\n[Check Installation](command:ocaml.open-utop)",
131+
"media": {
132+
"image": "assets/utop.png",
133+
"altText": "A screenshot showing the output of running utop in a command line"
134+
},
135+
"completionEvents": [
136+
"onCommand:ocaml.open-utop"
137+
]
138+
},
139+
{
140+
"id": "finish-onboarding",
141+
"title": "Congratulations",
142+
"description": "You now have OCaml installed and setup on your computer. Please take a few minutes to answer this short survey.\n\n[OCaml Survey](https://docs.google.com/forms/d/e/1FAIpQLSfGGFZBiw4PF7L0yt2DBX8443G5_7aFL5v6wvo6p5MwL-DW8Q/viewform?usp=pp_url&entry.454013858=Link+in+the+VSCode+plugin)",
143+
"media": {
144+
"image": "assets/ocaml_survey.png",
145+
"altText": "A screenshot of some of the various companies that use OCaml including JaneStreet, Bloomberg, ahrefs, Tezos, Facebook, Microsoft, Docker"
146+
},
147+
"completionEvents": [
148+
"onLink:https://docs.google.com/forms/d/e/1FAIpQLSfGGFZBiw4PF7L0yt2DBX8443G5_7aFL5v6wvo6p5MwL-DW8Q/viewform?usp=pp_url&entry.454013858=Link+in+the+VSCode+plugin"
149+
]
150+
}
151+
]
152+
}
153+
],
46154
"breakpoints": [
47155
{
48156
"language": "ocaml"
@@ -1378,4 +1486,4 @@
13781486
"color": "#f29100",
13791487
"theme": "light"
13801488
}
1381-
}
1489+
}

src/command_api.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ module Internal = struct
150150
let augment_selection_type_verbosity = unit_handle "augment-selection-type-verbosity"
151151
let install_dune_lsp = unit_handle "install-dune-lsp"
152152
let run_dune_pkg_lock = unit_handle "run_dune_pkg_lock"
153+
let install_opam = unit_handle "install-opam"
154+
let init_opam = unit_handle "init-opam"
155+
let install_ocaml_dev = unit_handle "install-ocaml-dev"
156+
let open_utop = unit_handle "open-utop"
153157
end
154158

155159
module Vscode = struct

src/command_api.mli

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ module Internal : sig
5151
val augment_selection_type_verbosity : (unit, unit) handle
5252
val install_dune_lsp : (unit, unit) handle
5353
val run_dune_pkg_lock : (unit, unit) handle
54+
val install_opam : (unit, unit) handle
55+
val init_opam : (unit, unit) handle
56+
val install_ocaml_dev : (unit, unit) handle
57+
val open_utop : (unit, unit) handle
5458
end
5559

5660
module Vscode : sig

0 commit comments

Comments
 (0)