Skip to content

Commit 999bd3f

Browse files
author
gaalcaras
committed
Reverse default value in snippet if arg is boolean
1 parent 3222c60 commit 999bd3f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pythonx/omnils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ def _process_argument(self, match):
236236
if quotes:
237237
match['snippet'] = lhs + ' = "${1:' + quotes.group(1) + '}"'
238238
else:
239+
if rhs in ('TRUE', 'FALSE'):
240+
rhs = 'TRUE' if rhs == 'FALSE' else 'FALSE'
241+
239242
match['snippet'] = lhs + ' = ${1:' + rhs + '}'
240243
else:
241244
match['snippet'] = lhs + ' = $1'
@@ -275,7 +278,11 @@ def _process_option(self, match):
275278
match['snippet'] = lhs + ' = "${1:' + snip + '}"'
276279
else:
277280
default = rhs
278-
match['snippet'] = lhs + ' = ${1:' + default + '}'
281+
282+
if rhs in ('TRUE', 'FALSE'):
283+
rhs = 'TRUE' if rhs == 'FALSE' else 'FALSE'
284+
285+
match['snippet'] = lhs + ' = ${1:' + rhs + '}'
279286
else:
280287
default = ''
281288
match['snippet'] = lhs + ' = $1'

0 commit comments

Comments
 (0)