Пример #1
0
        public void RSignature()
        {
            using (var script = new TestScript("```{r}\r\n\r\n```", MdContentTypeDefinition.ContentType)) {
                FunctionRdDataProvider.HostStartTimeout = 10000;
                using (new RHostScript(EditorShell.Current.ExportProvider.GetExportedValue <IRSessionProvider>())) {
                    FunctionIndex.Initialize();
                    FunctionIndex.BuildIndexAsync().Wait();
                    FunctionIndexUtility.GetFunctionInfoAsync("lm").Wait(3000);

                    script.MoveDown();
                    script.Type("x <- lm(");
                    script.DoIdle(2000);

                    ISignatureHelpSession session = script.GetSignatureSession();
                    session.Should().NotBeNull();
                    IParameter parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Should().NotBeNull();
                    parameter.Name.Should().Be("formula");

                    script.Type("sub");
                    script.DoIdle(500);
                    script.Type("{TAB}");
                    script.DoIdle(1000);

                    parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Name.Should().Be("subset");

                    string actual = script.EditorText;
                    actual.Should().Be("```{r}\r\nx <- lm(subset = )\r\n```");

                    session   = script.GetSignatureSession();
                    parameter = session.SelectedSignature.CurrentParameter;
                }
            }
        }
Пример #2
0
        public async Task R_SignatureParametersMatch()
        {
            using (var script = await _editorHost.StartScript(_coreShell, string.Empty, "file", RContentTypeDefinition.ContentType, _sessionProvider)) {
                await _editorHost.FunctionIndex.GetFunctionInfoAsync("lm");

                script.Type("x <- lm(");
                script.DoIdle(2000);

                ISignatureHelpSession session = script.GetSignatureSession();
                session.Should().NotBeNull();
                IParameter parameter = session.SelectedSignature.CurrentParameter;
                parameter.Should().NotBeNull();

                parameter.Name.Should().Be("formula");

                script.Type("sub");
                script.DoIdle(500);
                script.Type("{TAB}");
                script.DoIdle(1000);

                parameter = session.SelectedSignature.CurrentParameter;
                parameter.Name.Should().Be("subset");

                string actual = script.EditorText;
                actual.Should().Be("x <- lm(subset = )");

                session   = script.GetSignatureSession();
                parameter = session.SelectedSignature.CurrentParameter;
            }
        }
Пример #3
0
        public async Task R_SignatureSessionNavigation()
        {
            using (var script = await _editorHost.StartScript(_coreShell, string.Empty, "file", RContentTypeDefinition.ContentType, _sessionProvider)) {
                await _editorHost.FunctionIndex.GetFunctionInfoAsync("lm");

                script.Type("x <- lm(subset = a, sing");
                script.DoIdle(1000);
                script.Type("{TAB}");
                script.DoIdle(1000);

                ISignatureHelpSession session = script.GetSignatureSession();
                session.Should().NotBeNull();

                script.DoIdle(200);
                IParameter parameter = session.SelectedSignature.CurrentParameter;
                parameter.Should().NotBeNull();
                parameter.Name.Should().Be("singular.ok");

                script.MoveLeft(17);
                script.DoIdle(200);
                parameter = session.SelectedSignature.CurrentParameter;
                parameter.Name.Should().Be("subset");

                script.MoveRight(3);
                script.DoIdle(200);
                parameter = session.SelectedSignature.CurrentParameter;
                parameter.Name.Should().Be("singular.ok");
            }
        }
Пример #4
0
        public void R_SignatureSessionNavigation()
        {
            using (var script = new TestScript(RContentTypeDefinition.ContentType)) {
                FunctionRdDataProvider.HostStartTimeout = 10000;
                using (new RHostScript(EditorShell.Current.ExportProvider.GetExportedValue <IRSessionProvider>())) {
                    PrepareFunctionIndex();
                    FunctionIndexUtility.GetFunctionInfoAsync("lm").Wait(3000);

                    script.Type("x <- lm(subset = a, sing");
                    script.DoIdle(1000);
                    script.Type("{TAB}");
                    script.DoIdle(1000);

                    ISignatureHelpSession session = script.GetSignatureSession();
                    session.Should().NotBeNull();

                    script.DoIdle(200);
                    IParameter parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Should().NotBeNull();
                    parameter.Name.Should().Be("singular.ok");

                    script.MoveLeft(17);
                    script.DoIdle(200);
                    parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Name.Should().Be("subset");

                    script.MoveRight(3);
                    script.DoIdle(200);
                    parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Name.Should().Be("singular.ok");
                }
            }
        }
Пример #5
0
        public async Task R_SignatureSessionNavigation()
        {
            using (var script = await _editorHost.StartScript(_exportProvider, RContentTypeDefinition.ContentType)) {
                IntelliSenseRSession.HostStartTimeout = 10000;
                using (new RHostScript(_exportProvider)) {
                    var functionIndex = PrepareFunctionIndex();
                    PackageIndexUtility.GetFunctionInfoAsync(functionIndex, "lm").Wait(3000);

                    script.Type("x <- lm(subset = a, sing");
                    script.DoIdle(1000);
                    script.Type("{TAB}");
                    script.DoIdle(1000);

                    ISignatureHelpSession session = script.GetSignatureSession();
                    session.Should().NotBeNull();

                    script.DoIdle(200);
                    IParameter parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Should().NotBeNull();
                    parameter.Name.Should().Be("singular.ok");

                    script.MoveLeft(17);
                    script.DoIdle(200);
                    parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Name.Should().Be("subset");

                    script.MoveRight(3);
                    script.DoIdle(200);
                    parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Name.Should().Be("singular.ok");
                }
            }
        }
Пример #6
0
        public async Task R_SignatureParametersMatch()
        {
            using (var script = await _editorHost.StartScript(_exportProvider, RContentTypeDefinition.ContentType)) {
                IntelliSenseRSession.HostStartTimeout = 10000;
                using (new RHostScript(_exportProvider)) {
                    var functionIndex = PrepareFunctionIndex();
                    PackageIndexUtility.GetFunctionInfoAsync(functionIndex, "lm").Wait(3000);

                    script.Type("x <- lm(");
                    script.DoIdle(2000);

                    ISignatureHelpSession session = script.GetSignatureSession();
                    session.Should().NotBeNull();
                    IParameter parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Should().NotBeNull();

                    parameter.Name.Should().Be("formula");

                    script.Type("sub");
                    script.DoIdle(500);
                    script.Type("{TAB}");
                    script.DoIdle(1000);

                    parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Name.Should().Be("subset");

                    string actual = script.EditorText;
                    actual.Should().Be("x <- lm(subset = )");

                    session   = script.GetSignatureSession();
                    parameter = session.SelectedSignature.CurrentParameter;
                }
            }
        }
Пример #7
0
        public async Task RSignature()
        {
            using (var script = await _editorHost.StartScript(_coreShell, "```{r}\r\n\r\n```", "filename", MdContentTypeDefinition.ContentType, _sessionProvider)) {
                var info = await _editorHost.FunctionIndex.GetFunctionInfoAsync("lm");

                info.Should().NotBeNull();

                script.DoIdle(500);
                script.MoveDown();
                script.Type("x <- lm(");
                script.DoIdle(2000);

                ISignatureHelpSession session = script.GetSignatureSession();
                session.Should().NotBeNull();
                IParameter parameter = session.SelectedSignature.CurrentParameter;
                parameter.Should().NotBeNull();
                parameter.Name.Should().Be("formula");

                script.Type("sub");
                script.DoIdle(500);
                script.Type("{TAB}");
                script.DoIdle(1000);

                parameter = session.SelectedSignature.CurrentParameter;
                parameter.Name.Should().Be("subset");

                string actual = script.EditorText;
                actual.Should().Be("```{r}\r\nx <- lm(subset = )\r\n```");

                session   = script.GetSignatureSession();
                parameter = session.SelectedSignature.CurrentParameter;
            }
        }
Пример #8
0
        public async Task RSignature()
        {
            using (var script = await _editorHost.StartScript(_exportProvider, "```{r}\r\n\r\n```", MdContentTypeDefinition.ContentType)) {
                IntelliSenseRSession.HostStartTimeout = 10000;
                using (new RHostScript(_sessionProvider)) {
                    var packageIndex = _exportProvider.GetExportedValue <IPackageIndex>();
                    await packageIndex.BuildIndexAsync();

                    var functionIndex = _exportProvider.GetExportedValue <IFunctionIndex>();
                    PackageIndexUtility.GetFunctionInfoAsync(functionIndex, "lm").Wait(3000);

                    script.DoIdle(500);
                    script.MoveDown();
                    script.Type("x <- lm(");
                    script.DoIdle(2000);

                    ISignatureHelpSession session = script.GetSignatureSession();
                    session.Should().NotBeNull();
                    IParameter parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Should().NotBeNull();
                    parameter.Name.Should().Be("formula");

                    script.Type("sub");
                    script.DoIdle(500);
                    script.Type("{TAB}");
                    script.DoIdle(1000);

                    parameter = session.SelectedSignature.CurrentParameter;
                    parameter.Name.Should().Be("subset");

                    string actual = script.EditorText;
                    actual.Should().Be("```{r}\r\nx <- lm(subset = )\r\n```");

                    session   = script.GetSignatureSession();
                    parameter = session.SelectedSignature.CurrentParameter;
                }
            }
        }