【问题标题】:Geany custom folding for custom filetype自定义文件类型的 Geany 自定义折叠
【发布时间】:2015-07-02 07:27:44
【问题描述】:

我工作的公司开发了一种新的编程语言,可以减轻工程师的工作。我的工作是为这种语言提供一个不错的编辑器,它也涉及代码折叠。我需要自定义代码折叠包括“{”和“}”。我正在使用 Geany 文件类型。我添加了新的文件类型。我想折叠一些像下面这样的结构。

 if %condition%  then                     for each %element% in  %range%  do 
    %statement%                              %statement%  
 else if %condition%  then                end for
    %statement%  
 else
 end if

我知道我的语言与 c type 相差甚远,但是在我的代码中添加这样一行以启用语法着色。

  [settings]
  lexer_filetype=C

我们将不胜感激。

【问题讨论】:

    标签: file-type geany code-folding


    【解决方案1】:

    我不知道确切的答案,但我知道如何挖掘它。到目前为止还没有答案,我将写下如何才能出现答案。使用 scintilla 及其词法分析器可以帮助我们解决这个问题。 GeanyScintilla 文档都提到了对该功能的支持。

    【讨论】:

      【解决方案2】:

      在 Debian 下:

      1. cp /usr/share/geany/filetypes.c ~/.config/geany/filedefs/

      2. chown myUser:myGroup ~/.config/geany/filedefs/filetypes.c

      3. 编辑文件。在[lexer_properties] 部分下添加以下行:

        fold.cpp.comment.explicit=1

      4. 保存文件。

      5. 打开 geany。您现在可以在 c 和 cpp 中使用默认的 //{//} 分隔符放置用户折叠。这些不会影响您的代码,因为对于 c 和 cpp 它是 cmets。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-05-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-10-31
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多