1

我正在尝试在我的一个 ScintillaNET 项目中实现 java 自动完成,但遇到了问题。我一直在遵循所需的所有步骤

  • 确保 ScintillaNET(和所需的 .dll)位于我的 PATH 变量中。
  • 将 CustomLocation 和 Language 参数值添加到我的编辑器

下面是我的审查代码,我确保我的参数设置正确......我只是迷路了。

Scintilla sciEditor = (Scintilla)selectedTab.Controls["sciEditor"];
            using (StreamReader sr = new StreamReader(fileName))
            {
                String line = sr.ReadToEnd();
                sciEditor.Text = line;
            }
            if (ext == "java")
            {
                sciEditor.ConfigurationManager.Language = "java";
                sciEditor.ConfigurationManager.CustomLocation = @"C:\java.xml";
                sciEditor.CharAdded += new EventHandler<CharAddedEventArgs>(sciEditor_CharAdded);
            }

所以你可以看到我将文本读入 Scintilla 编辑器,如果文件 ext 是 java(我在此块上方解析,并得到有效答案),那么我将编辑器 languaget 设置为 java,并将我的自定义位置设置为java.xml 文件

<?xml version="1.0" encoding="utf-8"?>
<ScintillaNET>
  <Language Name="java">
    <AutoComplete FillUpCharacters=".([" SingleLineAccept="True" IsCaseSensitive="False">
      <List>
        abstract assert boolean break byte case catch char class continue default do double else enum extends
        final finally float for if import int interface long native new package private protected public return
        short static strictfp super switch synchronized this throw throws transient try void volatile while
      </List>
    </AutoComplete>

    <Indentation TabWidth="4" SmartIndentType="cpp" />

    <Lexer LexerName="java" LineCommentPrefix="//" StreamCommentPrefix="/* " StreamCommentSuffix=" */" >
      <Keywords List="0" Inherit="False">
        abstract assert break case catch continue default do else extends final finally for if import interface
        native new package private protected public return strictfp super switch synchronized this throw throws
        transient try volatile while
      </Keywords>
      <Keywords List="1" Inherit="False">
        boolean byte char class double enum float int long short static
      </Keywords>
    </Lexer>
  </Language>
</ScintillaNET>

每当我部署(并将 .xml 放在我的 C:\ 文件夹中(或部署在我的可执行文件旁边)时,它都不会应用任何样式(并且自动完成是空的)。除了下载和重新编译我自己的之外,我不知道是什么错误的。

4

1 回答 1

0

今天我也遇到了同样的问题,我因为问这样的问题而被禁止。ScintillaNET 开发人员感到羞耻。试图为自己定义一种自定义语言,但最终你做不到。所以,我所做的是我使用预先构建的语言作为名称,然后扩展该语言而不是定义我自己的语言,这是 ScintillaNET 无法找到的。希望你明白,我花了四天时间才弄清楚,真是个愚蠢的狗屎。感谢查尔斯:) - dreamincode.net 的提示,因为我的头被吹动了。

于 2014-08-16T02:05:01.670 回答