hansec / fortran-language-server

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

Looking for help with launching on Linux with VS Code #212

Closed trainreth closed 2 years ago

trainreth commented 2 years ago

I have both a development machine and a production machine that I'm trying to set up to use the Modern Fortran and Fortran Intellisense with the Fortran language server. The server is installed on both machines and the direct path is specified, and I have disabled the settings in Modern Fortran that say to disable when using Intellisense, but I am not seeing any of the features provided by Intellisense and the language server. I feel like I must be missing a step in how to actually launch it from within my workspace in VS Code. Running the fortls --debug_rootpath=/path/to/root/dir command results in a success and lists out the directories I want it to include. Any idea what I might be doing wrong?

gnikit commented 2 years ago

Hi there, is the linter enabled in the Modern Fortran extension? Other than the linter being disabled I cannot think of anything else. Also, would you mind sharing your modern fortran and fortls .json settings so I can have a look?

trainreth commented 2 years ago

Thanks for your response! The linter is enabled; here are the .json settings:

    "terminal.integrated.inheritEnv": false,
    "python.pythonPath": "/opt/anaconda3/bin/python",
    "python.linting.pylintEnabled": true,
    "python.linting.flake8Enabled": false,
    "python.linting.enabled": true,
    "python.linting.banditEnabled": false,
    "python.linting.pycodestyleEnabled": false,
    "fortran.provideCompletion": false,
    "fortran.provideSymbols": false,
    "fortran.provideHover": false,
    "python.defaultInterpreterPath": "/opt/anaconda3/bin/python",
    "fortran-ls.executablePath": "/opt/anaconda3/bin/fortls",
    "fortran-ls.variableHover": true,
    "fortran-ls.enableCodeActions": true,
    "fortran-ls.hoverSignature": true,
    "fortran-ls.notifyInit": true
trainreth commented 2 years ago

I had a sudden thought - apparently it is working if I mark my file as "Fortran90" as opposed to "Fortran" for the language mode in VS Code. I hadn't run into this being a problem before, but tried looking at one of my .f90 files and when it worked I double checked the setting on the .f files and updated it. Apologies for the confusion.

gnikit commented 2 years ago

I see, FYI I think you might have stumbled upon an actual bug in the FORTRAN Intellisense extension. Recently, in the Modern Fortran extension we renamed the fixed form format from fortran_fixed-form to FortranFixedForm. Unfortunately the interface to the fortls i.e. FORTRAN Intellisense is not maintained anymore so they haven't updated their end of the extension.

We are planning on dropping the FORTRAN Intellisense dependency soon and implementing our own interface with fortls because of this. You can find a dev branch in modern Fortran that already does that.

trainreth commented 2 years ago

That's great to hear, thank you! We do have a lot of fixed form code, so I'll look forward to that update. I appreciate the feedback.