Search in sources :

Example 1 with INamespaceDecorationNode

use of org.apache.flex.compiler.tree.as.INamespaceDecorationNode in project vscode-nextgenas by BowlerHatLLC.

the class ActionScriptTextDocumentService method actionScriptHoverWithNode.

private CompletableFuture<Hover> actionScriptHoverWithNode(TextDocumentPositionParams position, IASNode offsetNode) {
    IDefinition definition = null;
    if (offsetNode == null) {
        //we couldn't find a node at the specified location
        return CompletableFuture.completedFuture(new Hover(Collections.emptyList(), null));
    }
    //any hover information for it.
    if (definition == null && offsetNode instanceof IIdentifierNode && !(offsetNode instanceof INamespaceDecorationNode)) {
        IIdentifierNode identifierNode = (IIdentifierNode) offsetNode;
        definition = identifierNode.resolve(currentUnit.getProject());
    }
    if (definition == null) {
        return CompletableFuture.completedFuture(new Hover(Collections.emptyList(), null));
    }
    Hover result = new Hover();
    String detail = getDefinitionDetail(definition);
    List<String> contents = new ArrayList<>();
    contents.add(MARKDOWN_CODE_BLOCK_NEXTGENAS_START + detail + MARKDOWN_CODE_BLOCK_END);
    result.setContents(contents);
    return CompletableFuture.completedFuture(result);
}
Also used : INamespaceDecorationNode(org.apache.flex.compiler.tree.as.INamespaceDecorationNode) Hover(org.eclipse.lsp4j.Hover) ArrayList(java.util.ArrayList) IIdentifierNode(org.apache.flex.compiler.tree.as.IIdentifierNode) IDefinition(org.apache.flex.compiler.definitions.IDefinition)

Aggregations

ArrayList (java.util.ArrayList)1 IDefinition (org.apache.flex.compiler.definitions.IDefinition)1 IIdentifierNode (org.apache.flex.compiler.tree.as.IIdentifierNode)1 INamespaceDecorationNode (org.apache.flex.compiler.tree.as.INamespaceDecorationNode)1 Hover (org.eclipse.lsp4j.Hover)1