Skip to content

Code completion broken in v2.1.0 #39

@ZedThree

Description

@ZedThree

With v2.1.0, code completion doesn't correctly expand argument names. For example, call bar completes to call bar(1:{int}) instead of call bar(int) in the MVCE below.

I've used git bisect and the steps below to track it back to a82f4e2

Steps to reproduce

Save the following as mvce.f90:

program foo
  implicit none

  call bar

contains
  subroutine bar(int)
    integer, intent(in) :: int
    print*, int
  end subroutine bar
end program foo

and run: fortls --debug_completion --debug_filepath mvce.f90 --debug_line 4 --debug_char 10 --debug_full_result

Expected output

Testing "textDocument/completion" request:
  File = "mvce.f90"
  Line = 4
  Char = 10

  Results:
[
  {
    "label": "bar",
    "insertText": "bar(${1:int})",
    "insertTextFormat": 2,
    "kind": 3,
    "detail": "SUBROUTINE bar(int)",
    "documentation": "SUBROUTINE bar(int)"
  },
  {
    "label": "BACKTRACE",
    "kind": 3,
    "detail": "SUBROUTINE BACKTRACE()",
    "documentation": "BACKTRACE shows a backtrace at an arbitrary place in user code. Program execution continues normally afterwards. The backtrace information is printed to the unit corresponding to ERROR_UNIT in ISO_FORTRAN_ENV."
  }
]

Actual output

produces:

Testing "textDocument/completion" request:
  File = "mvce.f90"
  Line = 4
  Char = 10

  Results:
[
  {
    "label": "bar",
    "insertText": "bar(${1}:{int})",
    "insertTextFormat": 2,
    "kind": 3,
    "detail": "SUBROUTINE bar(int)",
    "documentation": "SUBROUTINE bar(int)"
  },
  {
    "label": "BACKTRACE",
    "kind": 3,
    "detail": "SUBROUTINE BACKTRACE()",
    "documentation": "BACKTRACE shows a backtrace at an arbitrary place in user code. Program execution continues normally afterwards. The backtrace information is printed to the unit corresponding to ERROR_UNIT in ISO_FORTRAN_ENV."
  }
]

Metadata

Metadata

Assignees

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