Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To enable automatic code completion for Fortran in VS code, you can follow these steps:

  1. Install the Fortran language extension for VS code: Open the Extensions tab in VS code, search for "Fortran" and install the "Modern Fortran" extension.

  2. Install a Fortran compiler: A Fortran compiler is required to generate the necessary metadata for the code completion feature. You can use any of the commonly used Fortran compilers like GFortran, Intel Fortran, etc.

  3. Configure the compiler path: In VS Code, open the Command Palette by pressing the F1 key and search for "Fortran: Set Compiler Path". Set the path to the Fortran compiler you installed in step 2.

  4. Open a Fortran project: If you haven't already, open a Fortran project in VS Code. You can create a new Fortran project or open an existing one.

  5. Enable IntelliSense: IntelliSense is the name of the code completion feature in VS code. To enable it for Fortran, open the Command Palette again and search for "Configure language-specific settings". Select Fortran from the list and add the following setting to enable IntelliSense:

"fortran.intellisenseEnabled": true

  1. Start coding: With these steps, you should now have automatic code completion for Fortran in VS code. While coding, you can press Ctrl+Space to trigger the code completion feature and get suggestions for code snippets, variables, functions, etc.