Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement an interface with the fortran-language-server #290

Closed
gnikit opened this issue Nov 17, 2021 · 4 comments · Fixed by #293
Closed

Implement an interface with the fortran-language-server #290

gnikit opened this issue Nov 17, 2021 · 4 comments · Fixed by #293
Assignees

Comments

@gnikit
Copy link
Member

gnikit commented Nov 17, 2021

We should implement the interface that FORTRAN Intellisense has into Modern Fortran. The Intellisense extension is not supported anymore, similar to the language server itself and taking control of the interface to the fortls would allow us to interface with it better.

@gnikit gnikit self-assigned this Nov 17, 2021
@trainreth
Copy link

@gnikit - you were helping me with an issue I was having with getting Modern Fortran/Intellisense/Fortran Language Server to work with VS Code in the fortls repository on Friday (hansec/fortran-language-server#212), and I've found my way over here looking for a way to test out the dev version of this extension.

Is there any way to obtain a vsix file for the dev branch? I'm trying to work out whether having all of my fixed format files labeled as "Fortran90" is preventing variable definitions from my include files from showing on hover. We've got a mixture of fixed and free form code in our repository and I'm not yet sure whether this will be an issue with the language server.

@gnikit
Copy link
Member Author

gnikit commented Nov 22, 2021

Here is the .vsix of the dev build, just change the extension name from .zip to .vsix (github does not allow arbitrary extensions to be uploaded) linter-gfortran-3.0.0.zip
In general, to build this you can check out this branch locally and run npm ci && vsce package. Assuming you have node.js, npm and vsce.

This branch should solve your hover issues. Let me know if you notice anything weird or something does not work.

FYI there is still a fair bit of work be done mainly on the fortran-language-server side of things. As it currently stands we have no way to pass certain options to fortls because fortls has no interface.

@trainreth
Copy link

trainreth commented Nov 22, 2021

Thank you for that - I was able to get it installed and working (we don't have access to node.js, so I couldn't create the package myself). This definitely fixed my issue with being able to use the Fortran language mode with my fixed form files, however for some reason the hover is still not working on variables defined in an include file, whether I'm in a free form or fixed form file.

For example, a basic code snippet within one of my fixed form subroutines looks like this (except with proper fixed form format):

include 'start.prm'

INTEGER COUNT

DO 200 COUNT = 1, MAXCOUNT
      ... stuff
200 CONTINUE

The variable MAXCOUNT is defined in the include file start.prm as follows:

integer, parameter :: MAXCOUNT = 4

I am able to hover over COUNT and see its declaration and show all the places where it's referenced, but nothing comes up when I hover over MAXCOUNT. I'm wondering if I'm setting something up incorrectly.

Also, if it helps, my directories at the root are set up to have an includes directory that holds all of the include files, and then source files in various directories; when linking we reference the includes directory for each routine.

@gnikit
Copy link
Member Author

gnikit commented Nov 23, 2021

Try associating the file extension '.prm' with the language, i.e.

 "files.associations": {
   "*.prm": "FortranFixedForm"
 },

Screenshot from 2021-11-23 12-30-47

@gnikit gnikit linked a pull request Nov 24, 2021 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants