本文整理汇总了C#中PythonToolsMockTests.PythonEditor.GetCompletionList方法的典型用法代码示例。如果您正苦于以下问题:C# PythonEditor.GetCompletionList方法的具体用法?C# PythonEditor.GetCompletionList怎么用?C# PythonEditor.GetCompletionList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PythonToolsMockTests.PythonEditor
的用法示例。
在下文中一共展示了PythonEditor.GetCompletionList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrueFalseNoneCompletions
public void TrueFalseNoneCompletions() {
// http://pytools.codeplex.com/workitem/1905
foreach (var version in new[] { PythonLanguageVersion.V27, PythonLanguageVersion.V33 }) {
using (var view = new PythonEditor(version: version)) {
var completionList = view.GetCompletionList(0);
var trueItems = completionList.Where(t => t.DisplayText == "True").ToArray();
var falseItems = completionList.Where(t => t.DisplayText == "False").ToArray();
var noneItems = completionList.Where(t => t.DisplayText == "None").ToArray();
Assert.AreEqual(1, trueItems.Count());
Assert.AreEqual(1, falseItems.Count());
Assert.AreEqual(1, noneItems.Count());
if (version.Is3x()) {
Assert.AreEqual("Keyword", trueItems[0].IconAutomationText);
Assert.AreEqual("Keyword", falseItems[0].IconAutomationText);
} else {
Assert.AreEqual("Constant", trueItems[0].IconAutomationText);
Assert.AreEqual("Constant", falseItems[0].IconAutomationText);
}
Assert.AreEqual("Keyword", noneItems[0].IconAutomationText);
}
}
}
示例2: NormalOverrideCompletions
public void NormalOverrideCompletions() {
using (var view2 = new PythonEditor(version: PythonLanguageVersion.V27))
using (var view3 = new PythonEditor(version: PythonLanguageVersion.V33)) {
foreach (var code in new[] {
@"class Fob(object):
def func_a(self, a=100): pass
def func_b(self, b, *p, **kw): pass
class Baz(Fob):
def None
",
@"class Fob(object):
def func_a(self, a=100): pass
class Oar(Fob):
def func_b(self, b, *p, **kw): pass
class Baz(Oar):
def None
",
@"class Fob(object):
def func_a(self, a=100): pass
class Oar(object):
def func_b(self, b, *p, **kw): pass
class Baz(Fob, Oar):
def None
",
@"class Fob(object):
def func_a(self, a=100): pass
def func_b(self, b, *p, **kw): pass
def func_c(self): pass
class Baz(Fob):
def func_c(self): pass
def None
",
@"class Fob(object):
def func_a(self, a=100): pass
def func_c(self): pass
class Oar(Fob):
def func_b(self, b, *p, **kw): pass
class Baz(Oar):
def func_c(self): pass
def None
",
@"class Fob(object):
def func_a(self, a=100): pass
class Oar(object):
def func_b(self, b, *p, **kw): pass
def func_c(self): pass
class Baz(Fob, Oar):
def func_c(self): pass
def None
"}) {
view2.Text = code;
Console.WriteLine(code);
AssertUtil.ContainsAtLeast(
view2.GetCompletionList(code.IndexOf("None")).Select(c => c.InsertionText),
@"func_a(self, a = 100):
return super(Baz, self).func_a(a)",
@"func_b(self, b, *p, **kw):
return super(Baz, self).func_b(b, *p, **kw)"
);
view3.Text = code;
AssertUtil.ContainsAtLeast(
view3.GetCompletionList(code.IndexOf("None")).Select(c => c.InsertionText),
@"func_a(self, a = 100):
return super().func_a(a)",
@"func_b(self, b, *p, **kw):
return super().func_b(b, *p, **kw)"
);
}
}
}
示例3: GetCompletionList
private static List<Completion> GetCompletionList(MockVs vs, int index, string code, PythonLanguageVersion version = PythonLanguageVersion.V27) {
using (var view = new PythonEditor(code, version, vs)) {
return view.GetCompletionList(index);
}
}