use of com.intellij.codeInsight.daemon.LineMarkerInfo in project intellij-community by JetBrains.
the class PyLineSeparatorUtil method addLineSeparatorIfNeeded.
@Nullable
public static LineMarkerInfo addLineSeparatorIfNeeded(final Provider provider, final PsiElement element) {
final Ref<LineMarkerInfo> info = new Ref<LineMarkerInfo>(null);
ApplicationManager.getApplication().runReadAction(() -> {
if (!provider.isSeparatorAllowed(element)) {
return;
}
boolean hasSeparableBefore = false;
final PsiElement parent = element.getParent();
if (parent == null) {
return;
}
for (PsiElement child : parent.getChildren()) {
if (child == element) {
break;
}
if (provider.isSeparatorAllowed(child)) {
hasSeparableBefore = true;
break;
}
}
if (!hasSeparableBefore) {
return;
}
info.set(createLineSeparatorByElement(element));
});
return info.get();
}
use of com.intellij.codeInsight.daemon.LineMarkerInfo in project intellij-community by JetBrains.
the class PyRunLineMarkerTest method testRunnableMain.
public void testRunnableMain() {
List<LineMarkerInfo> infos = getInfos("runnable.py");
assertEquals("Wrong number of line markers", 1, infos.size());
LineMarkerInfo lineMarkerInfo = infos.get(0);
PsiElement elementWithInfo = lineMarkerInfo.getElement();
assertNotNull(elementWithInfo);
assertTrue(elementWithInfo.getText().startsWith("if __name__ == \"__main__\""));
}
Aggregations