diff --git a/doc/dev/index.md b/doc/dev/index.md index 38140570c3..a915b05299 100644 --- a/doc/dev/index.md +++ b/doc/dev/index.md @@ -63,6 +63,7 @@ cd src # make `lean` etc. point to stage0 anywhere inside `src` elan override set lean4-stage0 ``` + You can also use the `+toolchain` shorthand (e.g. `lean +lean4-debug`) to switch toolchains on the spot. `lean4-mode` will automatically use the `lean` executable associated with the directory of the current file as long as `lean4-rootdir` is diff --git a/doc/images/code-success.png b/doc/images/code-success.png index 9aaa7b908b..1afbcf60ae 100644 Binary files a/doc/images/code-success.png and b/doc/images/code-success.png differ diff --git a/doc/images/install_elan.png b/doc/images/install_elan.png new file mode 100644 index 0000000000..550f883b8e Binary files /dev/null and b/doc/images/install_elan.png differ diff --git a/doc/make/msys2.md b/doc/make/msys2.md index 4b8ee787f1..511a366034 100644 --- a/doc/make/msys2.md +++ b/doc/make/msys2.md @@ -74,6 +74,11 @@ The following linux command will do that: cp $(ldd lean.exe | cut -f3 -d' ' | grep mingw) . ``` +However, if you plan to use this build to compile lean programs +to executable binaries using `lake build` in normal Windows command +prompt outside of msys2 environment you will also need to add a windows +version clang to your path. + ## Trouble shooting **-bash: gcc: command not found** diff --git a/doc/quickstart.md b/doc/quickstart.md index 1bd547454a..db4e15bad1 100644 --- a/doc/quickstart.md +++ b/doc/quickstart.md @@ -3,33 +3,48 @@ These instructions will walk you through setting up Lean using the "basic" setup and VS Code as the editor. See [Setup](./setup.md) for other ways and more details on setting up Lean. -1. Install the latest Lean 4 nightly through [`elan`](https://github.com/leanprover/elan): in any bash-compatible shell, run - ```sh - curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain leanprover/lean4:nightly - ``` - On Windows, instead run in `cmd` - ```sh - curl -O --location https://raw.githubusercontent.com/leanprover/elan/master/elan-init.ps1 - powershell -f elan-init.ps1 --default-toolchain leanprover/lean4:nightly - del elan-init.ps1 - ``` - See the [elan repo](https://github.com/leanprover/elan) for other installation options and details. - 1. Install [VS Code](https://code.visualstudio.com/). -1. Open VS Code and install the `lean4` extension. +1. Launch VS Code and install the `lean4` extension. ![installing the vscode-lean4 extension](images/code-ext.png) -1. Create a new file with the extension `.lean` and add the following code: +1. Create a new file using "File > New File" and click the `Select a language` link and type in `lean4` and hit ENTER. You should see the following popup: + ![elan](images/install_elan.png) + + Click the "Install Lean using Elan" link and follow the progress + pressing ENTER in the terminal window to install lean. You should see some progress output like this: + + ``` + info: syncing channel updates for 'nightly' + info: latest update on nightly, lean version nightly-2021-12-05 + info: downloading component 'lean' + ``` + +1. While it is installing you can paste the following Lean program into the new file: + ```lean #eval Lean.versionString ``` - You should get a syntax-highlighted file with a "Lean Infoview" on the right that tells you the installed Lean version when placing your cursor on the last line. + + When the install finishes the Lean Language Server should start automatically and you should get a syntax-highlighting and a "Lean Infoview" popping up on the right. You will see the output of the #eval statement when + you place your cursor at the end of the #eval statement. ![successful setup](images/code-success.png) -1. You are set up! You can now also run `lake init foo` from the command line to create a package, followed by `lake build` to get an executable version of your Lean program. +You are set up! + +## Create a Lean Project + +You can now create a Lean project in a new folder. Run `lake init foo` from the "View > Terminal" to create a package, followed by `lake build` to get an executable version of your Lean program. +On Linux/macOS, you first have to follow the instructions printed by the Lean installation or log out and in again for the Lean executables to be available in you terminal. Note: Packages **have** to be opened using "File > Open Folder..." for imports to work. Saved changes are visible in other files after running "Lean 4: Refresh File Dependencies" (`Ctrl+Shift+X`). + +## Troubleshooting + +**The InfoView says "Waiting for Lean server to start..." forever.** + +Check that the VS Code Terminal is not prompting you with `Press ENTER key to start Lean:`. If so click in the terminal window and pressthe ENTER key. +If that doesn't work try also running the VS Code command `Developer: Reload Window`.