public async Task AddFilesToPendingChanges()
        {
            var context = new IndexTestContext(this);
            var f1      = context.AddFileToRoot($"{_rootPath}/fileA.py", MakeStream(""));
            var f2      = context.AddFileToRoot($"{_rootPath}/fileB.py", MakeStream(""));

            var indexManager = context.GetDefaultIndexManager();
            await indexManager.IndexWorkspace();

            indexManager.AddPendingDoc(DocumentWithAst("y = 1", f1));
            indexManager.AddPendingDoc(DocumentWithAst("x = 1", f2));

            context.SetIdleEvent(Raise.Event());

            var symbols = await indexManager.WorkspaceSymbolsAsync("", maxSymbolsCount);

            symbols.Should().HaveCount(2);
        }
Beispiel #2
0
        public async Task AddsRootDirectoryAsync()
        {
            var context = new IndexTestContext(this);

            context.FileWithXVarInRootDir();
            context.AddFileToRoot($"{_rootPath}\foo.py", MakeStream("y = 1"));

            var indexManager = context.GetDefaultIndexManager();

            var symbols = await indexManager.WorkspaceSymbolsAsync("", maxSymbolsCount);

            symbols.Should().HaveCount(2);
        }
Beispiel #3
0
        public async Task WorkspaceSymbolsLimited()
        {
            var context = new IndexTestContext(this);

            for (int fileNumber = 0; fileNumber < 10; fileNumber++)
            {
                context.AddFileToRoot($"{_rootPath}\bla{fileNumber}.py", MakeStream($"x{fileNumber} = 1"));
            }
            var indexManager = context.GetDefaultIndexManager();

            const int amountOfSymbols = 3;

            var symbols = await indexManager.WorkspaceSymbolsAsync("", amountOfSymbols);

            symbols.Should().HaveCount(amountOfSymbols);
        }