static private void CompleteTemplate(string Context) { // get indentation ScintillaControl Sci = ASContext.CurSciControl; if (Sci == null) { return; } int position = Sci.CurrentPos; int line = Sci.LineFromPosition(position); int indent = Sci.LineIndentPosition(line) - Sci.PositionFromLine(line); string tab = Sci.GetLine(line).Substring(0, indent); // get EOL int eolMode = Sci.EOLMode; string newline = LineEndDetector.GetNewLineMarker(eolMode); CommentBlockStyle cbs = PluginBase.Settings.CommentBlockStyle; string star = cbs == CommentBlockStyle.Indented ? " *" : "*"; string parInd = cbs == CommentBlockStyle.Indented ? "\t" : " "; if (!PluginBase.MainForm.Settings.UseTabs) { parInd = " "; } // empty box if (Context == null) { Sci.ReplaceSel(newline + tab + star + " " + newline + tab + star + "/"); position += newline.Length + tab.Length + 1 + star.Length; Sci.SetSel(position, position); } // method details else { string box = newline + tab + star + " "; Match mFun = re_splitFunction.Match(Context); if (mFun.Success && !re_property.IsMatch(mFun.Groups["fname"].Value)) { // parameters MemberList list = ParseMethodParameters(mFun.Groups["params"].Value); foreach (MemberModel param in list) { box += newline + tab + star + " @param" + parInd + param.Name; } // return type Match mType = re_variableType.Match(mFun.Groups["type"].Value); if (mType.Success && !mType.Groups["type"].Value.Equals("void", StringComparison.OrdinalIgnoreCase)) { box += newline + tab + star + " @return"; //+mType.Groups["type"].Value; } } box += newline + tab + star + "/"; Sci.ReplaceSel(box); position += newline.Length + tab.Length + 1 + star.Length; Sci.SetSel(position, position); } }
/// <summary> /// Gets the comment block indent /// </summary> public static String GetCBI() { CommentBlockStyle cbs = Globals.Settings.CommentBlockStyle; if (cbs == CommentBlockStyle.Indented) { return(" "); } else { return(""); } }