VSCode

From PHASTA Wiki
Jump to: navigation, search

This goes over usage of VSCode on the viz nodes.


Accessing VSCode in VNC

To access VSCode, you first need to add it via soft add +vscode. Then to run VSCode, simply run code in your terminal.

Fortran Language Server setup

Language servers are programs based on the open-source Language Server Protocol that intelligently parses code (including seperate files in the same code base). This allows a user to see the definition of another function, rename a variable across multiple instances/files, and see associated inline documentation*.

Setting Up

Install fortls

The fortran-language-server is implemented in Python, so it can be installed simply using pip3 (note that pip is not available on the viz nodes for whatever reason). This must be installed locally, so we must use the --user flag.

$ pip3 install -U setuptools
$ pip3 install --user fortran-language-server 

This will place the fortls executable into ~/.local/bin. So this must be added to your path.

Add .local/bin to $PATH

Add export PATH=$PATH:$HOME/.local/bin to your .bashrc file. This will ensure that VSCode can access the fortls executable.

Add extensions to VSCode

To leverage the language server in VSCode, you need to install extensions that will call it. These are FORTRAN Intellisense and Modern Fortran. Note that both of these extensions must be installed to work correctly. Also note that you may also use the fortran extension instead of Modern Fortran.



\*Note that for fortls to use inline documentation settings, the inline documentation must be in either Doxygen format or FORD. See Document Parsing here.