Skip to content

Commit

Permalink
Add instructions for vscode setup
Browse files Browse the repository at this point in the history
* Added link and blurb about vscode

* Added installation instructions for `fortls` and Modern Fortran
  Extension

* Added instructions for adding a ruler to the editor window
  • Loading branch information
abrown41 committed Nov 15, 2024
1 parent b86ef37 commit 83b5d77
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
56 changes: 56 additions & 0 deletions learners/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,59 @@ Initialization settings can be placed within your `~/.config/emacs/init.el` file
The `.emacs` or `.emacs.el` file is an older method of configuring Emacs. This file is held in your home directory.

:::::::::::::::::::::::::

### VScode

[VScode][vscode-link] Visual Studio Code (VSCode) is a powerful IDE available for Linux, macOS, and Windows. To bring the power of VScode to bear on Fortran, two additions are required. The [Modern Fortran extension](vscode-modern-fortran) enhances Fortran support in VSCode, offering features such as syntax highlighting, IntelliSense for Fortran statements, and debugging capabilities, along with customization options to improve the coding experience for Fortran developers. The Modern Fortran extension depends on `fortls`: a language server that interfaces with the code editor.

::::::::::::::::: tab

### Pypi

```bash
pip install fortls
```

### Anaconda

```bash
conda install -c conda-forge fortls
```

### Brew

```bash
brew install fortls
```

### Source

The development version of fortls can be installed from github via

```bash
pip install --user --upgrade git+git://github.com/fortran-lang/fortls
```

:::::::::::::::::::::::::

Once fortls is installed, install the [Modern Fortran extension](vscode-modern-fortran), and it should work out of the box.

#### Adding a ruler

We recommend adding a ruler: essentially a vertical line in the editor which gives you a visual guide as to the number of characters you should include on a single line of code.

To add a ruler at 80 characters to your VScode editor window, in VScode

1. Open the Command Palette (Press `Cmd+Shift+P`, or `Ctrl+Shift+P`)
2. Type 'settings' and then select the option which says "Preferences: Open User Settings (JSON)"
3. This should open the `settings.json` file in your editor. It may already have code in it.
4. Add the `editor.rulers` property to the JSON file, e.g.

```json
{
other.settings: "already here",
editor.rulers: [80]
}
```

If you save the file, you should immediately see a vertical line appear in your editor.
5 changes: 4 additions & 1 deletion links.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ any links that you are not going to use.
[install-gfortran]: https://fortran-lang.org/learn/os_setup/install_gfortran/

[emacs-link]: https://www.gnu.org/software/emacs/
[emacs-init-link]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html
[emacs-init-link]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html

[vscode-link]: https://code.visualstudio.com
[vscode-modern-fortran]: https://marketplace.visualstudio.com/items?itemName=fortran-lang.linter-gfortran

0 comments on commit 83b5d77

Please sign in to comment.