Conversation
rchl
commented
Mar 16, 2026
Comment on lines
149
to
+151
| class InvalidUriSchemeException(Exception): | ||
| def __init__(self, uri: str) -> None: | ||
| self.uri = uri | ||
|
|
||
| def __str__(self) -> str: | ||
| return f"invalid URI scheme: {self.uri}" | ||
| super().__init__(f"invalid URI scheme: {uri}") |
Member
Author
There was a problem hiding this comment.
Drive-by change. Was unnecessarily complicated.
rchl
commented
Mar 16, 2026
plugin/core/views.py
Outdated
Comment on lines
+137
to
+146
| @property | ||
| def scope(self) -> str: | ||
| return DIAGNOSTIC_STYLES[self.severity].region_scope | ||
|
|
||
| @property | ||
| def icon(self) -> str: | ||
| if userprefs().diagnostics_gutter_marker == "sign": | ||
| return DIAGNOSTIC_STYLES[self.severity].icon_resource | ||
| else: | ||
| return "" if self.severity == DiagnosticSeverity.Hint else userprefs().diagnostics_gutter_marker |
Member
Author
There was a problem hiding this comment.
I'm not sure if we really need to expose those on DiagnosticSeverityData.
Or at least scope we could easily read from DIAGNOSTIC_STYLES.
icon needs to be re-evaluated currently so it needs to exist somewhere.
jwortmann
reviewed
Mar 16, 2026
plugin/session_view.py
Outdated
Comment on lines
+310
to
+311
| for sev in reversed(DIAGNOSTIC_STYLES.keys()): | ||
| style = DIAGNOSTIC_STYLES[sev] |
Member
There was a problem hiding this comment.
Can be simplified:
Suggested change
| for sev in reversed(DIAGNOSTIC_STYLES.keys()): | |
| style = DIAGNOSTIC_STYLES[sev] | |
| for sev, style in reversed(DIAGNOSTIC_STYLES.items()): |
jwortmann
reviewed
Mar 16, 2026
plugin/core/views.py
Outdated
Comment on lines
+746
to
+747
| def format_severity(severity: DiagnosticSeverity) -> str: | ||
| return DIAGNOSTIC_STYLES[severity].kind if severity in DIAGNOSTIC_STYLES else "???" |
Member
There was a problem hiding this comment.
If severity is typed as DiagnosticSeverity, then we shouldn't need the in check.
I think this is pretty old code with the "???" and that fallback should actually be unnecessary anyway.
Also this function seems to be used only in a single place a few lines below, so you could just inline that below as
DIAGNOSTIC_STYLES[diagnostic_severity(diagnostic)].kind
jwortmann
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address #2788 (comment). I don't want to make that other PR too busy so making this change separately.
DIAGNOSTIC_SEVERITY(list of tuples) withDIAGNOSTIC_STYLES(dict keyed byDiagnosticSeverity). Accessing properties by index was not very readable and same for having to subtract 1 from severity when indexingDIAGNOSTIC_SEVERITY.