0

我正在使用 Notepad++ 编辑 rake 文件,我希望能够使用函数列表插件。

我一直无法在线找到任何解析规则,并且“语言解析规则”对话框没有很清楚地记录。

我正在使用以下方法将方法解析到列表中,但也想显示任务。

Function Begin:  [ \t]*def[ \t]+
Function List Name: [a-zA-Z0-9_\.]*

这不是很干净,并且不会捕获以 ? 结尾的函数 或!,但这是一个开始。

我的任务规则不起作用是:

Function Begin: [ \t]*task[ \t]+
Function List Name: :[a-zA-Z0-9_\.]*
Function End: [ \t]+do

欢迎提出任何建议。

谢谢

4

4 回答 4

1

也许您可以使用可以添加到FunctionListRules.xml文件中的以下设置:

<Language name="Ruby" imagelistpath="C:\Documents and Settings\king_cao\Application Data\Notepad++\plugins\config\C++.flb">
        <Group name="CLASS" subgroup="FUNCTION" icon="1" child="11" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^class\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
        <Group name="FUNCTION" subgroup="" icon="9" child="17" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^[\s\t]+def\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^[\s\t]+end$" sep="" />
        </Group>
        <Group name="GlobalFunction" subgroup="" icon="9" child="17" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^def\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
        <Group name="MODULE" subgroup="FUNCTION" icon="8" child="11" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
            <Rules regexbeg="^module\s+" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="^end$" sep="" />
        </Group>
</Language>
于 2010-07-29T03:03:23.383 回答
1

从 6.4 版开始就不需要插件了!查看新的功能列表功能: http: //notepad-plus-plus.org/features/function-list.html

语言支持即将到来,也许在这里询问会有所帮助: https ://sourceforge.net/p/notepad-plus/discussion/331753/thread/b9d2fe00/

于 2013-08-11T11:59:38.447 回答
1

这是我的规则。仍然不完美。不知道如何配置子组。

<Language name="Ruby" imagelistpath="">
    <CommList param1="#" param2="" />
    <CommList param1="//" param2="" />
    <CommList param1="/\*" param2="\*/" />
    <Group name="MODULE" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*module\s+" regexfunc="[\w]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
    <Group name="CLASS" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*class\s+" regexfunc="[\w]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
    <Group name="FUNCTION" subgroup="" icon="0" child="0" autoexp="0" matchcase="1" fendtobbeg="" bbegtobend="" keywords="">
        <Rules regexbeg="^[\s\t]*def\s+" regexfunc="[\w\?!\.=]+" regexend="" bodybegin="" bodyend="" sep="" />
    </Group>
</Language>
于 2011-09-10T01:13:01.930 回答
0

我正在为新的 functionList.xml 使用以下解析器。如果多个定义在同一行上,它可以识别大多数类模块和方法定义。例如

module A; module B; class C end; end; end;

在上述情况下,它只会识别“模块 A”

一切都以函数形式呈现,包括“class”、“module”或“def”关键字。它不使用 classrange 提供的层次结构。

  <parser id="rb_function" displayName="Ruby" >
    <function
        mainExpr="^[\s]*(def|class|module)[\s]+(self\.)?[\S]+;?"
        displayMode="$className->$functionName" >
      <functionName>
        <nameExpr expr="(def|class|module)[^\(;]*" />
      </functionName>
    </function>
  </parser>
于 2016-04-30T13:38:01.020 回答