private String digestSuggestRaml(String topSection, String bottomSection, int contextColumn) { if (bottomSection == null) { return trimTrailingComments(topSection); } String bottom = digestBottomSection(bottomSection, contextColumn); return trimTrailingComments(topSection + "\n" + bottom); }
public List<Suggestion> suggest(String topSection, String context) { return suggest(topSection, context, null); }
int contextColumn = calculateContextColumn(context); String suggestRaml = digestSuggestRaml(topSection, bottomSection, contextColumn); this.offset = suggestRaml.length(); if (offset == 0) while (!nodes.isEmpty()) nodeContext = popNode(); parentNodeBuilder = (NodeBuilder) this.builder.getBuilderContext().pop(); if (nodeContext.getParentIndentation() < contextColumn) if (!isContextInValue(context)) addKeySuggestions(context, result, parentNodeBuilder, nodeContext);
@Override public void onTupleEnd(NodeTuple nodeTuple) { Node valueNode = nodeTuple.getValueNode(); if (validateOffset(valueNode)) { popNode(); builder.onTupleEnd(nodeTuple); } }
@Override public void onSequenceEnd(SequenceNode node, TupleType tupleType) { popNode(); builder.onSequenceEnd(node, tupleType); }
int contextColumn = calculateContextColumn(context); String suggestRaml = digestSuggestRaml(topSection, bottomSection, contextColumn); this.offset = suggestRaml.length(); if (offset == 0) while (!nodes.isEmpty()) nodeContext = popNode(); parentNodeBuilder = (NodeBuilder) this.builder.getBuilderContext().pop(); if (nodeContext.getParentIndentation() < contextColumn) if (!isContextInValue(context)) addKeySuggestions(context, result, parentNodeBuilder, nodeContext);
@Override public void onTupleEnd(NodeTuple nodeTuple) { Node valueNode = nodeTuple.getValueNode(); if (validateOffset(valueNode)) { popNode(); builder.onTupleEnd(nodeTuple); } }
@Override public void onSequenceEnd(SequenceNode node, TupleType tupleType) { popNode(); builder.onSequenceEnd(node, tupleType); }
private String digestSuggestRaml(String topSection, String bottomSection, int contextColumn) { if (bottomSection == null) { return trimTrailingComments(topSection); } String bottom = digestBottomSection(bottomSection, contextColumn); return trimTrailingComments(topSection + "\n" + bottom); }
public List<Suggestion> suggest(String topSection, String context) { return suggest(topSection, context, null); }
@Override @SuppressWarnings("unchecked") public boolean onSequenceStart(SequenceNode node, TupleType tupleType) { pushNode(node, null); return builder.onSequenceStart(node, tupleType); }
@Override @SuppressWarnings("unchecked") public boolean onSequenceStart(SequenceNode node, TupleType tupleType) { pushNode(node, null); return builder.onSequenceStart(node, tupleType); }
private void pushNode(Node node, MappingNode mappingNode) { pushNode(node.getStartMark().getColumn(), mappingNode); }
private void pushNode(Node node, MappingNode mappingNode) { pushNode(node.getStartMark().getColumn(), mappingNode); }
@Override public boolean onTupleStart(NodeTuple nodeTuple) { try { builder.onTupleStart(nodeTuple); MappingNode mapping = nodeTuple.getValueNode().getNodeId() == NodeId.mapping ? (MappingNode) nodeTuple.getValueNode() : null; pushNode(nodeTuple.getKeyNode(), mapping); } catch (Exception e) { return false; } return true; }
@Override public boolean onTupleStart(NodeTuple nodeTuple) { try { builder.onTupleStart(nodeTuple); MappingNode mapping = nodeTuple.getValueNode().getNodeId() == NodeId.mapping ? (MappingNode) nodeTuple.getValueNode() : null; pushNode(nodeTuple.getKeyNode(), mapping); } catch (Exception e) { return false; } return true; }