示例#1
0
        public override Window CreateTooltipWindow(TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
        {
            var result = item.Item as List <Result>;

            var sb = new StringBuilder();

            foreach (var r in result)
            {
                var escapedMessage = Ambience.EscapeText(r.Message);
                if (sb.Length > 0)
                {
                    sb.AppendLine();
                }
                if (result.Count > 1)
                {
                    string   severity;
                    HslColor color;
                    switch (r.Level)
                    {
                    case Microsoft.CodeAnalysis.DiagnosticSeverity.Info:
                        severity = GettextCatalog.GetString("Info");
                        editor.Options.GetEditorTheme().TryGetColor(EditorThemeColors.UnderlineSuggestion, out color);
                        break;

                    case Microsoft.CodeAnalysis.DiagnosticSeverity.Warning:
                        severity = GettextCatalog.GetString("Warning");
                        editor.Options.GetEditorTheme().TryGetColor(EditorThemeColors.UnderlineWarning, out color);
                        break;

                    case Microsoft.CodeAnalysis.DiagnosticSeverity.Error:
                        severity = GettextCatalog.GetString("Error");
                        editor.Options.GetEditorTheme().TryGetColor(EditorThemeColors.UnderlineError, out color);
                        break;

                    default:
                        severity = "?";
                        editor.Options.GetEditorTheme().TryGetColor(EditorThemeColors.UnderlineSuggestion, out color);
                        break;
                    }

                    sb.AppendFormat("<span foreground ='{2}'font_weight='bold'>{0}</span>: {1}", severity, escapedMessage, color.ToPangoString());
                }
                else
                {
                    sb.Append(escapedMessage);
                }
            }
            var window = new LanguageItemWindow(CompileErrorTooltipProvider.GetExtensibleTextEditor(editor), modifierState, null, sb.ToString(), null);

            if (window.IsEmpty)
            {
                return(null);
            }
            return(window);
        }
示例#2
0
        public override Control CreateTooltipWindow(TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Gdk.ModifierType modifierState)
        {
            var result = item.Item as Result;

            var window = new LanguageItemWindow(CompileErrorTooltipProvider.GetExtensibleTextEditor(editor), modifierState, null, result.Message, null);

            if (window.IsEmpty)
            {
                return(null);
            }
            return(window);
        }
示例#3
0
        public override Window CreateTooltipWindow(TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
        {
            var result = item.Item as TooltipInformation;

            if (result == null)
            {
                return(null);
            }
            var window = new LanguageItemWindow(CompileErrorTooltipProvider.GetExtensibleTextEditor(editor), modifierState, null, result.SignatureMarkup, null);

            window.Destroyed += delegate {
                if (window.Tag is FloatingQuickFixIconWidget widget)
                {
                    widget.QueueDestroy();
                }
            };
            if (window.IsEmpty)
            {
                return(null);
            }
            return(window);
        }