本文整理汇总了C#中CompletionDataList.AddKeyHandler方法的典型用法代码示例。如果您正苦于以下问题:C# CompletionDataList.AddKeyHandler方法的具体用法?C# CompletionDataList.AddKeyHandler怎么用?C# CompletionDataList.AddKeyHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompletionDataList
的用法示例。
在下文中一共展示了CompletionDataList.AddKeyHandler方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMiscBeginTags
/// <summary>
/// Adds CDATA and comment begin tags.
/// </summary>
protected static void AddMiscBeginTags (CompletionDataList list)
{
list.Add ("!--", "md-literal", GettextCatalog.GetString ("Comment"));
list.AddKeyHandler (new IgnoreDashKeyHandler ());
list.Add ("![CDATA[", "md-literal", GettextCatalog.GetString ("Character data"));
}
示例2: HandleCodeCompletion
public override ICompletionDataList HandleCodeCompletion(CodeCompletionContext completionContext, char triggerChar, ref int triggerWordLength)
{
if (!EnableCodeCompletion)
return null;
if (!EnableAutoCodeCompletion && char.IsLetter(triggerChar))
return null;
if (char.IsLetterOrDigit(triggerChar) || triggerChar == '_')
{
if (completionContext.TriggerOffset > 1){
var prevChar = document.Editor.GetCharAt(completionContext.TriggerOffset - 2);
if(char.IsLetterOrDigit(prevChar) || prevChar == '"') // Don't trigger if we're already typing an identifier or if we're typing a string suffix (kinda hacky though)
return null;
}
}
else if (!(triggerChar==' ' ||
triggerChar == '@' ||
triggerChar == '(' ||
triggerChar == '.' ||
triggerChar == '\0'))
return null;
triggerWordLength = (char.IsLetter(triggerChar) || triggerChar=='_' || triggerChar=='@') ? 1 : 0;
// Require a parsed D source
var dom = base.Document.ParsedDocument as ParsedDModule;
if (dom == null || dom.DDom == null)
return null;
var l = new CompletionDataList();
if (D_Parser.Misc.CompletionOptions.Instance.EnableSuggestionMode)
{
l.AddKeyHandler(new SuggestionKeyHandler());
l.AutoSelect = l.AutoCompleteEmptyMatch = false;
}
else
l.AddKeyHandler(new DoubleUnderScoreWorkaroundHandler());
lock(dom.DDom)
DCodeCompletionSupport.BuildCompletionData(
Document,
dom.DDom,
completionContext,
l,
triggerChar);
return l.Count != 0 ? l : null;
}
示例3: CompletionDataCollector
public CompletionDataCollector (ProjectDom dom, CompletionDataList completionList, ICompilationUnit unit, IType declaringType, DomLocation location)
{
this.CompletionList = completionList;
this.unit = unit;
this.dom = dom;
this.FullyQualify = false;
// this.location = location;
this.declaringType = declaringType;
completionList.AddKeyHandler (new NegateKeyHandler ());
// Get a list of all namespaces in scope
if (unit != null) {
foreach (IUsing u in unit.Usings) {
if (!u.IsFromNamespace || u.Region.Contains (location)) {
foreach (string ns in u.Namespaces)
namespacesInScope.Add (ns);
}
}
}
}
示例4: HandleCodeCompletion
public override ICompletionDataList HandleCodeCompletion(CodeCompletionContext completionContext, char triggerChar, ref int triggerWordLength)
{
if (!currentWrapperNullfied && workaround_currentWrapper != null)
{
workaround_currentWrapper.SetValue(document, null);
currentWrapperNullfied = true;
}
var isLetter = char.IsLetter (triggerChar) || triggerChar == '_';
if (char.IsDigit(triggerChar) || !EnableAutoCodeCompletion && isLetter)
return null;
if (isLetter)
{
if (completionContext.TriggerOffset > 1){
var prevChar = document.Editor.GetCharAt(completionContext.TriggerOffset - 2);
if(char.IsLetterOrDigit(prevChar) || prevChar =='_' || prevChar == '"' || prevChar == '#') // Don't trigger if we're already typing an identifier or if we're typing a string suffix (kinda hacky though)
return null;
}
}
else if (!(triggerChar==' ' ||
triggerChar == '@' ||
triggerChar == '(' ||
triggerChar == '.' ||
triggerChar == '\0'))
return null;
triggerWordLength = isLetter ? 1 : 0;
// Require a parsed D source
var ast = Document.GetDAst();
if (ast == null)
return null;
updater.FinishUpdate();
lastTriggerOffset = completionContext.TriggerOffset;
var l = new CompletionDataList();
if (D_Parser.Misc.CompletionOptions.Instance.EnableSuggestionMode)
{
l.AddKeyHandler(new SuggestionKeyHandler());
l.AutoCompleteUniqueMatch = false;
l.AutoCompleteEmptyMatch = false;
l.AutoSelect = true;
}
else
l.AddKeyHandler(new DoubleUnderScoreWorkaroundHandler(this));
try{
lock(ast)
DCodeCompletionSupport.BuildCompletionData(
Document,
ast,
completionContext,
l,
triggerChar);
}catch(System.Exception ex) {
LoggingService.LogWarning ("Error during completion", ex);
}
return l.Count != 0 ? l : null;
}