Dynamic creation of code snippets ?

Feb 26, 2010 at 1:03 PM

Hi,

i am testing scintilla.net in a personal project, and i would like to know if it is possible to add code snippets without reloading then complete xml file ?

Is it possible to add it by code ? i tried without success , but i do not know very well the whole code of the scintilla API.

 

Thank you in advance

 

 

 

 

Developer
Mar 8, 2010 at 2:09 PM

I think you can use this:

ScintillaNet.Snippets.InsertSnippet(new Snippet("SHORTCUT", "SNIPPETCODE"));

Mar 8, 2010 at 2:20 PM

From Memory the insertsnippet only insert the defined snippet into the current Document ,

i will give a try to be sure ,

but if my memory is good the inner snippet list get never initialized , and i don't know how to

 

 

Developer
Mar 8, 2010 at 5:58 PM
Edited Mar 8, 2010 at 5:58 PM

Hi alainb33,

sorry I did'nt check if it works, I just took the first method....

So after I looked through the code, I guess you could try this:

 

scintilla.Snippets.List.Add("string","string");

But I don't tried this out.

 

Mar 8, 2010 at 6:18 PM

I tested it but the list can't initialize (the snippetlist is internal) and is only initialized when loading the config.

Finally i bypassed this in dynamically adding snippets in an default configuration File and loading it with ConfigurationManager.Configure(....).

The code is a bit crappy but it works :-)