Skip to content

Eclipse Contribution

Angelo edited this page Jun 11, 2017 · 1 revision

CodeLens are displayed in a view zone (virtual lines). StyledText doesn't support this kind of features, that's why I had to fork StyledText. The fork of StyledText is done with Javassist (by updating at runtime orginal behaviour of StyledTextRenderer), but the best thing is that Eclipse change their code to support view zones (virtual lines).

This section explains the idea of view zone and explains which code of Eclipse should be updated.

StyledText

Each line of StyledText are managed with an ITextLayout instance. This layout instance manage width, height of line. The StyledTextRenderer manage a pool of ITextLayout and each line have the same line spacing.

To support view zone, the idea is to give the capability to set a line spacing for a given line.

ILineSpacingProvider

package org.eclipse.swt.custom.provisional;

public interface ILineSpacingProvider {

Integer getLineSpacing(int lineIndex);

}

StyledText#setLineSpacingProvider

To initialize line spacing provider, StyledText should provide an new setLineSpacingProvider method like this:

public void setLineSpacingProvider() {

}

StyledText#setLineSpacingProvider(ILineSpacingProvider lineSpacingProvider) like this:

Fork of StyledTextRenderer

Fork of LineNumberChangeRulerColumn