Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does custom syntax highlighting in Scintilla work (and why doesn't mine)?

Tags:

c#

scintilla

So anyways, I'm trying to implement custom syntax highlighting into a Scintilla control in Visual C#.NET.

I've been told do this through an XML file. I have named it "ScintillaNET.xml" and placed it in the debug bin for my project.

In the Form_Load, I set its language to batch (which is correct), and in the properties I specify the location of the file.

The code I have in the XML file is:

<?xml version="1.0" encoding="utf-8"?>

<ScintillaNET>

    <!-- Set up the language, style, and lexer for batch -->
    <Language Name="batch">

        <!-- Lexer -->
        <Lexer StreamCommentPrefix="{ " StreamCommentSuffix=" }">
            <Keywords List="0">var</Keywords>
        </Lexer>

        <!-- Style -->
        <Styles>
            <Sytle Name="CHARACTER" ForeColor="Black" BackColor="Red"/>
        </Styles>

        <!-- Other Settings -->
        <Indentation TabWidth="2" UseTabs="false"/>

    </Language>

</ScintillaNET>

Unfortunately, that doesn't seem to work... When I run my program, nothing happens in Scintilla.

My main goal for the custom syntax highlighting is nothing complicated.

I just want to be able to: Choose the words to be highlighted. Choose the color to have them highlighted/colored in.

How do I do this? What's wrong with my code?

(and if anyone has a quick tutorial on how to do it, that would be appreciated)

like image 779
Alper Avatar asked Jun 20 '11 22:06

Alper


1 Answers

I've tested your xml file in my machine. A windows form app with ScintillaNet Control and with your xml is working fine.

enter image description here

Make sure you do following:

  1. Your system "path" includes the directory where SciLexer.dll is located
  2. In ConfigrationManager property of ScintillaNet Control. Set the CustomLocation property = ScintillaNET.xml
  3. In ConfigrationManager property of ScintillaNet Control. Language property = batch.

references:

(Installation) http://scintillanet.codeplex.com/wikipage?title=Installation&referringTitle=Documentation

(How do I use my own configuration files?) http://scintillanet.codeplex.com/wikipage?title=HowToCustomConfig&referringTitle=Documentation

like image 51
Tae-Sung Shin Avatar answered Sep 30 '22 20:09

Tae-Sung Shin