Exemplo n.º 1
0
    def definition(self, textDocument, position):
            """
            The go to definition request is sent from the client to the server to resolve the declaration location of a 
            symbol at a given text document position.

            The result type LocationLink[] got introduce with version 3.14.0 and depends in the corresponding client
            capability `clientCapabilities.textDocument.declaration.linkSupport`.

            :param TextDocumentItem textDocument: The text document.
            :param Position position: The position inside the text document.
            """
            result_dict = self.lsp_endpoint.call_method("textDocument/definition", textDocument=textDocument, position=position)
            if "uri" in result_dict:
                return lsp_structs.Location(**result_dict)

            return [lsp_structs.Location(**l) if "uri" in l else lsp_structs.LinkLocation(**l) for l in result_dict]
Exemplo n.º 2
0
    def typeDefinition(self, textDocument, position):
        """
        The goto type definition request is sent from the client to the server to resolve the type definition location of a symbol at a given text document position.

        :param TextDocumentItem textDocument: The text document.
        :param Position position: The position inside the text document.
        """
        result_dict = self.lsp_endpoint.call_method("textDocument/definition", textDocument=textDocument, position=position)
        return [lsp_structs.Location(**l) for l in result_dict]
Exemplo n.º 3
0
    def references(self, textDocument, position, context):
        """
        The references request is sent from the client to the server to resolve project-wide references for
        the symbol denoted by the given text document position.

        :param TextDocumentItem textDocument: The text document.
        :param Position position: The position inside the text document.
        :param ReferenceContext context: Context which describe "Include the declaration of the current symbol." or not
        """
        result_dict = self.lsp_endpoint.call_method("textDocument/references", textDocument=textDocument,
                                                    position=position, context=context)
        return [lsp_structs.Location(**l) for l in result_dict]