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


C# PythonEditor.Type方法代码示例

本文整理汇总了C#中PythonToolsMockTests.PythonEditor.Type方法的典型用法代码示例。如果您正苦于以下问题:C# PythonEditor.Type方法的具体用法?C# PythonEditor.Type怎么用?C# PythonEditor.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PythonToolsMockTests.PythonEditor的用法示例。


在下文中一共展示了PythonEditor.Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AutoListIdentifierCompletions

        public void AutoListIdentifierCompletions()
        {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.AutoListIdentifiers = true;

                view.Type("a = ");

                foreach (var c in "abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
                    // x<space> should bring up a completion session
                    Console.WriteLine("Typing {0}", c);
                    view.Type(c.ToString());

                    using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                        sh.Session.Dismiss();
                    }

                    view.Backspace();
                }

                view.View.AssertNoIntellisenseSession();

                // x<space> should not bring up a completion session
                // Don't check too many items, since asserting that no session
                // starts is slow.
                foreach (var c in "1234567890([{") {
                    Console.WriteLine("Typing {0}", c);
                    view.Type(c.ToString());

                    view.View.AssertNoIntellisenseSession();

                    view.Backspace();
                }
            }
        }
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: FilterCompletions

        public void FilterCompletions() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.Contains(sh.Session.Completions(), "__call__");

                    view.Type("class");

                    AssertUtil.DoesntContain(sh.Session.Completions(), "__call__");
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:13,代码来源:EditorTests.cs

示例3: BuiltinFunctionCompletions

        public void BuiltinFunctionCompletions() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.Contains(sh.Session.Completions(), "__call__");
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:9,代码来源:EditorTests.cs

示例4: SigHelpInClass

        public void SigHelpInClass() {
            using (var view = new PythonEditor()) {
                view.Type("class C(): pass");
                view.MoveCaret(1, 9);

                view.ParamInfo();

                view.View.AssertNoIntellisenseSession();
            }
        }
开发者ID:zooba,项目名称:PTVS,代码行数:10,代码来源:EditorTests.cs

示例5: BuiltinFunctionSigHelp

        public void BuiltinFunctionSigHelp() {
            using (var view = new PythonEditor()) {
                view.Type("min(");

                for (int retries = 10; retries > 0; --retries) {
                    using (var sh = view.View.WaitForSession<ISignatureHelpSession>()) {
                        var doc = sh.Session.Signatures[0].Documentation;
                        if (doc.Contains("still being calculated")) {
                            view.VS.Sleep(100);
                            continue;
                        }
                        AssertUtil.AreEqual(new Regex(@"^min\(x\: object\).+?"), doc);
                        break;
                    }
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:17,代码来源:EditorTests.cs

示例6: CompletionsAtEndOfLastChildScope

        public void CompletionsAtEndOfLastChildScope() {
            using (var view = new PythonEditor(@"class A:
    def f(param1, param2):
        y = 234

        

class B:
    pass
")) {
                view.View.MoveCaret(5, 9);
                view.Type("p");
                view.View.MemberList();
                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "param1", "param2");
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:18,代码来源:EditorTests.cs

示例7: DisableAutoCompletions

        public void DisableAutoCompletions() {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.AutoListMembers = false;
                view.AdvancedOptions.AutoListIdentifiers = false;

                foreach (var t in new[] { "a", "a.", "import " }) {
                    Console.WriteLine("Typed " + t);
                    view.Type(t);

                    view.View.AssertNoIntellisenseSession();

                    view.View.Clear();
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:15,代码来源:EditorTests.cs

示例8: AutoListTest

        private void AutoListTest(string code, PythonLanguageVersion version, params int[] triggerAtIndex) {
            using (var view = new PythonEditor(version: version)) {
                view.AdvancedOptions.AutoListIdentifiers = true;
                view.AdvancedOptions.AutoListMembers = true;

                int lastStart = 0;
                string text;
                foreach (var _i in triggerAtIndex) {
                    bool expectCompletions = _i >= 0;
                    int expected = _i > 0 ? _i : -_i;

                    text = code.Substring(lastStart, expected - lastStart);
                    Console.WriteLine("Typing '{0}' [{1}, {2})", text, lastStart, expected);
                    view.Type(text);

                    view.View.AssertNoIntellisenseSession();
                    lastStart = expected;

                    if (expectCompletions) {
                        text = code.Substring(expected, 1);
                        Console.WriteLine("Typing '{0}' [{1}, {2}) and expect completions", text, expected, expected + 1);
                        view.Type(text);

                        using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                            sh.Session.Dismiss();
                        }

                        lastStart = expected + 1;
                    }
                }
                text = code.Substring(lastStart);
                if (!string.IsNullOrEmpty(text)) {
                    Console.WriteLine("Typing '{0}' [{1}, {2})", text, lastStart, code.Length);
                    view.Type(text);

                    view.View.AssertNoIntellisenseSession();
                }
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:39,代码来源:EditorTests.cs

示例9: DecoratorNonCompletions

        public void DecoratorNonCompletions() {
            using (var view = new PythonEditor()) {
                view.Type("a = b @");

                view.View.AssertNoIntellisenseSession();
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:7,代码来源:EditorTests.cs

示例10: EditAndGetCompletions

        private static IEnumerable<string> EditAndGetCompletions(
            MockVs vs,
            string code,
            string editText,
            int editInsert,
            string completeAfter,
            PythonLanguageVersion version = PythonLanguageVersion.V27
        ) {
            using (var view = new PythonEditor(code, version, vs)) {
                view.AdvancedOptions.HideAdvancedMembers = false;

                var snapshot = view.CurrentSnapshot;
                ITextVersion afterEditVersion = null;
                ManualResetEvent mre = new ManualResetEvent(false);
                view.View.TextView.TextBuffer.RegisterForNewAnalysis(entry => {
                    if (afterEditVersion != null &&
                    entry.BufferParser.GetAnalysisVersion(snapshot.TextBuffer).VersionNumber >= afterEditVersion.VersionNumber) {
                        mre.Set();
                    }
                });
                view.View.MoveCaret(new SnapshotPoint(snapshot, editInsert));
                view.Type(editText);
                afterEditVersion = view.CurrentSnapshot.Version;

                if (!mre.WaitOne(10000)) {
                    Assert.Fail("Failed to wait for new analysis");
                }
                var newSnapshot = view.CurrentSnapshot;
                Assert.AreNotSame(snapshot, newSnapshot);

                return view.GetCompletionsAfter(completeAfter);
            }
        }
开发者ID:RussBaz,项目名称:PTVS,代码行数:33,代码来源:CompletionTests.cs

示例11: TabCommits

        public void TabCommits() {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.EnterCommitsIntellisense = false;
                view.AdvancedOptions.AutoListMembers = true;
                view.AdvancedOptions.AutoListIdentifiers = false;
                view.AdvancedOptions.HideAdvancedMembers = false;

                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "__class__");

                    view.Type("class\t");
                }

                Assert.AreEqual("min.__class__", view.Text);
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:18,代码来源:EditorTests.cs

示例12: EnterCommitsCompleteNoNewLine

        public void EnterCommitsCompleteNoNewLine() {
            using (var view = new PythonEditor()) {
                view.AdvancedOptions.AddNewLineAtEndOfFullyTypedWord = true;
                view.AdvancedOptions.AutoListMembers = true;
                view.AdvancedOptions.AutoListIdentifiers = false;
                view.AdvancedOptions.HideAdvancedMembers = false;

                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "__class__");

                    view.Type("__class__\r");
                }
                Assert.AreEqual("min.__class__\r\n", view.Text);
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:17,代码来源:EditorTests.cs

示例13: EnterCommits

        public void EnterCommits() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.ContainsAtLeast(sh.Session.Completions(), "__class__");
                    view.Type("class\r");
                }

                Assert.AreEqual("min.__class__", view.Text);
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:12,代码来源:EditorTests.cs

示例14: NonIdentifierDismisses

        public void NonIdentifierDismisses() {
            using (var view = new PythonEditor()) {
                view.Type("min.");

                using (var sh = view.View.WaitForSession<ICompletionSession>()) {
                    AssertUtil.Contains(sh.Session.Completions(), "__call__");

                    view.Type("#");

                    Assert.IsTrue(sh.Session.IsDismissed);
                }
                view.View.AssertNoIntellisenseSession();
                Assert.AreEqual("min.#", view.Text);
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:15,代码来源:EditorTests.cs

示例15: EditAndGetCompletions

        private static IEnumerable<string> EditAndGetCompletions(
            MockVs vs,
            string code,
            string editText,
            int editInsert,
            string completeAfter,
            PythonLanguageVersion version = PythonLanguageVersion.V27
        ) {
            using (var view = new PythonEditor(code, version, vs)) {
                view.AdvancedOptions.HideAdvancedMembers = false;

                var snapshot = view.CurrentSnapshot;
                view.View.MoveCaret(new SnapshotPoint(snapshot, editInsert));
                view.Type(editText);

                var newSnapshot = view.CurrentSnapshot;
                Assert.AreNotSame(snapshot, newSnapshot);

                return view.GetCompletionsAfter(completeAfter);
            }
        }
开发者ID:sadapple,项目名称:PTVS,代码行数:21,代码来源:CompletionTests.cs


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