예제 #1
0
    def test_type_definition_return_location_link_list(self):
        response = self.client.lsp.send_request(
            TYPE_DEFINITION,
            TypeDefinitionParams(
                text_document=TextDocumentIdentifier(
                    uri='file://return.location_link_list'),
                position=Position(line=0, character=0),
            ),
        ).result(timeout=CALL_TIMEOUT)

        assert response[0]['targetUri'] == 'uri'

        assert response[0]['targetRange']['start']['line'] == 0
        assert response[0]['targetRange']['start']['character'] == 0
        assert response[0]['targetRange']['end']['line'] == 1
        assert response[0]['targetRange']['end']['character'] == 1

        assert response[0]['targetSelectionRange']['start']['line'] == 0
        assert response[0]['targetSelectionRange']['start']['character'] == 0
        assert response[0]['targetSelectionRange']['end']['line'] == 2
        assert response[0]['targetSelectionRange']['end']['character'] == 2

        assert response[0]['originSelectionRange']['start']['line'] == 0
        assert response[0]['originSelectionRange']['start']['character'] == 0
        assert response[0]['originSelectionRange']['end']['line'] == 3
        assert response[0]['originSelectionRange']['end']['character'] == 3
예제 #2
0
    def test_type_definition_return_none(self):
        response = self.client.lsp.send_request(
            TYPE_DEFINITION,
            TypeDefinitionParams(
                text_document=TextDocumentIdentifier(uri='file://return.none'),
                position=Position(line=0, character=0),
            ),
        ).result(timeout=CALL_TIMEOUT)

        assert response is None