-
Notifications
You must be signed in to change notification settings - Fork 80
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
PizieDust
wants to merge
30
commits into
ocamllabs:master
Choose a base branch
from
PizieDust:welcome_screen
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
OCaml Onboarding #1737
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
67e0195
images and gifs for onboarding
PizieDust 402d8a3
new onboarding commands
PizieDust 748c8fb
ocaml onboarding sequence of steps
PizieDust 46744e6
add instructions and new images
PizieDust 1df7df9
add link for ocaml survey
PizieDust d91911e
better utop screenshot
PizieDust e9a1808
add changelog
PizieDust 5f65f54
Update src/extension_commands.ml
PizieDust e9b1d07
Update src/extension_commands.ml
PizieDust e69a596
Update src/extension_commands.ml
PizieDust 2927841
Update package.json
PizieDust 2fb7c0f
Update package.json
PizieDust 4ab0a57
Update package.json
PizieDust fca0ce6
Update package.json
PizieDust 7417e4b
Update package.json
PizieDust 81640ff
Update package.json
PizieDust 46959e2
Update package.json
PizieDust 735f71e
Update CHANGELOG.md
PizieDust faa9682
Update package.json
PizieDust c7134a9
Update package.json
PizieDust e1da771
Update package.json
PizieDust f30dae6
Update package.json
PizieDust 1ee09b4
Update package.json
PizieDust b8abbfc
better alt descriptions
PizieDust 93d6358
fix lint
PizieDust 872cedf
check each step upon completion of the event
PizieDust ec380da
check that opam is installed before proceeding
PizieDust 6ef929c
remove unusued value
PizieDust a56a204
changes based on reviews
PizieDust 56a6418
explain the different choices in opam init
PizieDust File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -117,6 +117,177 @@ let _switch_impl_intf = | |||||
command Extension_consts.Commands.switch_impl_intf handler | ||||||
;; | ||||||
|
||||||
let _install_opam = | ||||||
let handler (instance : Extension_instance.t) ~args:_ = | ||||||
let process_installation () = | ||||||
let open Promise.Syntax in | ||||||
let* opam = Opam.make () in | ||||||
match opam with | ||||||
| None -> | ||||||
let options = | ||||||
ProgressOptions.create | ||||||
~location:(`ProgressLocation Notification) | ||||||
~title:"Installing opam package manager" | ||||||
~cancellable:false | ||||||
() | ||||||
in | ||||||
let task ~progress:_ ~token:_ = | ||||||
let+ result = | ||||||
match Platform.t with | ||||||
| Win32 -> | ||||||
let _ = | ||||||
let terminal = | ||||||
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" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we know if this works? |
||||||
in | ||||||
Ok () |> Promise.return | ||||||
| Darwin | Linux | Other -> | ||||||
let open Promise.Result.Syntax in | ||||||
let+ _ = | ||||||
let _ = | ||||||
let terminal = | ||||||
Extension_instance.sandbox instance |> Terminal_sandbox.create | ||||||
in | ||||||
let _ = Terminal_sandbox.show ~preserveFocus:true terminal in | ||||||
Terminal_sandbox.send | ||||||
terminal | ||||||
"bash -c \"sh <(curl -fsSL https://opam.ocaml.org/install.sh)\"" | ||||||
in | ||||||
Ok () |> Promise.return | ||||||
in | ||||||
() | ||||||
in | ||||||
match result with | ||||||
| Ok () -> Ojs.null | ||||||
| Error err -> | ||||||
show_message `Error "An error occured while installing opam %s" err; | ||||||
Ojs.null | ||||||
in | ||||||
let+ _ = Vscode.Window.withProgress (module Ojs) ~options ~task in | ||||||
() | ||||||
| Some _ -> show_message `Info "Opam is already installed!" |> Promise.return | ||||||
in | ||||||
let (_ : unit Promise.t) = process_installation () in | ||||||
() | ||||||
in | ||||||
command Extension_consts.Commands.install_opam handler | ||||||
;; | ||||||
|
||||||
let _init_opam = | ||||||
let handler (instance : Extension_instance.t) ~args:_ = | ||||||
let options = | ||||||
ProgressOptions.create | ||||||
~location:(`ProgressLocation Notification) | ||||||
~title:"Initialising opam" | ||||||
~cancellable:false | ||||||
() | ||||||
in | ||||||
let task ~progress:_ ~token:_ = | ||||||
let open Promise.Syntax in | ||||||
let+ result = | ||||||
let open Promise.Result.Syntax in | ||||||
let+ _ = | ||||||
let _ = | ||||||
let terminal = | ||||||
Extension_instance.sandbox instance |> Terminal_sandbox.create | ||||||
in | ||||||
let _ = Terminal_sandbox.show ~preserveFocus:true terminal in | ||||||
Terminal_sandbox.send terminal "opam init" | ||||||
in | ||||||
Ok () |> Promise.return | ||||||
in | ||||||
() | ||||||
in | ||||||
match result with | ||||||
| Ok () -> Ojs.null | ||||||
| Error err -> | ||||||
show_message `Error "An error occured while initializing opam %s" err; | ||||||
Ojs.null | ||||||
in | ||||||
let _ = Vscode.Window.withProgress (module Ojs) ~options ~task in | ||||||
() | ||||||
in | ||||||
command Extension_consts.Commands.init_opam handler | ||||||
;; | ||||||
|
||||||
let _install_ocaml_dev = | ||||||
let handler (instance : Extension_instance.t) ~args:_ = | ||||||
let options = | ||||||
ProgressOptions.create | ||||||
~location:(`ProgressLocation Notification) | ||||||
~title:"Installing development packages" | ||||||
~cancellable:false | ||||||
() | ||||||
in | ||||||
let task ~progress:_ ~token:_ = | ||||||
let open Promise.Syntax in | ||||||
let+ result = | ||||||
let open Promise.Result.Syntax in | ||||||
let+ _ = | ||||||
let _ = | ||||||
let terminal = | ||||||
Extension_instance.sandbox instance |> Terminal_sandbox.create | ||||||
in | ||||||
let _ = Terminal_sandbox.show ~preserveFocus:true terminal in | ||||||
Terminal_sandbox.send | ||||||
terminal | ||||||
"opam install ocaml-lsp-server odoc ocamlformat utop" | ||||||
in | ||||||
Ok () |> Promise.return | ||||||
in | ||||||
() | ||||||
in | ||||||
match result with | ||||||
| Ok () -> Ojs.null | ||||||
| Error err -> | ||||||
show_message `Error "An error occured while installing packages %s" err; | ||||||
Ojs.null | ||||||
in | ||||||
let _ = Vscode.Window.withProgress (module Ojs) ~options ~task in | ||||||
() | ||||||
in | ||||||
command Extension_consts.Commands.install_ocaml_dev handler | ||||||
;; | ||||||
|
||||||
let _open_utop = | ||||||
let handler (instance : Extension_instance.t) ~args:_ = | ||||||
let options = | ||||||
ProgressOptions.create | ||||||
~location:(`ProgressLocation Notification) | ||||||
~title:"Launching utop" | ||||||
~cancellable:false | ||||||
() | ||||||
in | ||||||
let task ~progress:_ ~token:_ = | ||||||
let open Promise.Syntax in | ||||||
let+ result = | ||||||
let open Promise.Result.Syntax in | ||||||
let+ _ = | ||||||
let _ = | ||||||
let terminal = | ||||||
Extension_instance.sandbox instance |> Terminal_sandbox.create | ||||||
in | ||||||
let _ = Terminal_sandbox.show ~preserveFocus:true terminal in | ||||||
Terminal_sandbox.send terminal "utop" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
in | ||||||
Ok () |> Promise.return | ||||||
in | ||||||
() | ||||||
in | ||||||
match result with | ||||||
| Ok () -> Ojs.null | ||||||
| Error err -> | ||||||
show_message `Error "An error occured while opening utop %s" err; | ||||||
Ojs.null | ||||||
in | ||||||
let _ = Vscode.Window.withProgress (module Ojs) ~options ~task in | ||||||
() | ||||||
in | ||||||
command Extension_consts.Commands.open_utop handler | ||||||
;; | ||||||
|
||||||
let _open_current_dune_file = | ||||||
let handler (_instance : Extension_instance.t) ~args:_ = | ||||||
match Vscode.Window.activeTextEditor () with | ||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.