Exemplo n.º 1
0
def lsp_symbol_information(name: Name) -> SymbolInformation:
    """Get LSP SymbolInformation from Jedi definition."""
    return SymbolInformation(
        name=name.name,
        kind=get_lsp_symbol_type(name.type),
        location=lsp_location(name),
        container_name=("None" if name is None else
                        (name.full_name or name.name or "None")),
    )
Exemplo n.º 2
0
        def f(
            params: DocumentSymbolParams
        ) -> Union[List[SymbolInformation], List[DocumentSymbol]]:
            symbol_info = SymbolInformation(
                name='symbol',
                kind=SymbolKind.Namespace,
                location=Location(
                    uri='uri',
                    range=Range(
                        start=Position(line=0, character=0),
                        end=Position(line=1, character=1),
                    ),
                ),
                container_name='container',
                deprecated=False,
            )

            document_symbol_inner = DocumentSymbol(
                name='inner_symbol',
                kind=SymbolKind.Number,
                range=Range(
                    start=Position(line=0, character=0),
                    end=Position(line=1, character=1),
                ),
                selection_range=Range(
                    start=Position(line=0, character=0),
                    end=Position(line=1, character=1),
                ),
            )

            document_symbol = DocumentSymbol(
                name='symbol',
                kind=SymbolKind.Object,
                range=Range(
                    start=Position(line=0, character=0),
                    end=Position(line=10, character=10),
                ),
                selection_range=Range(
                    start=Position(line=0, character=0),
                    end=Position(line=10, character=10),
                ),
                detail='detail',
                children=[document_symbol_inner],
                deprecated=True,
            )

            return {    # type: ignore
                'file://return.symbol_information_list': [symbol_info],
                'file://return.document_symbol_list': [document_symbol],
            }.get(params.text_document.uri, None)