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

Add support for GoTo Implementation in submodules #74

Closed
gha3mi opened this issue Mar 8, 2022 · 7 comments · Fixed by #310
Closed

Add support for GoTo Implementation in submodules #74

gha3mi opened this issue Mar 8, 2022 · 7 comments · Fixed by #310
Assignees
Labels
bug Something isn't working

Comments

@gha3mi
Copy link

gha3mi commented Mar 8, 2022

fortls can detect the interface in a module, but not its implementation in a submodule, see this example.

MODULE MOD

IMPLICIT NONE

!==============================================================================
TYPE :: TYP
    REAL(KIND=8) :: value
CONTAINS
    PROCEDURE :: PRC1 => PRC_PRC1
END TYPE TYP
!==============================================================================


!==============================================================================
INTERFACE
    MODULE  SUBROUTINE PRC_PRC1(this)

        IMPLICIT NONE

        CLASS(TYP), INTENT(INOUT) :: this

    END SUBROUTINE PRC_PRC1
END INTERFACE
!==============================================================================

END MODULE MOD
SUBMODULE(MOD) SMOD

IMPLICIT NONE

CONTAINS

!==============================================================================
MODULE SUBROUTINE PRC_PRC1(this)

    IMPLICIT NONE

    CLASS(TYP), INTENT(INOUT) :: this

    this%value = 0

END SUBROUTINE PRC_PRC1
!==============================================================================

END SUBMODULE SMOD
@gnikit
Copy link
Member

gnikit commented Mar 8, 2022

Could you please elaborate as to what fortls is currently doing and what the expected behaviour should be?

@gha3mi
Copy link
Author

gha3mi commented Mar 8, 2022

In this example, go to definition (vscode: F12) for procedure PRC_PRC1 can find the module subroutine PRC_PRC1 in the interface, but not the implementation of module subroutine PRC_PRC1 in submodule SMOD, also fortls does not give any information about the implementation of the procedure PRC_PRC1 in the submodule SMOD.

@gnikit
Copy link
Member

gnikit commented Mar 8, 2022

I see what you mean. I think both issues that you are mentioning are effectively the same. GoTo Implementation does not detect the implementation for submodules.

I will look into it, thanks!

@gnikit gnikit self-assigned this Mar 8, 2022
@gnikit gnikit added the bug Something isn't working label Mar 8, 2022
@gnikit gnikit changed the title Add support for submodules Add support for GoTo Implementation in submodules Mar 8, 2022
@gnikit
Copy link
Member

gnikit commented Mar 25, 2022

This has turned out to be a bit tricker that what I originally thought. Since the object associated with the interface does not hold a reference to the object with the implementation. I will have to redesign some bits but I think it is doable.

@gha3mi
Copy link
Author

gha3mi commented Aug 25, 2022

Hi @gnikit, I would like to ask you if there is a plan for this issue?

@gnikit
Copy link
Member

gnikit commented Aug 25, 2022

I started to work on it, but then I encountered a series of other bugs along the way with the parser and constants so I got side-tracked. Right now I am slightly busy with PhD work, so it might be a while until I get to this.

I am making a project with the most critical bugs to fix, I will try to have a look at this end of day today, but people are also invited to try and help.

@gha3mi
Copy link
Author

gha3mi commented Aug 25, 2022

Thank you for your reply, I am also very busy at the moment. I will try to contribute when I find some free time.

@gnikit gnikit removed this from fortls v3.0.0 May 15, 2023
gnikit added a commit that referenced this issue Jul 23, 2023
It is now possible for interfaces with implementations in submodules
i.e. a Function or a Subroutine

Fixes #74
@github-project-automation github-project-automation bot moved this from To do to Done in fortls v3.0.0 Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants