@Override public List<? extends ColoringInformation> getColoring(final XtextResource resource, final Document document) { if ((resource == null)) { return CollectionLiterals.<ColoringInformation>emptyList(); } final ImmutableList.Builder<ColoringInformation> builder = ImmutableList.<ColoringInformation>builder(); final Procedure1<Object> _function = (Object it) -> { List<INode> _xifexpression = null; if ((it instanceof Property)) { _xifexpression = NodeModelUtils.findNodesForFeature(((EObject)it), TestLanguagePackage.Literals.MEMBER__NAME); } else { List<INode> _xifexpression_1 = null; if ((it instanceof Operation)) { _xifexpression_1 = NodeModelUtils.findNodesForFeature(((EObject)it), TestLanguagePackage.Literals.MEMBER__NAME); } else { _xifexpression_1 = CollectionLiterals.<INode>emptyList(); } _xifexpression = _xifexpression_1; } final List<INode> nodes = _xifexpression; final Consumer<INode> _function_1 = (INode it_1) -> { final int start = it_1.getOffset(); int _offset = it_1.getOffset(); int _length = it_1.getLength(); final int end = (_offset + _length); Position _position = document.getPosition(start); Position _position_1 = document.getPosition(end); final Range range = new Range(_position, _position_1); ColoringInformation _coloringInformation = new ColoringInformation(range, ColoringServiceImpl.STYLE_IDS); builder.add(_coloringInformation); }; nodes.forEach(_function_1); }; IteratorExtensions.<Object>forEach(EcoreUtil.<Object>getAllContents(resource, true), _function); return builder.build(); }
protected String _toExpectation(final ColoringInformation it) { StringConcatenation _builder = new StringConcatenation(); String _expectation = this.toExpectation(it.getRange()); _builder.append(_expectation); _builder.append(" -> ["); String _join = IterableExtensions.join(it.getStyles(), ", "); _builder.append(_join); _builder.append("]"); return _builder.toString(); }
public ColoringParams() { ArrayList<ColoringInformation> _arrayList = new ArrayList<ColoringInformation>(); this.infos = _arrayList; }
public ColoringParams(final String uri, final List<? extends ColoringInformation> infos) { this.uri = uri; this.infos = infos; }
/** * A list of coloring information instances. */ @Pure @NonNull public List<? extends ColoringInformation> getInfos() { return this.infos; }
/** * A list of coloring information instances. */ public void setInfos(@NonNull final List<? extends ColoringInformation> infos) { this.infos = infos; }
@Override public List<? extends ColoringInformation> getColoring(XtextResource resource, Document document) { return emptyList(); }
protected String toExpectation(final Object it) { if (it instanceof Integer) { return _toExpectation((Integer)it); } else if (it instanceof List) { return _toExpectation((List<?>)it); } else if (it instanceof DocumentHighlightKind) { return _toExpectation((DocumentHighlightKind)it); } else if (it instanceof String) { return _toExpectation((String)it); } else if (it == null) { return _toExpectation((Void)null); } else if (it instanceof Map) { return _toExpectation((Map<Object, Object>)it); } else if (it instanceof CodeLens) { return _toExpectation((CodeLens)it); } else if (it instanceof ColoringInformation) { return _toExpectation((ColoringInformation)it); } else if (it instanceof Command) { return _toExpectation((Command)it); } else if (it instanceof CompletionItem) { return _toExpectation((CompletionItem)it); } else if (it instanceof DocumentHighlight) { return _toExpectation((DocumentHighlight)it); } else if (it instanceof Hover) { return _toExpectation((Hover)it); } else if (it instanceof Location) { return _toExpectation((Location)it); } else if (it instanceof Position) { return _toExpectation((Position)it); } else if (it instanceof Range) { return _toExpectation((Range)it); } else if (it instanceof SignatureHelp) { return _toExpectation((SignatureHelp)it); } else if (it instanceof SymbolInformation) { return _toExpectation((SymbolInformation)it); } else if (it instanceof TextEdit) { return _toExpectation((TextEdit)it); } else if (it instanceof WorkspaceEdit) { return _toExpectation((WorkspaceEdit)it); } else if (it instanceof Either) { return _toExpectation((Either<?, ?>)it); } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.<Object>asList(it).toString()); } }
/** * Provides a list of all available coloring information for the resource. * * @param resource * the resource that will be highlighted. May be {@code null} in * some rare cases. * @param document * the IDE and Xtext independent document that can be used to * convert the document based offsets to line based positions. * @return a list of all the coloring and highlighting information for the * resource. Must not return with {@code null}, but an empty list * instead. */ List<? extends ColoringInformation> getColoring(XtextResource resource, Document document);