本文整理汇总了C#中Dev2.Studio.Core.Interfaces.IntellisenseProviderContext类的典型用法代码示例。如果您正苦于以下问题:C# IntellisenseProviderContext类的具体用法?C# IntellisenseProviderContext怎么用?C# IntellisenseProviderContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntellisenseProviderContext类属于Dev2.Studio.Core.Interfaces命名空间,在下文中一共展示了IntellisenseProviderContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetIntellisenseResults
public IList<IntellisenseProviderResult> GetIntellisenseResults(IntellisenseProviderContext context)
{
if(context == null)
{
return new List<IntellisenseProviderResult>();
}
IList<IIntellisenseResult> oldResults = GetIntellisenseResultsImpl(context);
var results = new List<IntellisenseProviderResult>();
if (oldResults != null)
{
foreach (IIntellisenseResult currentResult in oldResults)
{
if (currentResult.ErrorCode != enIntellisenseErrorCode.None)
{
if (currentResult.Type == enIntellisenseResultType.Error && currentResult.IsClosedRegion)
{
results.Add(new IntellisenseProviderResult(this, currentResult.Option.DisplayValue, currentResult.Message, currentResult.Message, true));
}
}
if (currentResult.Type == enIntellisenseResultType.Selectable)
{
results.Add(new IntellisenseProviderResult(this, currentResult.Option.DisplayValue, currentResult.Option.Description, currentResult.Option.Description, false));
}
}
}
return results;
}
示例2: GetIntellisenseResults
public IList<IntellisenseProviderResult> GetIntellisenseResults(IntellisenseProviderContext context)
{
if (context == null)
{
return new List<IntellisenseProviderResult>();
}
var results = new List<IntellisenseProviderResult>();
if(context.DesiredResultSet == IntellisenseDesiredResultSet.EntireSet)
{
FileSystemQuery.QueryList("");
FileSystemQuery.QueryCollection.ForEach(s => IntellisenseResults.Add(new IntellisenseProviderResult(this, s, string.Empty, string.Empty, false)));
results.AddRange(IntellisenseResults);
}
else
{
if(!InLiteralRegion(context.InputText, context.CaretPosition))
{
IntellisenseResults.Clear();
var regions = context.InputText.Split(' ');
var sum = 0;
string searchText = regions.Select(a => new { a, a.Length }).TakeWhile(a =>
{
sum = sum + context.CaretPosition;
return sum >= context.CaretPosition;
}).Last().a;
FileSystemQuery.QueryList(searchText);
FileSystemQuery.QueryCollection.ForEach(s => IntellisenseResults.Add(new IntellisenseProviderResult(this, s, string.Empty, string.Empty, false)));
results.AddRange(IntellisenseResults);
}
}
return results;
}
示例3: PerformResultInsertion
public string PerformResultInsertion(string input, IntellisenseProviderContext context)
{
VerifyArgument.IsNotNull("Context",context);
string inputText = context.InputText ?? string.Empty;
int caretPosition = context.CaretPosition;
if (caretPosition < 0 || caretPosition>inputText.Length)
return string.Empty;
var regions = inputText.Split(' '); // we can safely do this because the default provider handles the language features
var sum = 0;
int items = 0;
var regionsText = regions.Select(a => new { a, a.Length }).TakeWhile(a =>
{
sum = sum + a.Length;
items++;
return sum <= caretPosition || items==1;
}).Select(a => a.a).ToList();
regionsText[regionsText.Count - 1] = input;// set caret region to replacement text
var prefix = regionsText.Aggregate("", (a, b) => a + " " + b).TrimStart(' '); // fold back together
context.CaretPositionOnPopup = prefix.Length;
context.CaretPosition = prefix.Length;
int i = 0;
var inner = regions.SkipWhile(a =>
{
i = i + 1;
return i < regionsText.Count + 1;
}).Aggregate("", (a, b) => a + " " + b);
return (prefix + inner).TrimEnd();
}
示例4: CalculateIntellisenseProvider_GetIntellisenseResults_CalculateModeIsFalse_ResultCountIsZero
public void CalculateIntellisenseProvider_GetIntellisenseResults_CalculateModeIsFalse_ResultCountIsZero()
{
var context = new IntellisenseProviderContext
{
CaretPosition = 2,
InputText = "se",
IsInCalculateMode = false,
DesiredResultSet = IntellisenseDesiredResultSet.ClosestMatch
};
CalculateIntellisenseProvider calculateIntellisenseProvider = GetCalculateProvider(false);
IList<IntellisenseProviderResult> results = calculateIntellisenseProvider.GetIntellisenseResults(context);
Assert.AreEqual(0, results.Count);
}
示例5: CalculateIntellisenseProvider_GetIntellisenseResults_DesiredIsEntireSet_ResultAllResult
public void CalculateIntellisenseProvider_GetIntellisenseResults_DesiredIsEntireSet_ResultAllResult()
{
var context = new IntellisenseProviderContext
{
CaretPosition = 2,
InputText = "se",
IsInCalculateMode = true,
DesiredResultSet = IntellisenseDesiredResultSet.EntireSet
};
CalculateIntellisenseProvider calculateIntellisenseProvider = GetCalculateProvider(false);
IList<IntellisenseProviderResult> results = calculateIntellisenseProvider.GetIntellisenseResults(context);
Assert.AreEqual(175, results.Count);
}
示例6: DateTimeIntellisenseProvider_GetIntellisenseResults_PartialMethodMatch_ClosestMatchesReturned
public void DateTimeIntellisenseProvider_GetIntellisenseResults_PartialMethodMatch_ClosestMatchesReturned()
{
var context = new IntellisenseProviderContext
{
CaretPosition = 1,
InputText = "d",
IsInCalculateMode = false,
DesiredResultSet = IntellisenseDesiredResultSet.ClosestMatch
};
var dateTimeIntellisenseProvider = new DateTimeIntellisenseProvider();
IList<IntellisenseProviderResult> results = dateTimeIntellisenseProvider.GetIntellisenseResults(context);
Assert.AreEqual(6, results.Count);
}
示例7: FileSystemIntellisenseProvider_ExecuteInsertion
public void FileSystemIntellisenseProvider_ExecuteInsertion(int caretPosition, string inputText, string inserted, string expected)
{
//------------Setup for test--------------------------
var fileSystemIntellisenseProvider = new FileSystemIntellisenseProvider();
//------------Execute Test---------------------------
var context = new IntellisenseProviderContext
{
CaretPosition = caretPosition,
InputText = inputText,
IsInCalculateMode = false,
DesiredResultSet = IntellisenseDesiredResultSet.ClosestMatch
};
var resp = fileSystemIntellisenseProvider.PerformResultInsertion(inserted, context);
//------------Assert Results-------------------------
Assert.AreEqual(resp, expected);
}
示例8: CalculateIntellisenseProvider_GetIntellisenseResults_InputBeginsCaretPositonedAfterTwoCharacters_ResultsFilteredBasedOnCharacters
public void CalculateIntellisenseProvider_GetIntellisenseResults_InputBeginsCaretPositonedAfterTwoCharacters_ResultsFilteredBasedOnCharacters()
{
var context = new IntellisenseProviderContext
{
CaretPosition = 2,
InputText = "se",
IsInCalculateMode = true,
DesiredResultSet = IntellisenseDesiredResultSet.ClosestMatch
};
CalculateIntellisenseProvider calculateIntellisenseProvider = GetCalculateProvider(false);
IList<IntellisenseProviderResult> results = calculateIntellisenseProvider.GetIntellisenseResults(context);
Assert.AreEqual(4, results.Count);
Assert.AreEqual("search", results[0].Name);
Assert.AreEqual("searchb", results[1].Name);
Assert.AreEqual("second", results[2].Name);
Assert.AreEqual("seriessum", results[3].Name);
}
示例9: GetIntellisenseResults
public IList<IntellisenseProviderResult> GetIntellisenseResults(IntellisenseProviderContext context)
{
var results = new List<IntellisenseProviderResult>();
if(context.DesiredResultSet == IntellisenseDesiredResultSet.EntireSet)
{
FileSystemQuery.QueryList("");
FileSystemQuery.QueryCollection.ForEach(s => _intellisenseResults.Add(new IntellisenseProviderResult(this, s, string.Empty, string.Empty, false)));
results.AddRange(_intellisenseResults);
}
else
{
if(!InLiteralRegion(context.InputText, context.CaretPosition))
{
_intellisenseResults.Clear();
string searchText = context.InputText; //context.InputText.Substring(context.CaretPositionOnPopup, (context.CaretPosition - context.CaretPositionOnPopup));
FileSystemQuery.QueryList(searchText);
FileSystemQuery.QueryCollection.ForEach(s => _intellisenseResults.Add(new IntellisenseProviderResult(this, s, string.Empty, string.Empty, false)));
results.AddRange(_intellisenseResults);
}
}
return results;
}
示例10: PerformResultInsertion
public string PerformResultInsertion(string input, IntellisenseProviderContext context)
{
throw new NotSupportedException();
}
示例11: GetIntellisenseResultsWithOpenRegionAndInRecSetIndexAndWithFieldExpectedAllResults
public void GetIntellisenseResultsWithOpenRegionAndInRecSetIndexAndWithFieldExpectedAllResults()
{
var context = new IntellisenseProviderContext
{
CaretPosition = 9,
InputText = "[[City([[).Name]]",
DesiredResultSet = IntellisenseDesiredResultSet.Default
};
var getResults = new DefaultIntellisenseProvider().GetIntellisenseResults(context);
Assert.AreEqual(9, getResults.Count);
Assert.AreEqual("[[Scalar]]", getResults[0].ToString());
Assert.AreEqual("[[Country]]", getResults[1].ToString());
Assert.AreEqual("[[State]]", getResults[2].ToString());
Assert.AreEqual("[[City(", getResults[3].ToString());
Assert.AreEqual("[[City().Name]]", getResults[4].ToString());
Assert.AreEqual("[[City(*).Name]]", getResults[5].ToString());
Assert.AreEqual("[[City().GeoLocation]]", getResults[6].ToString());
Assert.AreEqual("[[City(*).GeoLocation]]", getResults[7].ToString());
Assert.AreEqual("Invalid Expression", getResults[8].ToString());
}
示例12: GetIntellisenseResultsWithInRecSetIndexAndWithFieldAndWithClosingSquareBraceExpectedNoResults
public void GetIntellisenseResultsWithInRecSetIndexAndWithFieldAndWithClosingSquareBraceExpectedNoResults()
{
var context = new IntellisenseProviderContext
{
CaretPosition = 13,
InputText = "[[City([[sca]).Name]]",
DesiredResultSet = IntellisenseDesiredResultSet.Default
};
var getResults = new DefaultIntellisenseProvider().GetIntellisenseResults(context);
Assert.AreEqual("Invalid expression: Opening and closing brackets dont match.", getResults[0].Description);
}
示例13: GetIntellisenseResultsWhereCarretPositionLessThanZeroExpectedNoResultsAndException
public void GetIntellisenseResultsWhereCarretPositionLessThanZeroExpectedNoResultsAndException()
{
var context = new IntellisenseProviderContext
{
CaretPosition = -1,
InputText = "Sum([[Scalar]],",
DesiredResultSet = IntellisenseDesiredResultSet.Default
};
var getResults = new DefaultIntellisenseProvider().GetIntellisenseResults(context);
Assert.AreEqual(0, getResults.Count);
}
示例14: GetIntellisenseResultsWhereCommaEnteredForInfragisticsFunctonExpectedNoResultsAndException
public void GetIntellisenseResultsWhereCommaEnteredForInfragisticsFunctonExpectedNoResultsAndException()
{
var context = new IntellisenseProviderContext
{
CaretPosition = 15,
InputText = "Sum([[Scalar]],",
DesiredResultSet = IntellisenseDesiredResultSet.Default
};
var getResults = new DefaultIntellisenseProvider().GetIntellisenseResults(context);
Assert.AreEqual(0, getResults.Count);
}
示例15: GetIntellisenseResultsWithSumAndAfterCommaAndBeforeBraceExpectedAllVarsInResults
public void GetIntellisenseResultsWithSumAndAfterCommaAndBeforeBraceExpectedAllVarsInResults()
{
var context = new IntellisenseProviderContext
{
CaretPosition = 17,
InputText = "Sum([[Scalar]],[[)",
DesiredResultSet = IntellisenseDesiredResultSet.EntireSet
};
var getResults = new DefaultIntellisenseProvider().GetIntellisenseResults(context);
Assert.AreEqual(9, getResults.Count);
Assert.AreEqual("[[Scalar]]", getResults[0].ToString());
Assert.AreEqual("[[Country]]", getResults[1].ToString());
Assert.AreEqual("[[State]]", getResults[2].ToString());
Assert.AreEqual("[[City(", getResults[3].ToString());
Assert.AreEqual("[[City().Name]]", getResults[4].ToString());
Assert.AreEqual("[[City(*).Name]]", getResults[5].ToString());
Assert.AreEqual("[[City().GeoLocation]]", getResults[6].ToString());
Assert.AreEqual("[[City(*).GeoLocation]]", getResults[7].ToString());
Assert.AreEqual("Invalid Expression", getResults[8].ToString());
}