Skip to content

Commit 50f7bd1

Browse files
committed
Shows pointer attribute upon hover
Fixes Show POINTER attribute when hovering #16
1 parent 016c2cf commit 50f7bd1

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
([#169](https://github.com/hansec/fortran-language-server/issues/169))
3535
- Fixes include with external files
3636
([gnikit/fortls#13](https://github.com/gnikit/fortls/issues/13))
37+
- `POINTER` attribute now displays upon hover
38+
([gnikit/fortls#16](https://github.com/gnikit/fortls/issues/16))
3739

3840
## 1.16.0
3941

fortls/helper_functions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ def map_keywords(keywords):
319319
for keyword in keywords:
320320
keyword_prefix = keyword.split("(")[0].lower()
321321
keyword_ind = KEYWORD_ID_DICT.get(keyword_prefix)
322-
if keyword_ind:
322+
# keyword_ind can be 0 which if 0: evaluates to False
323+
if keyword_ind is not None:
323324
mapped_keywords.append(keyword_ind)
324325
if keyword_prefix in ("intent", "dimension", "pass"):
325326
keyword_substring = get_paren_substring(keyword)

test/test_server.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ def check_return(result_array, checks):
521521
string += hover_req(file_path, 6, 28)
522522
string += hover_req(file_path, 7, 38)
523523
string += hover_req(file_path, 7, 55)
524+
file_path = os.path.join(test_dir, "hover", "pointers.f90")
525+
string += hover_req(file_path, 1, 26)
524526
errcode, results = run_request(
525527
string, fortls_args=" --variable_hover --sort_keywords"
526528
)
@@ -537,6 +539,7 @@ def check_return(result_array, checks):
537539
"INTEGER, PARAMETER :: var4 = 123",
538540
"DOUBLE PRECISION, PARAMETER :: somevar = 23.12",
539541
"DOUBLE PRECISION, PARAMETER :: some = 1e-19",
542+
"INTEGER, POINTER",
540543
)
541544
assert len(ref_results) == len(results) - 1
542545
check_return(results[1:], ref_results)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
program pointers
2+
INTEGER, POINTER :: val1
3+
end program

0 commit comments

Comments
 (0)