Skip to content

Commit c0ef77b

Browse files
committed
Fixes GoTo Implementation for intrinsics
Closes Request textDocument/implementation failed. #80
1 parent 2d4609e commit c0ef77b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELONG
22

3+
## 2.2.10
4+
5+
### Fixed
6+
7+
- Fixes GoTo Implementation error for intrinsics
8+
([#80](https://github.com/gnikit/fortls/issues/80))
9+
310
## 2.2.9
411

512
### Changed

fortls/langserver.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,9 @@ def serve_implementation(self, request: dict):
11221122
var_obj = self.get_definition(file_obj, def_line, def_char)
11231123
if var_obj is None:
11241124
return None
1125+
# Intrinsics do not have implementations we can access
1126+
if isinstance(var_obj, fortran_intrinsic_obj):
1127+
return None
11251128
# Construct implementation reference
11261129
if var_obj.parent.get_type() == CLASS_TYPE_ID:
11271130
impl_obj = var_obj.link_obj

test/test_server_implementation.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ def test_implementation_type_bound():
3535
errcode, results = run_request(string, ["-n", "1"])
3636
assert errcode == 0
3737
assert results[1] == create(test_dir / "subdir" / "test_free.f90", 49, 11, 28)
38+
39+
40+
def test_implementation_intrinsics():
41+
"""Go to implementation of implicit methods is handled gracefully"""
42+
string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir / "rename")})
43+
file_path = test_dir / "rename" / "test_rename_intrinsic.f90"
44+
string += imp_request(file_path, 11, 18)
45+
errcode, results = run_request(string, ["-n", "1"])
46+
assert errcode == 0
47+
assert results[1] is None

0 commit comments

Comments
 (0)