Skip to content

Commit

Permalink
improve getCurrentAttribute method for AbstractPositionReqest
Browse files Browse the repository at this point in the history
  • Loading branch information
Seiphon committed Oct 28, 2019
1 parent 68d9292 commit e03dc15
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4xml.commons.BadLocationException;
import org.eclipse.lsp4xml.dom.DOMAttr;
import org.eclipse.lsp4xml.dom.DOMDocument;
import org.eclipse.lsp4xml.dom.DOMElement;
import org.eclipse.lsp4xml.dom.DOMNode;
Expand Down Expand Up @@ -101,6 +102,9 @@ public String getCurrentTag() {

@Override
public String getCurrentAttributeName() {
if (node != null && node.isAttribute() && ((DOMAttr) node).getName() != null) {
return ((DOMAttr) node).getName();
}
return currentAttributeName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,18 @@ class AggregatedHoverParticipant extends HoverParticipantAdapter {

@Override
public String onTag(IHoverRequest request) throws Exception {
return TEST_FOR_TAG_HOVER;
if ("bean".equals(request.getCurrentTag())) {
return TEST_FOR_TAG_HOVER;
}
return null;
}

@Override
public String onAttributeName(IHoverRequest request) throws Exception {
return TEST_FOR_ATTRIBUTENAME_HOVER;
if ("class".equals(request.getCurrentAttributeName())) {
return TEST_FOR_ATTRIBUTENAME_HOVER;
}
return null;
}
}
}
Expand Down

0 comments on commit e03dc15

Please sign in to comment.