在升华文本中用f字符串完成引号';s Python 3

在升华文本中用f字符串完成引号';s Python 3,python,python-3.x,autocomplete,sublimetext3,Python,Python 3.x,Autocomplete,Sublimetext3,当我在Sublime Text 3(3176)中键入引号时,它会自动以一个结束引号结束 e、 g.我键入“我得到” 这很好,我现在一直都在期待它。然而,如果我键入f“,在Python中引入f字符串,我得到的是f”,而不是f”“。这无论如何都不是一个大问题,但它并不像我感觉的那么流畅 我认为,如果光标左侧有一个字符,自动补全规则不会添加额外的引号,因为这通常是在您尝试输入结束引号时添加的 是否有办法修改规则,以便在左边的字符是“f”时输入结束引号?以避免在真正尝试以“f”结尾的字符串时出现奇怪的用

当我在Sublime Text 3(3176)中键入引号时,它会自动以一个结束引号结束

e、 g.我键入
我得到

这很好,我现在一直都在期待它。然而,如果我键入
f“
,在Python中引入f字符串,我得到的是
f”
,而不是
f”“
。这无论如何都不是一个大问题,但它并不像我感觉的那么流畅

我认为,如果光标左侧有一个字符,自动补全规则不会添加额外的引号,因为这通常是在您尝试输入结束引号时添加的


是否有办法修改规则,以便在左边的字符是“f”时输入结束引号?以避免在真正尝试以“f”结尾的字符串时出现奇怪的用例“对于
打印(f“string”
foo=f“string”
foo=f“string”
foo=f“string”
foo=f“string”

的高使用情形,可能会有一个
条件来检查“f”左边的开口括号、空格或等号。只需将以下内容添加到您的用户密钥映射文件中即可。”(首选项菜单->键绑定。用户键映射位于右侧):

//即使在字符串修饰符之后也会自动对引号。
//从默认绑定复制过来,并修改为“previous_text”`
//和一个附加的选择器条件。
{“keys”:[“\”“]”,“command”:“insert\u snippet”,“args”:{“contents”:“\“$0\”},“context”:
[
{“key”:“setting.auto_match_enabled”,“operator”:“equal”,“operator”:true},
{“key”:“selection_empty”,“operator”:“equal”,“operator”:true,“match_all”:true},
{“key”:“following_text”,“operator”:“regex_contains”,“operator”:“^(?::\t| \\)\124;]\ 124; \\}}>|$”,“match|u all”:true},
{“key”:“preference_text”,“operator”:“regex_contains”,“operator”:“(?i)\\b[bfru]+$”,“match_all”:true},
{“key”:“selector”,“operator”:“equal”,“operator”:“source.python”},
{“key”:“eol_选择器”,“运算符”:“not_equal”,“操作数”:“string.quoted.double-标点符号.定义.string.end”,“match_all”:true}
]
},
{“keys”:[“'”],“command”:“insert_snippet”,“args”:{“contents”:“$0'”},“context”:
[
{“key”:“setting.auto_match_enabled”,“operator”:“equal”,“operator”:true},
{“key”:“selection_empty”,“operator”:“equal”,“operator”:true,“match_all”:true},
{“key”:“following_text”,“operator”:“regex_contains”,“operator”:“^(?::\t| \\)\124;]\ 124; \\}}>|$”,“match|u all”:true},
{“key”:“preference_text”,“operator”:“regex_contains”,“operator”:“(?i)\\b[bfru]+$”,“match_all”:true},
{“key”:“selector”,“operator”:“equal”,“operator”:“source.python”},
{“key”:“eol_选择器”,“运算符”:“not_equal”,“操作数”:“string.quoted.single-标点符号.定义.string.end”,“match_all”:true}
]
},


它使用范围选择器来确定插入符号是否已经在字符串中,因此使用
f
字符来完成字符串并不成问题。

是的,这是可能的。只需将以下内容添加到用户密钥映射文件中(首选项菜单->密钥绑定。用户密钥映射位于右侧):

//即使在字符串修饰符之后也会自动对引号。
//从默认绑定复制过来,并修改为“previous_text”`
//和一个附加的选择器条件。
{“keys”:[“\”“]”,“command”:“insert\u snippet”,“args”:{“contents”:“\“$0\”},“context”:
[
{“key”:“setting.auto_match_enabled”,“operator”:“equal”,“operator”:true},
{“key”:“selection_empty”,“operator”:“equal”,“operator”:true,“match_all”:true},
{“key”:“following_text”,“operator”:“regex_contains”,“operator”:“^(?::\t| \\)\124;]\ 124; \\}}>|$”,“match|u all”:true},
{“key”:“preference_text”,“operator”:“regex_contains”,“operator”:“(?i)\\b[bfru]+$”,“match_all”:true},
{“key”:“selector”,“operator”:“equal”,“operator”:“source.python”},
{“key”:“eol_选择器”,“运算符”:“not_equal”,“操作数”:“string.quoted.double-标点符号.定义.string.end”,“match_all”:true}
]
},
{“keys”:[“'”],“command”:“insert_snippet”,“args”:{“contents”:“$0'”},“context”:
[
{“key”:“setting.auto_match_enabled”,“operator”:“equal”,“operator”:true},
{“key”:“selection_empty”,“operator”:“equal”,“operator”:true,“match_all”:true},
{“key”:“following_text”,“operator”:“regex_contains”,“operator”:“^(?::\t| \\)\124;]\ 124; \\}}>|$”,“match|u all”:true},
{“key”:“preference_text”,“operator”:“regex_contains”,“operator”:“(?i)\\b[bfru]+$”,“match_all”:true},
{“key”:“selector”,“operator”:“equal”,“operator”:“source.python”},
{“key”:“eol_选择器”,“运算符”:“not_equal”,“操作数”:“string.quoted.single-标点符号.定义.string.end”,“match_all”:true}
]
},


它使用范围选择器来确定插入符号是否已经在字符串中,因此用
f
字符结束字符串不是问题。

!非常感谢。工作完全如预期。太棒了!非常感谢。工作一如预期。