From e76f43571fdc29791fa83a871059842e6ade2d94 Mon Sep 17 00:00:00 2001 From: Sergey M Date: Sun, 11 Jun 2023 11:08:49 +0200 Subject: [PATCH 1/8] Issue #284 fix and extend hover of parameters. Add division sign, allow spaces in values of parameters. Extend unittests with patameters variables --- fortls/regex_patterns.py | 2 +- test/test_server_hover.py | 67 +++++++++++++++++++++++++++ test/test_source/hover/parameters.f90 | 6 +++ 3 files changed, 74 insertions(+), 1 deletion(-) diff --git a/fortls/regex_patterns.py b/fortls/regex_patterns.py index d6611f30..80a793e6 100644 --- a/fortls/regex_patterns.py +++ b/fortls/regex_patterns.py @@ -93,7 +93,7 @@ class FortranRegularExpressions: r"CONTIGUOUS)", I, ) - PARAMETER_VAL: Pattern = compile(r"\w*[\s\&]*=[\s\&]*([\w\.\*\-\+\\\'\"]*)", I) + PARAMETER_VAL: Pattern = compile(r"\w*[\s\&]*=(([\s\&]*[\w\.\-\+\*\/\'\"])*)", I) TATTR_LIST: Pattern = compile( r"[ ]*,[ ]*(PUBLIC|PRIVATE|ABSTRACT|EXTENDS\(\w*\))", I ) diff --git a/test/test_server_hover.py b/test/test_server_hover.py index f1a79147..c2cf57bc 100644 --- a/test/test_server_hover.py +++ b/test/test_server_hover.py @@ -70,6 +70,73 @@ def test_hover_parameter(): validate_hover(results, ref_results) +def test_hover_parameter_eqnospace(): + """Test that hover parameters display value correctly""" + string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) + file_path = test_dir / "hover" / "parameters.f90" + string += hover_req(file_path, 11, 28) + errcode, results = run_request(string, fortls_args=["--sort_keywords"]) + assert errcode == 0 + ref_results = ["```fortran90\nINTEGER, PARAMETER :: var_no_space = 123\n```"] + validate_hover(results, ref_results) + + +def test_hover_parameter_morespace(): + """Test that hover parameters display value correctly""" + string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) + file_path = test_dir / "hover" / "parameters.f90" + string += hover_req(file_path, 12, 28) + errcode, results = run_request(string, fortls_args=["--sort_keywords"]) + assert errcode == 0 + ref_results = ["```fortran90\nINTEGER, PARAMETER :: var_more_space = 123\n```"] + validate_hover(results, ref_results) + + +def test_hover_parameter_var_sum(): + """Test that hover parameters display value correctly with sum""" + string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) + file_path = test_dir / "hover" / "parameters.f90" + string += hover_req(file_path, 13, 28) + errcode, results = run_request(string, fortls_args=["--sort_keywords"]) + assert errcode == 0 + ref_results = ["```fortran90\nINTEGER, PARAMETER :: var_sum1 = 1 + 23\n```"] + validate_hover(results, ref_results) + + +def test_hover_parameter_var_neg(): + """Test that hover parameters display value correctly with extraction""" + string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) + file_path = test_dir / "hover" / "parameters.f90" + string += hover_req(file_path, 14, 28) + errcode, results = run_request(string, fortls_args=["--sort_keywords"]) + assert errcode == 0 + ref_results = ["```fortran90\nINTEGER, PARAMETER :: var_ex1 = 1 - 23\n```"] + validate_hover(results, ref_results) + + +def test_hover_parameter_var_mul(): + """Test that hover parameters display value correctly with + multiplication and spaces""" + string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) + file_path = test_dir / "hover" / "parameters.f90" + string += hover_req(file_path, 15, 28) + errcode, results = run_request(string, fortls_args=["--sort_keywords"]) + assert errcode == 0 + ref_results = ["```fortran90\nINTEGER, PARAMETER :: var_mul1 = 1 * 23\n```"] + validate_hover(results, ref_results) + + +def test_hover_parameter_var_div(): + """Test that hover parameters display value correctly with value of division""" + string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) + file_path = test_dir / "hover" / "parameters.f90" + string += hover_req(file_path, 16, 28) + errcode, results = run_request(string, fortls_args=["--sort_keywords"]) + assert errcode == 0 + ref_results = ["```fortran90\nINTEGER, PARAMETER :: var_div1 = 1/1\n```"] + validate_hover(results, ref_results) + + def test_hover_parameter_nested(): """Test that hover parameters using other parameter values works""" string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) diff --git a/test/test_source/hover/parameters.f90 b/test/test_source/hover/parameters.f90 index e60f5cbc..89eff60d 100644 --- a/test/test_source/hover/parameters.f90 +++ b/test/test_source/hover/parameters.f90 @@ -9,4 +9,10 @@ program params logical(kind=8), parameter :: long_bool = .true. character(len=5), parameter :: sq_str = '12345' character(len=5), parameter :: dq_str = "12345" + integer, parameter :: var_no_space=123 + integer, parameter :: var_more_space = 123 + integer, parameter :: var_sum1 = 1 + 23 + integer, parameter :: var_ex1 = 1 - 23 + integer, parameter :: var_mul1 = 1 * 23 + integer, parameter :: var_div1 = 1/1 end program params From 86d8eb539fd5da3f484dd214fb4d99421802a6ce Mon Sep 17 00:00:00 2001 From: Sergey M Date: Sat, 17 Jun 2023 14:06:09 +0200 Subject: [PATCH 2/8] Fix #291 hover multi-line parameter signature Trim trailing whitespaces. Modify one test and add one more parameter_val test with multiline definition. --- fortls/parse_fortran.py | 2 +- test/test_server_hover.py | 16 +++++++++++++++- test/test_source/hover/parameters.f90 | 3 +++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fortls/parse_fortran.py b/fortls/parse_fortran.py index fa1d9dfe..da0b6c57 100644 --- a/fortls/parse_fortran.py +++ b/fortls/parse_fortran.py @@ -1451,7 +1451,7 @@ def parse( _, col = find_word_in_line(line, name) match = FRegex.PARAMETER_VAL.match(line[col:]) if match: - var = match.group(1).strip() + var = " ".join(match.group(1).strip().split()) new_var.set_parameter_val(var) # Check if the "variable" is external and if so cycle diff --git a/test/test_server_hover.py b/test/test_server_hover.py index c2cf57bc..285d2a97 100644 --- a/test/test_server_hover.py +++ b/test/test_server_hover.py @@ -122,7 +122,7 @@ def test_hover_parameter_var_mul(): string += hover_req(file_path, 15, 28) errcode, results = run_request(string, fortls_args=["--sort_keywords"]) assert errcode == 0 - ref_results = ["```fortran90\nINTEGER, PARAMETER :: var_mul1 = 1 * 23\n```"] + ref_results = ["```fortran90\nINTEGER, PARAMETER :: var_mul1 = 1 * 23\n```"] validate_hover(results, ref_results) @@ -137,6 +137,20 @@ def test_hover_parameter_var_div(): validate_hover(results, ref_results) +def test_hover_parameter_var_multiline2(): + """Test that hover parameters display value correctly with + multiplication and spaces. Item 2""" + string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) + file_path = test_dir / "hover" / "parameters.f90" + string += hover_req(file_path, 17, 28) + errcode, results = run_request(string, fortls_args=["--sort_keywords"]) + assert errcode == 0 + ref_results = [ + "```fortran90\nINTEGER, PARAMETER :: var_multi2 = 1 * 23 + 2 /1\n```" + ] + validate_hover(results, ref_results) + + def test_hover_parameter_nested(): """Test that hover parameters using other parameter values works""" string = write_rpc_request(1, "initialize", {"rootPath": str(test_dir)}) diff --git a/test/test_source/hover/parameters.f90 b/test/test_source/hover/parameters.f90 index 89eff60d..c0189055 100644 --- a/test/test_source/hover/parameters.f90 +++ b/test/test_source/hover/parameters.f90 @@ -15,4 +15,7 @@ program params integer, parameter :: var_ex1 = 1 - 23 integer, parameter :: var_mul1 = 1 * 23 integer, parameter :: var_div1 = 1/1 + INTEGER, PARAMETER :: var_multi2 = 1 * & + 23 + & + 2 /1 ! comment end program params From 74ce93106dfcaaaff02bfe463cd96cdc3869281b Mon Sep 17 00:00:00 2001 From: Sergey M Date: Sun, 9 Jul 2023 18:30:11 +0200 Subject: [PATCH 3/8] Issue #286: Fix wrong indentation of derived type --- fortls/helper_functions.py | 2 ++ test/test_server_completion.py | 2 ++ test/test_server_rename.py | 4 ++-- test/test_server_signature_help.py | 10 +++++----- test/test_source/test_prog.f08 | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/fortls/helper_functions.py b/fortls/helper_functions.py index 469aa0dc..ee28167a 100644 --- a/fortls/helper_functions.py +++ b/fortls/helper_functions.py @@ -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: diff --git a/test/test_server_completion.py b/test/test_server_completion.py index 6ef55fee..319ea74f 100644 --- a/test/test_server_completion.py +++ b/test/test_server_completion.py @@ -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 @@ -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): diff --git a/test/test_server_rename.py b/test/test_server_rename.py index 3c67d1a2..f676ef46 100644 --- a/test/test_server_rename.py +++ b/test/test_server_rename.py @@ -55,7 +55,7 @@ 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 = {} @@ -63,7 +63,7 @@ def test_rename_var_across_module(): 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) diff --git a/test/test_server_signature_help.py b/test/test_server_signature_help.py index 2c116f51..4d14d31c 100644 --- a/test/test_server_signature_help.py +++ b/test/test_server_signature_help.py @@ -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 diff --git a/test/test_source/test_prog.f08 b/test/test_source/test_prog.f08 index 98b38f22..1829e98b 100644 --- a/test/test_source/test_prog.f08 +++ b/test/test_source/test_prog.f08 @@ -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 @@ -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 From 85680db9eaf70851dd548b352bf14918d9e05bf0 Mon Sep 17 00:00:00 2001 From: Sergey M Date: Sun, 9 Jul 2023 20:36:49 +0200 Subject: [PATCH 4/8] issue #286: indication derived type args --- test/test_server_completion.py | 25 +++++++++++++++++++++++-- test/test_server_rename.py | 4 ++-- test/test_server_signature_help.py | 10 +++++----- test/test_source/test_prog.f08 | 3 ++- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/test/test_server_completion.py b/test/test_server_completion.py index 319ea74f..91d3234b 100644 --- a/test/test_server_completion.py +++ b/test/test_server_completion.py @@ -34,7 +34,6 @@ 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 @@ -48,7 +47,6 @@ 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): @@ -227,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" diff --git a/test/test_server_rename.py b/test/test_server_rename.py index f676ef46..3c67d1a2 100644 --- a/test/test_server_rename.py +++ b/test/test_server_rename.py @@ -55,7 +55,7 @@ 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, 27, 15) + string += rename_request("new_module_var", file_path, 26, 15) errcode, results = run_request(string) assert errcode == 0 ref = {} @@ -63,7 +63,7 @@ def test_rename_var_across_module(): 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", 27, 8, 27, 23)) + ref[path_to_uri(str(file_path))].append(create("new_module_var", 26, 8, 26, 23)) check_rename_response(results[1]["changes"], ref) diff --git a/test/test_server_signature_help.py b/test/test_server_signature_help.py index 4d14d31c..2c116f51 100644 --- a/test/test_server_signature_help.py +++ b/test/test_server_signature_help.py @@ -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, 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) + 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) errcode, results = run_request(string) assert errcode == 0 diff --git a/test/test_source/test_prog.f08 b/test/test_source/test_prog.f08 index 1829e98b..15d81280 100644 --- a/test/test_source/test_prog.f08 +++ b/test/test_source/test_prog.f08 @@ -22,8 +22,9 @@ 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 +y = stretch_vector%scale % val +y = stretch_vector % scale % val END PROGRAM test_program From d5f04727a7ea29ff4946d544148fecc988ab4f46 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 9 Jul 2023 18:39:14 +0000 Subject: [PATCH 5/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- test/test_server_completion.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_server_completion.py b/test/test_server_completion.py index 91d3234b..a62a1d85 100644 --- a/test/test_server_completion.py +++ b/test/test_server_completion.py @@ -226,7 +226,7 @@ def test_comp10(): def test_comp11(): - '''Indicate the derived types arguments separated with spaces and types''' + """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) From 48a872f1db00f9584bcd518a31d4074f50c52a4b Mon Sep 17 00:00:00 2001 From: Sergey M Date: Sat, 22 Jul 2023 23:59:07 +0200 Subject: [PATCH 6/8] Issue #286: indication derived type args --- CHANGELOG.md | 3 +++ fortls/helper_functions.py | 3 +-- test/test_server_completion.py | 4 ++-- test/test_source/test_prog.f08 | 5 +++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b380ae..4cd5abf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,9 @@ ### Fixed +- Fixed bug where type fields or methods were not detected if spaces were + used around `%` + ([#286](https://github.com/fortran-lang/fortls/issues/286)) - Fixed bug where `associate` blocks for variables pointing to function results where not properly resolved ([#269](https://github.com/fortran-lang/fortls/issues/269)) diff --git a/fortls/helper_functions.py b/fortls/helper_functions.py index ee28167a..896f2840 100644 --- a/fortls/helper_functions.py +++ b/fortls/helper_functions.py @@ -569,14 +569,13 @@ def get_var_stack(line: str) -> list[str]: # Continuation of variable after paren requires '%' character iLast = 0 for i, section in enumerate(sections): - if not line[section.start : section.end].startswith("%"): + if not line[section.start : section.end].strip().startswith("%"): iLast = i final_var = "" for section in sections[iLast:]: 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("%") diff --git a/test/test_server_completion.py b/test/test_server_completion.py index a62a1d85..2ef97825 100644 --- a/test/test_server_completion.py +++ b/test/test_server_completion.py @@ -229,16 +229,16 @@ 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) + string += comp_request(file_path, 29, 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)"], [1, "val", "REAL(8)"], diff --git a/test/test_source/test_prog.f08 b/test/test_source/test_prog.f08 index 15d81280..ab754457 100644 --- a/test/test_source/test_prog.f08 +++ b/test/test_source/test_prog.f08 @@ -4,11 +4,11 @@ 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,val +INTEGER(4) :: n,a,b,c,d REAL(8) :: x,y COMPLEX(8) :: xc,yc TYPE(vector) :: loc_vector -TYPE(scaled_vector) :: stretch_vector +TYPE(scaled_vector) :: stretch_vector, vector1d(1) ! y = myfun(n,x) CALL glob_sub(n,xc,yc) @@ -27,4 +27,5 @@ PROGRAM test_program PRINT*, module_variable y = stretch_vector%scale % val y = stretch_vector % scale % val +y = vector1d( 1 ) % scale % val END PROGRAM test_program From c28cea538e7f770d29f8eb154913b202d0d7c175 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 22 Jul 2023 22:00:45 +0000 Subject: [PATCH 7/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cd5abf3..3b06dff8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ ### Fixed -- Fixed bug where type fields or methods were not detected if spaces were +- Fixed bug where type fields or methods were not detected if spaces were used around `%` ([#286](https://github.com/fortran-lang/fortls/issues/286)) - Fixed bug where `associate` blocks for variables pointing to function results From 2d88bfa99afa7be93c1514cc4b76ccabd01e8015 Mon Sep 17 00:00:00 2001 From: gnikit Date: Sun, 23 Jul 2023 15:06:04 +0100 Subject: [PATCH 8/8] docs: updated example docstring for doctests --- fortls/helper_functions.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fortls/helper_functions.py b/fortls/helper_functions.py index 896f2840..0d589377 100644 --- a/fortls/helper_functions.py +++ b/fortls/helper_functions.py @@ -553,6 +553,9 @@ def get_var_stack(line: str) -> list[str]: >>> get_var_stack('myarray(i)%foo%bar') ['myarray', 'foo', 'bar'] + >>> get_var_stack('myarray( i ) % foo % bar') + ['myarray', 'foo', 'bar'] + In this case it will operate at the end of the string i.e. ``'this%foo'`` >>> get_var_stack('CALL self%method(this%foo')