Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
frabert committed Apr 9, 2024
1 parent 28ece24 commit b972041
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions slither_lsp/app/logging/lsp_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class LSPHandler(Handler):
"""
Forwards log messages to the LSP client
"""

def __init__(self, server: LanguageServer):
Handler.__init__(self)
self.server = server
Expand Down
2 changes: 1 addition & 1 deletion slither_lsp/app/request_handlers/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ def to_pos(pos: lsp.Position) -> Pos:


def to_range(range: lsp.Range) -> Range:
return (to_pos(range.start), to_pos(range.end))
return (to_pos(range.start), to_pos(range.end))
6 changes: 3 additions & 3 deletions slither_lsp/app/slither_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
from slither_lsp.app.utils.file_paths import normalize_uri, uri_to_fs_path

# TODO(frabert): Maybe this should be upstreamed? https://github.com/openlawlibrary/pygls/discussions/338
METHOD_TO_OPTIONS[lsp.WORKSPACE_DID_CHANGE_WATCHED_FILES] = (
lsp.DidChangeWatchedFilesRegistrationOptions
)
METHOD_TO_OPTIONS[
lsp.WORKSPACE_DID_CHANGE_WATCHED_FILES
] = lsp.DidChangeWatchedFilesRegistrationOptions


class SlitherProtocol(LanguageServerProtocol):
Expand Down
10 changes: 4 additions & 6 deletions slither_lsp/app/utils/file_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def is_solidity_file(path: str) -> bool:
filename_base, file_extension = os.path.splitext(path)
return file_extension is not None and file_extension.lower() == '.sol'
return file_extension is not None and file_extension.lower() == ".sol"


def uri_to_fs_path(uri: str) -> str:
Expand All @@ -19,7 +19,7 @@ def normalize_uri(uri: str) -> str:


def fs_path_to_uri(path: str) -> str:
uri = urljoin('file:', pathname2url(path))
uri = urljoin("file:", pathname2url(path))
return uri


Expand All @@ -41,10 +41,8 @@ def get_solidity_files(folders: Iterable[str], recursive=True) -> Set[str]:
solidity_files.add(full_path)
elif recursive and os.path.isdir(full_path):
# If recursive, join our set with any other discovered files in subdirectories.
if item != 'node_modules':
solidity_files.update(
get_solidity_files([full_path], recursive)
)
if item != "node_modules":
solidity_files.update(get_solidity_files([full_path], recursive))

# Return all discovered solidity files
return solidity_files
4 changes: 3 additions & 1 deletion slither_lsp/app/utils/ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def source_to_location(source: Source) -> lsp.Location:
)


def get_object_name_range(obj: Union[Function, Contract, Enum, Event, Structure], comp: CryticCompile) -> lsp.Range:
def get_object_name_range(
obj: Union[Function, Contract, Enum, Event, Structure], comp: CryticCompile
) -> lsp.Range:
name_pos = get_definition(obj, comp)
return lsp.Range(
start=lsp.Position(
Expand Down

0 comments on commit b972041

Please sign in to comment.