当前位置: 首页>>代码示例>>C#>>正文


C# PythonEditor.GetCompletionList方法代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:23,代码来源:CompletionTests.cs

示例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)"
                    );
                }
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:83,代码来源:CompletionTests.cs

示例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);
     }
 }
开发者ID:sadapple,项目名称:PTVS,代码行数:5,代码来源:CompletionTests.cs


注:本文中的PythonToolsMockTests.PythonEditor.GetCompletionList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。