本文整理汇总了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();
}
}
}
示例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__");
}
}
}
示例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__");
}
}
}
示例4: SigHelpInClass
public void SigHelpInClass() {
using (var view = new PythonEditor()) {
view.Type("class C(): pass");
view.MoveCaret(1, 9);
view.ParamInfo();
view.View.AssertNoIntellisenseSession();
}
}
示例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;
}
}
}
}
示例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");
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例9: DecoratorNonCompletions
public void DecoratorNonCompletions() {
using (var view = new PythonEditor()) {
view.Type("a = b @");
view.View.AssertNoIntellisenseSession();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}