Search in sources :

Example 1 with JsonSchemaDocumentationProvider

use of com.jetbrains.jsonSchema.ide.JsonSchemaDocumentationProvider in project intellij-community by JetBrains.

the class JsonBySchemaDocumentationBaseTest method doTest.

protected void doTest(boolean hasDoc, String extension) throws Exception {
    final JsonSchemaDocumentationProvider provider = new JsonSchemaDocumentationProvider();
    LanguageDocumentation.INSTANCE.addExplicitExtension(JsonLanguage.INSTANCE, provider);
    try {
        skeleton(new Callback() {

            @Override
            public void registerSchemes() {
                final String moduleDir = getModuleDir(getProject());
                final ArrayList<JsonSchemaMappingsConfigurationBase.Item> patterns = new ArrayList<>();
                patterns.add(new JsonSchemaMappingsConfigurationBase.Item(getTestName(true) + "*", true, false));
                addSchema(new JsonSchemaMappingsConfigurationBase.SchemaInfo("testDoc", moduleDir + "/" + getTestName(true) + "Schema.json", false, patterns));
            }

            @Override
            public void configureFiles() throws Exception {
                configureByFiles(null, "/" + getTestName(true) + "." + extension, "/" + getTestName(true) + "Schema.json");
            }

            @Override
            public void doCheck() {
                PsiElement psiElement = DocumentationManager.getInstance(getProject()).findTargetElement(myEditor, myFile);
                assertDocumentation(psiElement, psiElement, hasDoc);
            }
        });
    } finally {
        LanguageDocumentation.INSTANCE.removeExplicitExtension(JsonLanguage.INSTANCE, provider);
        JsonSchemaTestServiceImpl.setProvider(null);
    }
}
Also used : ArrayList(java.util.ArrayList) JsonSchemaDocumentationProvider(com.jetbrains.jsonSchema.ide.JsonSchemaDocumentationProvider) PsiElement(com.intellij.psi.PsiElement)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 JsonSchemaDocumentationProvider (com.jetbrains.jsonSchema.ide.JsonSchemaDocumentationProvider)1 ArrayList (java.util.ArrayList)1