Beispiel #1
0
        public async Task CacheTest(bool cached)
        {
            if (!cached)
            {
                PackageIndex.ClearCache();
            }

            var content = @"x <- as.matrix(x)";
            var session = await TriggerSessionAsync(content, 13);

            var parametersInfo = session.Ast.GetSignatureInfoFromBuffer(session.EditorBuffer.CurrentSnapshot, 10);

            session.ApplicableSpan.Should().NotBeNull();
            session.QuickInfoContent.Should().ContainSingle()
            .Which.ToString().Should().StartWith("as.matrix(x, ...)");
        }
Beispiel #2
0
        public async Task QuickInfoSourceTest01(bool cached)
        {
            if (!cached)
            {
                PackageIndex.ClearCache();
            }
            string  content = @"x <- as.matrix(x)";
            AstRoot ast     = RParser.Parse(content);

            int                  caretPosition    = 15; // in arguments
            ITextBuffer          textBuffer       = new TextBufferMock(content, RContentTypeDefinition.ContentType);
            QuickInfoSource      quickInfoSource  = new QuickInfoSource(textBuffer, _editorShell);
            QuickInfoSessionMock quickInfoSession = new QuickInfoSessionMock(textBuffer, caretPosition);
            List <object>        quickInfoContent = new List <object>();

            quickInfoSession.TriggerPoint = new SnapshotPoint(textBuffer.CurrentSnapshot, caretPosition);
            var applicableSpan = await quickInfoSource.AugmentQuickInfoSessionAsync(ast, caretPosition, quickInfoSession, quickInfoContent);

            ParameterInfo parametersInfo = SignatureHelp.GetParametersInfoFromBuffer(ast, textBuffer.CurrentSnapshot, 10);

            applicableSpan.Should().NotBeNull();
            quickInfoContent.Should().ContainSingle()
            .Which.ToString().Should().StartWith("as.matrix(x, ..., data, nrow, ncol, byrow, dimnames, rownames.force)");
        }