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