Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fortls/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ def get_var_stack(line: str) -> list[str]:
final_var += line[section.start : section.end]

if final_var is not None:
# refuse any spaces in class
final_var = "%".join([i.strip() for i in final_var.split("%")])
final_op_split: list[str] = FRegex.OBJBREAK.split(final_var)
return final_op_split[-1].split("%")
else:
Expand Down
23 changes: 23 additions & 0 deletions test/test_server_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,29 @@ def test_comp10():
validate_comp(results[i + 1], ref)


def test_comp11():
"""Indicate the derived types arguments separated with spaces and types"""
string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)})
file_path = test_dir / "test_prog.f08"
string += comp_request(file_path, 6, 25)
string += comp_request(file_path, 23, 26)
string += comp_request(file_path, 27, 28)
string += comp_request(file_path, 28, 30)
errcode, results = run_request(string, ["--use_signature_help", "-n1"])
assert errcode == 0

exp_results = (
# test_prog.f08
[1, "val", "INTEGER(4)"],
[1, "val", "REAL(8)"],
[1, "val", "REAL(8)"],
[1, "val", "REAL(8)"],
)
assert len(exp_results) == len(results) - 1
for i, ref in enumerate(exp_results):
validate_comp(results[i + 1], ref)


def test_comp_import_host_association():
string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)})
file_path = test_dir / "test_import.f90"
Expand Down
4 changes: 3 additions & 1 deletion test/test_source/test_prog.f08
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PROGRAM test_program
IMPLICIT NONE
!
CHARACTER(LEN=*) :: test_str1 = "i2.2,':',i2.2", test_str2 = 'i2.2,":",i2.2'
INTEGER(4) :: n,a,b,c,d
INTEGER(4) :: n,a,b,c,d,val
REAL(8) :: x,y
COMPLEX(8) :: xc,yc
TYPE(vector) :: loc_vector
Expand All @@ -25,4 +25,6 @@ PROGRAM test_program
!
CALL test_sig_Sub(a,b,opt2=c,opt3=d)
PRINT*, module_variable
y = stretch_vector%scale % val
y = stretch_vector % scale % val
END PROGRAM test_program