Skip to content
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
12 changes: 7 additions & 5 deletions devchat/ide/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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.

Expand All @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
7 changes: 4 additions & 3 deletions tests/test_cli_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down