Repository: fortran-lang/fortls (language: python)

Issue:
Incomplete hover of parameters variables
**Describe the bug**
When hovering over a variable that was defined as a computed `parameter`, only the first member of the computation shows up

**To Reproduce**
Define a computed parameter, use it in the code and hover over it.
If there is a space or "/" in the parameter definition, anything after will not show up.

```fortran
real(8), parameter :: three = 1.0d0*3.0d0
real(8), parameter :: six = 2.0d0 * 3.0d0
real(8), parameter :: one = 1.0d0
real(8), parameter :: sixth = one / six
real(8), parameter :: third = one/three
```
On Hovering, one gets the following:

![image](https://github.com/fortran-lang/fortls/assets/25324757/c4814ae9-e4f9-4ce0-a82e-771f83c7709f)
![image](https://github.com/fortran-lang/fortls/assets/25324757/9a1a9895-96ea-458a-b18e-0bfac0d41744)
![image](https://github.com/fortran-lang/fortls/assets/25324757/ab9dec06-aa64-4af5-a683-ee0d0d43c95a)
![image](https://github.com/fortran-lang/fortls/assets/25324757/6a6e2ea2-3d01-4d86-806c-850bcf53600b)
![image](https://github.com/fortran-lang/fortls/assets/25324757/42c89682-30c7-49fa-8f17-aabd3a1527d5)

Except when there is a "*" without spaces, the second term of the computed parameter is always missing.

**Expected behavior**
I would expect the whole line to show up, until an endline character or the start of a comment.

**Setup information (please complete the following information):**
 - OS: Mac with Linux SSH Server
 - Python 3.8.1
 - fortls 2.13.0
 - VS Code
 - Modern Fortran v3.4.2023051701


Discussion / hints:
I suggest the solution of this bug. Add several tests. But `pytest -v` failed in one test `test/test_interface.py::test_version_update_pypi`. 

Fix patch:
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
     )


Test patch:
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