コード例 #1
0
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.')
コード例 #2
0
    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)
コード例 #3
0
ファイル: server.py プロジェクト: robocorp/robotframework-lsp
    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,
        )
コード例 #4
0
ファイル: fixtures.py プロジェクト: xylix/robotframework-lsp
    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)
コード例 #5
0
    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)
コード例 #6
0
    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)