diff --git a/json/src/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogExclusion.java b/json/src/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogExclusion.java new file mode 100644 index 000000000000..f5ec8fa58226 --- /dev/null +++ b/json/src/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogExclusion.java @@ -0,0 +1,19 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.jetbrains.jsonSchema.remote; + +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; + +/** + * Disables JSON schema download from schema store for particular files. + * Not intended to be used except to suppress JSON schema for JSCS + */ +@ApiStatus.Experimental +public interface JsonSchemaCatalogExclusion { + + ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.json.catalog.exclusion"); + + boolean isExcluded(@NotNull VirtualFile file); +} diff --git a/json/src/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogManager.java b/json/src/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogManager.java index 76e93ed4b879..8ee4d3ac8c65 100644 --- a/json/src/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogManager.java +++ b/json/src/com/jetbrains/jsonSchema/remote/JsonSchemaCatalogManager.java @@ -50,6 +50,11 @@ public class JsonSchemaCatalogManager { @Nullable public VirtualFile getSchemaFileForFile(@NotNull VirtualFile file) { if (!myIsEnabled.get()) return null; + for (JsonSchemaCatalogExclusion exclusion : JsonSchemaCatalogExclusion.EP_NAME.getExtensions()) { + if (exclusion.isExcluded(file)) { + return null; + } + } String name = file.getName(); if (myResolvedMappings.containsKey(name)) { diff --git a/platform/platform-resources/src/META-INF/JsonPlugin.xml b/platform/platform-resources/src/META-INF/JsonPlugin.xml index 9902e2dcba7b..ab18a376883b 100644 --- a/platform/platform-resources/src/META-INF/JsonPlugin.xml +++ b/platform/platform-resources/src/META-INF/JsonPlugin.xml @@ -112,6 +112,7 @@ + \ No newline at end of file