Sublime Text 3 多行折叠方法 [英] Sublime Text 3 Multiline Method Folding
问题描述
所以...
Sublime Text 具有折叠方法的内置能力,但是一旦方法声明跨越多行,它就失去了这种能力.有谁知道插件或使这项工作的方法?具体来说,我在使用 ruby 时遇到了这个问题(我的团队在行长度方面遵循严格的风格指南),但语言应该无关紧要.
Sublime Text has the built in ability to fold methods, but as soon as the method declaration spans multiple lines it loses this ability. Does anyone know about a plugin or a way to make this work? Specifically I am running into this with ruby (and my team adheres to a strict style guide regarding line length), but the language shouldn't matter.
推荐答案
不要单击出现在函数定义第一行旁边的装订线中的向下箭头,您只需将光标放在一个函数的缩进行(不是缩进的函数参数,而是在函数定义本身中)并使用 CtrlShift[ 键绑定(在OS X 使用 ⌘Alt[) 折叠函数及其参数.使用 CtrlShift] (⌘Alt]在 OS X 上)展开,或者您可以单击 def
行旁边的横向箭头.
Instead of clicking on the down arrow that appears in the gutter next to the first line of the function definition, all you need to do is put your cursor on one of the function's indented lines (not the indented function parameters, but in the function definition itself) and use the CtrlShift[ key binding (on OS X use ⌘Alt[) to fold the function and its parameters. Use CtrlShift] (⌘Alt] on OS X) to unfold, or you can click the sideways arrow next to the def
line.
所以,这个:
变成这样:
这篇关于Sublime Text 3 多行折叠方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!