private void InitializeAutoComplete() { _codeBox.AutoCCancelAtStart = true; _codeBox.AutoCChooseSingle = false; _codeBox.AutoCIgnoreCase = true; _codeBox.AutoCSeparator = ';'; _codeBox.AutoCSetFillUps(""); _codeBox.AutoCStops("("); }
private void OnCharAdded(object sender, CharAddedEventArgs e) { // Auto Indent if (e.Char == '\n') { int foldBase = textArea.Lines[0].FoldLevel; int lineCur = textArea.CurrentLine; int foldCur = textArea.Lines[lineCur].FoldLevel - foldBase; int foldPrev = textArea.Lines[lineCur - 1].FoldLevel - foldBase; string indents = ""; for (int i = 0; i < foldCur; i++) { indents += spaces; } textArea.AddText(indents); indents = ""; for (int i = 0; i < foldPrev; i++) { indents += spaces; } int iStart = textArea.Lines[lineCur - 1].Position; string linePrev = textArea.Lines[lineCur - 1].Text; int iLen = 0; while (iLen < linePrev.Length && char.IsWhiteSpace(linePrev[iLen]) && linePrev[iLen] != '\r' && linePrev[iLen] != '\n') { iLen++; } textArea.SetTargetRange(iStart, iStart + iLen); textArea.ReplaceTarget(indents); } // Display the autocompletion list int currentPos = textArea.CurrentPosition; int wordStartPos = textArea.WordStartPosition(currentPos, true); int style = textArea.GetStyleAt(currentPos - 2); string currentWord = textArea.GetWordFromPosition(wordStartPos); int lenEntered = currentPos - wordStartPos; textArea.AutoCSetFillUps(""); textArea.AutoCStops(""); if (style == STYLE_COMMENT || style == STYLE_STRING) { return; } if (wordStartPos > 1 && textArea.GetCharAt(wordStartPos - 1) == '.') //method { textArea.AutoCSetFillUps("("); textArea.AutoCStops(" "); currentPos = wordStartPos - 2; wordStartPos = textArea.WordStartPosition(currentPos, true); lastObject = textArea.GetWordFromPosition(wordStartPos); AutoCData = sbObjects.GetMembers(lastObject, currentWord).Trim(); textArea.AutoCShow(lenEntered, AutoCData); AutoCMode = 2; AutoCTimer.Enabled = true; } else if (lenEntered > 0) { textArea.AutoCSetFillUps("."); textArea.AutoCStops(" "); AutoCData = (sbObjects.GetKeywords(currentWord) + sbObjects.GetObjects(currentWord) + sbObjects.GetSubroutines(currentWord) + sbObjects.GetLabels(currentWord) + sbObjects.GetVariables(currentWord)).Trim(); textArea.AutoCShow(lenEntered, AutoCData); lastObject = ""; AutoCMode = 1; AutoCTimer.Enabled = true; } }