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

Doxygen style comments are sometimes picked up in the wrong place #237

Open
plevold opened this issue Nov 16, 2022 · 2 comments
Open

Doxygen style comments are sometimes picked up in the wrong place #237

plevold opened this issue Nov 16, 2022 · 2 comments
Labels
bug Something isn't working lsp/hover Issues related with hovering requests

Comments

@plevold
Copy link
Contributor

plevold commented Nov 16, 2022

Describe the bug
Due to the way fortls parses Doxygen style comments they could appear in unexpected places if a developer is not careful about using !> comments.

To Reproduce
In the following example:

subroutine sub_before
    integer :: i

    !> Trying to add a docstring to an expression
    i = 1
end subroutine


subroutine sub_no_doc
end subroutine

The comment !> Trying to add a docstring to an expression is added as a docstring to sub_no_doc.

Expected behavior
When building the AST, pendic_doc should probably be cleared when something other than subroutine / function / type / module appears.

See also #212 (comment)

@plevold plevold added the bug Something isn't working label Nov 16, 2022
@gnikit
Copy link
Member

gnikit commented Nov 16, 2022

Cheers @plevold, so this should be attached to the integer :: i AST node. If placed in the same line as integer :: i then it attaches correctly. I suspect what I need to do is ignore new lines and attached to the previous AST node. Not sure if that will break the existing parser.

@gnikit gnikit added the lsp/hover Issues related with hovering requests label Jan 13, 2023
@folk85
Copy link
Contributor

folk85 commented Jun 18, 2023

I think that it's not bug. If I change the !> to !< it would work properly.
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp/hover Issues related with hovering requests
Projects
None yet
Development

No branches or pull requests

3 participants