Пример #1
0
 public TokenCompletionData(byte Token)
 {
     try
     {
         this.Token  = Token;
         Text        = DTokens.GetTokenString(Token);
         Description = ToolTipContentHelper.CreateToolTipContent(Text, DTokens.GetDescription(Token));
         Image       = DCodeCompletionSupport.GetNodeImage("keyword");
     }
     catch (Exception ex)
     {
         ErrorLogger.Log(ex);
     }
 }
Пример #2
0
        public static void BuildToolTip(DEditorDocument EditorDocument, ToolTipRequestArgs ToolTipRequest)
        {
            if (!ToolTipRequest.InDocument)
            {
                return;
            }

            var dataOverride = new EditorData();

            dataOverride.ApplyFrom(EditorDocument);

            dataOverride.CaretLocation = new CodeLocation(ToolTipRequest.Column, ToolTipRequest.Line);
            dataOverride.CaretOffset   = EditorDocument.Editor.Document.GetOffset(ToolTipRequest.Position);

            var ttContents = AbstractTooltipProvider.BuildToolTip(dataOverride);

            if (ttContents == null)
            {
                return;
            }

            int offset = EditorDocument.Editor.Document.GetOffset(ToolTipRequest.Line, ToolTipRequest.Column);

            try
            {
                var vertStack = new StackPanel()
                {
                    Orientation = Orientation.Vertical
                };
                string lastDescription = "";
                foreach (var tt in ttContents)
                {
                    vertStack.Children.Add(
                        ToolTipContentHelper.CreateToolTipContent(
                            tt.Title,
                            lastDescription == tt.Description ? null : lastDescription = tt.Description)
                        as UIElement);
                }

                ToolTipRequest.ToolTipContent = vertStack;
            }
            catch { }
        }
Пример #3
0
        void Init()
        {
            bool IsPackage = AssociatedModule == null;

            var descString = (IsPackage ? "(Package)" : "(Module)");

            if (!string.IsNullOrWhiteSpace(ExplicitModulePath))
            {
                descString += ExplicitModulePath;
            }
            else if (AssociatedModule != null)
            {
                descString += " " + AssociatedModule.FileName;

                if (AssociatedModule.Description != null)
                {
                    descString += "\r\n" + AssociatedModule.Description;
                }
            }

            Description = ToolTipContentHelper.CreateToolTipContent(
                IsPackage ? ModuleName : AssociatedModule.ModuleName, descString);
        }