FORTRAN IntelliSense extension (path) - Visual Studio Code

Viewed 2802

After installing FORTRAN IntelliSense extension, then when using in a file by Select Language Mode keep getting a popup

enter image description here Error spawning fortls: Please check that fortran-language-server is installed and in your path.

So in Settings of VSC go to Extensions > Fortran IntelliSence

enter image description here

and have this word as path fortls assumed it would be a environment variable, but doesn't seems to be the case since it doesn't exist one by that name.

In the extension documentation is refered:

Configuration Note: When setting an explicit language server executable path on Windows backslashes must be escaped (ex. C:\path\to\fortls.exe).

but can't find anywhere this executable so what is the correct path for this extension/executable?

note: the extension is located at C:\Users\Username\.vscode\extensions\hansec.fortran-ls-0.6.2

OS: Windows


installed in the Visual Studion Extension enter image description here


In Ctrl+Caps Lock+P Preferences: Configure Languages Specific Settings

"fortran-ls.executablePath": "C:\Users\XXXXXX\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts"

or enter image description here

created environment variable called fortls that also haves its value that path and added to the PATH environment variable.

1 Answers

Make sure the Fortran language server is actually installed. (Usually installed via python pip. For example:

pip install fortran-language-server

For me, it was installed in c:\users\user\AppData\Roaming\Python\Python310\scripts\fortls.exe

You can verify via running with --version option.

After installing the Fortran Intellisense extension either set the executable path setting to the your install path (c:\bla\bla\fortls) OR, in the settings.json (don't forget to escape backslashes in the .json). For example:

"fortran-ls.executablePath": "C:\\Users\\user\\AppData\\Roaming\\Python\\Python310\\Scripts\\fortls",

If you cannot find the fortls.exe, just search for it using windows file explorer. Assuming you only have one drive, search c:\ and use the following search script:

file: fortls.exe

It may take a while, but it should show up in the search results.

Related