private void SetLanguage(string language) { if ("ini".Equals(language, StringComparison.OrdinalIgnoreCase)) { // Reset/set all styles and prepare scintilla for custom lexing ActiveDocument.IniLexer = true; IniLexer.Init(ActiveDocument.Scintilla); } else { // Use a built-in lexer and configuration ActiveDocument.IniLexer = false; ActiveDocument.Scintilla.ConfigurationManager.Language = language; // Smart indenting... if ("cs".Equals(language, StringComparison.OrdinalIgnoreCase)) { ActiveDocument.Scintilla.Indentation.SmartIndentType = SmartIndent.CPP; } else { ActiveDocument.Scintilla.Indentation.SmartIndentType = SmartIndent.None; } } }
public static void StyleNeeded(Scintilla scintilla, Range range) { // Create an instance of our lexer and bada-bing the line! IniLexer lexer = new IniLexer(scintilla, range.Start, range.StartingLine.Length); lexer.Style(); }