From 83b5d775beb02ccfc891e4f4d962c8cff358bc96 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 15 Nov 2024 12:07:56 +0000 Subject: [PATCH] Add instructions for vscode setup * 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 --- learners/setup.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++ links.md | 5 ++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/learners/setup.md b/learners/setup.md index 9bf39cd..86050d2 100644 --- a/learners/setup.md +++ b/learners/setup.md @@ -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. \ No newline at end of file diff --git a/links.md b/links.md index b300146..10298fc 100644 --- a/links.md +++ b/links.md @@ -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 \ No newline at end of file +[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 \ No newline at end of file