Skip to content

Fortls can't read "use mod, only: procedure" if followed by a comment #450

Closed
@cWetaski

Description

@cWetaski

Describe the bug
A very minor bug, but a bug (I think) nonetheless. If I use a specific subroutine/function from a module, the linter can't find it if the name of the subroutine is followed by a comment. If I have multiple subroutines/functions after the only: statement, then only the last one will not be found by the linter (if it is followed by a comment).

To Reproduce

  1. Create a module with a subroutine.
  2. Create a second module which usees the subroutine from the first module
  3. Compare linting behavior with or without a comment of the use statement

Expected behavior
fortls should find useed procedures regardless of whether they are followed by a comment or not.

Screenshots & Animations
used_module.f90
Image

user_module.f90 attempted hover / peek with comment (does not work)
Image

user_module.f90 attempted hover without comment (works correctly)
Image

Setup information (please complete the following information):

  • OS: [Windows 11]
  • Python Version [3.12.7]
  • fortls Version [3.1.2]
  • Code editor used [VSCode]
  • the Fortran extension for the code editor and its version [Modern Fortran v3.2.0 (also checked with Modern Fortran prerelease v3.4.2024101621]
  • Compiler [gfortran 14.2.0]

Configuration information (please complete the following information):
relevant snippet from Workspace settings.json:

    "fortran.linter.modOutput": "${workspaceFolder}/.vscode/linter",
    "fortran.linter.includePaths": [
        "${workspaceFolder}/.vscode/linter"
    ],

Edit: Removed description of a "workaround" using a comma after the subroutine name since this is invalid syntax.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions