Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: get rid of SessionBuffer.data_per_severity #2286

Merged
merged 2 commits into from
Jun 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion plugin/core/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
from .url import parse_uri
from .url import unparse_uri
from .version import __version__
from .views import DiagnosticSeverityData
from .views import extract_variables
from .views import get_storage_path
from .views import get_uri_and_range_from_location
Expand Down Expand Up @@ -539,7 +540,9 @@ def has_capability_async(self, capability_path: str) -> bool:
def shutdown_async(self) -> None:
...

def present_diagnostics_async(self, is_view_visible: bool) -> None:
def present_diagnostics_async(
self, is_view_visible: bool, data_per_severity: Dict[Tuple[int, bool], DiagnosticSeverityData]
) -> None:
...

def on_request_started_async(self, request_id: int, request: Request) -> None:
Expand Down
13 changes: 13 additions & 0 deletions plugin/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,19 @@
}


class DiagnosticSeverityData:

__slots__ = ('regions', 'regions_with_tag', 'annotations', 'scope', 'icon')

def __init__(self, severity: int) -> None:
self.regions = [] # type: List[sublime.Region]
self.regions_with_tag = {} # type: Dict[int, List[sublime.Region]]
self.annotations = [] # type: List[str]
_, _, self.scope, self.icon, _, _ = DIAGNOSTIC_SEVERITY[severity - 1]
if userprefs().diagnostics_gutter_marker != "sign":
self.icon = "" if severity == DiagnosticSeverity.Hint else userprefs().diagnostics_gutter_marker


class InvalidUriSchemeException(Exception):
def __init__(self, uri: str) -> None:
self.uri = uri
Expand Down
Loading