void editor_TextArea_TextEntered(object sender, TextCompositionEventArgs e)
        {
            if (e.Text == ".")
            {
                DebuggerCompletionContext context = null;
                StackFrame frame = WindowsDebugger.CurrentStackFrame;
                if (frame == null)
                {
                    if (DebugContext != null)
                    {
                        context = DebugContext;
                    }
                }
                else
                {
                    context = new DebuggerCompletionContext(frame);
                }
                if (context == null)
                {
                    return;
                }
                var binding = DebuggerDotCompletion.PrepareDotCompletion(editor.Text.Substring(0, editor.CaretOffset), context);
                if (binding == null)
                {
                    return;
                }
                binding.HandleKeyPressed(editorAdapter, '.');
                SD.ParserService.ParseFileAsync(context.FileName).FireAndForget();
            }
            else
            {
                // TODO : implement automated error checking CSharpParser.ParseExpression does not report useful error messages.
//				Error[] errors;
//				if (!DebuggerDotCompletion.CheckSyntax(Text, out errors)) {
//					StringBuilder output = new StringBuilder();
//					foreach (var error in errors) {
//						output.AppendLine(error.Message + " at " + error.Region.Begin);
//					}
//					messageView.Content = output.ToString();
//					messageView.IsOpen = true;
//				} else {
//					messageView.IsOpen = false;
//				}
            }
        }
Exemplo n.º 2
0
        void editor_TextArea_TextEntered(object sender, TextCompositionEventArgs e)
        {
            if (e.Text == ".")
            {
                StackFrame frame = WindowsDebugger.CurrentStackFrame;
                if (frame != null)
                {
                    ContextFileName     = new FileName(frame.NextStatement.Filename);
                    ContextTextLocation = new TextLocation(frame.NextStatement.StartLine, frame.NextStatement.StartColumn);
                }
                if (ContextFileName == null)
                {
                    return;
                }
                var binding = DebuggerDotCompletion.PrepareDotCompletion(editor.Text.Substring(0, editor.CaretOffset), SD.ParserService.ResolveContext(ContextFileName, ContextTextLocation));
                if (binding == null)
                {
                    return;
                }
                binding.HandleKeyPressed(editorAdapter, '.');
            }
            else
            {
                // TODO : implement automated error checking CSharpParser.ParseExpression does not report useful error messages.
//				Error[] errors;
//				if (!DebuggerDotCompletion.CheckSyntax(Text, out errors)) {
//					StringBuilder output = new StringBuilder();
//					foreach (var error in errors) {
//						output.AppendLine(error.Message + " at " + error.Region.Begin);
//					}
//					messageView.Content = output.ToString();
//					messageView.IsOpen = true;
//				} else {
//					messageView.IsOpen = false;
//				}
            }
        }