public void RequireKeyboardCompletionBraceCompletionOn()
        {
            using (new OptionHolder("TextEditor", "Node.js", "BraceCompletion", true)) {
                using (var solution = BasicProject.Generate().ToVs()) {
                    var server = solution.OpenItem("Require", "server.js");
                    Keyboard.Type("require(ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require('addons')");

                    Keyboard.Type(")");
                    server.WaitForText("require('addons')");

                    Keyboard.Backspace(20);

                    Keyboard.Type("require('ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require('addons')");

                    Keyboard.Type("')");
                    server.WaitForText("require('addons')");

                    Keyboard.Backspace(20);

                    Keyboard.Type("require(\"ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require(\"addons\")");

                    Keyboard.Type("\")");
                    server.WaitForText("require(\"addons\")");

                    Keyboard.Backspace(20);

                    TypeRequireStatementAndSelectModuleName(false, server);
                    Keyboard.Type("ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require('addons')");

                    Keyboard.PressAndRelease(Key.Right);
                    Keyboard.PressAndRelease(Key.Right);
                    Keyboard.Backspace(20);

                    TypeRequireStatementAndSelectModuleName(true, server);
                    Keyboard.Type("ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require(\"addons\")");
                }
            }
        }
        public void BasicRequireCompletions()
        {
            using (new OptionHolder("TextEditor", "Node.js", "BraceCompletion", false)) {
                using (var solution = BasicProject.Generate().ToVs()) {
                    var server = solution.OpenItem("Require", "server.js");
                    Keyboard.Type("require(");

                    using (var completionSession = server.WaitForSession <ICompletionSession>()) {
                        Assert.AreEqual(1, completionSession.Session.CompletionSets.Count);

                        // we pick up built-ins, folders w/ package.json, and peers
                        AssertUtil.ContainsAtLeast(
                            completionSession.Session.GetDisplayTexts(),
                            "http",
                            "Foo",
                            "./myapp.js",
                            "./SomeFolder/baz.js",
                            "quox.js"
                            );

                        // we don't show our own file
                        AssertUtil.DoesntContain(completionSession.Session.GetDisplayTexts(), "./server.js");

                        AssertUtil.ContainsAtLeast(
                            completionSession.Session.GetInsertionTexts(),
                            "'http'",
                            "'Foo'",
                            "'./myapp.js'",
                            "'./SomeFolder/baz.js'",
                            "'quox.js'"
                            );

                        Keyboard.Type("htt");
                        server.WaitForText("require(htt");

                        // we should be filtered down
                        AssertUtil.ContainsExactly(
                            completionSession.Session.GetDisplayTexts(),
                            "http",
                            "https"
                            );

                        // this should trigger completion
                        Keyboard.Type(")");
                        server.WaitForText("require('http')");
                    }

                    Keyboard.Backspace(8);
                    server.WaitForText("require");

                    Keyboard.Type("(");
                    using (var completionSession = server.WaitForSession <ICompletionSession>()) {
                        Assert.AreEqual(1, completionSession.Session.CompletionSets.Count);

                        // this should dismiss the session and not complete anything
                        Keyboard.Type("'".ToString());
                        server.WaitForText("require('");

                        Assert.IsTrue(completionSession.Session.IsDismissed);
                    }

                    Keyboard.Backspace(2);
                    server.WaitForText("require");

                    Keyboard.Type("(");
                    using (var completionSession = server.WaitForSession <ICompletionSession>()) {
                        Assert.AreEqual(1, completionSession.Session.CompletionSets.Count);

                        // this should dismiss the session and not complete anything
                        Keyboard.Type("\"".ToString());
                        server.WaitForText("require(\"");

                        Assert.IsTrue(completionSession.Session.IsDismissed);
                    }
                }
            }
        }