當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。