示例#1
0
        /// <summary>
        /// Set default selected item in completion list
        /// </summary>
        static public void SelectItem(String name)
        {
            int p = name.IndexOf('<');

            if (p > 1)
            {
                name = name.Substring(0, p) + "<T>";
            }
            string pname = (name.IndexOf('.') < 0) ? "." + name : null;
            ICompletionListItem found = null;

            foreach (ICompletionListItem item in completionList.Items)
            {
                if (item.Label == name)
                {
                    defaultItem = item;
                    completionList.SelectedItem = item;
                    return;
                }
                if (pname != null && item.Label.EndsWith(pname))
                {
                    found = item;
                }
            }
            if (found != null)
            {
                defaultItem = found;
                completionList.SelectedItem = found;
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        static public bool ReplaceText(ScintillaControl sci, String tail, char trigger)
        {
            sci.BeginUndoAction();
            try
            {
                String triggers = PluginBase.Settings.InsertionTriggers ?? "";
                if (triggers.Length > 0 && Regex.Unescape(triggers).IndexOf(trigger) < 0)
                {
                    return(false);
                }

                ICompletionListItem item = null;
                if (completionList.SelectedIndex >= 0)
                {
                    item = completionList.Items[completionList.SelectedIndex] as ICompletionListItem;
                }
                Hide();
                if (item != null)
                {
                    String replace = item.Value;
                    if (replace != null)
                    {
                        sci.SetSel(startPos, sci.CurrentPos);
                        if (word != null && tail.Length > 0)
                        {
                            if (replace.StartsWith(word, StringComparison.OrdinalIgnoreCase) && replace.IndexOfOrdinal(tail) >= word.Length)
                            {
                                replace = replace.Substring(0, replace.IndexOfOrdinal(tail));
                            }
                        }
                        sci.ReplaceSel(replace);
                        if (OnInsert != null)
                        {
                            OnInsert(sci, startPos, replace, trigger, item);
                        }
                        if (tail.Length > 0)
                        {
                            sci.ReplaceSel(tail);
                        }
                    }
                    return(true);
                }
                return(false);
            }
            finally
            {
                sci.EndUndoAction();
            }
        }
示例#3
0
 static public void Hide()
 {
     if ((completionList != null) && isActive)
     {
         // list
         tempo.Enabled          = false;
         isActive               = false;
         fullList               = false;
         completionList.Visible = false;
         if (completionList.Items.Count > 0)
         {
             completionList.Items.Clear();
         }
         currentItem = null;
         allItems    = null;
         InfoTip.Hide();                 // InfoTip
         UITools.UnlockControl();        // unlock keys
     }
 }
示例#4
0
 static public void ReplaceText(ScintillaControl sci, string tail)
 {
     if (InfoTip.CallTipActive)
     {
         InfoTip.Hide();
         return;
     }
     if (completionList.SelectedIndex >= 0)
     {
         ICompletionListItem item = (ICompletionListItem)completionList.Items[completionList.SelectedIndex];
         sci.SetSel(startPos, sci.CurrentPos);
         string replace = item.Value;
         if (replace != null)
         {
             sci.ReplaceSel(replace + tail);
         }
     }
     Hide();
 }
示例#5
0
        /// <summary>
        ///
        /// </summary>
        static private void CLDrawListItem(Object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            ICompletionListItem item = completionList.Items[e.Index] as ICompletionListItem;

            e.DrawBackground();
            Color     fore         = PluginBase.MainForm.GetThemeColor("CompletionList.ForeColor", SystemColors.WindowText);
            Color     sel          = PluginBase.MainForm.GetThemeColor("CompletionList.SelectedTextColor", SystemColors.HighlightText);
            bool      selected     = (e.State & DrawItemState.Selected) > 0;
            Brush     textBrush    = (selected) ? new SolidBrush(sel) : new SolidBrush(fore);
            Brush     packageBrush = new SolidBrush(PluginBase.MainForm.GetThemeColor("CompletionList.PackageColor", Color.Gray));
            Rectangle tbounds      = new Rectangle(ScaleHelper.Scale(18), e.Bounds.Top, e.Bounds.Width, e.Bounds.Height);

            if (item != null)
            {
                Graphics g         = e.Graphics;
                float    newHeight = e.Bounds.Height - 2;
                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                g.DrawImage(item.Icon, 1, e.Bounds.Top + ((e.Bounds.Height - newHeight) / 2), newHeight, newHeight);
                int p = item.Label.LastIndexOf('.');
                if (p > 0 && !selected)
                {
                    string package = item.Label.Substring(0, p + 1);
                    g.DrawString(package, e.Font, packageBrush, tbounds, StringFormat.GenericDefault);
                    int left = tbounds.Left + DrawHelper.MeasureDisplayStringWidth(e.Graphics, package, e.Font) - 2;
                    if (left < tbounds.Right)
                    {
                        g.DrawString(item.Label.Substring(p + 1), e.Font, textBrush, left, tbounds.Top, StringFormat.GenericDefault);
                    }
                }
                else
                {
                    g.DrawString(item.Label, e.Font, textBrush, tbounds, StringFormat.GenericDefault);
                }
            }
            e.DrawFocusRectangle();
            if ((item != null) && ((e.State & DrawItemState.Selected) > 0))
            {
                UITools.Tip.Hide();
                currentItem = item;
                tempoTip.Stop();
                tempoTip.Start();
            }
        }
示例#6
0
 /// <summary>
 /// Hide completion list
 /// </summary>
 static public void Hide()
 {
     if (completionList != null && isActive)
     {
         tempo.Enabled          = false;
         isActive               = false;
         fullList               = false;
         faded                  = false;
         completionList.Visible = false;
         if (completionList.Items.Count > 0)
         {
             completionList.Items.Clear();
         }
         currentItem = null;
         allItems    = null;
         UITools.Tip.Hide();
         if (!UITools.CallTip.CallTipActive)
         {
             UITools.Manager.UnlockControl();
         }
     }
 }
示例#7
0
        /// <summary>
        ///
        /// </summary>
        static private void CLDrawListItem(Object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            ICompletionListItem item = completionList.Items[e.Index] as ICompletionListItem;

            e.DrawBackground();
            bool      selected     = (e.State & DrawItemState.Selected) > 0;
            Brush     textBrush    = (selected) ? Brushes.White : Brushes.Black;
            Brush     packageBrush = Brushes.Gray;
            Rectangle tbounds      = new Rectangle(18, e.Bounds.Top + 1, e.Bounds.Width, e.Bounds.Height);

            if (item != null)
            {
                Graphics g = e.Graphics;
                g.DrawImage(item.Icon, 1, e.Bounds.Top + ((e.Bounds.Height - item.Icon.Height) / 2));
                int p = item.Label.LastIndexOf('.');
                if (p > 0 && !selected)
                {
                    string package = item.Label.Substring(0, p + 1);
                    g.DrawString(package, e.Font, packageBrush, tbounds, StringFormat.GenericDefault);
                    int left = tbounds.Left + DrawHelper.MeasureDisplayStringWidth(e.Graphics, package, e.Font) - 2;
                    if (left < tbounds.Right)
                    {
                        g.DrawString(item.Label.Substring(p + 1), e.Font, textBrush, left, tbounds.Top, StringFormat.GenericDefault);
                    }
                }
                else
                {
                    g.DrawString(item.Label, e.Font, textBrush, tbounds, StringFormat.GenericDefault);
                }
            }
            e.DrawFocusRectangle();
            if ((item != null) && ((e.State & DrawItemState.Selected) > 0))
            {
                UITools.Tip.Hide();
                currentItem = item;
                tempoTip.Stop();
                tempoTip.Start();
            }
        }
示例#8
0
        static private void CLDrawListItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            ICompletionListItem item = completionList.Items[e.Index] as ICompletionListItem;

            e.DrawBackground();             // empty background
            // draw text
            Brush     myBrush = ((e.State & DrawItemState.Selected) > 0) ? Brushes.White : Brushes.Black;
            Rectangle tbounds = new Rectangle(18, e.Bounds.Top + 1, e.Bounds.Width, e.Bounds.Height);

            if (item != null)
            {
                e.Graphics.DrawImage(item.Icon, 1, e.Bounds.Top);
                e.Graphics.DrawString(item.Label, e.Font, myBrush, tbounds, StringFormat.GenericDefault);
            }
            // focus rect
            e.DrawFocusRectangle();
            // InfoTip
            if ((item != null) && ((e.State & DrawItemState.Selected) > 0))
            {
                currentItem = item;
                UpdateTip();
            }
        }
示例#9
0
        /// <summary>
        /// Set default selected item in completion list
        /// </summary>
        static public void SelectItem(String name)
        {
            string pname = name.IndexOf('.') < 0 ? "." + name : null;
            ICompletionListItem found = null;

            foreach (ICompletionListItem item in completionList.Items)
            {
                if (item.Label == name)
                {
                    defaultItem = item;
                    completionList.SelectedItem = item;
                    return;
                }
                if (pname != null && item.Label.EndsWithOrdinal(pname))
                {
                    found = item;
                }
            }
            if (found != null)
            {
                defaultItem = found;
                completionList.SelectedItem = found;
            }
        }
示例#10
0
        /// <summary>
        /// 
        /// </summary>
        static private void CLDrawListItem(Object sender, System.Windows.Forms.DrawItemEventArgs e)
		{
			ICompletionListItem item = completionList.Items[e.Index] as ICompletionListItem;
			e.DrawBackground();
            bool selected = (e.State & DrawItemState.Selected) > 0;
			Brush textBrush = (selected) ? Brushes.White : Brushes.Black;
            Brush packageBrush = Brushes.Gray;
			Rectangle tbounds = new Rectangle(18, e.Bounds.Top + 1, e.Bounds.Width, e.Bounds.Height);
			if (item != null)
			{
                Graphics g = e.Graphics;
                g.DrawImage(item.Icon, 1, e.Bounds.Top + ((e.Bounds.Height - item.Icon.Height) / 2));
                int p = item.Label.LastIndexOf('.');
                if (p > 0 && !selected)
                {
                    string package = item.Label.Substring(0, p + 1);
                    g.DrawString(package, e.Font, packageBrush, tbounds, StringFormat.GenericDefault);
                    int left = tbounds.Left + DrawHelper.MeasureDisplayStringWidth(e.Graphics, package, e.Font) - 2;
                    if (left < tbounds.Right) g.DrawString(item.Label.Substring(p + 1), e.Font, textBrush, left, tbounds.Top, StringFormat.GenericDefault);
                }
                else g.DrawString(item.Label, e.Font, textBrush, tbounds, StringFormat.GenericDefault);
			}
			e.DrawFocusRectangle();
			if ((item != null) && ((e.State & DrawItemState.Selected) > 0))
			{
                UITools.Tip.Hide();
				currentItem = item;
                tempoTip.Stop();
                tempoTip.Start();
			}
		}
示例#11
0
        /// <summary>
        /// Shows the completion list
        /// </summary>
        static public void Show(List <ICompletionListItem> itemList, bool autoHide)
        {
            ITabbedDocument doc = PluginBase.MainForm.CurrentDocument;

            if (!doc.IsEditable)
            {
                return;
            }
            ScintillaControl sci = doc.SciControl;
            ListBox          cl  = completionList;

            try
            {
                if ((itemList == null) || (itemList.Count == 0))
                {
                    if (isActive)
                    {
                        Hide();
                    }
                    return;
                }
                if (sci == null)
                {
                    if (isActive)
                    {
                        Hide();
                    }
                    return;
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ShowError(ex);
            }
            // state
            allItems     = itemList;
            autoHideList = autoHide;
            word         = "";
            if (currentWord != null)
            {
                word        = currentWord;
                currentWord = null;
            }
            MinWordLength    = 1;
            fullList         = (word.Length == 0) || !autoHide || !PluginBase.MainForm.Settings.AutoFilterList;
            lastIndex        = 0;
            exactMatchInList = false;
            if (sci.SelectionStart == sci.SelectionEnd)
            {
                startPos = sci.CurrentPos - word.Length;
            }
            else
            {
                startPos = sci.SelectionStart;
            }
            currentPos  = sci.SelectionEnd; // sci.CurrentPos;
            defaultItem = null;
            // populate list
            needResize    = true;
            tempo.Enabled = autoHide && (PluginBase.MainForm.Settings.DisplayDelay > 0);
            if (tempo.Enabled)
            {
                tempo.Interval = PluginBase.MainForm.Settings.DisplayDelay;
            }
            FindWordStartingWith(word);
            // state
            isActive          = true;
            tempoTip.Enabled  = false;
            showTime          = DateTime.Now.Ticks;
            disableSmartMatch = PluginBase.MainForm.Settings.DisableSmartMatch;
            UITools.Manager.LockControl(sci);
            faded = false;
        }
示例#12
0
 public ItemMatch(int score, ICompletionListItem item)
 {
     Score = score;
     Item  = item;
 }
示例#13
0
 /// <summary>
 /// On completion list insert or cancel, reset the previous selection
 /// </summary>
 private static void HandleListInsert(ScintillaControl sender, Int32 position, String text, Char trigger, ICompletionListItem item)
 {
     CompletionList.OnInsert  -= new InsertedTextHandler(HandleListInsert);
     CompletionList.OnCancel  -= new InsertedTextHandler(HandleListInsert);
     ArgsProcessor.PrevSelText = String.Empty;
 }
示例#14
0
 /// <summary>
 /// 
 /// </summary>
 private static void CLDrawListItem(Object sender, System.Windows.Forms.DrawItemEventArgs e)
 {
     ICompletionListItem item = completionList.Items[e.Index] as ICompletionListItem;
     e.DrawBackground();
     Color fore = PluginBase.MainForm.GetThemeColor("CompletionList.ForeColor", SystemColors.WindowText);
     Color sel = PluginBase.MainForm.GetThemeColor("CompletionList.SelectedTextColor", SystemColors.HighlightText);
     bool selected = (e.State & DrawItemState.Selected) > 0;
     Brush textBrush = (selected) ? new SolidBrush(sel) : new SolidBrush(fore);
     Brush packageBrush = new SolidBrush(PluginBase.MainForm.GetThemeColor("CompletionList.PackageColor", Color.Gray));
     Rectangle tbounds = new Rectangle(ScaleHelper.Scale(18), e.Bounds.Top, e.Bounds.Width, e.Bounds.Height);
     if (item != null)
     {
         Graphics g = e.Graphics;
         float newHeight = e.Bounds.Height - 2;
         g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
         g.DrawImage(item.Icon, 1, e.Bounds.Top + ((e.Bounds.Height - newHeight) / 2), newHeight, newHeight);
         int p = item.Label.LastIndexOf('.');
         if (p > 0 && !selected)
         {
             string package = item.Label.Substring(0, p + 1);
             g.DrawString(package, e.Font, packageBrush, tbounds, StringFormat.GenericDefault);
             int left = tbounds.Left + DrawHelper.MeasureDisplayStringWidth(e.Graphics, package, e.Font) - 2;
             if (left < tbounds.Right) g.DrawString(item.Label.Substring(p + 1), e.Font, textBrush, left, tbounds.Top, StringFormat.GenericDefault);
         }
         else g.DrawString(item.Label, e.Font, textBrush, tbounds, StringFormat.GenericDefault);
     }
     e.DrawFocusRectangle();
     if ((item != null) && ((e.State & DrawItemState.Selected) > 0))
     {
         UITools.Tip.Hide();
         currentItem = item;
         tempoTip.Stop();
         tempoTip.Start();
     }
 }
示例#15
0
 /// <summary>
 /// Shows the completion list
 /// </summary>
 public static void Show(List<ICompletionListItem> itemList, bool autoHide)
 {
     ITabbedDocument doc = PluginBase.MainForm.CurrentDocument;
     if (!doc.IsEditable) return;
     ScintillaControl sci = doc.SciControl;
     try
     {
         if ((itemList == null) || (itemList.Count == 0))
         {
             if (isActive) Hide();
             return;
         }
         if (sci == null)
         {
             if (isActive) Hide();
             return;
         }
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
     // state
     allItems = itemList;
     autoHideList = autoHide;
     noAutoInsert = false;
     word = "";
     if (currentWord != null)
     {
         word = currentWord;
         currentWord = null;
     }
     MinWordLength = 1;
     fullList = (word.Length == 0) || !autoHide || !PluginBase.MainForm.Settings.AutoFilterList;
     lastIndex = 0;
     exactMatchInList = false;
     if (sci.SelectionStart == sci.SelectionEnd)
         startPos = sci.CurrentPos - word.Length;
     else
         startPos = sci.SelectionStart;
     currentPos = sci.SelectionEnd; // sci.CurrentPos;
     defaultItem = null;
     // populate list
     needResize = true;
     tempo.Enabled = autoHide && (PluginBase.MainForm.Settings.DisplayDelay > 0);
     if (tempo.Enabled) tempo.Interval = PluginBase.MainForm.Settings.DisplayDelay;
     FindWordStartingWith(word);
     // state
     isActive = true;
     tempoTip.Enabled = false;
     showTime = DateTime.Now.Ticks;
     disableSmartMatch = noAutoInsert || PluginBase.MainForm.Settings.DisableSmartMatch;
     UITools.Manager.LockControl(sci);
     faded = false;
 }
示例#16
0
 /// <summary>
 /// Set default selected item in completion list
 /// </summary>
 public static void SelectItem(String name)
 {
     int p = name.IndexOf('<');
     if (p > 1) name = name.Substring(0, p) + "<T>";
     string pname = (name.IndexOf('.') < 0) ? "." + name : null;
     ICompletionListItem found = null;
     foreach (ICompletionListItem item in completionList.Items)
     {
         if (item.Label == name)
         {
             defaultItem = item;
             completionList.SelectedItem = item;
             return;
         }
         if (pname != null && item.Label.EndsWithOrdinal(pname)) found = item;
     }
     if (found != null)
     {
         defaultItem = found;
         completionList.SelectedItem = found;
     }
 }
 private void CLDrawListItem(Object sender, System.Windows.Forms.DrawItemEventArgs e)
 {
     ICompletionListItem item = completionList.Items[e.Index] as ICompletionListItem;
     e.DrawBackground();
     bool selected = (e.State & DrawItemState.Selected) > 0;
     Brush myBrush = (selected) ? Brushes.White : Brushes.Black;
     Rectangle tbounds = new Rectangle(18, e.Bounds.Top + 1, e.Bounds.Width, e.Bounds.Height);
     if (item != null)
     {
         e.Graphics.DrawImage(item.Icon, 1, e.Bounds.Top + ((e.Bounds.Height - item.Icon.Height) / 2));
         int p = item.Label.LastIndexOf('.');
         if (p > 0)
         {
             string package = item.Label.Substring(0, p + 1);
             e.Graphics.DrawString(package, e.Font, Brushes.Gray, tbounds, StringFormat.GenericDefault);
             SizeF dims = e.Graphics.MeasureString(package, e.Font, tbounds.Width, StringFormat.GenericDefault);
             int left = tbounds.Left + (int)dims.Width + 1;
             if (left < tbounds.Right) e.Graphics.DrawString(item.Label.Substring(p + 1), e.Font, myBrush, left, tbounds.Top, StringFormat.GenericTypographic);
         }
         else e.Graphics.DrawString(item.Label, e.Font, myBrush, tbounds, StringFormat.GenericDefault);
     }
     e.DrawFocusRectangle();
     if ((item != null) && ((e.State & DrawItemState.Selected) > 0))
     {
         UITools.Tip.Hide();
         currentItem = item;
         tempoTip.Stop();
         tempoTip.Start();
     }
 }
示例#18
0
 private void CompletionList_OnInsert(ScintillaControl sender, int position, string text, char trigger, ICompletionListItem item)
 {
     if (completion != null && sender.ConfigurationLanguage == "css")
         completion.OnInsert(sender, position, text, trigger, item);
 }
示例#19
0
		static public void Hide()
		{
			if ((completionList != null) && isActive) 
			{
				// list
				tempo.Enabled = false;
				isActive = false;
				fullList = false;
				completionList.Visible = false;
				if (completionList.Items.Count > 0) completionList.Items.Clear();
				currentItem = null;
				allItems = null;
				InfoTip.Hide(); // InfoTip
				UITools.UnlockControl(); // unlock keys
			}
		}
示例#20
0
        void CompletionList_OnInsert(ScintillaControl sender, int position, string text, char trigger, ICompletionListItem item)
        {
            if (trigger == '(' || trigger == '.') return;
            if (!(item is MemberItem)) return; // Generate Event
              //      if (item is EventItem) return;
             currentData = (DataEvent)currentNotifyEvent;
             Hashtable table = currentData.Data as Hashtable;
             if (table==null) return;

            ASResult res = (table)["context"] as ASResult;

            if (res == null) return;

            MemberModel member = res.Member;
            int posAdd = 0;

                    if (member != null)
                    {
                        if ((member.Flags & FlagType.Function) == 0) { return; }

                            int pos = sender.CurrentPos;
                            int insertPos = pos;
                            if (((member.Flags & FlagType.Constructor) > 0))
                            {

                                if (!thereIsNewWord(sender))
                                {
                                    sender.GotoPos(pos);
                                    return;
                                }
                            }

                          //  sender.ReplaceSel
                                bool hasParameters = false;

                                char lastChar=' ';
                                posAdd = SearchNextNewLineWithoutChar(sender, position, text, ref lastChar);

                                if (lastChar == '(')
                                {
                                    return;
                                }

                            // Search if is a parameter of a function
                                if (lastChar == ',' || lastChar == ')')
                                {
                                    if (IsFunctionParameter(sender, position - 1))
                                    {
                                        return;
                                    };
                                }

                                sender.BeginUndoAction();

                                if (posAdd > 0)
                                {
                                    sender.InsertText(pos, "();");
                                    posAdd = 1;

                                }
                                else
                                    sender.InsertText(pos, "()");

                                pos++;

                                if (!(trigger == '[' || trigger == '"'))
                                {
                                    if (member.Parameters != null)
                                    {
                                        if (member.Parameters.Count == 0)
                                        {
                                            pos += 1 + posAdd;

                                        }
                                        else
                                        {
                                            hasParameters = true;
                                        }

                                    }
                                    else
                                    {
                                        pos += 1 + posAdd;
                                    }

                                }

                                sender.GotoPos(pos);

                                if (hasParameters)
                                {
                                    if (abbreviations != null &&  member.Parameters[0].Value == null && member.Parameters[0].Name != "...rest")
                                    {

                                       // string str = res.Member.ToString();
                                        TextParameters tp = new TextParameters(res.Member);

                                        if (member.Name.EndsWith("EventListener"))
                                        {
                                            if (text.EndsWith("Event"))
                                            {
                                                sender.GotoPos(insertPos+2);
                                                sender.DeleteBack();
                                                sender.DeleteBack();
                                                sender.EndUndoAction();
                                                return;
                                            }
                                            abbreviations.CreateParameters(member.Parameters, true,tp);

                                        }
                                        else
                                            abbreviations.CreateParameters(member.Parameters, false,tp);

                                        sender.EndUndoAction();
                                        return;
                                    }

                                    ASComplete.HandleFunctionCompletion(sender, true);
                                }

                                sender.EndUndoAction();

                    }
                    else if (res.Type != null)
                    {

                        int pos2 = sender.CurrentPos;

                        bool hasParameters = false;
                        MemberModel mlConstructor = null;

                        if (!thereIsNewWord(sender)) { sender.GotoPos(pos2); return; }

                            char lastChar=' ';
                            posAdd = SearchNextNewLineWithoutChar(sender, pos2, "",ref lastChar);

                            if (lastChar == '(') { sender.GotoPos(pos2); return; }

                            if (res.Type.Members.Count > 0)
                            {

                                foreach (MemberModel ml in res.Type.Members)
                                {
                                    if ((ml.Flags & FlagType.Constructor)>0)
                                    {
                                        if (ml.Parameters!=null && ml.Parameters.Count > 0)
                                        {
                                            mlConstructor = ml;
                                            hasParameters = true;
                                        }
                                        break;
                                    }
                                }

                            }

                            if(posAdd>0)
                                sender.InsertText(pos2, "();");
                            else
                            sender.InsertText(pos2, "()");

                            if (trigger == '[' || trigger == '"' || hasParameters)
                              pos2++;
                            else
                            pos2 += 2 + posAdd;

                        sender.GotoPos(pos2);
                        if (hasParameters)
                        {
                            sender.BeginUndoAction();
                            if (abbreviations != null && mlConstructor.Parameters[0].Value == null && mlConstructor.Parameters[0].Name != "...rest")
                            {
                                TextParameters tp = new TextParameters(mlConstructor);

                               abbreviations.CreateParameters(mlConstructor.Parameters, false, tp);
                            }
                            else
                                ASComplete.HandleFunctionCompletion(sender, true);
                            sender.EndUndoAction();
                        }

                    }
        }
示例#21
0
 void CompletionList_OnInsert(ScintillaControl sender, int position, string text, char trigger, ICompletionListItem item)
 {
     if (item.Description == "File")
     {
         this.FinishFileCompletion(sender, null);
     }
     else if (item.Description == "Current Document")
     {
         FileInfo fi = new FileInfo(PluginBase.MainForm.CurrentDocument.FileName);
         if (!fi.Exists)
         {
             this.FinishFileCompletion(sender, null);
         }
         else
         {
             this.currentFolder = fi.Directory;
         }
     }
 }
示例#22
0
		static private void CLDrawListItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
		{
			ICompletionListItem item = completionList.Items[e.Index] as ICompletionListItem;
			e.DrawBackground(); // empty background
			// draw text
			Brush myBrush = ((e.State & DrawItemState.Selected) > 0) ? Brushes.White : Brushes.Black;
			Rectangle tbounds = new Rectangle(18, e.Bounds.Top+1, e.Bounds.Width, e.Bounds.Height);
			if (item != null)
			{
				e.Graphics.DrawImage(item.Icon, 1,e.Bounds.Top);
				e.Graphics.DrawString(item.Label, e.Font, myBrush, tbounds, StringFormat.GenericDefault);
			}
			// focus rect
			e.DrawFocusRectangle();
			// InfoTip
			if ((item != null) && ((e.State & DrawItemState.Selected) > 0))
			{
				currentItem = item;
				UpdateTip();
			}
		}
示例#23
0
 private void CompletionList_OnInsert(ScintillaControl sender, int position, string text, char trigger, ICompletionListItem item)
 {
     if (completion != null && sender.ConfigurationLanguage == "css")
     {
         completion.OnInsert(sender, position, text, trigger, item);
     }
 }
示例#24
0
        internal void OnInsert(ScintillaControl sci, int position, string text, char trigger, ICompletionListItem item)
        {
            if (!(item is CompletionItem))
            {
                return;
            }
            CompletionItem it = item as CompletionItem;

            if (trigger == ':')
            {
                lastColonInsert = position + text.Length + 1;
            }
            else if (it.Kind == ItemKind.Property && !settings.DisableInsertColon)
            {
                int  pos = position + text.Length;
                char c   = (char)sci.CharAt(pos);
                if (c != ':')
                {
                    sci.InsertText(pos, ":");
                }
                sci.SetSel(pos + 1, pos + 1);
                lastColonInsert = pos + 1;
            }
            else
            {
                lastColonInsert = -1;
            }
        }
示例#25
0
        void CompletionList_OnInsert(ScintillaControl sender, int position, string text, char trigger, ICompletionListItem item)
        {
            RemoveListenerAbbrevationsList();

            if (!(item is QuickGenerator.UI.CompletionListItem))
            {
                insertOnly = false;
                return;
            }

            if (insertOnly)
            {
                insertOnly = false;
                return;
            }
                //sender.WordLeftExtend();
                //sender.ReplaceSel(text);

            ProcessAbbrevation(sender);
        }
示例#26
0
 /// <summary>
 /// Hide completion list
 /// </summary>  
 public static void Hide()
 {
     if (completionList != null && isActive)
     {
         tempo.Enabled = false;
         isActive = false;
         fullList = false;
         faded = false;
         completionList.Visible = false;
         if (completionList.Items.Count > 0) completionList.Items.Clear();
         currentItem = null;
         allItems = null;
         UITools.Tip.Hide();
         if (!UITools.CallTip.CallTipActive) UITools.Manager.UnlockControl();
     }
 }
 internal void OnInsert(ScintillaControl sci, int position, string text, char trigger, ICompletionListItem item)
 {
     if (!(item is CompletionItem)) return;
     CompletionItem it = item as CompletionItem;
     if (trigger == ':')
     {
         lastColonInsert = position + text.Length + 1;
     }
     else if (it.Kind == ItemKind.Property && !settings.DisableInsertColon)
     {
         int pos = position + text.Length;
         char c = (char)sci.CharAt(pos);
         if (c != ':') sci.InsertText(pos, ":");
         sci.SetSel(pos + 1, pos + 1);
         lastColonInsert = pos + 1;
     }
     else lastColonInsert = -1;
 }
        public virtual void Show(List<ICompletionListItem> itemList, bool autoHide)
        {
            if (itemList == null) return;

            allItems = itemList;
            autoHideList = autoHide;
            word = "";
            if (currentWord != null)
            {
                word = currentWord;
                currentWord = null;
            }

            fullList = (word.Length == 0) || !autoHide || !PluginBase.MainForm.Settings.AutoFilterList;

            lastIndex = 0;

            defaultItem = null;
            // populate list
            needResize = true;

            tempo.Enabled = autoHide && (PluginBase.MainForm.Settings.DisplayDelay > 0);
            if (tempo.Enabled) tempo.Interval = PluginBase.MainForm.Settings.DisplayDelay;
            _FindWordStartingWith(word);

            isActive = true;
            tempoTip.Enabled = false;

            disableSmartMatch = PluginBase.MainForm.Settings.DisableSmartMatch;

            faded = false;
        }
示例#29
0
 public ItemMatch(int score, ICompletionListItem item)
 {
     Score = score;
     Item = item;
 }
示例#30
0
 void CompletionList_OnCancel(ScintillaControl sender, int position, string text, char trigger, ICompletionListItem item)
 {
     RemoveListenerAbbrevationsList();
 }