本文整理汇总了C#中ScintillaNet.Colourise方法的典型用法代码示例。如果您正苦于以下问题:C# ScintillaNet.Colourise方法的具体用法?C# ScintillaNet.Colourise怎么用?C# ScintillaNet.Colourise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScintillaNet
的用法示例。
在下文中一共展示了ScintillaNet.Colourise方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnUpdateCallTip
private void OnUpdateCallTip(ScintillaNet.ScintillaControl sci, int position)
{
if (ASComplete.HasCalltip())
{
int pos = sci.CurrentPos - 1;
char c = (char)sci.CharAt(pos);
if ((c == ',' || c == '(') && sci.BaseStyleAt(pos) == 0)
sci.Colourise(0, -1);
ASComplete.HandleFunctionCompletion(sci, false, true);
}
}
示例2: GenerateExtractVariable
public static void GenerateExtractVariable(ScintillaNet.ScintillaControl Sci, string NewName)
{
FileModel cFile;
IASContext context = ASContext.Context;
Int32 pos = Sci.CurrentPos;
string expression = Sci.SelText.Trim(new char[] { '=', ' ', '\t', '\n', '\r', ';', '.' });
expression = expression.TrimEnd(new char[] { '(', '[', '{', '<' });
expression = expression.TrimStart(new char[] { ')', ']', '}', '>' });
cFile = ASContext.Context.CurrentModel;
ASFileParser parser = new ASFileParser();
parser.ParseSrc(cFile, Sci.Text);
MemberModel current = cFile.Context.CurrentMember;
string characterClass = ScintillaNet.ScintillaControl.Configuration.GetLanguage(Sci.ConfigurationLanguage).characterclass.Characters;
int funcBodyStart = ASGenerator.GetBodyStart(current.LineFrom, current.LineTo, Sci);
Sci.SetSel(funcBodyStart, Sci.LineEndPosition(current.LineTo));
string currentMethodBody = Sci.SelText;
bool isExprInSingleQuotes = (expression.StartsWith("'") && expression.EndsWith("'"));
bool isExprInDoubleQuotes = (expression.StartsWith("\"") && expression.EndsWith("\""));
int stylemask = (1 << Sci.StyleBits) - 1;
int lastPos = -1;
char prevOrNextChar;
Sci.Colourise(0, -1);
while (true)
{
lastPos = currentMethodBody.IndexOf(expression, lastPos + 1);
if (lastPos > -1)
{
if (lastPos > 0)
{
prevOrNextChar = currentMethodBody[lastPos - 1];
if (characterClass.IndexOf(prevOrNextChar) > -1)
{
continue;
}
}
if (lastPos + expression.Length < currentMethodBody.Length)
{
prevOrNextChar = currentMethodBody[lastPos + expression.Length];
if (characterClass.IndexOf(prevOrNextChar) > -1)
{
continue;
}
}
int style = Sci.StyleAt(funcBodyStart + lastPos) & stylemask;
if (ASComplete.IsCommentStyle(style))
{
continue;
}
else if ((isExprInDoubleQuotes && currentMethodBody[lastPos] == '"' && currentMethodBody[lastPos + expression.Length - 1] == '"')
|| (isExprInSingleQuotes && currentMethodBody[lastPos] == '\'' && currentMethodBody[lastPos + expression.Length - 1] == '\''))
{
}
else if (!ASComplete.IsTextStyle(style))
{
continue;
}
Sci.SetSel(funcBodyStart + lastPos, funcBodyStart + lastPos + expression.Length);
Sci.ReplaceSel(NewName);
currentMethodBody = currentMethodBody.Substring(0, lastPos) + NewName + currentMethodBody.Substring(lastPos + expression.Length);
lastPos += NewName.Length;
}
else
{
break;
}
}
Sci.CurrentPos = funcBodyStart;
Sci.SetSel(Sci.CurrentPos, Sci.CurrentPos);
MemberModel m = new MemberModel(NewName, "", FlagType.LocalVar, 0);
m.Value = expression;
string snippet = TemplateUtils.GetTemplate("Variable");
snippet = TemplateUtils.ReplaceTemplateVariable(snippet, "Modifiers", null);
snippet = TemplateUtils.ToDeclarationString(m, snippet);
snippet += NewLine + "$(Boundary)";
SnippetHelper.InsertSnippetText(Sci, Sci.CurrentPos, snippet);
}
示例3: OnChar
/// <summary>
/// Character written in editor
/// </summary>
/// <param name="Value">Character inserted</param>
static public bool OnChar(ScintillaNet.ScintillaControl Sci, int Value, bool autoHide)
{
if (autoHide && !ASContext.HelpersEnabled)
return false;
try
{
int eolMode = Sci.EOLMode;
// code auto
if (((Value == 10) && (eolMode != 1)) || ((Value == 13) && (eolMode == 1)))
{
DebugConsole.Trace("Struct");
HandleStructureCompletion(Sci);
return false;
}
// ignore repeated characters
int position = Sci.CurrentPos;
if ((Sci.CharAt(position-2) == Value) && (Sci.CharAt(position-1) == Value) && (Value != '*'))
return false;
// ignore text in comments & quoted text
Sci.Colourise(0,-1);
int stylemask = (1 << Sci.StyleBits) -1;
int style = Sci.StyleAt(position-1) & stylemask;
DebugConsole.Trace("style "+style);
if (!IsTextStyle(style) && !IsTextStyle(Sci.StyleAt(position) & stylemask))
{
// documentation completion
if (ASContext.DocumentationCompletionEnabled && IsCommentStyle(style))
return ASDocumentation.OnChar(Sci, Value, position, style);
else if (autoHide) return false;
}
// stop here if the class is not valid
if (!ASContext.IsClassValid()) return false;
// handle
switch (Value)
{
case '.':
return HandleDotCompletion(Sci, autoHide);
case ' ':
position--;
string word = GetWordLeft(Sci, ref position);
DebugConsole.Trace("Word? "+word);
if (word.Length > 0)
switch (word)
{
case "new":
case "extends":
case "implements":
return HandleNewCompletion(Sci, "", autoHide);
case "import":
return HandleImportCompletion(Sci, "", autoHide);
case "public":
return HandleDeclarationCompletion(Sci, "function static var", "", autoHide);
case "private":
return HandleDeclarationCompletion(Sci, "function static var", "", autoHide);
case "static":
return HandleDeclarationCompletion(Sci, "function private public var", "", autoHide);
}
break;
case ':':
ASContext.UnsetOutOfDate();
bool result = HandleColonCompletion(Sci, "", autoHide);
ASContext.SetOutOfDate();
return result;
case '(':
return HandleFunctionCompletion(Sci);
case ')':
if (InfoTip.CallTipActive) InfoTip.Hide();
return false;
case '*':
return CodeAutoOnChar(Sci, Value);
}
}
catch (Exception ex) {
ErrorHandler.ShowError("Completion error", ex);
}
// CodeAuto context
if (!PluginCore.Controls.CompletionList.Active) LastExpression = null;
return false;
}