use of com.jetbrains.jsonSchema.ide.JsonSchemaAnnotator in project intellij-community by JetBrains.
the class JsonSchemaHighlightingTest method testImpl.
private void testImpl(@NotNull final String schema, @NotNull final String text) throws Exception {
final PsiFile file = createFile(myModule, "config.json", text);
final Annotator annotator = new JsonSchemaAnnotator();
registerProvider(getProject(), schema);
LanguageAnnotators.INSTANCE.addExplicitExtension(JsonLanguage.INSTANCE, annotator);
Disposer.register(getTestRootDisposable(), new Disposable() {
@Override
public void dispose() {
LanguageAnnotators.INSTANCE.removeExplicitExtension(JsonLanguage.INSTANCE, annotator);
JsonSchemaTestServiceImpl.setProvider(null);
}
});
configureByFile(file.getVirtualFile());
doTest(file.getVirtualFile(), true, false);
}
use of com.jetbrains.jsonSchema.ide.JsonSchemaAnnotator in project intellij-community by JetBrains.
the class JsonSchemaReadTest method testMainSchemaHighlighting.
public void testMainSchemaHighlighting() throws Exception {
final Set<VirtualFile> files = JsonSchemaServiceEx.Impl.getEx(myProject).getSchemaFiles();
VirtualFile mainSchema = null;
for (VirtualFile file : files) {
if ("schema.json".equals(file.getName())) {
mainSchema = file;
break;
}
}
assertNotNull(mainSchema);
assertTrue(JsonSchemaFileType.INSTANCE.equals(mainSchema.getFileType()));
final Annotator annotator = new JsonSchemaAnnotator();
LanguageAnnotators.INSTANCE.addExplicitExtension(JsonLanguage.INSTANCE, annotator);
Disposer.register(getTestRootDisposable(), new Disposable() {
@Override
public void dispose() {
LanguageAnnotators.INSTANCE.removeExplicitExtension(JsonLanguage.INSTANCE, annotator);
JsonSchemaTestServiceImpl.setProvider(null);
}
});
configureByExistingFile(mainSchema);
final List<HighlightInfo> infos = doHighlighting();
for (HighlightInfo info : infos) {
if (!HighlightSeverity.INFORMATION.equals(info.getSeverity()))
assertFalse(info.getDescription(), true);
}
}
Aggregations