use of org.apache.flex.compiler.tree.as.IDefinitionNode in project vscode-nextgenas by BowlerHatLLC.
the class ActionScriptTextDocumentService method actionScriptRenameWithNode.
private CompletableFuture<WorkspaceEdit> actionScriptRenameWithNode(RenameParams params, IASNode offsetNode) {
if (offsetNode == null) {
//we couldn't find a node at the specified location
return CompletableFuture.completedFuture(new WorkspaceEdit(new HashMap<>()));
}
IDefinition definition = null;
if (offsetNode instanceof IDefinitionNode) {
IDefinitionNode definitionNode = (IDefinitionNode) offsetNode;
IExpressionNode expressionNode = definitionNode.getNameExpressionNode();
definition = expressionNode.resolve(currentProject);
} else if (offsetNode instanceof IIdentifierNode) {
IIdentifierNode identifierNode = (IIdentifierNode) offsetNode;
definition = identifierNode.resolve(currentProject);
}
if (definition == null) {
if (languageClient != null) {
MessageParams message = new MessageParams();
message.setType(MessageType.Info);
message.setMessage("You cannot rename this element.");
languageClient.showMessage(message);
}
return CompletableFuture.completedFuture(new WorkspaceEdit(new HashMap<>()));
}
WorkspaceEdit result = renameDefinition(definition, params.getNewName());
return CompletableFuture.completedFuture(result);
}
Aggregations