1010from urllib .parse import unquote
1111
1212import pythinker_host
13- from pythinker_core . tooling import CallableTool2 , ToolReturnValue
13+ from pythinker_core import tooling as _tooling
1414from pythinker_host .path import HostPath
1515
1616from pythinker_code .lsp .recommend import get_matching_lsp_plugins
2828_GIT_CHECK_IGNORE_TIMEOUT = 5.0
2929
3030
31- class Lsp (CallableTool2 [Params ]):
31+ class Lsp (_tooling . CallableTool2 [Params ]):
3232 name : str = "LSP"
3333 supports_parallel : bool = True
3434 description : str = load_desc (Path (__file__ ).parent / "tool.md" , {})
@@ -44,7 +44,7 @@ def __init__(self, runtime: Runtime) -> None:
4444 self ._recommended_exts : set [str ] = set ()
4545
4646 @override
47- async def __call__ (self , params : Params ) -> ToolReturnValue :
47+ async def __call__ (self , params : Params ) -> _tooling . ToolReturnValue :
4848 builder = ToolResultBuilder (max_chars = MAX_RESULT_SIZE_CHARS , max_line_length = None )
4949
5050 if self ._lsp .status () == LspInitStatus .PENDING :
@@ -182,7 +182,9 @@ def _brief(self, params: Params) -> str:
182182 return f"{ params .operation } { symbol } "
183183 return f"{ params .operation } { params .file_path } :{ params .line } :{ params .character } "
184184
185- async def _validate_file (self , file_path : str ) -> tuple [str | None , ToolReturnValue | None ]:
185+ async def _validate_file (
186+ self , file_path : str
187+ ) -> tuple [str | None , _tooling .ToolReturnValue | None ]:
186188 builder = ToolResultBuilder (max_chars = MAX_RESULT_SIZE_CHARS , max_line_length = None )
187189
188190 if _is_unc_path (file_path ):
@@ -224,7 +226,7 @@ async def _ensure_file_open(
224226 manager : Any ,
225227 absolute_path : str ,
226228 display_path : str ,
227- ) -> ToolReturnValue | None :
229+ ) -> _tooling . ToolReturnValue | None :
228230 builder = ToolResultBuilder (max_chars = MAX_RESULT_SIZE_CHARS , max_line_length = None )
229231 host_path = HostPath (absolute_path )
230232 try :
@@ -289,6 +291,7 @@ def _method_and_params(params: Params, absolute_path: str) -> tuple[str, dict[st
289291 return "textDocument/prepareCallHierarchy" , text_document
290292 case _:
291293 raise ValueError (f"Unsupported LSP operation: { params .operation } " )
294+ raise AssertionError (f"Unsupported LSP operation: { params .operation } " )
292295
293296
294297def _to_location (item : dict [str , Any ]) -> dict [str , Any ]:
0 commit comments