fortran-lang / vscode-fortran-support

Fortran language support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=fortran-lang.linter-gfortran
MIT License
217 stars 30 forks source link

Crash when no Compiler is installed #837

Open Nuramon27 opened 1 year ago

Nuramon27 commented 1 year ago

Is there an existing issue for this?

Description

When trying to use the Extension without a fortran compiler installed (and only the language server), it always crashes immediately, even if I set "fortran.linter.compiler" to "Disabled" in the settings.

Steps to reproduce: Install fortls. Install Modern Fortran Extension on a system with no fortran compiler (gfortran, ifort) installed. In the extension settings, set "fortran.linter.compiler": "Disabled". Then open a fortran source file and, if the language server does not start automatically, execute the command "Fortran: Restart the Fortran Language Server".

Error Messages The errors shown in VSCode as popup messages are "Server initialization failed" and "Fortran Language Server client: couldn't create connection to server". The extension tries to restart a few times before it gives up with the message "The Fortran Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information."

In the "Extension Host"-Output of VSCode, I could see the error message "[error] Error: not found: Disabled" and after that a few times "[error] Error: tuple index out of range".

Screenshots

No response

Expected Behaviour

Without a compiler, I expected the extension to work with only the functionalities provided by the language server, i.e. hover, autocompletion, symbols and Go to & Peeking into definitions, but without linting.

Version of Modern Fortran

v3.2.0

Version of Visual Studio Code

v1.75.1

Platform and Architecture

Windows 10

Additional Information

No response

gnikit commented 1 year ago

Can you install the pre-release version, and enable Debug log level and post the output of the OUTPUT channel (make sure to select Modern Fortran from the drop down menu). This will help narrow things down.

Linting and fortls should be completely isolated so initialisation should not be affected.

Can you also post your Fortran VS Code settings?

Nuramon27 commented 1 year ago

Sure, my vscode settings are:

{
    "workbench.colorTheme": "Default Light+",
    "files.eol": "\n",
    "files.encoding": "iso88591",
    "terminal.integrated.tabStopWidth": 4,
    "editor.tabSize": 8,
    "C_Cpp.default.compilerPath": "",
    "fortran.linter.compiler": "Disabled",
    "fortran.fortls.directories": [
        "."
    ],
    "fortran.logging.level": "Debug"
}

The output of the OUTPUT channel ist attached as a file: output_modern_fortran.txt

I have, however, now noticed that when removing the setting "fortran.fortls.directories": ["."], everything works fine.