Ejemplo n.º 1
0
    def setUp(self):
        self.folder = Path(__file__).parent / 'verilog'
        # Client to Server pipe
        csr, csw = os.pipe()
        # Server to client pipe
        scr, scw = os.pipe()

        # Server
        self.server = server
        # Client
        self.client = LanguageServer(asyncio.new_event_loop())

        server_thread = Thread(target=self.server.start_io,
                               args=(os.fdopen(csr,
                                               'rb'), os.fdopen(scw, 'wb')))
        server_thread.daemon = True
        server_thread.start()

        client_thread = Thread(target=self.client.start_io,
                               args=(os.fdopen(scr,
                                               'rb'), os.fdopen(csw, 'wb')))
        client_thread.daemon = True
        client_thread.start()
        # Initialize server
        self.server.lsp.bf_initialize(
            InitializeParams(process_id=1234,
                             root_uri=self.folder.as_uri(),
                             capabilities=None))
        print("Setup done!")
Ejemplo n.º 2
0
def test_bf_initialize(client_server):
    client, _ = client_server

    response = client.lsp.send_request(
        INITIALIZE,
        InitializeParams(
            process_id=1234,
            root_path=os.path.dirname(__file__))).result(timeout=CALL_TIMEOUT)

    assert hasattr(response, 'capabilities')
def _init(client: LanguageServer, root: Path):
    retry = 3
    while retry > 0:
        try:
            client.lsp.send_request(
                INITIALIZE,
                InitializeParams(
                    process_id=1234, root_uri=root.as_uri(),
                    capabilities=None)).result(timeout=CALL_TIMEOUT)
        except futures.TimeoutError:
            retry -= 1
        else:
            break
Ejemplo n.º 4
0
def _initialize_server(server):
    server.lsp.bf_initialize(
        InitializeParams(process_id=1234,
                         root_uri=pathlib.Path(__file__).parent.as_uri(),
                         capabilities=None))
Ejemplo n.º 5
0
def _initialize_server(server):
    server.lsp.bf_initialize(
        InitializeParams(process_id=1234, root_path=os.path.dirname(__file__)))
Ejemplo n.º 6
0
def initialize_server(server):
    server.lsp.bf_initialize(
        InitializeParams(process_id=1234,
                         capabilities=ClientCapabilities(),
                         root_uri=from_fs_path(WORKSPACE_PATH)))