@@ -2034,7 +2034,7 @@ def _complete_keyword_arguments_at_position(
2034
2034
return None
2035
2035
else :
2036
2036
name_or_value , value = split_from_equals ((argument_token or token_at_position ).value )
2037
- if value is not None and name_or_value :
2037
+ if value is not None and name_or_value and any ( k for k in kw_arguments if k . name == name_or_value ) :
2038
2038
has_name = True
2039
2039
equal_index = (argument_token or token_at_position ).value .index ("=" )
2040
2040
if position .character <= completion_range .start .character + equal_index :
@@ -2046,6 +2046,21 @@ def _complete_keyword_arguments_at_position(
2046
2046
2047
2047
result = []
2048
2048
2049
+ arg_index_before = tokens .index (argument_token or token_at_position ) - 1
2050
+ if arg_index_before >= 0 :
2051
+ while arg_index_before >= 0 and tokens [arg_index_before ].type != RobotToken .ARGUMENT :
2052
+ arg_index_before -= 1
2053
+
2054
+ before_is_named = False
2055
+ if arg_index_before >= 0 and tokens [arg_index_before ].type == RobotToken .ARGUMENT :
2056
+ name_or_value , value = split_from_equals ((tokens [arg_index_before ]).value )
2057
+ before_is_named = (
2058
+ value is not None and name_or_value and any (k for k in kw_arguments if k .name == name_or_value )
2059
+ )
2060
+
2061
+ if before_is_named and not has_name :
2062
+ complete_argument_values = False
2063
+
2049
2064
if (
2050
2065
complete_argument_values
2051
2066
and argument_index >= 0
@@ -2138,7 +2153,8 @@ def _complete_keyword_arguments_at_position(
2138
2153
kind = CompletionItemKind .ENUM_MEMBER ,
2139
2154
detail = type_info .name ,
2140
2155
documentation = MarkupContent (
2141
- MarkupKind .MARKDOWN , f"```python\n { member .name } = { member .value } \n ```"
2156
+ MarkupKind .MARKDOWN ,
2157
+ f"```python\n { member .name } = { member .value } \n ```\n \n { type_info .to_markdown ()} " ,
2142
2158
),
2143
2159
sort_text = f"09_{ i :03} _{ member_index :03} _{ member .name } " ,
2144
2160
insert_text_format = InsertTextFormat .PLAIN_TEXT ,
@@ -2196,12 +2212,13 @@ def _complete_keyword_arguments_at_position(
2196
2212
)
2197
2213
2198
2214
for i in range (len (positional )):
2199
- known_names .append (kw_arguments [i ].name )
2215
+ if i != argument_index :
2216
+ known_names .append (kw_arguments [i ].name )
2200
2217
for n , _ in named :
2201
2218
known_names .append (n )
2202
2219
2203
2220
preselected = - 1
2204
- if known_names :
2221
+ if known_names and before_is_named :
2205
2222
n = known_names [- 1 ]
2206
2223
preselected = next ((i for i , e in enumerate (kw_arguments ) if e .name == n ), - 1 ) + 1
2207
2224
if preselected >= len (kw_arguments ):
0 commit comments