Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 2 additions & 0 deletions test/test_server_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_comp1():
string += comp_request(file_path, 21, 20)
string += comp_request(file_path, 21, 42)
string += comp_request(file_path, 23, 26)
string += comp_request(file_path, 24, 28)
errcode, results = run_request(string, ["--use_signature_help", "-n1"])
assert errcode == 0

Expand All @@ -47,6 +48,7 @@ def test_comp1():
[6, "scale", "TYPE(scale_type)"],
[2, "n", "INTEGER(4)"],
[1, "val", "REAL(8)"],
[1, "val", "REAL(8)"],
)
assert len(exp_results) == len(results) - 1
for i, ref in enumerate(exp_results):
Expand Down
4 changes: 2 additions & 2 deletions test/test_server_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ def test_rename_var_across_module():
"""Test renaming objects like variables across modules works"""
string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)})
file_path = test_dir / "test_prog.f08"
string += rename_request("new_module_var", file_path, 26, 15)
string += rename_request("new_module_var", file_path, 27, 15)
errcode, results = run_request(string)
assert errcode == 0
ref = {}
ref[path_to_uri(str(test_dir / "subdir" / "test_free.f90"))] = [
create("new_module_var", 32, 11, 32, 26)
]
ref[path_to_uri(str(file_path))] = [create("new_module_var", 2, 44, 2, 59)]
ref[path_to_uri(str(file_path))].append(create("new_module_var", 26, 8, 26, 23))
ref[path_to_uri(str(file_path))].append(create("new_module_var", 27, 8, 27, 23))

check_rename_response(results[1]["changes"], ref)

Expand Down
10 changes: 5 additions & 5 deletions test/test_server_signature_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def test_subroutine_signature_help():
"""
string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)})
file_path = test_dir / "test_prog.f08"
string += sigh_request(file_path, 25, 18)
string += sigh_request(file_path, 25, 20)
string += sigh_request(file_path, 25, 22)
string += sigh_request(file_path, 25, 27)
string += sigh_request(file_path, 25, 29)
string += sigh_request(file_path, 26, 18)
string += sigh_request(file_path, 26, 20)
string += sigh_request(file_path, 26, 22)
string += sigh_request(file_path, 26, 27)
string += sigh_request(file_path, 26, 29)
errcode, results = run_request(string)
assert errcode == 0

Expand Down
3 changes: 2 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 @@ -22,6 +22,7 @@ PROGRAM test_program
CALL stretch_vector%set_scale(loc_vector%norm(self))
x = stretch_vector%norm()
y = stretch_vector%scale%val
y = stretch_vector%scale % val
!
CALL test_sig_Sub(a,b,opt2=c,opt3=d)
PRINT*, module_variable
Expand Down