Use actual value for SINGLE_QUOTES/DOUBLE_QUOTES
This commit is contained in:
parent
c7c1734b44
commit
3514b3cb44
@ -36,8 +36,8 @@ DOXYGEN = 0x2
|
|||||||
SPHINX = 0x3
|
SPHINX = 0x3
|
||||||
GOOGLE = 0x4
|
GOOGLE = 0x4
|
||||||
|
|
||||||
SINGLE_QUOTES = 0x1
|
SINGLE_QUOTES = "'"
|
||||||
DOUBLE_QUOTES = 0x2
|
DOUBLE_QUOTES = '"'
|
||||||
|
|
||||||
|
|
||||||
class Arg(object):
|
class Arg(object):
|
||||||
@ -69,9 +69,28 @@ def get_quoting_style(snip):
|
|||||||
return DOUBLE_QUOTES
|
return DOUBLE_QUOTES
|
||||||
|
|
||||||
def triple_quotes(snip):
|
def triple_quotes(snip):
|
||||||
if get_quoting_style(snip) == SINGLE_QUOTES:
|
return get_quoting_style(snip) * 3
|
||||||
return "'''"
|
|
||||||
return '"""'
|
def triple_quotes_handle_trailing(snip, quoting_style):
|
||||||
|
if not hasattr(snip, '_tqt'):
|
||||||
|
_, col = vim.current.window.cursor
|
||||||
|
line = vim.current.line
|
||||||
|
|
||||||
|
# Handle already existing quote chars, usually from an autoclose plugin
|
||||||
|
# like delimitMate.
|
||||||
|
_ret = quoting_style * 3
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
nextc = line[col]
|
||||||
|
except IndexError:
|
||||||
|
break
|
||||||
|
if nextc == quoting_style and len(_ret):
|
||||||
|
_ret = _ret[1:]
|
||||||
|
col = col+1
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
snip._tqt = _ret
|
||||||
|
snip.rv = snip._tqt
|
||||||
|
|
||||||
def get_style(snip):
|
def get_style(snip):
|
||||||
style = snip.opt("g:ultisnips_python_style", "normal")
|
style = snip.opt("g:ultisnips_python_style", "normal")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user