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

Remove unnecessary is_range_equal function #2114

Merged
merged 1 commit into from
Nov 4, 2022
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: 0 additions & 5 deletions plugin/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,6 @@ def region_to_range(view: sublime.View, region: sublime.Region) -> Range:
}


def is_range_equal(lhs: Range, rhs: Range) -> bool:
return lhs['start']['line'] == rhs['start']['line'] and lhs['start']['character'] == rhs['start']['character'] and \
lhs['end']['line'] == rhs['end']['line'] and lhs['end']['character'] == rhs['end']['character']


def to_encoded_filename(path: str, position: Position) -> str:
# WARNING: Cannot possibly do UTF-16 conversion :) Oh well.
return '{}:{}:{}'.format(path, position['line'] + 1, position['character'] + 1)
Expand Down
3 changes: 1 addition & 2 deletions plugin/session_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from .core.views import document_color_params
from .core.views import DOCUMENT_LINK_FLAGS
from .core.views import entire_content_range
from .core.views import is_range_equal
from .core.views import lsp_color_to_phantom
from .core.views import MissingUriError
from .core.views import range_to_region
Expand Down Expand Up @@ -389,7 +388,7 @@ def get_document_link_at_point(self, view: sublime.View, point: int) -> Optional
def update_document_link(self, new_link: DocumentLink) -> None:
new_link_range = new_link["range"]
for link in self.document_links:
if is_range_equal(link["range"], new_link_range):
if link["range"] == new_link_range:
self.document_links.remove(link)
self.document_links.append(new_link)
break
Expand Down