This project is read-only.

Colorize and Autocomplete

Topics: Developer Forum
Jan 7, 2011 at 5:09 PM

I have set the Lexing to Hypertext and trying to enable the autocomplete and colorizing, but nothing happens.

'   create document
Dim scin As New ScintillaNet.Scintilla()
With scin
   .Dock = DockStyle.Fill

   Dim xfont As New Font("Consolas", 10, FontStyle.Regular, GraphicsUnit.Point)
   .Styles(ScintillaNet.StylesCommon.LineNumber).Font = xfont
   .Styles(ScintillaNet.StylesCommon.BraceBad).Font = xfont
   .Styles(ScintillaNet.StylesCommon.BraceLight).Font = xfont
   .Styles(ScintillaNet.StylesCommon.CallTip).Font = xfont
   .Styles(ScintillaNet.StylesCommon.ControlChar).Font = xfont
   .Styles(ScintillaNet.StylesCommon.Default).Font = xfont
   .Styles(ScintillaNet.StylesCommon.IndentGuide).Font = xfont
   .Styles(ScintillaNet.StylesCommon.LastPredefined).Font = xfont
   .Styles(ScintillaNet.StylesCommon.Max).Font = xfont
   
   .Lexing.Lexer = ScintillaNet.Lexer.Hypertext ' <<  HTML
   .Lexing.Colorize()  ' << apply coloring
End With
Anyone knows how to enable the coloring and the autocomplete? Thanks in advance.

Jan 7, 2011 at 5:48 PM

I'm not sure but maybe you need to supply keywords for Hypertext? Set up an .XML file and supply keywords and make sure you copy the .XML file to the output directory (or set the .XML file as an embedded resource).

To set up auto-completion, what I did was load a a list of strings from a list<string>. Here is some C# code:

List s = new List();

s.Add("test");
s.Add("test2");
s.Add("test3");

s.Sort();
scintilla.AutoComplete.Show(s);

I load the auto-complete list on a CharAdded event.

 

 

 

Jan 7, 2011 at 6:05 PM

Thanks will have a look at it. Anything about the coloring?

Jan 8, 2011 at 3:53 PM

Oh, whoops. I should have elaborated more on my first sentence. When you set up the XML file, you'll have to make the Scintilla control use it (see the ConfigurationManager property and CustomLocation and Language there, they should point to your XML file and the language). If it works well, then it should automatically do syntax-highlighting and colorize keywords. In case you need more information, you should look up and read some other threads about setting up syntax highlighting or the documentation. The developers here probably know a lot more about this, but it really seems like this project is dead or totally inactive.

Jan 6, 2012 at 4:23 PM

I am looking to use an .xsd that defines my xml and am looking to apply it to Scintilla's AutoComplete.  I am setting the configuration of the control at run-time and NOT in a configuration file.

Do you know of any post that have already addressed this issue and/or know how I might accomplish this?

Thank you for any assistance in this matter.

Jan 6, 2012 at 6:40 PM

If you're looking to do a Visual Studio style context sensitive XSD Intellisense where you only show elements and attributes that match the schema then no. If all you want to do is set the AutoComplete to a flat list of items available at all times in code it's pretty easy:

 

yourScintillaControl.AutoComplete.List = new List<string>(){"Item 1", "Item 2", "Item 3"};