Exemplo n.º 1
0
        private bool StartShowTooltip(Vector2 pos, bool showMethodOverloads)
        {
            if (!isEnabled)
            {
                return(true);
            }

            if (useMultiThreading)
            {
                if (UIDEThreadPool.IsRegistered("AutoComplete_UpdateTooltip"))
                {
                    wantsTooltipUpdate          = true;
                    wantsTooltipUpdateOverloads = showMethodOverloads;
                    return(false);
                }
                toolTipPos         = pos;
                wantsTooltipUpdate = false;

                UIDEThreadPool.RegisterThread("AutoComplete_UpdateTooltip", StartShowTooltipActual, new System.Object[] { toolTipPos, showMethodOverloads });
            }
            else
            {
                toolTipPos         = pos;
                wantsTooltipUpdate = false;
                StartShowTooltipActual(new System.Object[] { toolTipPos, showMethodOverloads });
            }
            return(true);
        }
        private bool UpdateChainResolver()
        {
            if (editor.editorWindow.generalSettings.GetDisableCompletion())
            {
                return(true);
            }
            if (editor.editorWindow.generalSettings.GetForceGenericAutoComplete())
            {
                return(true);
            }
            if (useMultiThreading)
            {
                if (UIDEThreadPool.IsRegistered("SRCSUS_UpdateChainResolver"))
                {
                    wantsChainResolverUpdate = true;
                    return(false);
                }
                wantsChainResolverUpdate = false;
                UIDEThreadPool.RegisterThread("SRCSUS_UpdateChainResolver", UpdateChainResolverActual);
            }
            else
            {
                wantsChainResolverUpdate = false;
                UpdateChainResolverActual(null);
            }

            return(true);
        }
        private bool Reparse()
        {
            if (editor.editorWindow.generalSettings.GetDisableCompletion())
            {
                return(true);
            }
            if (editor.editorWindow.generalSettings.GetForceGenericAutoComplete())
            {
                return(true);
            }

            if (useMultiThreading)
            {
                if (UIDEThreadPool.IsRegistered("SRCSUS_Reparse") || editor.editorWindow.time - lastReparseTime <= 1.0f)
                {
                    wantsParserUpdate = true;
                    return(false);
                }
                lastReparseTime   = editor.editorWindow.time;
                wantsParserUpdate = false;
                UIDEThreadPool.RegisterThread("SRCSUS_Reparse", ReparseActual);
            }
            else
            {
                wantsParserUpdate = false;
                ReparseActual(null);
            }

            return(true);
        }
Exemplo n.º 4
0
 public override void OnTextEditorUpdate()
 {
     if (wantsParserUpdate && editor.editorWindow.time - lastParseTime > reparseDelay)
     {
         if (!UIDEThreadPool.IsRegistered("InlineErrorHighlighter_Parse"))
         {
             wantsParserUpdate = false;
             lastParseTime     = editor.editorWindow.time;
             UIDEThreadPool.RegisterThread("InlineErrorHighlighter_Parse", UpdateParser);
         }
     }
     mouseOverError = null;
 }
 public bool UpdateMultilineFormatting()
 {
     if (useMultiThreading)
     {
         if (UIDEThreadPool.IsRegistered("SRCSUS_UpdateMultilineFormatting"))
         {
             wantsMultiLineFormattingUpdate = true;
             return(false);
         }
         wantsMultiLineFormattingUpdate = false;
         UIDEThreadPool.RegisterThread("SRCSUS_UpdateMultilineFormatting", UpdateMultilineFormattingActual);
     }
     else
     {
         wantsMultiLineFormattingUpdate = false;
         UpdateMultilineFormattingActual(null);
     }
     return(true);
 }
Exemplo n.º 6
0
 public bool TryStartUpdateAutoCompleteList(bool isChain)
 {
     if (!isEnabled)
     {
         return(true);
     }
     if (useMultiThreading)
     {
         if (UIDEThreadPool.IsRegistered("AutoComplete_UpdateAutoCompleteList"))
         {
             wantsChainUpdate        = isChain;
             wantsAutoCompleteUpdate = true;
             return(false);
         }
         wantsAutoCompleteUpdate = false;
         UIDEThreadPool.RegisterThread("AutoComplete_UpdateAutoCompleteList", UpdateAutoCompleteList, isChain);
     }
     else
     {
         wantsAutoCompleteUpdate = false;
         UpdateAutoCompleteList(isChain);
     }
     return(true);
 }
Exemplo n.º 7
0
        public override void OnTextEditorUpdate()
        {
            if (!isEnabled)
            {
                return;
            }

            if (newVisibleState != visible)
            {
                visible = newVisibleState;
                editor.editorWindow.Repaint();
            }

            if (visible)
            {
                Rect blockRect = rect;
                blockRect.x -= editor.doc.scroll.x;
                blockRect.y -= editor.doc.scroll.y;
                editor.clickBlockers.Add(CreateClickBlocker(blockRect));

                editor.disabledKeys.Add(KeyCode.UpArrow);
                editor.disabledKeys.Add(KeyCode.DownArrow);
            }
            if (isShowingMethodOverloadTooltip)
            {
                editor.disabledKeys.Add(KeyCode.UpArrow);
                editor.disabledKeys.Add(KeyCode.DownArrow);
            }
            if (wantsAutoCompleteUpdate)
            {
                if (TryStartUpdateAutoCompleteList(wantsChainUpdate))
                {
                    wantsAutoCompleteUpdate = false;
                }
            }
            if (wantsFunishedUpdateAutoComplete)
            {
                OnFinishUpdateAutoCompleteListActual();
            }

            if (wantsTooltipUpdate)
            {
                if (StartShowTooltip(toolTipPos, wantsTooltipUpdateOverloads))
                {
                    wantsTooltipUpdate          = false;
                    wantsTooltipUpdateOverloads = false;
                }
            }

            if (lastScroll != editor.doc.scroll)
            {
                HideToolTip();
                lastScroll = editor.doc.scroll;
            }

            if (!genericMode)
            {
                if (lastMousePos != editor.windowMousePos || !editor.editorWindow.canTextEditorInteract)
                {
                    if (showTooltip && !isShowingMethodOverloadTooltip)
                    {
                        HideToolTip();
                    }
                    dontShowToolTipAgain = false;
                    cancelTooltip        = false;
                    lastMouseMoveTime    = Time.realtimeSinceStartup;
                }
                else
                {
                    if (Time.realtimeSinceStartup - lastMouseMoveTime >= tooltipPopupTime && editor.textEditorNoScrollBarRect.Contains(editor.windowMousePosWithTabBar))
                    {
                        if (!showTooltip && !dontShowToolTipAgain && (!UIDEThreadPool.IsRegistered("AutoComplete_UpdateTooltip")) && !wantsTooltipUpdate)
                        {
                            if (editor.TestClickBlockers(editor.windowMousePos))
                            {
                                Vector2 cursorPos   = editor.ScreenSpaceToCursorSpace(editor.windowMousePos);
                                bool    isValidChar = char.IsLetterOrDigit(editor.doc.GetCharAt(cursorPos));
                                if (isValidChar)
                                {
                                    StartShowTooltip(cursorPos, false);
                                }
                            }
                            dontShowToolTipAgain = true;
                        }
                    }
                }
            }
            lastMousePos = editor.windowMousePos;
        }