File tree Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Expand file tree Collapse file tree 4 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -2045,9 +2045,9 @@ def replace_defined(line: str):
2045
2045
out_line = ""
2046
2046
for match in FRegex .DEFINED .finditer (line ):
2047
2047
if match .group (1 ) in defs :
2048
- out_line += line [i0 : match .start (0 )] + "($@)"
2048
+ out_line += line [i0 : match .start (0 )] + "(@ $@)"
2049
2049
else :
2050
- out_line += line [i0 : match .start (0 )] + "($%)"
2050
+ out_line += line [i0 : match .start (0 )] + "(% $%)"
2051
2051
i0 = match .end (0 )
2052
2052
if i0 < len (line ):
2053
2053
out_line += line [i0 :]
@@ -2064,8 +2064,8 @@ def replace_vars(line: str):
2064
2064
i0 = match .end (0 )
2065
2065
if i0 < len (line ):
2066
2066
out_line += line [i0 :]
2067
- out_line = out_line .replace ("$@" , "True" )
2068
- out_line = out_line .replace ("$%" , "False" )
2067
+ out_line = out_line .replace ("@ $@" , "True" )
2068
+ out_line = out_line .replace ("% $%" , "False" )
2069
2069
return out_line
2070
2070
2071
2071
if defs is None :
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ class FortranRegularExpressions:
98
98
r"[ ]*,[ ]*(PUBLIC|PRIVATE|ABSTRACT|EXTENDS\(\w*\))" , I
99
99
)
100
100
VIS : Pattern = compile (r"[ ]*\b(PUBLIC|PRIVATE)\b" , I )
101
- WORD : Pattern = compile (r"[a-z_]\w *" , I )
101
+ WORD : Pattern = compile (r"[a-z_][\w\$] *" , I )
102
102
NUMBER : Pattern = compile (
103
103
r"[\+\-]?(\b\d+\.?\d*|\.\d+)(_\w+|d[\+\-]?\d+|e[\+\-]?\d+(_\w+)?)?(?!\w)" ,
104
104
I ,
@@ -146,7 +146,7 @@ class FortranRegularExpressions:
146
146
# Object regex patterns
147
147
CLASS_VAR : Pattern = compile (r"(TYPE|CLASS)[ ]*\(" , I )
148
148
DEF_KIND : Pattern = compile (r"(\w*)[ ]*\((?:KIND|LEN)?[ =]*(\w*)" , I )
149
- OBJBREAK : Pattern = compile (r"[\/\-(.,+*<>=$ : ]" , I )
149
+ OBJBREAK : Pattern = compile (r"[\/\-(.,+*<>=: ]" , I )
150
150
151
151
152
152
# TODO: use this in the main code
Original file line number Diff line number Diff line change @@ -70,6 +70,17 @@ def test_hover_parameter():
70
70
validate_hover (results , ref_results )
71
71
72
72
73
+ def test_hover_parameter_dollar ():
74
+ """Test that hover parameters with dollar in name are recognized correctly"""
75
+ string = write_rpc_request (1 , "initialize" , {"rootPath" : str (test_dir )})
76
+ file_path = test_dir / "hover" / "parameters.f90"
77
+ string += hover_req (file_path , 20 , 31 )
78
+ errcode , results = run_request (string , fortls_args = ["--sort_keywords" ])
79
+ assert errcode == 0
80
+ ref_results = ["```fortran90\n INTEGER(4), PARAMETER :: SIG$ERR = -1\n ```" ]
81
+ validate_hover (results , ref_results )
82
+
83
+
73
84
def test_hover_parameter_eqnospace ():
74
85
"""Test that hover parameters display value correctly"""
75
86
string = write_rpc_request (1 , "initialize" , {"rootPath" : str (test_dir )})
Original file line number Diff line number Diff line change @@ -18,4 +18,5 @@ program params
18
18
INTEGER , PARAMETER :: var_multi2 = 1 * &
19
19
23 + &
20
20
2 / 1 ! comment
21
+ INTEGER (4 ), PARAMETER :: SIG$ERR = - 1
21
22
end program params
You can’t perform that action at this time.
0 commit comments