- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
之前我问过一个关于如何hide everything except comments的问题在 Sublime Text 3 中。
r-stein开发了一个方便的插件,能够做到这一点:
import sublime_plugin
class FoldEverythingExceptCommentsCommand(sublime_plugin.TextCommand):
def run(self, edit):
regions = self.view.find_by_selector("-comment")
self.view.fold(regions)
以下是一些示例图片:
这就是代码最初的样子...如果我们使用该插件隐藏除评论之外的所有内容,我们会得到:
正如你所看到的,一切都落在一条线上。这可能会令人困惑和困惑。我现在真正想做的是得到这样的东西:
有没有办法编辑插件来实现这一点?
最佳答案
您可以更改以前的插件以在折叠区域后保留前导“换行符”和“换行符和缩进”:
import sublime
import sublime_plugin
def char_at(view, point):
return view.substr(sublime.Region(point, point + 1))
def is_space(view, point):
return char_at(view, point).isspace()
def is_newline(view, point):
return char_at(view, point) == "\n"
class FoldEverythingExceptCommentsCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
regions = view.find_by_selector("-comment")
fold_regions = []
for region in regions:
a, b = region.begin(), region.end()
# keep new line before the fold
if is_newline(view, a):
a += 1
# keep the indent before next comment
while is_space(view, b - 1):
b -= 1
if is_newline(view, b):
break
# if it is still a valid fold, add it to the list
if a < b:
fold_regions.append(sublime.Region(a, b))
view.fold(fold_regions)
关于python - Sublime Text : Hide all code and show only comments (with line break),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38014950/
有没有办法在 Brainfuck 中做包含句点('.')的评论? 我知道我基本上可以使用不是命令之一的每个字符,它会被忽略,但我想在文件顶部的注释中放置一个版本号,其中包含一个句点。 最佳答案 您可以
我不明白以下代码的 % comment.length 位: comment.charAt(i % comment.length()) 括号之间的部分是否会转换为整数,其值表示与评论长度相关的i? 例如
我终于找到了我的 PHP 脚本无法运行的原因。这是因为 MySQL "--comment"而不是 "-- comment"。我最近开始使用 PHP,直到那时,我一直使用“--comment”。现在,我
是否可以在项目中搜索用户在 checkin 文件后添加的评论? (手动可以通过选择一个文件,右键单击 --> 显示历史记录 --> 选择版本 --> 详细信息,在评论 Pane 中查看)。 是否可以自
我不完全确定这是否不是插件,但是在 .js 文件中开始一行注释之后,例如,当我按下回车键时,下一行也以“//”开头。这有点烦人。有没有简单的方法可以删除它? 最佳答案 在“首选项 -> 包设置 ->
我在网上搜索,没有找到解释这个评论 block 用法的结果。因此,我希望有人能向我解释这种评论风格背后的原因。 /// Text goes here. 最佳答案 它们是 XML 文档注释。 http
这有充分的理由吗?这是一个蹩脚的问题,但我只是想知道是否有原因。 最佳答案 因为 specification允许/**/但不允许//:) 不过,严重的是,CSS 像对待所有其他空格一样对待换行符,并且
我有一个评论模型,我看过使用 @comment, :comment, comment 来引用 MVC 中的对象的示例。我怎么知道哪个是哪个?有区别吗? 最佳答案 @comment指 Rails Con
我有一些使用 Drupal 实现的网站。然而,尽管 Drupal 很酷,但我从未对它的编码感到满意,主要是因为它是在 PHP 中的,而且我想使用 python。我曾与 Django 调情,但我最近才发
似乎我仍然没有完全转变为 mac 用户(来自 Windows),再次遇到键盘快捷键问题: 在 phpstorm 中,下拉菜单中显示了以下“带有行注释的注释”的快捷方式: 现在,问题是,我的键盘上没有“
我正在按照 here 所述使用 fb:comments| . 评论工作正常,但我找不到在添加新评论时收到通知的方法。有没有办法轻松找到新评论(无需每次都访问我的 3000 篇文章)? 我知道 FB 对
我正在尝试创建一个功能,用户可以在其中使用 Ajax 创建对文章的评论。但是,我不明白为什么只有存在一个评论才能通过 ajax 成功呈现评论。评论提交到数据库,没有任何回滚。 如果我重新加载页面并创建
我正在使用 mongodb native 驱动器来获取查询结果的游标。 我正在使用一个“评论”字段,它基本上是一个字符串,下面是我正在使用的代码片段 let leve1_n = 'labreports
如果我将此URL放入浏览器中:。Https://www.facebook.com/plugins/comments.php?api_key=MYAPID。它会显示注释框,但不会显示任何评论。谁能告诉我
我想显示每个项目的评论数量和最后评论的日期。 SELECT item.*, count(comments.itemid) AS commentcount, comments.created A
这个问题在这里已经有了答案: What is the second parameter of NSLocalizedString()? (5 个答案) 关闭 6 年前。 我搜索并阅读了 NSLoca
我希望我的 Wordpress 博客中的字幕能够计算我的帖子在 Facebook 上的评论数。插入Facebook的代码后 ID); ?>"> comments 我意识到当我只有 1
我在我的项目中收到以下 TsLint 消息: TsLint: comment must start with lowercase letter 这背后有什么依据吗?我同意我在 TsLint 中遇到的大
我正在使用以下代码完成教程: New Comment @comment = Comment.new, :locals => { :button_name => "Create" } %>
环境 适用于macOS的Visual Studio代码1.18.0。 主题hedinne.popping-and-locking-vscode,由 hedinne 组成。 问题 当我覆盖/*> edi
我是一名优秀的程序员,十分优秀!