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

Fortran Submodule Support Atom-IDE Outline #14

Closed
Schroeterm opened this issue May 8, 2018 · 5 comments
Closed

Fortran Submodule Support Atom-IDE Outline #14

Schroeterm opened this issue May 8, 2018 · 5 comments
Labels

Comments

@Schroeterm
Copy link

Dear Chris,

first of all thanks for developing and maintaining the language server and the atom ide for Fortran.

I'm frequently using the Fortran 2008 submodule construction in my code and am experiencing an issue with the outline feature of the atom ide which appears to be related to the language server. A frequently appearing part of my code looks like this

module test
implicit none 
type test_type
  integer :: i
end type test_type

interface test_submodule
  module subroutine test_routine(L_input)
    integer,intent(inout) :: L_input
  end subroutine test_routine
end interface test_submodule

contains
  subroutine test_routine_2()
    ! some code
  end subroutine test_routine_2
end module test

The outline is just displaying the defined type correctly but neither the interface nor the subroutines defined in the main module. Instead the symbol for module appears. When I replace module subroutine in the interface with just subroutine everything is displayed correctly. I assume that the language server (or the ide) just detects the module statement instead of processing the whole module subroutine statement.

Thanks for looking into this!
Best,
Marco

@hansec
Copy link
Owner

hansec commented May 8, 2018

Thanks for the report. Currently, the language server does not support submodules or some of the associated constructs (like "module subroutine" in interface statements). The issue you described with the outline should be easy enough to fix, which I will work on. However, I suspect that the interface won't be handled properly in autocompletion and other areas without improvements to handle submodules. If the code you are working with is open source I would be happy to take a look and work on improving practical submodule support as well.

@hansec hansec added the bug label May 8, 2018
@hansec hansec closed this as completed in eeef5ff May 8, 2018
@hansec
Copy link
Owner

hansec commented May 8, 2018

I just pushed a change that should fix the outline portion of this bug. As I mentioned submodule support for other tasks will be future work, see issue #15. I will comment again on this issue once the fix has been included in a pip release.

@Schroeterm
Copy link
Author

Thanks for fixing the outline issue.

You are right, autocompletion is another issue. I circumvented this so far by coding the submodules as modules importing everything via USE statements so that autocompletion works properly and declaring them submodules later on.

My code is open source but not on a release level yet. It doesn't go much beyond the minimal example provided above though. If you would like to have a look anyway I can share it with you towards the end of the week.

@hansec
Copy link
Owner

hansec commented May 9, 2018

I have published this and basic submodule support in release v0.3.6. Let me know if you run into further issues.

@Schroeterm
Copy link
Author

Outline and autocompletion work fine for me now. Thanks again for the fixes. There are two minor things which I would like to suggest for future enhancements. Both of them are mainly convenience issues.

a) Include Interfaces and procedures defined therein in the outline
b) Restrict autocompletion for variables of a certain derived type to the attributes of this type and show all possible attributes already when entering the % (I remember this worked quite well with the old autocomplete-fortran package)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants