SearchCompletions() приватный Метод

Matches the completion string with classes and global methods and properties loaded in the session
private SearchCompletions ( string stringToComplete, Guid guid, ElementResolver resolver = null ) : IEnumerable
stringToComplete string current string being typed which is to be completed
guid Guid code block node guid to identify current node being typed
resolver ElementResolver
Результат IEnumerable
Пример #1
0
        public void TestHiddenConflictingClassCompletionWhenTyping()
        {
            var codeCompletionServices = new CodeCompletionServices(libraryServicesCore);

            // "SecondNamespace.AnotherClassWithNameConflict" is defined in FFITarget library with "IsVisibleInDynamoLibrary" 
            // attribute set to false. We verify that this class does not appear in code completion results
            // and that only "FirstNamespace.AnotherClassWithNameConflict" appears in code completion results with
            // fully qualified name so that it can be resolved against "SecondNamespace.AnotherClassWithNameConflict" 
            string code = "ano";
            var completions = codeCompletionServices.SearchCompletions(code, Guid.Empty);

            // Expected 1 completion items
            Assert.AreEqual(1, completions.Count());

            string[] expected = { "AnotherClassWithNameConflict" };
            var actual = completions.Select(x => x.Text).OrderBy(x => x);

            Assert.AreEqual(expected, actual);

            // Assert that the class name is indeed a class
            ClassMirror type = null;
            Assert.DoesNotThrow(() => type = new ClassMirror("FirstNamespace.AnotherClassWithNameConflict", libraryServicesCore));

            var members = type.GetMembers();

            expected = new[] { "AnotherClassWithNameConflict", "PropertyA", "PropertyB", "PropertyC" };
            AssertCompletions(members, expected);
        }
Пример #2
0
        public void TestMethodKeywordCompletionWhenTyping()
        {
            var codeCompletionServices = new CodeCompletionServices(libraryServicesCore);
            string code = "im";
            var completions = codeCompletionServices.SearchCompletions(code, Guid.Empty);

            // Expected 5 completion items
            Assert.AreEqual(5, completions.Count());

            string[] expected = { "Decimal", "Imperative", "ImportFromCSV", "Minimal", "MinimalTracedClass" };
            var actual = completions.Select(x => x.Text).OrderBy(x => x);

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void TestHiddenClassCompletionWhenTyping()
        {
            var codeCompletionServices = new CodeCompletionServices(libraryServicesCore);

            // "SampleClassB" defined in FFITarget library with "IsVisibleInDynamoLibrary" attribute
            // is set to false. We verify that this class does not appear in code completion results
            string code = "sam";
            var completions = codeCompletionServices.SearchCompletions(code, Guid.Empty);

            // Expected 2 completion items
            Assert.AreEqual(3, completions.Count());

            string[] expected = { "SampleClassA", "SampleClassC", "TestSamePropertyName" };
            var actual = completions.Select(x => x.Text).OrderBy(x => x);

            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void TestCompletionWhenTyping()
        {
            var codeCompletionServices = new CodeCompletionServices(libraryServicesCore);
            string code = "Poi";
            var completions = codeCompletionServices.SearchCompletions(code, Guid.Empty);

            // Expected 4 completion items
            Assert.AreEqual(8, completions.Count());

            string[] expectedValues = {"DummyPoint", "DesignScript.Point",
                                    "Dynamo.Point", "UnknownPoint", "DummyPoint2D", "Point_1D", "Point_2D", "Point_3D"};
            var expected = expectedValues.OrderBy(x => x);
            var actual = completions.Select(x => x.Text).OrderBy(x => x);

            Assert.AreEqual(expected, actual);
        }