Ejemplo n.º 1
0
        public override bool OnCompletionInsert(ScintillaNet.ScintillaControl sci, int position, string text, char trigger)
        {
            if (text == "Vector")
            {
                string insert = null;
                string line   = sci.GetLine(sci.LineFromPosition(position));
                Match  m      = Regex.Match(line, @"\svar\s+(?<varname>.+)\s*:\s*Vector\.<(?<indextype>.+)(?=(>\s*=))");
                if (m.Success)
                {
                    insert = String.Format(".<{0}>", m.Groups["indextype"].Value);
                }
                else
                {
                    m = Regex.Match(line, @"\s*=\s*new");
                    if (m.Success)
                    {
                        ASResult result = ASComplete.GetExpressionType(sci, sci.PositionFromLine(sci.LineFromPosition(position)) + m.Index);
                        if (result != null && !result.IsNull() && result.Member != null && result.Member.Type != null)
                        {
                            m = Regex.Match(result.Member.Type, @"(?<=<).+(?=>)");
                            if (m.Success)
                            {
                                insert = String.Format(".<{0}>", m.Value);
                            }
                        }
                    }
                    if (insert == null)
                    {
                        if (trigger == '.' || trigger == '(')
                        {
                            return(true);
                        }
                        insert = ".<>";
                        sci.InsertText(position + text.Length, insert);
                        sci.CurrentPos = position + text.Length + 2;
                        sci.SetSel(sci.CurrentPos, sci.CurrentPos);
                        ASComplete.HandleAllClassesCompletion(sci, "", false, true);
                        return(true);
                    }
                }
                if (insert == null)
                {
                    return(false);
                }
                if (trigger == '.')
                {
                    sci.InsertText(position + text.Length, insert.Substring(1));
                    sci.CurrentPos = position + text.Length;
                }
                else
                {
                    sci.InsertText(position + text.Length, insert);
                    sci.CurrentPos = position + text.Length + insert.Length;
                }
                sci.SetSel(sci.CurrentPos, sci.CurrentPos);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Checking syntax of current file
        /// </summary>
        private void BackgroundSyntaxCheck()
        {
            if (Panel == null)
            {
                return;
            }
            if (Panel.InvokeRequired)
            {
                Panel.BeginInvoke((System.Windows.Forms.MethodInvoker) delegate { BackgroundSyntaxCheck(); });
                return;
            }
            if (!IsFileValid)
            {
                return;
            }

            ScintillaNet.ScintillaControl sci = CurSciControl;
            if (sci == null)
            {
                return;
            }
            ClearSquiggles(sci);

            string src = CurSciControl.Text;

            FlexShells.Instance.CheckAS3(CurrentFile, as3settings.FlexSDK, src);
        }
Ejemplo n.º 3
0
 public HaXeCompletion(ScintillaNet.ScintillaControl sci, int position)
 {
     this.sci = sci;
     this.position = position;
     tips = new ArrayList();
     nbErrors = 0;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Convert multibyte column to byte length
        /// </summary>
        private int MBSafeColumn(ScintillaNet.ScintillaControl sci, int line, int length)
        {
            String text = sci.GetLine(line) ?? "";

            length = Math.Min(length, text.Length);
            return(sci.MBSafeTextLength(text.Substring(0, length)));
        }
Ejemplo n.º 5
0
        public void WordSwitch()
        {
            if (!PluginBase.MainForm.CurrentDocument.IsEditable)
            {
                return;
            }

            ScintillaNet.ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl;

            sci.BeginUndoAction();

            InitializeWords();

            int    pos        = sci.CurrentPos;
            string word       = sci.GetWordFromPosition(pos);
            string switchWord = SwitchValue(wordsKeys, wordsValues, word);

            if (word != switchWord)
            {
                int ws = sci.WordStartPosition(pos, true);
                int we = sci.WordEndPosition(pos, true);
                int ss = sci.SelectionStart;
                int se = sci.SelectionEnd;

                sci.SetSel(ws, we);
                sci.ReplaceSel(switchWord);

                float ratio = ((float)pos - (float)ws) / (float)word.Length;
                int   pos2  = ws + Convert.ToInt16(Math.Round((float)switchWord.Length * ratio));

                sci.SetSel(pos2, pos2);
            }

            sci.EndUndoAction();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// ツールチップで表示するテキストを取得する
        /// </summary>
        /// <param name="document"></param>
        /// <param name="lineNumber"></param>
        /// <param name="colNumber"></param>
        /// <returns></returns>
        public static string GetText(ScintillaNet.ScintillaControl sci, int position)
        {
            if (sci == null)
            {
                return("");                     //ドキュメントがないとき
            }

            string         tip      = "";
            string         lineText = KagUtility.GetKagLineText(sci, position);
            string         word     = sci.GetWordFromPosition(position);
            KagTagKindInfo info     = KagUtility.GetTagKind(lineText);

            if (info == null)
            {
                return("");                     //取得できなかった
            }
            switch (info.Kind)
            {
            case KagTagKindInfo.KagKind.KagTagName:
                tip = getTagComment(word);
                break;

            case KagTagKindInfo.KagKind.AttrName:
                tip = getTagAttrComment(word, info);
                break;

            default:
                break;                          //不明とか属性値は何もしない
            }

            return(tip);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Processes the snippet and template arguments
        /// </summary>
        public static Int32 PostProcessSnippets(ScintillaNet.ScintillaControl sci, Int32 currentPosition)
        {
            Int32 delta = 0;

            while (sci.SelectText(BOUNDARY, 0) != -1)
            {
                sci.ReplaceSel(""); delta -= BOUNDARY.Length;
            }
            String text          = sci.Text; // Store text temporarily
            Int32  entryPosition = sci.MBSafePosition(text.IndexOf(ENTRYPOINT));
            Int32  exitPosition  = sci.MBSafePosition(text.IndexOf(EXITPOINT));

            if (entryPosition != -1 && exitPosition != -1)
            {
                sci.SelectText(ENTRYPOINT, 0); sci.ReplaceSel(""); delta -= ENTRYPOINT.Length;
                sci.SelectText(EXITPOINT, 0); sci.ReplaceSel(""); delta  -= EXITPOINT.Length;
                sci.SetSel(entryPosition, exitPosition - ENTRYPOINT.Length);
            }
            else if (entryPosition != -1 && exitPosition == -1)
            {
                sci.SelectText(ENTRYPOINT, 0); sci.ReplaceSel(""); delta -= ENTRYPOINT.Length;
                sci.SetSel(entryPosition, entryPosition);
            }
            else
            {
                sci.SetSel(currentPosition, currentPosition);
            }
            return(delta);
        }
Ejemplo n.º 8
0
        private void ContextChanged()
        {
            ITabbedDocument doc     = PluginBase.MainForm.CurrentDocument;
            bool            isValid = false;

            if (doc.IsEditable)
            {
                ScintillaNet.ScintillaControl sci = ASContext.CurSciControl;
                if (currentDoc == doc.FileName && sci != null)
                {
                    int line = sci.LineFromPosition(currentPos);
                    ASContext.SetCurrentLine(line);
                }
                else
                {
                    ASComplete.CurrentResolvedContext = null;  // force update
                }
                isValid = ASContext.Context.IsFileValid;
                if (isValid)
                {
                    ASComplete.ResolveContext(sci);
                }
            }
            else
            {
                ASComplete.ResolveContext(null);
            }

            bool enableItems = isValid && !doc.IsUntitled;

            pluginUI.OutlineTree.Enabled = ASContext.Context.CurrentModel != null;
            SetItemsEnabled(enableItems, ASContext.Context.CanBuild);
        }
Ejemplo n.º 9
0
 private void OnUpdateSimpleTip(ScintillaNet.ScintillaControl sci, Point mousePosition)
 {
     if (UITools.Tip.Visible)
     {
         OnMouseHover(sci, lastHoverPosition);
     }
 }
Ejemplo n.º 10
0
        private void OnMouseHover(ScintillaNet.ScintillaControl sci, int position)
        {
            if (ASContext.Locked || !ASContext.Context.IsFileValid())
            {
                return;
            }

            // get word at mouse position
            int style = sci.BaseStyleAt(position);

            DebugConsole.Trace("Style=" + style);
            if (!ASComplete.IsTextStyle(style))
            {
                return;
            }
            position = sci.WordEndPosition(position, true);
            ASResult result = ASComplete.GetExpressionType(sci, position);

            // set tooltip
            if (!result.IsNull())
            {
                string text = ASComplete.GetToolTipText(result);
                DebugConsole.Trace("SHOW " + text);
                if (text == null)
                {
                    return;
                }
                // show tooltip
                InfoTip.ShowAtMouseLocation(text);
            }
        }
Ejemplo n.º 11
0
 private void OnUpdateCallTip(ScintillaNet.ScintillaControl sci, int position)
 {
     if (ASComplete.HasCalltip())
     {
         ASComplete.HandleFunctionCompletion(sci, false, true);
     }
 }
Ejemplo n.º 12
0
        private void Navigate()
        {
            if (listBox.SelectedItem == null)
            {
                return;
            }

            ClassModel classModel = dictionary[listBox.SelectedItem.ToString()];
            FileModel  model      = ModelsExplorer.Instance.OpenFile(classModel.InFile.FileName);

            if (model != null)
            {
                ClassModel theClass = model.GetClassByName(classModel.Name);
                if (!theClass.IsVoid())
                {
                    int line = theClass.LineFrom;
                    ScintillaNet.ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl;
                    if (sci != null && !theClass.IsVoid() && line > 0 && line < sci.LineCount)
                    {
                        sci.GotoLine(line);
                    }
                }
            }

            Close();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Generates the menu for the selected sci control
        /// </summary>
        public void GenerateSnippets(ScintillaNet.ScintillaControl sci)
        {
            var files = new List <string>();

            string specific = Path.Combine(Path.Combine(PathHelper.SnippetDir, sci.ConfigurationLanguage), SurroundWithCommand.SurroundFolder);

            if (Directory.Exists(specific))
            {
                var walker = new PathWalker(specific, "*" + SurroundWithCommand.SurroundExt, false);
                files.AddRange(walker.GetFiles());
            }

            string global = Path.Combine(PathHelper.SnippetDir, SurroundWithCommand.SurroundFolder);

            if (Directory.Exists(global))
            {
                var walker = new PathWalker(global, "*" + SurroundWithCommand.SurroundExt, false);
                files.AddRange(walker.GetFiles());
            }

            items.Clear();
            if (files.Count > 0)
            {
                files.Sort();
                foreach (string file in files)
                {
                    string content = File.ReadAllText(file);
                    if (content.IndexOfOrdinal("{0}") >= 0)
                    {
                        items.Add(new SurroundWithItem(Path.GetFileNameWithoutExtension(file)));
                    }
                }
            }
        }
Ejemplo n.º 14
0
        private void OnMouseHover(ScintillaNet.ScintillaControl sci, int position)
        {
            if (!ASContext.Context.IsFileValid)
            {
                return;
            }

            lastHoverPosition = position;

            // get word at mouse position
            int style = sci.BaseStyleAt(position);

            if (!ASComplete.IsTextStyle(style))
            {
                return;
            }
            position = sci.WordEndPosition(position, true);
            ASResult result = ASComplete.GetExpressionType(sci, position);

            // set tooltip
            if (!result.IsNull())
            {
                string text = ASComplete.GetToolTipText(result);
                if (text == null)
                {
                    return;
                }
                // show tooltip
                UITools.Tip.ShowAtMouseLocation(text);
            }
        }
Ejemplo n.º 15
0
        private void Flex2Shell_SyntaxError(string error)
        {
            if (!IsFileValid)
            {
                return;
            }
            Match m = re_syntaxError.Match(error);

            if (!m.Success)
            {
                return;
            }

            ScintillaNet.ScintillaControl sci = CurSciControl;
            if (sci == null || m.Groups["filename"].Value != CurrentFile)
            {
                return;
            }
            try
            {
                int line = int.Parse(m.Groups["line"].Value) - 1;
                if (sci.LineCount < line)
                {
                    return;
                }
                int start = MBSafeColumn(sci, line, int.Parse(m.Groups["col"].Value) - 1);
                if (line == sci.LineCount && start == 0 && line > 0)
                {
                    start = -1;
                }
                AddSquiggles(sci, line, start, start + 1);
            }
            catch { }
        }
Ejemplo n.º 16
0
 public HaXeCompletion(ScintillaNet.ScintillaControl sci, int position)
 {
     this.sci      = sci;
     this.position = position;
     tips          = new ArrayList();
     nbErrors      = 0;
 }
        static private bool HandleDocTagCompletion(ScintillaNet.ScintillaControl Sci)
        {
            string txt = Sci.GetLine(Sci.LineFromPosition(Sci.CurrentPos)).TrimStart();

            if (!Regex.IsMatch(txt, "^\\*[\\s]*\\@"))
            {
                return(false);
            }
            DebugConsole.Trace("Documentation tag completion");

            // build tag list
            if (docVariables == null)
            {
                docVariables = new ArrayList();
                TagItem  item;
                string[] tags = ASContext.DocumentationTags.Split(' ');
                foreach (string tag in tags)
                {
                    item = new TagItem(tag);
                    docVariables.Add(item);
                }
            }

            // show
            CompletionList.Show(docVariables, true, "");
            return(true);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Handles the incoming events
 /// </summary>
 public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
 {
     try
     {
         String[] args = PluginBase.MainForm.StartArguments;
         for (int i = 0; i < args.Length; i++)
         {
             String arg = args[i];
             if (arg == "-line")
             {
                 if (args.Length >= i + 1)
                 {
                     Int32 line = Int32.Parse(args[i + 1]) - 1;
                     if (PluginBase.MainForm.CurrentDocument != null)
                     {
                         ScintillaNet.ScintillaControl Sci = PluginBase.MainForm.CurrentDocument.SciControl;
                         int pos = Sci.PositionFromLine(line);
                         int end = Sci.LineEndPosition(line);
                         Sci.BeginInvoke((MethodInvoker) delegate
                         {
                             Sci.SetSel(pos, end);
                             Sci.ScrollCaret();
                         });
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Display completion list or calltip info
 /// </summary>
 private void OnChar(ScintillaNet.ScintillaControl Sci, int Value)
 {
     if (Sci.Lexer == 3 || Sci.Lexer == 4)
     {
         ASComplete.OnChar(Sci, Value, true);
     }
 }
        static private bool HandleDocTagCompletion(ScintillaNet.ScintillaControl Sci)
        {
            if (ASContext.CommonSettings.JavadocTags == null || ASContext.CommonSettings.JavadocTags.Length == 0)
            {
                return(false);
            }

            string txt = Sci.GetLine(Sci.LineFromPosition(Sci.CurrentPos)).TrimStart();

            if (!Regex.IsMatch(txt, "^\\*[\\s]*\\@"))
            {
                return(false);
            }

            // build tag list
            if (docVariables == null)
            {
                docVariables = new List <ICompletionListItem>();
                TagItem item;
                foreach (string tag in ASContext.CommonSettings.JavadocTags)
                {
                    item = new TagItem(tag);
                    docVariables.Add(item);
                }
            }

            // show
            CompletionList.Show(docVariables, true, "");
            return(true);
        }
Ejemplo n.º 21
0
        public bool RestoreLastLookupPosition()
        {
            if (!ASContext.Context.IsFileValid || lookupLocations == null || lookupLocations.Count == 0)
            {
                return(false);
            }

            LookupLocation location = lookupLocations.Pop();

            // menu item
            if (lookupLocations.Count == 0 && LookupMenuItem != null)
            {
                LookupMenuItem.Enabled = false;
            }

            PluginBase.MainForm.OpenEditableDocument(location.file, false);
            ScintillaNet.ScintillaControl sci = ASContext.CurSciControl;
            if (sci != null)
            {
                int position = sci.PositionFromLine(location.line) + location.column;
                sci.SetSel(position, position);
                int line = sci.LineFromPosition(sci.CurrentPos);
                sci.EnsureVisible(line);
                int top    = sci.FirstVisibleLine;
                int middle = top + sci.LinesOnScreen / 2;
                sci.LineScroll(0, line - middle);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Display completion list or calltip info
 /// </summary>
 private void OnChar(ScintillaNet.ScintillaControl Sci, int Value)
 {
     DebugConsole.Trace(Value);
     if (Sci.Lexer == 3)
     {
         ASComplete.OnChar(Sci, Value, true);
     }
 }
Ejemplo n.º 23
0
        public void GotoPosAndFocus(ScintillaNet.ScintillaControl sci, int position)
        {
            int pos  = sci.MBSafePosition(position);
            int line = sci.LineFromPosition(pos);

            sci.EnsureVisible(line);
            sci.GotoPos(pos);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Update File System Watchers to automatically set classes out of date
        /// </summary>

        /*protected void UpdateWatchers()
         * {
         *      if (WatchersLock > 0) return;
         *      Hashtable prevWatchers = Watchers;
         *      Watchers = new Hashtable();
         *      FileSystemWatcher fsw = null;
         *
         *      try
         *      {
         *      // create or recycle watchers
         *      foreach(string path in classPath)
         *      {
         *              if (prevWatchers != null)
         *              {
         *                      fsw = (FileSystemWatcher)prevWatchers[path];
         *              }
         *              if (fsw != null)
         *              {
         *                      prevWatchers.Remove(path);
         *              }
         *              else if (Watchers[path] == null)
         *              {
         *                      fsw = new FileSystemWatcher();
         *                      fsw.SynchronizingObject = ASContext.Panel;
         *              fsw.Path = path;
         *              fsw.IncludeSubdirectories = true;
         *              fsw.NotifyFilter = NotifyFilters.LastWrite;
         *              fsw.Filter = "*.as";
         *              fsw.Changed += new FileSystemEventHandler(ASContext.Panel.OnFileChanged);
         *              fsw.EnableRaisingEvents = true;
         *              }
         *              DebugConsole.Trace("Watch "+path);
         *              Watchers[path] = fsw;
         *              fsw = null;
         *      }
         *      }
         *      catch (Exception ex)
         *      {
         *              ErrorHandler.ShowError(ex.Message, ex);
         *      }
         *
         *      try
         *      {
         *      // remove off-path watchers
         *      if (prevWatchers != null)
         *      {
         *              foreach(FileSystemWatcher oldFsw in prevWatchers.Values)
         *              {
         *                      oldFsw.EnableRaisingEvents = false;
         *                      oldFsw.Dispose();
         *              }
         *              prevWatchers.Clear();
         *      }
         *      }
         *      catch (Exception ex2)
         *      {
         *              ErrorHandler.ShowError(ex2.Message, ex2);
         *      }
         * }*/
        #endregion

        #region class_caching
        static public void OnTextChanged(ScintillaNet.ScintillaControl sender, int position, int length, int linesAdded)
        {
            if (context != null)
            {
                context.cFile.OutOfDate = true;
            }
            DebugConsole.Trace("ins " + position + ", " + length + ", " + linesAdded);
        }
Ejemplo n.º 25
0
 public override void TrackTextChange(ScintillaNet.ScintillaControl sender, int position, int length, int linesAdded)
 {
     base.TrackTextChange(sender, position, length, linesAdded);
     if (as3settings != null && !as3settings.DisableLiveChecking && IsFileValid)
     {
         timerCheck.Stop();
         timerCheck.Start();
     }
 }
        static private bool HandleBoxCompletion(ScintillaNet.ScintillaControl Sci, int position)
        {
            DebugConsole.Trace("Documentation tag completion");
            // is the block before a function declaration?
            int           len = Sci.TextLength - 1;
            char          c;
            StringBuilder sb = new StringBuilder();

            while (position < len)
            {
                c = (char)Sci.CharAt(position);
                sb.Append(c);
                if ((c == '(') || (c == ';') || (c == '{'))
                {
                    break;
                }
                position++;
            }
            string signature = sb.ToString();

            if (re_functionDeclaration.IsMatch(signature))
            {
                // get method signature
                position++;
                while (position < len)
                {
                    c = (char)Sci.CharAt(position);
                    sb.Append(c);
                    if ((c == ';') || (c == '{'))
                    {
                        break;
                    }
                    position++;
                }
                signature = sb.ToString();
            }
            else
            {
                signature = null;
            }

            // build templates list
            ArrayList templates = new ArrayList();

            if (signature != null)
            {
                boxMethodParams.Context = signature;
                templates.Add(boxMethodParams);
            }
            templates.Add(boxSimpleClose);

            // show
            CompletionList.Show(templates, true, "");
            return(true);
        }
Ejemplo n.º 27
0
        private void AddSquiggles(ScintillaNet.ScintillaControl sci, int line, int start, int end)
        {
            if (sci == null)
            {
                return;
            }
            fileWithSquiggles = CurrentFile;
            int position = sci.PositionFromLine(line) + start;

            sci.AddHighlight(2, (int)ScintillaNet.Enums.IndicatorStyle.Squiggle, 0x000000ff, position, end - start);
        }
Ejemplo n.º 28
0
        private void outlineTreeView_Click(object sender, EventArgs e)
        {
            if (outlineTreeView.SelectedNode == null)
            {
                return;
            }
            TreeNode     node = outlineTreeView.SelectedNode;
            TypeTreeNode tnode;

            if (node is TypeTreeNode)
            {
                tnode = node as TypeTreeNode;
                string filename = (tnode.Tag as string).Split('@')[0];

                FileModel model = OpenFile(filename);
                if (model != null)
                {
                    ClassModel theClass = model.GetClassByName(tnode.Text);
                    if (!theClass.IsVoid())
                    {
                        int line = theClass.LineFrom;
                        ScintillaNet.ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl;
                        if (sci != null && !theClass.IsVoid() && line > 0 && line < sci.LineCount)
                        {
                            sci.GotoLineIndent(line);
                        }
                    }
                }
            }
            else if (node is MemberTreeNode && node.Parent is TypeTreeNode)
            {
                tnode = node.Parent as TypeTreeNode;
                string filename = (tnode.Tag as string).Split('@')[0];

                FileModel model = OpenFile(filename);
                if (model != null)
                {
                    ClassModel  theClass   = model.GetClassByName(tnode.Text);
                    string      memberName = (node.Tag as String).Split('@')[0];
                    MemberModel member     = theClass.Members.Search(memberName, 0, 0);
                    if (member == null)
                    {
                        return;
                    }
                    int line = member.LineFrom;
                    ScintillaNet.ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl;
                    if (sci != null && line > 0 && line < sci.LineCount)
                    {
                        sci.GotoLineIndent(line);
                    }
                }
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Inserts the specified snippet to the document
        /// </summary>
        public static Int32 InsertSnippetText(ScintillaNet.ScintillaControl sci, Int32 currentPosition, String snippet)
        {
            sci.BeginUndoAction();
            try
            {
                Int32  newIndent;
                String text = snippet;
                if (sci.SelTextSize > 0)
                {
                    currentPosition -= sci.MBSafeTextLength(sci.SelText);
                }
                Int32 line   = sci.LineFromPosition(currentPosition);
                Int32 indent = sci.GetLineIndentation(line);
                sci.ReplaceSel("");

                Int32  lineMarker = LineEndDetector.DetectNewLineMarker(text, sci.EOLMode);
                String newline    = LineEndDetector.GetNewLineMarker(lineMarker);
                if (newline != "\n")
                {
                    text = text.Replace(newline, "\n");
                }
                newline = LineEndDetector.GetNewLineMarker((Int32)PluginBase.MainForm.Settings.EOLMode);
                text    = PluginBase.MainForm.ProcessArgString(text).Replace(newline, "\n");
                newline = LineEndDetector.GetNewLineMarker(sci.EOLMode);
                String[] splitted = text.Trim().Split('\n');
                for (Int32 j = 0; j < splitted.Length; j++)
                {
                    if (j != splitted.Length - 1)
                    {
                        sci.InsertText(sci.CurrentPos, splitted[j] + newline);
                    }
                    else
                    {
                        sci.InsertText(sci.CurrentPos, splitted[j]);
                    }
                    sci.CurrentPos += sci.MBSafeTextLength(splitted[j]) + newline.Length;
                    if (j > 0)
                    {
                        line      = sci.LineFromPosition(sci.CurrentPos - newline.Length);
                        newIndent = sci.GetLineIndentation(line) + indent;
                        sci.SetLineIndentation(line, newIndent);
                    }
                }
                Int32 length = sci.CurrentPos - currentPosition - newline.Length;
                Int32 delta  = PostProcessSnippets(sci, currentPosition);
                return(length + delta);
            }
            finally
            {
                sci.EndUndoAction();
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Display completion list or calltip info
        /// </summary>
        private void OnChar(ScintillaNet.ScintillaControl Sci, int Value)
        {
            if (ASContext.Locked)
            {
                return;
            }

            DebugConsole.Trace(Value);
            if (Sci.Lexer == 3)
            {
                ASComplete.OnChar(Sci, Value, true);
            }
        }
Ejemplo n.º 31
0
 private void OnUpdateCallTip(ScintillaNet.ScintillaControl sci, int position)
 {
     if (ASComplete.HasCalltip())
     {
         int  pos = sci.CurrentPos - 1;
         char c   = (char)sci.CharAt(pos);
         if ((c == ',' || c == '(') && sci.BaseStyleAt(pos) == 0)
         {
             sci.Colourise(0, -1);
         }
         ASComplete.HandleFunctionCompletion(sci, false, true);
     }
 }