|
6 | 6 | from .core.configurations import is_supported_syntax
|
7 | 7 | from .core.diagnostics import get_point_diagnostics
|
8 | 8 | from .core.clients import LspTextCommand, client_for_view
|
9 |
| -from .core.protocol import Request |
| 9 | +from .core.protocol import Request, DiagnosticSeverity |
10 | 10 | from .core.documents import get_document_position
|
11 | 11 | from .core.popups import popup_css, popup_class
|
12 | 12 |
|
@@ -76,10 +76,29 @@ def symbol_actions_content(self):
|
76 | 76 | return "<p>" + " | ".join(actions) + "</p>"
|
77 | 77 |
|
78 | 78 | def diagnostics_content(self, diagnostics):
|
79 |
| - formatted = ["<div class='errors'>"] |
80 |
| - formatted.extend("<pre>{}</pre>".format(diagnostic.message) for diagnostic in diagnostics) |
81 |
| - formatted.append("<a href='{}'>{}</a>".format('code-actions', 'Code Actions')) |
82 |
| - formatted.append("</div>") |
| 79 | + formatted_errors = list( |
| 80 | + "<pre>{}</pre>".format(diagnostic.message) |
| 81 | + for diagnostic in diagnostics |
| 82 | + if diagnostic.severity == DiagnosticSeverity.Error) |
| 83 | + if len(formatted_errors) > 0: |
| 84 | + formatted = ["<div class='errors'>"] |
| 85 | + formatted.extend(formatted_errors) |
| 86 | + formatted.append("<a href='{}'>{}</a>".format('code-actions', |
| 87 | + 'Code Actions')) |
| 88 | + formatted.append("</div>") |
| 89 | + |
| 90 | + formatted_warnings = list( |
| 91 | + "<pre>{}</pre>".format(diagnostic.message) |
| 92 | + for diagnostic in diagnostics |
| 93 | + if diagnostic.severity == DiagnosticSeverity.Warning) |
| 94 | + |
| 95 | + if len(formatted_warnings) > 0: |
| 96 | + formatted = ["<div class='warnings'>"] |
| 97 | + formatted.extend(formatted_warnings) |
| 98 | + formatted.append("<a href='{}'>{}</a>".format('code-actions', |
| 99 | + 'Code Actions')) |
| 100 | + formatted.append("</div>") |
| 101 | + |
83 | 102 | return "".join(formatted)
|
84 | 103 |
|
85 | 104 | def hover_content(self, point, response):
|
|
0 commit comments