hansec / fortran-language-server

Fortran Language Server for the Language Server Protocol
MIT License
294 stars 57 forks source link

`Initialization failed` error #209

Open Turgon-Aran-Gondolin opened 2 years ago

Turgon-Aran-Gondolin commented 2 years ago

I ran into an Initialization failed error when I opened my project. The project file is on https://mcfm.fnal.gov/downloads/MCFM-8.3.tar.gz.

I was using the fortran intellisense extension of vscode, and the logs are as following:

Error while parsing file /path-to-MCFM/MCFM-8.3/TensorReduction/recur/Include/ShatC.f Traceback (most recent call last): File "~/.local/pipx/venvs/fortran-language-server/lib64/python3.9/site-packages/fortls/langserver.py", line 33, in init_file file_ast = process_file(file_obj, True, pp_defs=pp_defs, include_dirs=include_dirs) File "~/.local/pipx/venvs/fortran-language-server/lib64/python3.9/site-packages/fortls/parse_fortran.py", line 1354, in processfile , line, post_lines = file_obj.get_code_line(line_ind, backward=False, pp_content=True) File "~/.local/pipx/venvs/fortran-language-server/lib64/python3.9/site-packages/fortls/parse_fortran.py", line 948, in get_code_line match = FREE_COMMENT_LINE_MATCH.match(next_line) TypeError: expected string or bytes-like object

As you can see, the error occurs when fortls was parsing a file called ShatC.f, but the file itself is only a bunch of definitions of ShatC (literally nothing else, no comments, no even declaration). The file look like this:

  Shat7(1,z6(1,1,1,1,1,1),ep) =
 &  - Bsum11111(ep)
 &  - 5.D0*Bsum1111(ep)
 &  - 10.D0*Bsum111(ep)
 &  - 10.D0*Bsum11(ep)
 &  - 5.D0*Bsum1(ep)
 &  - Bsum0(ep)
 &

  Shat7(2,z6(1,1,1,1,1,1),ep) =
 &  - Bsum11111(ep)
 &  - 5.D0*Bsum1111(ep)
 &  - 10.D0*Bsum111(ep)
 &  - 10.D0*Bsum11(ep)
 &  - 5.D0*Bsum1(ep)
 &  - Bsum0(ep)
 &  + Bv(bb111111 + B12,ep)
 &

  Shat7(1,z6(1,1,1,1,1,2),ep) =
 &  + Bsum11111(ep)
 &  + 4.D0*Bsum1111(ep)
 &  + 6.D0*Bsum111(ep)
 &  + 4.D0*Bsum11(ep)
 &  + Bsum1(ep)
 &

And it goes on. I can't figure out what went wrong.