Skip to content

Commit

Permalink
Support collegamento v0.2.0 (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moosems authored Aug 7, 2024
1 parent aec52ec commit c0b6f03
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions salve/wrappers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collegamento import Request
from collegamento import Request, FileServer
from pyeditorconfig import get_config
from token_tools import Token, normal_text_range

Expand All @@ -11,43 +11,43 @@
)


def find_autocompletions_request_wrapper(request: Request) -> list[str]:
def find_autocompletions_request_wrapper(server: FileServer, request: Request) -> list[str]:
return find_autocompletions(
full_text=request["file"], # type: ignore
expected_keywords=request["expected_keywords"], # type: ignore
current_word=request["current_word"], # type: ignore
)


def get_replacements_request_wrapper(request: Request) -> list[str]:
def get_replacements_request_wrapper(server: FileServer, request: Request) -> list[str]:
return get_replacements(
full_text=request["file"], # type: ignore
expected_keywords=request["expected_keywords"], # type: ignore
replaceable_word=request["current_word"], # type: ignore
)


def get_highlights_request_wrapper(request: Request) -> list[Token]:
def get_highlights_request_wrapper(server: FileServer, request: Request) -> list[Token]:
return get_highlights(
full_text=request["file"], # type: ignore
language=request["language"], # type: ignore
text_range=request["text_range"], # type: ignore
)


def editorconfig_request_wrapper(request: Request) -> dict:
def editorconfig_request_wrapper(server: FileServer, request: Request) -> dict:
return get_config(request["file_path"]) # type: ignore


def get_definition_request_wrapper(request: Request) -> Token:
def get_definition_request_wrapper(server: FileServer, request: Request) -> Token:
return get_definition(
request["file"], # type: ignore
request["definition_starters"], # type: ignore
request["current_word"], # type: ignore
)


def get_special_tokens_request_wrapper(request: Request) -> list[Token]:
def get_special_tokens_request_wrapper(server: FileServer, request: Request) -> list[Token]:
return get_special_tokens(
request["file"], # type: ignore
normal_text_range(request["file"], request["text_range"])[ # type: ignore
Expand Down

0 comments on commit c0b6f03

Please sign in to comment.