public static bool TriggerCodeSnippetInsertion() { if (InsertionActive) { return(false); // do no insert a snippet within a snippet! } string token = Sci.GetWord(null, Sci.CurrentPosition); var curPos = Sci.CurrentPosition; Point tokenPoints = new Point(curPos - token.Length, curPos); if (Contains(token)) { string replacement = GetTemplate(token); if (replacement != null) { int line = Sci.Line.CurrentLine; int lineStartPos = Sci.GetLine(line).Position; int horizontalOffset = tokenPoints.X - lineStartPos; //relative selection in the replacement text PrepareForIncertion(replacement, horizontalOffset, tokenPoints.X); var indic = Sci.GetIndicator(SnippetContext.IndicatorId); indic.IndicatorStyle = IndicatorStyle.Box; indic.ForeColor = Color.Blue; foreach (var point in LocSnippetContext.Parameters) { indic.Add(point.X, point.Y); } if (LocSnippetContext.CurrentParameter.HasValue) { Sci.SetSelection(LocSnippetContext.CurrentParameter.Value.X, LocSnippetContext.CurrentParameter.Value.Y); LocSnippetContext.CurrentParameterValue = Sci.GetTextBetween(LocSnippetContext.CurrentParameter.Value); } AutoCompletion.Cloak(); if (LocSnippetContext.Parameters.Count <= 1) { FinalizeCurrent(); } } return(true); } return(false); }