Fortran LSP Configuration

The details below describe how to install and configure the Fortran language server found here.
NOTE: This installation process assumes a full version of Python has been installed on the machine.

Installing the Language Server

To build the language servel perform the following steps:
Open a command line prompt and install the language server by running the following command:
pip install fortran-language-server
Check the installation by runing the fortls.exe -? command which should result in the following output:
usage: fortls [-h] [--version] [--nthreads NTHREADS] [--notify_init]
              [--symbol_skip_mem] [--incremental_sync]
              [--autocomplete_no_prefix] [--lowercase_intrinsics]
              [--use_signature_help] [--variable_hover]
              [--preserve_keyword_order] [--enable_code_actions]
              [--max_line_length MAX_LINE_LENGTH]
              [--max_comment_line_length MAX_COMMENT_LINE_LENGTH]
              [--debug_log] [--debug_parser] [--debug_diagnostics]
              [--debug_symbols]
              [--debug_workspace_symbols DEBUG_WORKSPACE_SYMBOLS]
              [--debug_completion] [--debug_signature] [--debug_definition]
              [--debug_hover] [--debug_implementation] [--debug_references]
              [--debug_rename DEBUG_RENAME] [--debug_actions]
              [--debug_filepath DEBUG_FILEPATH]
              [--debug_rootpath DEBUG_ROOTPATH] [--debug_line DEBUG_LINE]
              [--debug_char DEBUG_CHAR]

Server Batch File

Since Zeus itself can be scripted using Python the Zeus installation includes a cut down version of the Python interpreter.
However, this Fortran language server is Python based and it requires a full version of Python and as such a batch file is needed to ensure these two versions of Python can run side by side.
Create the following zLSP.cmd batch file, taking note of the folder location of the file as that information will be needed in a later configuration step:
@echo off

:: Point to the full Python installation
set PATH=C:\Python37\;%PATH%
set PYTHONPATH=C:\Python37\Lib

cd C:\Python37\Scripts\

:: Echo the command about to be run
echo fortls.exe

:: Run the language server
fortls.exe
NOTE: The details found in this batch file may need to be adjusted to suit the local machine. For example the Python installation folder or the version of Python installed may need to be adjusted.

Configuration

Edit the Fortran document type and in the Language Server configuration panel apply the following configuration settings:
Program Type: Batch
     Program: zLSP.cmd
   Directory: The folder location of the zLSP.cmd file

Using the Language Server

To test the configuration create a simple test.f90 file and fire off an auto-complete request:
lsp fortran


Latest Version: Zeus 3.98u
Released: 3rd March 2019