区分 Textmate 中 Python 字符串与 Docstrings 的语法颜色?
喜欢 TextMate,喜欢 Python,blah,blah,blah..
但是......我讨厌“Docstrings”,又名多行注释/Sphinx 的爱子 - 在语法上是彩色的 - 在在我前面提到的选择的编辑器中,与普通“字符串”的方式相同。这是两种类型的过度匹配服装的示例...
这种轻微的不便是否可以被正则表达式消除 - 以便在视觉上更轻松地区分两者?
Love TextMate, love Python, blah, blah, blah..
But.. i hate that "Docstrings", aka multiline-comments / Sphinx's lovechild - are colored syntactically - in the same manner as normal "Strings", in my aforementioned editor of choice. Here is an example of the two types in their overly matchy-matchy outfits...
Can this slight inconvenience be regexed-away - so as to differentiate the two more easily, visually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您查看 Python 包的语言部分的第 560-1064 行,您将找到字符串的定义。简而言之,您可以找到三引号字符串的模式,并向捕获名称添加另一个组件。然后您需要做的就是将该捕获名称添加到当前样式中,然后三引号字符串应该具有不同的颜色。
If you look at lines 560-1064 of the language part of the Python bundle, you'll find the definitions for strings. Simply, you'd find the patterns for the triple-quote strings and add another component to the capture names. Then all you need to do is add that capture name to your current style and then triple-quote strings should be colored differently.
将其添加到主题文件的代码中,以使文档字符串看起来与常规字符串不同。
如果您需要 XML 版本,就是:
Add this to code to your theme file to make doc strings appear different from regular strings.
If you need the XML version this is it: