Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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));
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }
Ejemplo 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");
        }