下面列出了com.intellij.psi.PsiStatement#com.intellij.openapi.editor.markup.TextAttributes 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void addHighlights(List<TextRange> ranges, Editor editor, ArrayList<RangeHighlighter> highlighters) {
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
TextAttributes attributes = colorsManager.getGlobalScheme().getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES);
HighlightManager highlightManager = HighlightManager.getInstance(editor.getProject());
Iterator iterator = ranges.iterator();
while (iterator.hasNext()) {
TextRange range = (TextRange) iterator.next();
//highlightManager.addOccurrenceHighlight(editor, range.getStartOffset() + 1, range.getEndOffset() - 1, attributes, 0, highlighters, (Color) null);
highlightManager.addRangeHighlight(editor, range.getStartOffset() + 1, range.getEndOffset() - 1, attributes, false, highlighters);
}
iterator = highlighters.iterator();
while (iterator.hasNext()) {
RangeHighlighter highlighter = (RangeHighlighter) iterator.next();
highlighter.setGreedyToLeft(true);
highlighter.setGreedyToRight(true);
}
}
public void copyTo(AbstractColorsScheme newScheme) {
myFontPreferences.copyTo(newScheme.myFontPreferences);
newScheme.myLineSpacing = myLineSpacing;
newScheme.myQuickDocFontSize = myQuickDocFontSize;
myConsoleFontPreferences.copyTo(newScheme.myConsoleFontPreferences);
newScheme.myConsoleLineSpacing = myConsoleLineSpacing;
final Set<EditorFontType> types = myFonts.keySet();
for (EditorFontType type : types) {
Font font = myFonts.get(type);
newScheme.setFont(type, font);
}
newScheme.myAttributesMap = new HashMap<TextAttributesKey, TextAttributes>(myAttributesMap);
newScheme.myColorsMap = new HashMap<ColorKey, Color>(myColorsMap);
newScheme.myVersion = myVersion;
}
void highlightHyperlinks(@Nonnull Filter.Result result, int offsetDelta) {
Document document = myEditor.getDocument();
for (Filter.ResultItem resultItem : result.getResultItems()) {
int start = resultItem.getHighlightStartOffset() + offsetDelta;
int end = resultItem.getHighlightEndOffset() + offsetDelta;
if (start < 0 || end < start || end > document.getTextLength()) {
continue;
}
TextAttributes attributes = resultItem.getHighlightAttributes();
if (resultItem.getHyperlinkInfo() != null) {
createHyperlink(start, end, attributes, resultItem.getHyperlinkInfo(), resultItem.getFollowedHyperlinkAttributes(), resultItem.getHighlighterLayer());
}
else if (attributes != null) {
addHighlighter(start, end, attributes, resultItem.getHighlighterLayer());
}
}
}
public static void highlightElement(Editor editor, @NotNull com.intellij.openapi.project.Project project, @NotNull PsiElement[] elements)
{
final HighlightManager highlightManager =
HighlightManager.getInstance(project);
final EditorColorsManager editorColorsManager =
EditorColorsManager.getInstance();
final EditorColorsScheme globalScheme =
editorColorsManager.getGlobalScheme();
final TextAttributes textattributes =
globalScheme.getAttributes(
EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
highlightManager.addOccurrenceHighlights(
editor, elements, textattributes, true, null);
final WindowManager windowManager = WindowManager.getInstance();
final StatusBar statusBar = windowManager.getStatusBar(project);
statusBar.setInfo("Press Esc to remove highlighting");
}
public void paint(Editor editor, Graphics g, Rectangle r) {
final TextAttributes color = editor.getColorsScheme().getAttributes(myKey);
Color bgColor = color.getBackgroundColor();
if (bgColor == null) {
bgColor = color.getForegroundColor();
}
if (editor.getSettings().isLineNumbersShown() || ((EditorGutterComponentEx)editor.getGutter()).isAnnotationsShown()) {
if (bgColor != null) {
bgColor = ColorUtil.toAlpha(bgColor, 150);
}
}
if (bgColor != null) {
g.setColor(bgColor);
}
g.fillRect(r.x, r.y, r.width, r.height);
final LineData lineData = getLineData(editor.xyToLogicalPosition(new Point(0, r.y)).line);
if (lineData != null && lineData.isCoveredByOneTest()) {
AllIcons.Gutter.Unique.paintIcon(editor.getComponent(), g, r.x, r.y);
}
}
private void writeStyles(@NonNls final Writer writer) throws IOException {
writer.write("<style type=\"text/css\">\n");
writer.write(".ln { color: rgb(0,0,0); font-weight: normal; font-style: normal; }\n");
HighlighterIterator hIterator = myHighlighter.createIterator(myOffset);
while(!hIterator.atEnd()) {
TextAttributes textAttributes = hIterator.getTextAttributes();
if (!myStyleMap.containsKey(textAttributes)) {
@NonNls String styleName = "s" + myStyleMap.size();
myStyleMap.put(textAttributes, styleName);
writer.write("." + styleName + " { ");
final Color foreColor = textAttributes.getForegroundColor();
if (foreColor != null) {
writer.write("color: rgb(" + foreColor.getRed() + "," + foreColor.getGreen() + "," + foreColor.getBlue() + "); ");
}
if ((textAttributes.getFontType() & Font.BOLD) != 0) {
writer.write("font-weight: bold; ");
}
if ((textAttributes.getFontType() & Font.ITALIC) != 0) {
writer.write("font-style: italic; ");
}
writer.write("}\n");
}
hIterator.advance();
}
writer.write("</style>\n");
}
private static void linkFollowed(Editor editor, Collection<? extends RangeHighlighter> ranges, final RangeHighlighter link) {
MarkupModelEx markupModel = (MarkupModelEx)editor.getMarkupModel();
for (RangeHighlighter range : ranges) {
TextAttributes oldAttr = range.getUserData(OLD_HYPERLINK_TEXT_ATTRIBUTES);
if (oldAttr != null) {
markupModel.setRangeHighlighterAttributes(range, oldAttr);
range.putUserData(OLD_HYPERLINK_TEXT_ATTRIBUTES, null);
}
if (range == link) {
range.putUserData(OLD_HYPERLINK_TEXT_ATTRIBUTES, range.getTextAttributes());
markupModel.setRangeHighlighterAttributes(range, getFollowedHyperlinkAttributes(range));
}
}
//refresh highlighter text attributes
markupModel.addRangeHighlighter(0, 0, link.getLayer(), getHyperlinkAttributes(), HighlighterTargetArea.EXACT_RANGE).dispose();
}
@Nonnull
TextAttributes convertAttributes(@Nonnull TextAttributesKey[] keys) {
TextAttributes resultAttributes = new TextAttributes();
boolean firstPass = true;
for (TextAttributesKey key : keys) {
TextAttributes attributesByKey = myScheme.getAttributes(key);
if (attributesByKey == null) {
continue;
}
if (firstPass) {
resultAttributes.copyFrom(attributesByKey);
firstPass = false;
}
else {
resultAttributes = TextAttributes.merge(resultAttributes, attributesByKey);
}
}
return resultAttributes;
}
private void applyHighlightingPasses(Project project, final EditorEx editor, Document document, final EditorColorsScheme colorsScheme, final TextRange rangeMarker) {
final int startOffset = rangeMarker.getStartOffset();
final int endOffset = rangeMarker.getEndOffset();
DaemonCodeAnalyzerEx.processHighlights(document, project, null, startOffset, endOffset, info -> {
if (info.getStartOffset() >= startOffset && info.getEndOffset() <= endOffset) {
HighlightSeverity highlightSeverity = info.getSeverity();
if (highlightSeverity == HighlightSeverity.ERROR ||
highlightSeverity == HighlightSeverity.WARNING ||
highlightSeverity == HighlightSeverity.WEAK_WARNING ||
highlightSeverity == HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING) {
return true;
}
TextAttributes textAttributes = info.forcedTextAttributes != null ? info.forcedTextAttributes : colorsScheme.getAttributes(info.forcedTextAttributesKey);
editor.getMarkupModel().addRangeHighlighter(info.getActualStartOffset() - rangeMarker.getStartOffset(), info.getActualEndOffset() - rangeMarker.getStartOffset(), 1000, textAttributes,
HighlighterTargetArea.EXACT_RANGE);
return true;
}
else {
return true;
}
});
}
@Nonnull
@Override
public RangeHighlighterEx addRangeHighlighterAndChangeAttributes(int startOffset,
int endOffset,
int layer,
TextAttributes textAttributes,
@Nonnull HighlighterTargetArea targetArea,
boolean isPersistent,
@Nullable Consumer<? super RangeHighlighterEx> changeAttributesAction) {
return addRangeHighlighter(isPersistent
? PersistentRangeHighlighterImpl.create(this, startOffset, layer, targetArea, textAttributes, true)
: new RangeHighlighterImpl(this, startOffset, endOffset, layer, targetArea, textAttributes, false, false), changeAttributesAction);
}
public Pair<RangeHighlighter, RangeHighlighter> highlightPair(BracePair bracePair) {
final Brace leftBrace = bracePair.getLeftBrace();
final Brace rightBrace = bracePair.getRightBrace();
final int leftBraceOffset = leftBrace.getOffset();
final int rightBraceOffset = rightBrace.getOffset();
final String leftBraceText = leftBrace.getText();
final String rightBraceText = rightBrace.getText();
if (leftBraceOffset == NON_OFFSET ||
rightBraceOffset == NON_OFFSET)
return null;
// try to get the text attr by element type
TextAttributesKey textAttributesKey =
HighlightBracketPairSettingsPage.getTextAttributesKeyByToken(leftBrace.getElementType());
// if not found, get the text attr by brace text
if (textAttributesKey == null) {
textAttributesKey = HighlightBracketPairSettingsPage.getTextAttributesKeyByText(leftBraceText);
}
final TextAttributes textAttributes = editor.getColorsScheme().getAttributes(textAttributesKey);
RangeHighlighter leftHighlighter = markupModelEx.addRangeHighlighter(
leftBraceOffset,
leftBraceOffset + leftBraceText.length(),
HighlighterLayer.SELECTION + HIGHLIGHT_LAYER_WEIGHT,
textAttributes,
HighlighterTargetArea.EXACT_RANGE);
RangeHighlighter rightHighlighter = markupModelEx.addRangeHighlighter(
rightBraceOffset,
rightBraceOffset + rightBraceText.length(),
HighlighterLayer.SELECTION + HIGHLIGHT_LAYER_WEIGHT,
textAttributes,
HighlighterTargetArea.EXACT_RANGE);
return new Pair<>(leftHighlighter, rightHighlighter);
}
public static TextAttributes getNormalAttributes() {
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES);
if (attributes == null || attributes.getForegroundColor() == null) {
return new TextAttributes(new JBColor(() -> isDarkEditor() ? new Color(0x3d8065) : Gray._135), null, null, null, Font.ITALIC);
}
return attributes;
}
private static void highlightInEditor(final Project project, final IncludeDuplicate pair, final Editor editor) {
final HighlightManager highlightManager = HighlightManager.getInstance(project);
EditorColorsManager colorsManager = EditorColorsManager.getInstance();
TextAttributes attributes = colorsManager.getGlobalScheme().getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
final int startOffset = pair.getStart().getTextRange().getStartOffset();
final int endOffset = pair.getEnd().getTextRange().getEndOffset();
highlightManager.addRangeHighlight(editor, startOffset, endOffset, attributes, true, null);
final LogicalPosition logicalPosition = editor.offsetToLogicalPosition(startOffset);
editor.getScrollingModel().scrollTo(logicalPosition, ScrollType.MAKE_VISIBLE);
}
private static TextAttributes createConstantAttributes() {
TextAttributes attrs = new TextAttributes();
attrs.setForegroundColor(Color.pink.darker().darker());
attrs.setFontType(Font.ITALIC);
return attrs;
}
public List<Pair<TextRange, TextAttributes>> execute() {
final TodoItemData[] todoItems = getTodoItems();
final StepIntersection<TodoItemData, TextRange> stepIntersection =
new StepIntersection<TodoItemData, TextRange>(new Convertor<TodoItemData, TextRange>() {
@Override
public TextRange convert(TodoItemData o) {
return o.getTextRange();
}
}, Convertor.SELF, myRanges, new Getter<String>() {
@Override
public String get() {
return "";
}
}
);
final List<TodoItemData> filtered = stepIntersection.process(Arrays.asList(todoItems));
final List<Pair<TextRange, TextAttributes>> result = new ArrayList<Pair<TextRange, TextAttributes>>(filtered.size());
int offset = 0;
for (TextRange range : myRanges) {
Iterator<TodoItemData> iterator = filtered.iterator();
while (iterator.hasNext()) {
TodoItemData item = iterator.next();
if (range.contains(item.getTextRange())) {
TextRange todoRange = new TextRange(offset - range.getStartOffset() + item.getTextRange().getStartOffset(),
offset - range.getStartOffset() + item.getTextRange().getEndOffset());
result.add(new Pair<TextRange, TextAttributes>(todoRange, item.getPattern().getAttributes().getTextAttributes()));
iterator.remove();
} else {
break;
}
}
offset += range.getLength() + 1 + myAdditionalOffset;
}
return result;
}
@Nonnull
protected HighlightInfo.Builder getInfoBuilder(int colorIndex, @Nullable TextAttributesKey colorKey) {
if (colorKey == null) {
colorKey = DefaultLanguageHighlighterColors.LOCAL_VARIABLE;
}
return HighlightInfo
.newHighlightInfo(RAINBOW_ELEMENT)
.textAttributes(TextAttributes
.fromFlyweight(myColorsScheme
.getAttributes(colorKey)
.getFlyweight()
.withForeground(calculateForeground(colorIndex))));
}
public static void setupRenderer(SimpleColoredComponent renderer, Project project, Bookmark bookmark, boolean selected) {
VirtualFile file = bookmark.getFile();
if (!file.isValid()) {
return;
}
PsiManager psiManager = PsiManager.getInstance(project);
PsiElement fileOrDir = file.isDirectory() ? psiManager.findDirectory(file) : psiManager.findFile(file);
if (fileOrDir != null) {
renderer.setIcon(IconDescriptorUpdaters.getIcon(fileOrDir, 0));
}
String description = bookmark.getDescription();
if (description != null) {
renderer.append(description + " ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file);
TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, null, EffectType.LINE_UNDERSCORE, Font.PLAIN);
renderer.append(file.getName(), SimpleTextAttributes.fromTextAttributes(attributes));
if (bookmark.getLine() >= 0) {
renderer.append(":", SimpleTextAttributes.GRAYED_ATTRIBUTES);
renderer.append(String.valueOf(bookmark.getLine() + 1), SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
if (!selected) {
FileColorManager colorManager = FileColorManager.getInstance(project);
if (fileOrDir instanceof PsiFile) {
Color color = colorManager.getRendererBackground((PsiFile)fileOrDir);
if (color != null) {
renderer.setBackground(color);
}
}
}
}
@Override
public void apply(EditorColorsScheme scheme) {
TextAttributesKey key = myDiffType.getAttributesKey();
TextAttributes attrs = new TextAttributes(null, myBackgroundColor, null, EffectType.BOXED, Font.PLAIN);
attrs.setErrorStripeColor(myStripebarColor);
scheme.setAttributes(key, attrs);
}
public static TextAttributes getChangedAttributes() {
TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.INLINED_VALUES_MODIFIED);
if (attributes == null || attributes.getForegroundColor() == null) {
return new TextAttributes(new JBColor(() -> isDarkEditor() ? new Color(0xa1830a) : new Color(0xca8021)), null, null, null, Font.ITALIC);
}
return attributes;
}
@RequiredUIAccess
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
Font font = UIUtil.getTreeFont();
setFont(font.deriveFont(font.getSize() + JBUI.scale(1f)));
if (value instanceof PackageDependenciesNode) {
PackageDependenciesNode node = (PackageDependenciesNode)value;
try {
setIcon(node.getIcon());
}
catch (IndexNotReadyException ignore) {
}
final SimpleTextAttributes regularAttributes = SimpleTextAttributes.REGULAR_ATTRIBUTES;
TextAttributes textAttributes = regularAttributes.toTextAttributes();
if (node instanceof BasePsiNode && ((BasePsiNode)node).isDeprecated()) {
textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES).clone();
}
final PsiElement psiElement = node.getPsiElement();
textAttributes.setForegroundColor(CopyPasteManager.getInstance().isCutElement(psiElement) ? CopyPasteManager.CUT_COLOR : node.getColor());
append(node.toString(), SimpleTextAttributes.fromTextAttributes(textAttributes));
String oldToString = toString();
if (!myProject.isDisposed()) {
for (ProjectViewNodeDecorator decorator : Extensions.getExtensions(ProjectViewNodeDecorator.EP_NAME, myProject)) {
decorator.decorate(node, this);
}
}
if (toString().equals(oldToString)) { // nothing was decorated
final String locationString = node.getComment();
if (locationString != null && locationString.length() > 0) {
append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
}
}
public void testHeredocHighlighting() {
myFixture.configureByText(BashFileType.BASH_FILE_TYPE, "<<XX<caret>\n" +
"XX\n" +
"# comment after");
List<TextAttributes> initialComments = collectComments();
Assert.assertEquals(1, initialComments.size());
// remove the start EOF marker and verify highlighting again
myFixture.type("\b\b");
myFixture.type("XX");
List<TextAttributes> comments = collectComments();
Assert.assertEquals("The trailing comment must be properly highlighted", initialComments, comments);
}
private RangeHighlighter addHighlighter(int startOffset, int endOffset, @Nonnull TextAttributes attributes) {
Project project = mySearchResults.getProject();
if (project == null || project.isDisposed()) return null;
List<RangeHighlighter> sink = new ArrayList<>();
HighlightManager.getInstance(project).addRangeHighlight(mySearchResults.getEditor(), startOffset, endOffset, attributes, false, sink);
RangeHighlighter result = ContainerUtil.getFirstItem(sink);
if (result instanceof RangeHighlighterEx) ((RangeHighlighterEx)result).setVisibleIfFolded(true);
return result;
}
@Override
@Nullable
public RangeHighlighterEx addPersistentLineHighlighter(int lineNumber, int layer, TextAttributes textAttributes) {
if (isNotValidLine(lineNumber)) {
return null;
}
int offset = DocumentUtil.getFirstNonSpaceCharOffset(getDocument(), lineNumber);
return addRangeHighlighter(PersistentRangeHighlighterImpl.create(this, offset, layer, HighlighterTargetArea.LINES_IN_RANGE, textAttributes, false), null);
}
public void addHighlToView(final Editor view, EditorColorsScheme scheme, final Map<TextAttributesKey,String> displayText) {
// XXX: Hack
if (HighlighterColors.BAD_CHARACTER.equals(myHighlightType)) {
return;
}
final TextAttributes attr = scheme.getAttributes(myHighlightType);
if (attr != null) {
UIUtil.invokeAndWaitIfNeeded((Runnable)() -> {
try {
// IDEA-53203: add ERASE_MARKER for manually defined attributes
view.getMarkupModel().addRangeHighlighter(myStartOffset, myEndOffset, HighlighterLayer.ADDITIONAL_SYNTAX,
TextAttributes.ERASE_MARKER, HighlighterTargetArea.EXACT_RANGE);
RangeHighlighter highlighter = view.getMarkupModel()
.addRangeHighlighter(myStartOffset, myEndOffset, HighlighterLayer.ADDITIONAL_SYNTAX, attr,
HighlighterTargetArea.EXACT_RANGE);
final Color errorStripeColor = attr.getErrorStripeColor();
highlighter.setErrorStripeMarkColor(errorStripeColor);
final String tooltip = displayText.get(myHighlightType);
highlighter.setErrorStripeTooltip(tooltip);
}
catch (Exception e) {
throw new RuntimeException(e);
}
});
}
}
@Nullable
protected TextAttributes getNavigationItemAttributes(Object value) {
TextAttributes attributes = null;
if (value instanceof NavigationItem) {
TextAttributesKey attributesKey = null;
final ItemPresentation presentation = ((NavigationItem)value).getPresentation();
if (presentation instanceof ColoredItemPresentation) attributesKey = ((ColoredItemPresentation)presentation).getTextAttributesKey();
if (attributesKey != null) {
attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey);
}
}
return attributes;
}
/**
* Returns the text attributes used for selection annotation range highlighters.
*
* @param editor the editor to which the annotation belongs
* @param user the user to whom the annotation belongs
* @return the text attributes used for selection annotation range highlighters
*/
private static TextAttributes getSelectionTextAttributes(
@NotNull Editor editor, @NotNull User user) {
// Retrieve color keys based on the color ID selected by this user. This will automatically
// fall back to default colors, if no colors for the given ID are available.
ColorKeys colorKeys = ColorManager.getColorKeys(user.getColorID());
TextAttributesKey highlightColorKey = colorKeys.getSelectionColorKey();
// Resolve the correct text attributes based on the currently configured IDE scheme.
return editor.getColorsScheme().getAttributes(highlightColorKey);
}
public IntentionUsagePanel() {
myEditor = (EditorEx)createEditor("", 10, 3, -1);
setLayout(new BorderLayout());
add(myEditor.getComponent(), BorderLayout.CENTER);
TextAttributes blinkAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.BLINKING_HIGHLIGHTS_ATTRIBUTES);
myRangeBlinker = new RangeBlinker(myEditor, blinkAttributes, Integer.MAX_VALUE);
}
private static void highlightWord(final CompletionVariant variant, final Project project, CompletionData data) {
int delta = data.startOffset < variant.offset ? variant.variant.length() - data.myWordUnderCursor.length() : 0;
HighlightManager highlightManager = HighlightManager.getInstance(project);
EditorColorsManager colorManager = EditorColorsManager.getInstance();
TextAttributes attributes = colorManager.getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES);
highlightManager.addOccurrenceHighlight(variant.editor, variant.offset + delta, variant.offset + variant.variant.length() + delta, attributes,
HighlightManager.HIDE_BY_ANY_KEY, null, null);
}
private static RangeHighlighter processHighlighter(int hFrom, int hTo, int colorIndex, TextAttributes attrs,
Editor editor, TIntObjectHashMap<RangeHighlighter> lastOffsetToMarkersMap,
THashSet<RangeHighlighter> highlightersSet,
THashSet<RangeHighlighter> invalidMarkersSet
) {
RangeHighlighter rangeHighlighter = lastOffsetToMarkersMap.get(hFrom);
if (rangeHighlighter == null ||
rangeHighlighter.getEndOffset() != hTo ||
rangeHighlighter.getTextAttributes() != attrs
) {
highlightersSet.add(
rangeHighlighter = HighlightUtils.createRangeMarker(
editor,
hFrom,
hTo,
colorIndex,
attrs
)
);
lastOffsetToMarkersMap.put(hFrom, rangeHighlighter);
} else {
highlightersSet.add(rangeHighlighter);
invalidMarkersSet.remove(rangeHighlighter);
}
return rangeHighlighter;
}
private static void doHighlightRefs(HighlightManager highlightManager, @Nonnull Editor editor, @Nonnull List<PsiReference> refs,
TextAttributes attributes, boolean clearHighlights) {
List<TextRange> textRanges = new ArrayList<>(refs.size());
for (PsiReference ref : refs) {
collectRangesToHighlight(ref, textRanges);
}
highlightRanges(highlightManager, editor, attributes, clearHighlights, textRanges);
}