diff --git a/devchat/ide/service.py b/devchat/ide/service.py index 8d3b887a..7afff5c2 100644 --- a/devchat/ide/service.py +++ b/devchat/ide/service.py @@ -9,7 +9,7 @@ from typing import List from .rpc import rpc_method -from .types import Location, SymbolNode +from .types import Location, SymbolNode, LocationWithText from .vscode_services import selected_range, visible_range from .idea_services import IdeaIDEService @@ -40,7 +40,8 @@ def get_lsp_brige_port(self) -> str: def install_python_env(self, command_name: str, requirements_file: str) -> str: """ A method to install a Python environment with the provided command name - and requirements file, returning a string result. + and requirements file, returning python path installed. + Command name is the name of the environment to be installed. """ return self._result @@ -63,6 +64,7 @@ def ide_language(self) -> str: @rpc_method def ide_logging(self, level: str, message: str) -> bool: """ + Logs a message to the IDE. level: "info" | "warn" | "error" | "debug" """ return self._result @@ -102,7 +104,7 @@ def ide_name(self) -> str: This method is a remote procedure call (RPC) that fetches the name of the IDE being used. Returns: - The name of the IDE as a string. + The name of the IDE as a string. For example, "vscode" or "pycharm". """ return self._result @@ -125,7 +127,7 @@ def diff_apply(self, filepath, content) -> bool: """ return self._result - def get_visible_range(self): + def get_visible_range(self) -> LocationWithText: """ Determines and returns the visible range of code in the current IDE. @@ -137,7 +139,7 @@ def get_visible_range(self): return visible_range() return IdeaIDEService().get_visible_range() - def get_selected_range(self): + def get_selected_range(self) -> LocationWithText: """ Retrieves the selected range of code in the current IDE. diff --git a/tests/test_cli_log.py b/tests/test_cli_log.py index e301cb24..7a52fddc 100755 --- a/tests/test_cli_log.py +++ b/tests/test_cli_log.py @@ -181,10 +181,10 @@ def test_log_insert(git_repo): # pylint: disable=W0613 ) assert result.exit_code == 0 content = get_content(result.output) - assert content.strip() == "Topic 2" + assert content.strip() == "Topic 2" or content.strip() == "2" result = runner.invoke(main, ['log', '-t', prompt2['hash'], '-n', 100]) assert result.exit_code == 0 logs = json.loads(result.output) assert len(logs) == 2 - assert logs[0]['responses'][0] == "Topic 2" + assert logs[0]['responses'][0] == "Topic 2" or logs[0]['responses'][0] == "2" diff --git a/tests/test_cli_prompt.py b/tests/test_cli_prompt.py index 770e5fc1..f50cb4df 100644 --- a/tests/test_cli_prompt.py +++ b/tests/test_cli_prompt.py @@ -174,16 +174,17 @@ def test_prompt_with_function_replay(git_repo, functions_file): # pylint: disab content = get_content(result.output) assert result.exit_code == 0 - assert '22 degrees Celsius and sunny' in content + assert '22' in content + assert 'sunny' in content or 'Sunny' in content prompt_hash = get_prompt_hash(result.output) result = runner.invoke(main, ['prompt', '-m', 'gpt-3.5-turbo', '-p', prompt_hash, - 'what is the GPT function name?']) + 'what is the function tool name?']) content = get_content(result.output) assert result.exit_code == 0 - assert 'get_current_weather' in content + assert 'get_current_weather' in content or 'GetCurrentWeather' in content def test_prompt_without_repo(mock_home_dir): # pylint: disable=W0613