protected override void OnSyntaxEditorTriggerActivated(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, TriggerEventArgs e)
 {
     string str = e.get_Trigger().get_Key();
     if ((str != null) && (str == "XMLCommentTagListTrigger"))
     {
         IntelliPromptMemberList list = syntaxEditor.get_IntelliPrompt().get_MemberList();
         list.ResetAllowedCharacters();
         list.set_ImageList(ActiproSoftware.SyntaxEditor.SyntaxEditor.get_ReflectionImageList());
         list.Clear();
         list.Add(new IntelliPromptMemberListItem("c", 0x33, "Indicates that text within the tag should be marked as code.  Use <code> to indicate multiple lines as code."));
         list.Add(new IntelliPromptMemberListItem("code", 0x33, "Indicates multiple lines as code. Use <c> to indicate that text within a description should be marked as code."));
         list.Add(new IntelliPromptMemberListItem("example", 0x33, "Specifies an example of how to use a method or other library member."));
         list.Add(new IntelliPromptMemberListItem("exception", 0x33, "Specifies which exceptions a class can throw.", "exception cref=\"", "\""));
         list.Add(new IntelliPromptMemberListItem("include", 0x33, "Refers to comments in another file that describe the types and members in your source code.", "include file='", "' path='[@name=\"\"]'/>"));
         list.Add(new IntelliPromptMemberListItem("list", 0x33, "Provides a container for list items.", "list type=\"", "\""));
         list.Add(new IntelliPromptMemberListItem("listheader", 0x33, "Defines the heading row of either a table or definition list."));
         list.Add(new IntelliPromptMemberListItem("item", 0x33, "Defines an item in a table or definition list."));
         list.Add(new IntelliPromptMemberListItem("term", 0x33, "A term to define, which will be defined in text."));
         list.Add(new IntelliPromptMemberListItem("description", 0x33, "Either an item in a bullet or numbered list or the definition of a term."));
         list.Add(new IntelliPromptMemberListItem("para", 0x33, "Provides a paragraph container."));
         list.Add(new IntelliPromptMemberListItem("param", 0x33, "Describes one of the parameters for the method.", "param name=\"", "\"/>"));
         list.Add(new IntelliPromptMemberListItem("paramref", 0x33, "Indicates that a word is a parameter.", "paramref name=\"", "\"/>"));
         list.Add(new IntelliPromptMemberListItem("permission", 0x33, "Documents the access of a member.", "permission cref=\"", "\""));
         list.Add(new IntelliPromptMemberListItem("remarks", 0x33, "Specifies overview information about a class or other type."));
         list.Add(new IntelliPromptMemberListItem("returns", 0x33, "Describes the return value for a method declaration."));
         list.Add(new IntelliPromptMemberListItem("see", 0x33, "Specifies a link from within text.", "see cref=\"", "\"/>"));
         list.Add(new IntelliPromptMemberListItem("seealso", 0x33, "Specifies the text that you might want to appear in a See Also section.", "seealso cref=\"", "\"/>"));
         list.Add(new IntelliPromptMemberListItem("summary", 0x33, "Describes a member for a type."));
         list.Add(new IntelliPromptMemberListItem("value", 0x33, "Describes the value for a property declaration."));
         if (list.get_Count() > 0)
         {
             list.Show();
         }
     }
 }
Exemplo n.º 2
0
 void Ribbon_IsApplicationMenuOpenChanged(object sender, ActiproSoftware.Windows.BooleanPropertyChangedRoutedEventArgs e)
 {
     if (!ResourceProvider.HasProjectOpen && !ResourceProvider.Ribbon.IsApplicationMenuOpen)
     {
         ResourceProvider.MainRegion.Content = ResourceProvider.StartPage;
     }
 }
Exemplo n.º 3
0
 private void syntaxEditor1_KeyTyped(object sender, ActiproSoftware.SyntaxEditor.KeyTypedEventArgs e)
 {
     if (e.KeyData.HasFlag(Keys.Shift) && e.KeyData.HasFlag(Keys.Control) && e.KeyData.HasFlag(Keys.F))
     {
         FormatXml();
     }
 }
Exemplo n.º 4
0
 public void SwitchFormatting(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor)
 {
     //UseSplitLanguage = !UseSplitLanguage;
     if (syntaxEditor.Document.Language.LexicalStates.Count > 1)
     {
         syntaxEditor.Document.Language.LexicalStates["ASPDirectiveState"].LexicalStateTransitionLexicalState.
             Language.BackColor = Slyce.Common.SyntaxEditorHelper.EDITOR_BACK_COLOR_FADED;
         syntaxEditor.Document.Language.BackColor = Slyce.Common.SyntaxEditorHelper.EDITOR_BACK_COLOR_NORMAL;
         syntaxEditor.Refresh();
     }
 }
Exemplo n.º 5
0
 private void editor_TextChanging(object sender, ActiproSoftware.Windows.StringPropertyChangingRoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.NewValue))
     {
         int val = Convert.ToInt32(e.NewValue);
         if ((val % _step) != 0)
         {
             e.Cancel = true;
             e.Handled = true;
         }
         else
         {
             var box = _element as Int32EditBox;
             if (box != null)
                 box.Value = val;
         }
     }
 }
Exemplo n.º 6
0
        private void MarkErrorWord(ActiproSoftware.SyntaxEditor.SyntaxEditor editor, int lineNumber, int characterPos, string message)
        {
            //string text = editor.Document.Lines[lineNumber].Text;
            //string preceedingText = characterPos <= compileText.Length ? compileText.Substring(0, characterPos) : "";

            ActiproSoftware.SyntaxEditor.DocumentPosition position = new ActiproSoftware.SyntaxEditor.DocumentPosition(lineNumber, characterPos);
            int offset = editor.Document.PositionToOffset(position);
            DynamicToken token = (DynamicToken)editor.Document.Tokens.GetTokenAtOffset(offset);
            ActiproSoftware.SyntaxEditor.SpanIndicator indicator = new ActiproSoftware.SyntaxEditor.WaveLineSpanIndicator("ErrorIndicator", Color.Red);
            indicator.Tag = message;
            ActiproSoftware.SyntaxEditor.SpanIndicatorLayer indicatorLayer = new ActiproSoftware.SyntaxEditor.SpanIndicatorLayer("kk", 1);
            editor.Document.SpanIndicatorLayers.Add(indicatorLayer);
            int startOffset = Math.Min(token.StartOffset, indicatorLayer.Document.Length - 1);
            int length = Math.Max(token.Length, 1);
            indicatorLayer.Add(indicator, startOffset, length);

            syntaxEditor1.Document.Lines[lineNumber].BackColor = Slyce.Common.Colors.BackgroundColor;
            syntaxEditor1.SelectedView.GoToLine(lineNumber, (lineNumber > 2) ? 2 : 0); // Allow 2 blank lines above selection
        }
Exemplo n.º 7
0
        private void Button_Click(object sender, ActiproSoftware.Windows.Controls.Ribbon.Controls.ExecuteRoutedEventArgs e)
        {
            ((DependencyObject) sender).FindAncestor<ActiproSoftware.Windows.Controls.Ribbon.Controls.Menu>().
                SaftyInvoke(menu =>
                                {
                                    menu.Parent.SaftyInvoke<PopupButton>(b=> b.IsPopupOpen = false);
                                });


            //popupButton.IsPopupOpen = false;

            //RibbonWindow ribbonWindow = VisualTreeHelperExtended.GetCurrentOrAncestor(this, typeof(RibbonWindow)) as RibbonWindow;
            //if (null != ribbonWindow)
            //{
            //    Ribbon button = VisualTreeHelperExtended.GetFirstDescendant(ribbonWindow, typeof(Ribbon)) as Ribbon;
            //    if (null != button)
            //        button.IsApplicationMenuOpen = true;
            //}
        }
Exemplo n.º 8
0
        /// <summary>
        /// Returns the quick info for the <see cref="SyntaxEditor"/> at the specified offset.
        /// </summary>
        /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> to examine.</param>
        /// <param name="offset">The offset to examine.  The offset is updated to the start of the context.</param>
        /// <returns>The quick info for the <see cref="SyntaxEditor"/> at the specified offset.</returns>
        private string GetQuickInfo(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, ref int offset)
        {
            Document document = syntaxEditor.Document;

            // Get the identifier at the offset, if any
            TextStream stream = syntaxEditor.Document.GetTextStream(offset);
            if (!stream.IsAtTokenStart)
                stream.GoToCurrentTokenStart();
            offset = stream.Offset;

            // Check to see if we're over a warning
            SpanIndicatorLayer warningLayer = document.SpanIndicatorLayers[WarningLayerId];
            if (warningLayer != null)
            {
                var sb = new StringBuilder();

                var range = new TextRange(offset, offset + 1);
                SpanIndicator[] spans = warningLayer.GetIndicatorsForTextRange(range);
                foreach (LuatWarningSpanIndicator span in spans)
                {
                    LuatWarning[] warnings = span.Warnings.Filter(warning => warning.TextRange.OverlapsWith(range));

                    var groupedWarnings = warnings.GroupItems(a => a.Message, a => a.Script);

                    foreach (KeyValuePair<string, LuatScript[]> groupedWarning in groupedWarnings)
                    {
                        if (sb.Length > 0)
                        {
                            sb.Append("<br /><br />");
                        }

                        sb.Append("Context: ");
                        sb.Append("<b>");
                        sb.Append(groupedWarning.Value.ToCommaSeperatedList(a => a.Name));
                        sb.Append("</b>");
                        sb.Append("<br />");

                        sb.Append(groupedWarning.Key);
                    }
                }

                if (sb.Length > 0)
                {
                    return sb.ToString();
                }
            }

            // Get the containing node
            var cu = syntaxEditor.Document.SemanticParseData as CompilationUnit;
            if (cu == null)
                return null;

            var qi = cu.FindNodeRecursive<IQuickInfoProvider>(stream.Offset);
            if (qi == null)
                return null;

            return FormatText(qi.QuickInfo);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Provides the core functionality to show an IntelliPrompt member list based on the current context in a <see cref="SyntaxEditor"/>.
        /// </summary>
        /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will display the IntelliPrompt member list.</param>
        /// <param name="completeWord">Whether to complete the word.</param>
        /// <returns>
        /// <c>true</c> if an auto-complete occurred or if an IntelliPrompt member list is displayed; otherwise, <c>false</c>.
        /// </returns>
        private bool ShowIntelliPromptMemberList(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, bool completeWord)
        {
            // Remove any pending tasks to display the IntelliPrompt member list
            m_plugin.TaskQueue.RemoveTasks(m_memberListKey);

            // Add a new tasks
            m_plugin.TaskQueue.AddTask(() =>
            {
                MemberList list = BuildMemberList(syntaxEditor);
                if (null != list)
                {
                    // Queue a task on the UI thread to display the member list
                    m_plugin.TaskQueue.AddTask(() => PresentMemberList(list, syntaxEditor, completeWord), TaskQueue.Thread.UI);
                }
            }, TaskQueue.Thread.Worker, m_memberListKey);

            return false;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Occurs when the mouse is hovered over an <see cref="EditorView"/>.
        /// </summary>
        /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will raise the event.</param>
        /// <param name="e">An <c>EditorViewMouseEventArgs</c> that contains the event data.</param>
        protected override void OnSyntaxEditorViewMouseHover(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, EditorViewMouseEventArgs e)
        {
            if ((e.HitTestResult.Token == null) || (e.ToolTipText != null))
                return;

            int offset = e.HitTestResult.Token.StartOffset;
            e.ToolTipText = GetQuickInfo(syntaxEditor, ref offset);
        }
Exemplo n.º 11
0
        protected override void OnSyntaxEditorSelectionChanged(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, SelectionEventArgs e)
        {
            Document document = syntaxEditor.Document;

            SpanIndicatorLayer referenceLayer = document.SpanIndicatorLayers[ReferenceLayerId];
            if (referenceLayer == null)
            {
                referenceLayer = new SpanIndicatorLayer(ReferenceLayerId, ReferenceLayerPriority);
                document.SpanIndicatorLayers.Add(referenceLayer);
            }

            SpanIndicatorLayer assignmentLayer = document.SpanIndicatorLayers[AssignmentLayerId];
            if (assignmentLayer == null)
            {
                assignmentLayer = new SpanIndicatorLayer(AssignmentLayerId, AssignmentLayerPriority);
                document.SpanIndicatorLayers.Add(assignmentLayer);
            }

            m_plugin.TaskQueue.AddTask(() =>
            {
                referenceLayer.Clear();
                assignmentLayer.Clear();

                var cu = document.SemanticParseData as CompilationUnit;
                if (cu == null)
                    return;

                var expression = cu.FindNodeRecursive<Expression>(e.Selection.StartOffset);
                if (expression == null)
                    return;

                string path = System.IO.Path.GetFullPath(document.Filename);

                foreach (LuatValue value in expression.ResolvedValues.Values)
                {
                    var variable = value as LuatVariable;
                    if (null != variable)
                    {
                        foreach (LuatValue.IReference reference in value.References)
                        {
                            if (path == System.IO.Path.GetFullPath(reference.Path))
                            {
                                referenceLayer.Add(new HighlightingStyleSpanIndicator(null, ReferenceStyle), ((SyntaxEditorTextRange)reference.TextRange).ToTextRange(), false);
                            }
                        }
                        foreach (LuatValue.IReference assignment in variable.Assignments)
                        {
                            if (path == System.IO.Path.GetFullPath(assignment.Path))
                            {
                                assignmentLayer.Add(new HighlightingStyleSpanIndicator(null, AssignmentStyle), ((SyntaxEditorTextRange)assignment.TextRange).ToTextRange(), false);
                            }
                        }
                    }
                }
            }, TaskQueue.Thread.Worker);

            base.OnSyntaxEditorSelectionChanged(syntaxEditor, e);
        }
Exemplo n.º 12
0
 public LINQPadFindReplaceForm(ActiproSoftware.SyntaxEditor.SyntaxEditor editor, FindReplaceOptions options) : base(editor, options)
 {
 }
Exemplo n.º 13
0
 private void ConfigureSyntaxEditor(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, bool multiLineMode)
 {
     #region Syntax Editor settings
     syntaxEditor.Document.Multiline = multiLineMode;
     SyntaxEditorHelper.SetupEditorTemplateAndScriptLanguages(syntaxEditor, TemplateContentLanguage.CSharp, SyntaxEditorHelper.ScriptLanguageTypes.CSharp, @"<%", @"%>");
     ActiproSoftware.SyntaxEditor.KeyPressTrigger t = new ActiproSoftware.SyntaxEditor.KeyPressTrigger("MemberListTrigger2", true, '#');
     t.ValidLexicalStates.Add(syntaxEditor.Document.Language.DefaultLexicalState);
     syntaxEditor.Document.Language.Triggers.Add(t);
     SwitchFormatting(syntaxEditor);
     #endregion
 }
Exemplo n.º 14
0
        /// <summary>
        /// Displays IntelliPrompt quick info in a <see cref="SyntaxEditor"/> based on the current context.
        /// </summary>
        /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will display the IntelliPrompt quick info.</param>
        /// <returns>
        /// <c>true</c> if IntelliPrompt quick info is displayed; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// Only call this method if the <see cref="IntelliPromptQuickInfoSupported"/> property is set to <c>true</c>.
        /// </remarks>
        public override bool ShowIntelliPromptQuickInfo(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor)
        {
            int offset = syntaxEditor.Caret.Offset;

            // Get the info for the context at the caret
            string quickInfo = GetQuickInfo(syntaxEditor, ref offset);

            // No info was found... try the offset right before the caret
            if (offset > 0)
            {
                offset = syntaxEditor.Caret.Offset - 1;
                quickInfo = GetQuickInfo(syntaxEditor, ref offset);
            }

            // Show the quick info if there is any
            if (quickInfo != null)
            {
                syntaxEditor.IntelliPrompt.QuickInfo.Show(offset, quickInfo);
                return true;
            }

            return false;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Presents the member list to the user
        /// </summary>
        /// <param name="memberList"></param>
        /// <param name="syntaxEditor"></param>
        /// <param name="completeWord"></param>
        private void PresentMemberList(MemberList memberList, ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, bool completeWord)
        {
            IntelliPromptMemberList prompt = syntaxEditor.IntelliPrompt.MemberList;
            if (prompt.Visible)
                return;

            // Initialize the member list
            prompt.ResetAllowedCharacters();
            prompt.AllowedCharacters.Add(new CharInterval(char.MinValue, char.MaxValue));
            prompt.Clear();
            prompt.ImageList = LuaIntellisenseIcons.GetImageList();
            prompt.AddRange(memberList.List);

            // Show the list
            if (memberList.TargetTextRange.IsDeleted)
                prompt.Show();
            else if (completeWord && memberList.TargetTextRange.Length > 0)
                prompt.CompleteWord(memberList.TargetTextRange.StartOffset, memberList.TargetTextRange.Length);
            else
                prompt.Show(memberList.TargetTextRange.StartOffset, memberList.TargetTextRange.Length);
        }
Exemplo n.º 16
0
 /// <summary>
 /// Displays an IntelliPrompt member list in a <see cref="SyntaxEditor"/> based on the current context.
 /// </summary>
 /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will display the IntelliPrompt member list.</param>
 /// <returns>
 /// <c>true</c> if an IntelliPrompt member list is displayed; otherwise, <c>false</c>.
 /// </returns>
 /// <remarks>
 /// Only call this method if the <see cref="IntelliPromptMemberListSupported"/> property is set to <c>true</c>.
 /// </remarks>
 public override bool ShowIntelliPromptMemberList(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor)
 {
     return ShowIntelliPromptMemberList(syntaxEditor, false);
 }
Exemplo n.º 17
0
        /// <summary>
        /// Displays IntelliPrompt parameter info in a <see cref="SyntaxEditor"/> based on the current context.
        /// </summary>
        /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will display the IntelliPrompt parameter info.</param>
        /// <returns>
        /// <c>true</c> if IntelliPrompt parameter info is displayed; otherwise, <c>false</c>.
        /// </returns>
        /// <remarks>
        /// Only call this method if the <see cref="IntelliPromptParameterInfoSupported"/> property is set to <c>true</c>.
        /// </remarks>
        public override bool ShowIntelliPromptParameterInfo(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor)
        {
            // Queue a task to display the parameter info prompt
            m_plugin.TaskQueue.AddTask(() => ShowIntelliPromptParameterInfoImmediate(syntaxEditor), TaskQueue.Thread.UI);

            return false;
        }
Exemplo n.º 18
0
 /// <summary>
 /// Performs an auto-complete if the <see cref="SyntaxEditor"/> context with which the IntelliPrompt member list is initialized causes a single selection.
 /// Otherwise, displays a member list in the <see cref="SyntaxEditor"/>.
 /// </summary>
 /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will display the IntelliPrompt member list.</param>
 /// <returns>
 /// <c>true</c> if an auto-complete occurred or if an IntelliPrompt member list is displayed; otherwise, <c>false</c>.
 /// </returns>
 public override bool IntelliPromptCompleteWord(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor)
 {
     // Triggered by Ctrl-Space
     return ShowIntelliPromptMemberList(syntaxEditor, true);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Constructor for initializing from the internal type we're trying to avoid exposing
 /// </summary>
 /// <param name="textRange"></param>
 internal SyntaxEditorTextRange(ActiproSoftware.SyntaxEditor.TextRange textRange)
     : this(textRange.StartOffset, textRange.EndOffset)
 {
 }
Exemplo n.º 20
0
		/// <summary>
		/// Initializes a new instance of the <c>LuatSemanticParser</c> class.
		/// </summary>
		/// <param name="lexicalParser">The <see cref="ActiproSoftware.SyntaxEditor.ParserGenerator.IRecursiveDescentLexicalParser"/> to use for lexical parsing.</param>
		public LuatSemanticParser(ActiproSoftware.SyntaxEditor.ParserGenerator.IRecursiveDescentLexicalParser lexicalParser) : base(lexicalParser) {}
Exemplo n.º 21
0
        /// <summary>
        /// Presents the parameter info prompt to the user
        /// </summary>
        /// <param name="syntaxEditor"></param>
        /// <returns></returns>
        private bool ShowIntelliPromptParameterInfoImmediate(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor)
        {
            // Initialize the parameter info
            syntaxEditor.IntelliPrompt.ParameterInfo.Hide();
            syntaxEditor.IntelliPrompt.ParameterInfo.Info.Clear();
            syntaxEditor.IntelliPrompt.ParameterInfo.SelectedIndex = 0;

            // Get the compilation unit
            var cu = syntaxEditor.Document.SemanticParseData as CompilationUnit;
            if (cu == null)
                return false;

            // Move back to the last open bracket
            int caret = syntaxEditor.Caret.Offset;
            TextStream stream = syntaxEditor.Document.GetTextStream(caret);
            stream.GoToPreviousTokenWithID(LuatTokenId.OpenParenthesis);

            // Find the argument list the caret is within
            var arguments = cu.FindNodeRecursive<ArgumentList>(stream.Offset);
            ArgumentList next = arguments;
            while (null != next && false == arguments.InsideBrackets(caret))
            {
                arguments = next;
                next = next.FindAncestor<ArgumentList>();
            }

            if (arguments == null)
                return false;

            var call = arguments.ParentNode as FunctionCall;
            if (call == null)
                throw new Exception("ArgumentList does not have FunctionCall as parent");

            // Configure the parameter info
            var textRange = new TextRange(arguments.ListTextRange.StartOffset, arguments.ListTextRange.EndOffset + 1);

            IntelliPromptParameterInfo pi = syntaxEditor.IntelliPrompt.ParameterInfo;
            pi.ValidTextRange = textRange;
            pi.CloseDelimiterCharacter = ')';
            pi.UpdateParameterIndex();
            pi.HideOnParentFormDeactivate = true;

            var functions = new List<LuatValue>();
            foreach (var value in call.ResolvedFunctions)
            {
                if (false == value.Type is LuatTypeFunction)
                    continue;

                functions.Merge(value);

                pi.Info.Add(GetQuickInfoForFunctionCall(value, pi.ParameterIndex));
            }

            // Store the function types in the context
            pi.Context = functions.ToArray();

            // Show the parameter info
            pi.Show(caret);

            return false;
        }
Exemplo n.º 22
0
 public static void SetSelectedIndex(ActiproSoftware.Windows.Controls.Ribbon.Controls.Backstage obj, int value)
 {
     obj.SetValue(SelectedIndexProperty, value);
 }
Exemplo n.º 23
0
        /// <summary>
        /// Builds a MemberList for the given syntaxEditor
        /// </summary>
        /// <param name="syntaxEditor"></param>
        /// <returns></returns>
        private MemberList BuildMemberList(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor)
        {
            // Get the target text range
            int caret = syntaxEditor.Caret.Offset;
            TextRange targetTextRange = TextRange.Deleted;
            TextStream stream = syntaxEditor.Document.GetTextStream(caret);

            // Get the compilation unit
            var cu = syntaxEditor.Document.SemanticParseData as CompilationUnit;
            if (cu == null)
                return null;

            var itemlist = new Hashtable();

            stream.GoToPreviousNonWhitespaceToken();

            if (stream.Token.IsComment)
            {
                return null;
            }

            var node = cu.FindNodeRecursive<LuatAstNodeBase>(stream.Offset);
            if (null != node)
            {
                foreach (AutoCompleteItem item in m_plugin.Database.GetAutoCompleteList(node, caret))
                {
                    itemlist[item.Name] = new IntelliPromptMemberListItem(item.Name, (int)item.Icon, item.Description);
                }

                targetTextRange = node.GetAutoCompleteTextRange(caret);
            }

            if (itemlist.Count == 0)
            {
                return null;
            }

            var memberlist = new MemberList { List = new IntelliPromptMemberListItem[itemlist.Count] };
            itemlist.Values.CopyTo(memberlist.List, 0);
            memberlist.TargetTextRange = targetTextRange;
            return memberlist;
        }
Exemplo n.º 24
0
 private static Color GetColor(ActiproSoftware.Drawing.BackgroundFill bgFill)
 {
     var solidColorBgFill = bgFill as ActiproSoftware.Drawing.SolidColorBackgroundFill;
     return solidColorBgFill == null ? Color.Black : solidColorBgFill.Color;
 }
Exemplo n.º 25
0
 public static int GetSelectedIndex(ActiproSoftware.Windows.Controls.Ribbon.Controls.Backstage obj)
 {
     return (int)obj.GetValue(SelectedIndexProperty);
 }
Exemplo n.º 26
0
 private void ScrollActiProEditor(ActiproSoftware.SyntaxEditor.SyntaxEditor editor, VerticalScrollAmount amount, bool down)
 {
     if ((amount == VerticalScrollAmount.Line) && down)
     {
         editor.get_SelectedView().ScrollDown();
     }
     else if (amount == VerticalScrollAmount.Line)
     {
         editor.get_SelectedView().ScrollUp();
     }
     else if ((amount == VerticalScrollAmount.Page) && down)
     {
         editor.get_SelectedView().ScrollPageDown();
     }
     else if (amount == VerticalScrollAmount.Page)
     {
         editor.get_SelectedView().ScrollPageUp();
     }
     else if ((amount == VerticalScrollAmount.Document) && down)
     {
         editor.get_SelectedView().ScrollToDocumentEnd();
     }
     else if (amount == VerticalScrollAmount.Document)
     {
         editor.get_SelectedView().ScrollToDocumentStart();
     }
 }
Exemplo n.º 27
0
        private void SetEditor(ActiproSoftware.SyntaxEditor.SyntaxEditor editor)
        {
            if (null != m_editor)
            {
                SetDocument(null);
                m_editor.DocumentChanged -= DocumentChanged;
                m_editor.SelectionChanged -= SelectionChanged;
            }

            m_editor = editor;

            if (m_editor != null)
            {
                m_editor.DocumentChanged += DocumentChanged;
                m_editor.SelectionChanged += SelectionChanged;
                SetDocument(editor.Document);
            }
        }
Exemplo n.º 28
0
        protected override void OnSyntaxEditorViewMouseDown(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, EditorViewMouseEventArgs e)
        {
            m_plugin.OnUserAction(LuaIntellisenseBroker.UserAction.MovedCaret, syntaxEditor);

            base.OnSyntaxEditorViewMouseDown(syntaxEditor, e);
        }
Exemplo n.º 29
0
        protected override void OnSyntaxEditorIntelliPromptParameterInfoParameterIndexChanged(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, EventArgs e)
        {
            IntelliPromptParameterInfo pi = syntaxEditor.IntelliPrompt.ParameterInfo;

            if (UpdateParameterInfoText(pi))
            {
                syntaxEditor.IntelliPrompt.ParameterInfo.MeasureAndResize(pi.Bounds.Location);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Occurs before a <see cref="SyntaxEditor.KeyTyped"/> event is raised 
        /// for a <see cref="SyntaxEditor"/> that has a <see cref="Document"/> using this language.
        /// </summary>
        /// <param name="syntaxEditor">The <see cref="SyntaxEditor"/> that will raise the event.</param>
        /// <param name="e">An <c>KeyTypedEventArgs</c> that contains the event data.</param>
        protected override void OnSyntaxEditorKeyTyped(ActiproSoftware.SyntaxEditor.SyntaxEditor syntaxEditor, KeyTypedEventArgs e)
        {
            m_timeLastKey = DateTime.Now;

            if (e.KeyData == Keys.Up ||
                 e.KeyData == Keys.Down ||
                 e.KeyData == Keys.Left ||
                 e.KeyData == Keys.Right ||
                 e.KeyData == Keys.PageUp ||
                 e.KeyData == Keys.PageDown ||
                 e.KeyData == Keys.End ||
                 e.KeyData == Keys.Home)
            {
                m_plugin.OnUserAction(LuaIntellisenseBroker.UserAction.MovedCaret, syntaxEditor);
            }
            else if (e.KeyChar != 0 ||
                      e.KeyData == Keys.Delete ||
                      e.KeyData == Keys.Enter ||
                      e.KeyData == Keys.Back)
            {
                m_plugin.OnUserAction(LuaIntellisenseBroker.UserAction.Typed, syntaxEditor);
            }

            // Prevent overzealous auto completion
            if (0 != e.KeyChar && false == Char.IsLetterOrDigit(e.KeyChar))
            {
                syntaxEditor.IntelliPrompt.MemberList.Abort();
            }

            switch (e.KeyChar)
            {
                default:
                    if (Char.IsLetter(e.KeyChar))
                    {
                        ShowIntelliPromptMemberList(syntaxEditor);
                    }
                    break;
                case '.':
                case ':':
                    // Show the parameter info for code
                    ShowIntelliPromptMemberList(syntaxEditor);
                    break;
                case '(':
                    ShowIntelliPromptParameterInfo(syntaxEditor);
                    break;
                case ')':
                    ShowIntelliPromptParameterInfo(syntaxEditor);
                    break;
                case ',':
                    if ((!syntaxEditor.IntelliPrompt.ParameterInfo.Visible) && (syntaxEditor.SelectedView.GetCurrentToken().LexicalState == LexicalStates["DefaultState"]))
                    {
                        // Show the parameter info for the context level if parameter info is not already displayed
                        ShowIntelliPromptParameterInfo(syntaxEditor);
                    }
                    break;
            }
        }