use of com.intellij.codeInsight.daemon.LineMarkerInfo in project kotlin by JetBrains.
the class AbstractLineMarkersTest method doTest.
public void doTest(String path) {
try {
String fileText = FileUtil.loadFile(new File(path));
ConfigLibraryUtil.configureLibrariesByDirective(myFixture.getModule(), PlatformTestUtil.getCommunityPath(), fileText);
myFixture.configureByFile(path);
Project project = myFixture.getProject();
Document document = myFixture.getEditor().getDocument();
ExpectedHighlightingData data = new ExpectedHighlightingData(document, false, false, false, myFixture.getFile());
data.init();
PsiDocumentManager.getInstance(project).commitAllDocuments();
myFixture.doHighlighting();
List<LineMarkerInfo> markers = DaemonCodeAnalyzerImpl.getLineMarkers(document, project);
try {
data.checkLineMarkers(markers, document.getText());
// the latter doesn't throw assertion error when some line markers are expected, but none are present.
if (FileUtil.loadFile(new File(path)).contains("<lineMarker") && markers.isEmpty()) {
throw new AssertionError("Some line markers are expected, but nothing is present at all");
}
} catch (AssertionError error) {
try {
String actualTextWithTestData = TagsTestDataUtil.insertInfoTags(markers, true, myFixture.getFile().getText());
KotlinTestUtils.assertEqualsToFile(new File(path), actualTextWithTestData);
} catch (FileComparisonFailure failure) {
throw new FileComparisonFailure(error.getMessage() + "\n" + failure.getMessage(), failure.getExpected(), failure.getActual(), failure.getFilePath());
}
}
assertNavigationElements(markers);
} catch (Exception exc) {
throw new RuntimeException(exc);
}
}
use of com.intellij.codeInsight.daemon.LineMarkerInfo in project intellij-plugins by JetBrains.
the class JstdAssertionFrameworkLineMarkerProvider method getLineMarkerInfo.
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
Project project = element.getProject();
JSFile jsFile = ObjectUtils.tryCast(element.getContainingFile(), JSFile.class);
if (jsFile == null) {
return null;
}
if (!JstdSettingsUtil.areJstdConfigFilesInProjectCached(project)) {
return null;
}
LineMarkerInfo lineMarkerInfo = getJstdLineMarkerInfo(project, jsFile, element);
if (lineMarkerInfo == null) {
lineMarkerInfo = getQUnitLineMarkerInfo(jsFile, element);
}
return lineMarkerInfo;
}
use of com.intellij.codeInsight.daemon.LineMarkerInfo in project intellij-elixir by KronicDeth.
the class CallDefinition method callDefinitionSeparator.
/*
* Private Instance Methods
*/
@NotNull
private LineMarkerInfo callDefinitionSeparator(@NotNull Call call) {
LineMarkerInfo lineMarkerInfo;
lineMarkerInfo = new LineMarkerInfo<Call>(call, call.getTextRange(), null, Pass.UPDATE_ALL, null, null, GutterIconRenderer.Alignment.RIGHT);
EditorColorsScheme editorColorsScheme = editorColorsManager.getGlobalScheme();
lineMarkerInfo.separatorColor = editorColorsScheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
lineMarkerInfo.separatorPlacement = SeparatorPlacement.TOP;
return lineMarkerInfo;
}
use of com.intellij.codeInsight.daemon.LineMarkerInfo in project intellij-plugins by JetBrains.
the class AnnotatorTestUtils method checkGutterTargets.
/**
* Verifies the navigation targets' names of the gutter icon match.
*
* @param renderer Gutter icon.
* @param resultValueFunction Function to transform target to expected name.
* @param expectedValues Expected names.
*/
static void checkGutterTargets(@NotNull final GutterMark renderer, @NotNull final Function<PsiElement, String> resultValueFunction, final String... expectedValues) {
final LineMarkerInfo lineMarkerInfo = ((LineMarkerInfo.LineMarkerGutterIconRenderer) renderer).getLineMarkerInfo();
final NavigationGutterIconRenderer navigationHandler = (NavigationGutterIconRenderer) lineMarkerInfo.getNavigationHandler();
assertNotNull(navigationHandler);
final List<PsiElement> targetElements = navigationHandler.getTargetElements();
final Set<String> foundValues = new HashSet<>();
for (final PsiElement psiElement : targetElements) {
foundValues.add(resultValueFunction.fun(psiElement));
}
assertSameElements(foundValues, expectedValues);
}
use of com.intellij.codeInsight.daemon.LineMarkerInfo in project intellij-plugins by JetBrains.
the class DartServerImplementationsMarkerProvider method createMarkerMember.
@NotNull
private static LineMarkerInfo createMarkerMember(@NotNull final DartComponentName name) {
final VirtualFile file = name.getContainingFile().getVirtualFile();
final int nameOffset = name.getTextRange().getStartOffset();
return new LineMarkerInfo<>(name, name.getTextRange(), AllIcons.Gutter.OverridenMethod, Pass.LINE_MARKERS, element -> DaemonBundle.message("method.is.overridden.too.many"), (GutterIconNavigationHandler<PsiElement>) (e, elt) -> {
final List<TypeHierarchyItem> items = DartAnalysisServerService.getInstance(name.getProject()).search_getTypeHierarchy(file, nameOffset, false);
if (items.isEmpty()) {
return;
}
final List<DartComponent> components = DartInheritorsSearcher.getSubMembers(name.getProject(), GlobalSearchScope.allScope(name.getProject()), items);
PsiElementListNavigator.openTargets(e, DartResolveUtil.getComponentNameArray(components), DaemonBundle.message("navigation.title.overrider.method", name.getName(), components.size()), "Overriding methods of " + name.getName(), new DefaultPsiElementCellRenderer());
}, GutterIconRenderer.Alignment.RIGHT);
}
Aggregations