void OnEditKeyPress(object s, Gtk.KeyPressEventArgs args)
        {
            Gtk.Entry entry = (Gtk.Entry)s;

            if (currentCompletionData != null)
            {
                bool ret = CompletionWindowManager.PreProcessKeyEvent(args.Event.Key, (char)args.Event.Key, args.Event.State);
                CompletionWindowManager.PostProcessKeyEvent(args.Event.Key, (char)args.Event.Key, args.Event.State);
                args.RetVal = ret;
            }

            Gtk.Application.Invoke(delegate {
                char c = (char)Gdk.Keyval.ToUnicode(args.Event.KeyValue);
                if (currentCompletionData == null && IsCompletionChar(c))
                {
                    string exp            = entry.Text.Substring(0, entry.CursorPosition);
                    currentCompletionData = GetCompletionData(exp);
                    if (currentCompletionData != null)
                    {
                        DebugCompletionDataList dataList = new DebugCompletionDataList(currentCompletionData);
                        CodeCompletionContext ctx        = ((ICompletionWidget)this).CreateCodeCompletionContext(entry.CursorPosition - currentCompletionData.ExpressionLenght);
                        CompletionWindowManager.ShowWindow(null, c, dataList, this, ctx);
                    }
                    else
                    {
                        currentCompletionData = null;
                    }
                }
            });
        }
Exemplo n.º 2
0
        async void PopupCompletion(Entry entry)
        {
            try {
                char c = (char)Gdk.Keyval.ToUnicode(keyValue);
                if (currentCompletionData == null && IsCompletionChar(c))
                {
                    string expr = entry.Text.Substring(0, entry.CursorPosition);
                    cts.Cancel();
                    cts = new CancellationTokenSource();
                    if (valueTree.Frame == null)
                    {
                        return;
                    }
                    currentCompletionData = await DebuggingService.GetCompletionDataAsync(valueTree.Frame, expr, cts.Token);

                    if (currentCompletionData != null)
                    {
                        DebugCompletionDataList dataList = new DebugCompletionDataList(currentCompletionData);
                        ctx = ((ICompletionWidget)this).CreateCodeCompletionContext(expr.Length - currentCompletionData.ExpressionLength);
                        CompletionWindowManager.ShowWindow(null, c, dataList, this, ctx);
                    }
                }
            } catch (OperationCanceledException) {
            }
        }
Exemplo n.º 3
0
        void PopupCompletion()
        {
            char c = (char)Gdk.Keyval.ToUnicode(keyValue);

            if (currentCompletionData == null && IsCompletionChar(c))
            {
                string expr = Buffer.GetText(TokenBegin, Cursor, false);
                currentCompletionData = GetCompletionData(expr);
                if (currentCompletionData != null)
                {
                    DebugCompletionDataList dataList = new DebugCompletionDataList(currentCompletionData);
                    ctx = ((ICompletionWidget)this).CreateCodeCompletionContext(expr.Length - currentCompletionData.ExpressionLength);
                    CompletionWindowManager.ShowWindow(null, c, dataList, this, ctx);
                }
                else
                {
                    currentCompletionData = null;
                }
            }
        }
        void PopupCompletion(Entry entry)
        {
            char c = (char)Gdk.Keyval.ToUnicode(keyValue);

            if (currentCompletionData == null && IsCompletionChar(c))
            {
                string expr = entry.Text.Substring(0, entry.CursorPosition);
                currentCompletionData = GetCompletionData(expr);
                if (currentCompletionData != null)
                {
                    DebugCompletionDataList dataList = new DebugCompletionDataList(currentCompletionData);
                    ctx = ((ICompletionWidget)this).CreateCodeCompletionContext(expr.Length - currentCompletionData.ExpressionLength);
                    CompletionWindowManager.ShowWindow(null, c, dataList, this, ctx);
                }
                else
                {
                    currentCompletionData = null;
                }
            }
        }