Error launching fortls

Hello! I am having trouble fixing

Error launching fortls: Please check that all selected options are supported by your language server version.

Any help is much appreciated.

Things I have tried:

  • Set extension settings to defaults
  • Added the following to PYTHONPATH:
  • Ran fortls from VS Code terminal: fortls --debug_filepath fortrantut.f90 --debug_parser
Testing parser
  File = "fortrantut.f90"
  Detected format: free

Parser Output

=== No PreProc ===

program fortrantut !!! PROGRAM - Ln:1
    implicit none !!! IMPLICIT - Ln:2
    integer :: ans !!! VARIABLE - Ln:3
contains !!! CONTAINS - Ln:9
    recursive function factorial(n) result(o) !!! FUNCTION - Ln:11
        integer :: n, o !!! VARIABLE - Ln:12
        if (n == 1) then !!! IF - Ln:13
        end if !!! END IF Scope - Ln:17
    end function factorial !!! END FUNCTION Scope - Ln:18
end program fortrantut !!! END PROGRAM Scope - Ln:20

Object Tree

1: fortrantut
  6: fortrantut::ans
  3: fortrantut::factorial
    6: fortrantut::factorial::n
    6: fortrantut::factorial::o
    13: fortrantut::factorial::#if1
3: fortrantut::factorial
  6: fortrantut::factorial::n
  6: fortrantut::factorial::o
  13: fortrantut::factorial::#if1
13: fortrantut::factorial::#if1

Exportable Objects

1: fortrantut
  • Checked output channel for the Modern Fortran Extension
[DEBUG - 1:45:15 PM] [lint] arguments:
[DEBUG - 1:45:15 PM] [lint] moduleOutput: -J c:\Users\dwbroad\AppData\Roaming\Code\User\workspaceStorage\433a475bcf0fc553cb4d609241edd04f\fortran-lang.linter-gfortran\include
[DEBUG - 1:45:15 PM] [lint] glob paths:
[DEBUG - 1:45:15 PM] [lint] resolved paths:
[DEBUG - 1:45:15 PM] [build.single] compiler: "gfortran" located in: "C:\Users\dwbroad\gcc\bin\gfortran.exe"
[INFO - 1:45:15 PM] [build.single] Compiler query command line: C:\Users\dwbroad\gcc\bin\gfortran.exe -fsyntax-only -cpp -fdiagnostics-plain-output -Wall -ffree-line-length-none -ffixed-line-length-none -J c:\Users\dwbroad\AppData\Roaming\Code\User\workspaceStorage\433a475bcf0fc553cb4d609241edd04f\fortran-lang.linter-gfortran\include -o e:\OneDrive\Personal\scratch_code\fortran\arithmetic.f90.o e:\OneDrive\Personal\scratch_code\fortran\arithmetic.f90
[DEBUG - 1:45:15 PM] [lsp.client] Language Server arguments:
[ERROR - 1:45:15 PM] [lsp.client] Unable to verify input arguments with LS:
[DEBUG - 1:45:15 PM] [lsp.client] Language Server version: null
[DEBUG - 1:45:15 PM] [build.single] Compiler output:

Here is my settings.json

    "fortran.fortls.path": "C:/Users/dwbroad/Anaconda3/pkgs/fortls-2.13.0-py39hcbf5309_1/Scripts/fortls.exe",
    "fortran.linter.compilerPath": "C:/Users/dwbroad/gcc/bin/gfortran.exe",
    "fortran.logging.level": "Debug",

    "code-runner.executorMap": {
        "javascript": "node",
        "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
        "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "php": "php",
        "python": "python -u",
        "perl": "perl",
        "perl6": "perl6",
        "ruby": "ruby",
        "go": "go run",
        "lua": "lua",
        "groovy": "groovy",
        "powershell": "powershell -ExecutionPolicy ByPass -File",
        "bat": "cmd /c",
        "shellscript": "bash",
        "fsharp": "fsi",
        "csharp": "scriptcs",
        "vbscript": "cscript //Nologo",
        "typescript": "ts-node",
        "coffeescript": "coffee",
        "scala": "scala",
        "swift": "swift",
        "julia": "julia",
        "crystal": "crystal",
        "ocaml": "ocaml",
        "r": "Rscript",
        "applescript": "osascript",
        "clojure": "lein exec",
        "haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
        "rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
        "racket": "racket",
        "scheme": "csi -script",
        "ahk": "autohotkey",
        "autoit": "autoit3",
        "dart": "dart",
        "pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
        "d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
        "haskell": "runhaskell",
        "nim": "nim compile --verbosity:0 --hints:off --run",
        "lisp": "sbcl --script",
        "kit": "kitc --run",
        "v": "v run",
        "sass": "sass --style expanded",
        "scss": "scss --style expanded",
        "less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
        "FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
        "sml": "cd $dir && sml $fileName"

    "code-runner.runInTerminal": true,
    "code-runner.saveAllFilesBeforeRun": true,
    "code-runner.saveFileBeforeRun": true,

    "editor.rulers": [132],
    "workbench.colorCustomizations": {
        "editorRuler.foreground": "#003cff"

Workspace settings.json is empty

System details

VS Code v1.74.2
Modern Fortran v3.4.2023010501 (pre-release for debug)
fortls v2.13.0

I changed my fortls path to

"fortran.fortls.path": "C:/Users/dwbroad/Anaconda3/Scripts/fortls.exe"

And this made the error message disappear.

You could try to add C:/Users/dwbroad/Anaconda3/Scripts/ to your PATH environment variable. IIRC Anaconda won’t do this by default but instead expect you to run their activation scripts when opening a terminal.

Personally I prefer regular Python because I’ve had so many problems like this with anaconda

Thanks, I added it just to be safe. But I found out that just changing my fortls path did the trick

"fortran.fortls.path": "C:/Users/dwbroad/Anaconda3/Scripts/fortls.exe"