Esempio n. 1
0
        public void Second_argument_empty_Then_suggests_subrutines()
        {
            string file        = @"
sub test1()
    UO.Print('param1',
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 23);

            completions.ShouldContainLabel("test1");
        }
Esempio n. 2
0
        public void Second_paramter_empty_Then_suggests_native_subrutines_without_namespace()
        {
            string file        = @"
sub test1()
    UO.Print('param1',
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 23);

            completions.ShouldContainLabel("wait", "str", "val");
        }
Esempio n. 3
0
        public void Statement_call_with_UO_prefix_Then_no_statement_keywords()
        {
            string file        = @"
sub test1()
    UO.
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 8);

            completions.ShouldNotContainLabel("if", "repeat");
        }
Esempio n. 4
0
        public void Argument_UO_namespace_Then_suggests_UO_subrutines()
        {
            string file        = @"
sub test1()
    UO.Print(UO.
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 17);

            completions.ShouldContainLabel("attack");
        }
Esempio n. 5
0
        public void Empty_statement_line_Then_suggests_no_native_subrutines_in_UO_namespace()
        {
            string file        = @"
sub test1()
    
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 5);

            completions.ShouldNotContainLabel("attack", "ignore");
        }
Esempio n. 6
0
        public void Argument_statement_call_with_UO_prefix_after_dot()
        {
            string file        = @"
sub test1()
    UO.Print(UO.
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 17);

            completions.ShouldContainLabel("ignore", "attack");
        }
Esempio n. 7
0
        public void Global_native_subrutine_prefix_Then_suggests_global_native_subrutine()
        {
            string file        = @"
sub test1()
    wa
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 7);

            completions.ShouldContainLabel("wait");
        }
Esempio n. 8
0
        public void Statement_call_with_UO_prefix_without_dot_Then_no_subrutines_in_UO_namespace()
        {
            string file        = @"
sub test1()
    UO
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 7);

            completions.ShouldNotContainLabel("ignore", "attack");
        }
Esempio n. 9
0
        public void Second_argument_empty_Then_suggests_no_native_subrutines_in_UO_namespace()
        {
            string file        = @"
sub test1()
    UO.Print('param1',
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 23);

            completions.ShouldNotContainLabel("attack", "ignore");
        }
Esempio n. 10
0
        public void Second_argument_global_native_subrutine_prefix_Then_suggests_global_native_subrutine()
        {
            string file        = @"
sub test1()
    UO.Print('param1',s
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 24);

            completions.ShouldContainLabel("str");
        }
Esempio n. 11
0
        public void Argument_empty_operand_Then_suggests_arguments()
        {
            string file = @"
sub test1(myParam, yourParam)
    UO.Print('x' + )
end sub";

            var completer   = new Completer();
            var completions = completer.GetCompletions(file, 3, 20);

            completions.ShouldContainLabel("myParam", "yourParam");
        }
Esempio n. 12
0
        public void UO_prefix_Then_suggests_UO_namespace()
        {
            string file        = @"
sub test1()
    U  
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 6);

            completions.ShouldContainLabel("UO");
        }
Esempio n. 13
0
        public void Empty_statement_line_Then_suggests_subrutines()
        {
            string file        = @"
sub test1()
    
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 5);

            completions.ShouldContainLabel("test1");
        }
Esempio n. 14
0
        public void Second_argument_UO_prefix_Then_suggests_UO_namespace()
        {
            string file        = @"
sub test1()
    UO.Print('param1',U
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 24);

            completions.ShouldContainLabel("UO");
        }
Esempio n. 15
0
        public void Empty_statement_line_Then_suggests_native_subrutines_without_namespace()
        {
            string file        = @"
sub test1()
    
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 5);

            completions.ShouldContainLabel("wait", "str", "val");
        }
Esempio n. 16
0
        public void Empty_statement_line_Then_suggests_flow_statement_keywords()
        {
            string file        = @"
sub test1()
    
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 5);

            completions.ShouldContainLabel("if", "else", "end if", "repeat", "until", "while", "wend",
                                           "for", "next", "return", "goto", "var", "dim");
        }
Esempio n. 17
0
        public void Second_argument_statement_keyword_prefix_Then_suggests_flow_statement_keywords()
        {
            string file        = @"
sub test1()
    UO.Print('param1',el
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 25);

            completions.ShouldNotContainLabel("if", "else", "end if", "repeat", "until", "while", "wend",
                                              "for", "next", "return", "goto", "var", "dim");
        }
Esempio n. 18
0
        public void Assignment_empty_operand_Then_suggests_arguments()
        {
            string file = @"
sub test1(myParam, yourParam)
     var x = 123 + my
end sub";

            var completer   = new Completer();
            var completions = completer.GetCompletions(file, 3, 22);

            completions.ShouldContainLabel("myParam");
            completions.ShouldNotContainLabel("yourParam");
        }
Esempio n. 19
0
        public void Assignment_empty_operand_Then_suggests_subrutines_without_namespace()
        {
            string file = @"
sub test1()
    var x = 123 + 
end sub";

            var completer   = new Completer();
            var completions = completer.GetCompletions(file, 3, 19);

            completions.ShouldContainLabel("str");
            completions.ShouldNotContainLabel("attack");
            completions.ShouldNotContainLabel("if");
        }
Esempio n. 20
0
        public void Argument_operand_with_UO_namespace_Then_suggests_UO_namespace_subrutines()
        {
            string file = @"
sub test1()
    UO.Print('x' + UO.)
end sub";

            var completer   = new Completer();
            var completions = completer.GetCompletions(file, 3, 23);

            completions.ShouldNotContainLabel("str");
            completions.ShouldContainLabel("attack");
            completions.ShouldNotContainLabel("if");
        }
Esempio n. 21
0
        public void First_argument_global_native_subrutine_prefix_Second_parameter_UO_prefix_Then_suggests_global_native_subrutine_for_first_parameter()
        {
            string file        = @"
sub test1()
    UO.Print(s,UO.
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 15);

            completions.ShouldContainLabel("str");
            completions.ShouldNotContainLabel("attack");
            completions.ShouldNotContainLabel("if");
        }
Esempio n. 22
0
        public Task <CompletionList> Handle(CompletionParams request, CancellationToken cancellationToken)
        {
            if (!injectionWorkspace.TryGetDocument(request.TextDocument.Uri, out var fileContent))
            {
                return(Task.FromResult(new CompletionList()));
            }

            var completer = new Completer();

            var completions = completer.GetCompletions(fileContent,
                                                       (int)request.Position.Line + 1, (int)request.Position.Character + 1);

            return(Task.FromResult(completions));
        }
Esempio n. 23
0
        public void Subrutine_prefix_Then_suggests_subrutine_names()
        {
            string file        = @"
sub test1()
    te   
end sub

sub test_subrutine()
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 7);

            completions.ShouldContainLabel("test1", "test_subrutine");
        }
Esempio n. 24
0
        public void Second_argument_subrutine_prefix_Then_suggests_subrutine_names()
        {
            string file        = @"
sub test1()
    UO.Print('param1',te
end sub

sub test_subrutine()
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 25);

            completions.ShouldContainLabel("test1", "test_subrutine");
        }
Esempio n. 25
0
        public void Outside_subrutine_Then_suggests_sub()
        {
            string file = @"

sub test1()
end sub";

            var completer   = new Completer();
            var completions = completer.GetCompletions(file, 2, 1);

            completions.ShouldNotContainLabel("str");
            completions.ShouldNotContainLabel("attack");
            completions.ShouldNotContainLabel("if");
            completions.ShouldContainLabel("sub", "end sub");
        }
Esempio n. 26
0
        public void Argument_list_empty_and_closed_Then_suggests_everything_except_flow_statement_keywords()
        {
            string file        = @"
sub test()
   UO.Print()
end sub
";
            var    completer   = new Completer();
            var    completions = completer.GetCompletions(file, 3, 13);

            completions.ShouldContainLabel("test");
            completions.ShouldContainLabel("UO");
            completions.ShouldContainLabel("str");
            completions.ShouldNotContainLabel("if", "else", "end if", "repeat", "until", "while", "wend",
                                              "for", "next", "return", "goto", "var", "dim");
        }
Esempio n. 27
0
        public void Argument_empty_operand_Then_suggests_variables()
        {
            string file = @"
sub test1()
    var myVariableBefore
    dim myDimBefore = 123

    UO.Print('x' + )

    var myVariableAfter
    dim myDimAfter = 123
end sub";

            var completer   = new Completer();
            var completions = completer.GetCompletions(file, 6, 20);

            completions.ShouldContainLabel("myVariableBefore", "myDimBefore");
            completions.ShouldNotContainLabel("myVariableAfter", "myDimAfter");
        }
Esempio n. 28
0
        public void Assignment_empty_operand_Then_suggests_variables_defined_before_assignment()
        {
            string file = @"
sub test1()
    var myVariableBefore
    dim myDimBefore

    var x = 123 + my

    var myVariableAfter
    dim myDimAfter
end sub";

            var completer   = new Completer();
            var completions = completer.GetCompletions(file, 6, 21);

            completions.ShouldContainLabel("myVariableBefore", "myDimBefore");
            completions.ShouldNotContainLabel("myVariableAfter", "myDimAfter");
        }