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

Rename fails to rename implementation reference #104

Closed
mscfd opened this issue Mar 29, 2019 · 1 comment
Closed

Rename fails to rename implementation reference #104

mscfd opened this issue Mar 29, 2019 · 1 comment
Labels

Comments

@mscfd
Copy link

mscfd commented Mar 29, 2019

For the code below, the rename request at line 7, charpos 22, fails to rename in line 12. For some reason
fortls --debug_rootpath . --debug_rename new_name --debug_filepath testB.f90 --debug_line 7 --debug_char 22
fails with some python error. However, lsp-rename from emacs succeeds in renaming the references on line 7 and 14, but fails on 12 as mentioned.

Also invoking the rename request at line 14, charpos 20 fails the same. But rename at line 12, charpos 20 works.

testB.f90:

module mod

implicit none

type :: t
contains
   procedure :: to_be_renamed
end type t

contains

   subroutine to_be_renamed(self)
      class(t), intent(in) :: self
      call self%to_be_renamed()
   end subroutine to_be_renamed

end module mod
@hansec hansec added the bug label Mar 30, 2019
@hansec hansec closed this as completed in b1633d4 Mar 31, 2019
@hansec
Copy link
Owner

hansec commented Mar 31, 2019

Thanks for the report! This should now be fixed in master and will be included in the next patch. Let me know if you run into any issues.

Please note that change requests are limited to a given object and will not "move through" the link. Therefore an explicit link will be added to the type-binding line to support a consistent rename on one side of the link. For example if you rename the subroutine the link line will become procedure :: to_be_renamed => new_name.

gnikit added a commit to fortran-lang/fortls that referenced this issue Mar 23, 2022
- Added unittests for renaming
- Properly implemented solution for hansec/fortran-language-server#104
 Now it does not add to the source code.
- Improves coverage of renaming and all_references
- Added warnings for edge cases i.e. renaming intrinsics
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