hansec / vscode-fortran-ls

Fortran IntelliSense for Visual Studio Code
MIT License
37 stars 7 forks source link

Error spawning fortls: Please check that fortran-language-server is installed and in your path. #42

Open HCorte opened 2 years ago

HCorte commented 2 years ago

keep getting the following error message in my project in VSC

image

have the path defined in settings.json: "fortran-ls.executablePath": "C:\Users\Username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts",

and also in the XXXX.code-workspace the same: "fortran-ls.executablePath": "C:\Users\Username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts",

have the path in the evnironment variable PATH and also created a environment variable named fortls that its value is: C:\Users\Username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts

installed python so could use pip to install the fortran-language-server: pip install fortran-language-server

the versions

python --version Python 3.9.9

fortls --version 1.12.0

gfortran --version GNU Fortran (GCC) 9.2.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

is there any step/s that am missing?

yumasheta commented 2 years ago

I just spend some time getting this to work on my linux machine. It should actually be enough to just set the fortran-ls.executablePath setting in any (even bound to the workspace) settings.json file.

I think the problem you have is that you have to provide the path to the executable itself, not just the containing folder. So it'd be:

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

Also, change your single backslashes to double, as stated under "Configuration" here: https://marketplace.visualstudio.com/items?itemName=hansec.fortran-ls

My problem was, that I didn't provide an absolute path in the settings, but relative to the workspace. That didn't work. Hope this helps.