def test_complete_from_context(rf_server_api, libspec_manager, tmpdir): from robotframework_ls.impl.completion_context import CompletionContext from robotframework_ls.impl.robot_workspace import RobotDocument from robotframework_ls.impl.robot_workspace import RobotWorkspace from robocorp_ls_core.watchdog_wrapper import create_observer api = rf_server_api text = """*** Task *** Some task Log Something console=True Lo""" doc = RobotDocument("", text) line, col = doc.get_last_line_col() workspace = RobotWorkspace( str(tmpdir), fs_observer=create_observer("dummy", []), libspec_manager=libspec_manager, ) completion_context = CompletionContext(doc, line, col, workspace=workspace) for completion in api._complete_from_completion_context(completion_context): if completion["label"] == "Log": break else: raise AssertionError('Did not find "Log" entry in completions.')
def _create_workspace(self, root_uri: str, fs_observer: IFSObserver, workspace_folders): from robotframework_ls.impl.robot_workspace import RobotWorkspace return RobotWorkspace(root_uri, fs_observer, workspace_folders, generate_ast=False)
def _create_workspace( self, root_uri: str, fs_observer: IFSObserver, workspace_folders ) -> IWorkspace: from robotframework_ls.impl.robot_workspace import RobotWorkspace return RobotWorkspace( root_uri, fs_observer, workspace_folders, libspec_manager=self.libspec_manager, )
def set_absolute_path_root(self, path, **kwargs): from robocorp_ls_core import uris from robotframework_ls.impl.robot_workspace import RobotWorkspace self._ws = RobotWorkspace(uris.from_fs_path(path), **kwargs)
def _create_workspace(self, root_uri, workspace_folders): from robotframework_ls.impl.robot_workspace import RobotWorkspace return RobotWorkspace(root_uri, workspace_folders, libspec_manager=self.libspec_manager)
def set_root(self, relative_path, **kwargs): from robocode_ls_core import uris from robotframework_ls.impl.robot_workspace import RobotWorkspace path = self._cases.get_path(relative_path) self._ws = RobotWorkspace(uris.from_fs_path(path), **kwargs)