diff --git a/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/settings/XMLValidationSettings.java b/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/settings/XMLValidationSettings.java index b81692bd2..330e361be 100644 --- a/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/settings/XMLValidationSettings.java +++ b/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/contentmodel/settings/XMLValidationSettings.java @@ -182,6 +182,7 @@ public XMLValidationSettings merge(XMLValidationSettings settings) { this.namespaces = settings.namespaces; this.schema = settings.schema; this.enabled = settings.enabled; + this.noGrammar = settings.noGrammar; this.disallowDocTypeDecl = settings.disallowDocTypeDecl; this.resolveExternalEntities = settings.resolveExternalEntities; } diff --git a/org.eclipse.lemminx/src/test/java/org/eclipse/lemminx/settings/SettingsMergeTest.java b/org.eclipse.lemminx/src/test/java/org/eclipse/lemminx/settings/SettingsMergeTest.java new file mode 100644 index 000000000..28997cff8 --- /dev/null +++ b/org.eclipse.lemminx/src/test/java/org/eclipse/lemminx/settings/SettingsMergeTest.java @@ -0,0 +1,38 @@ +/******************************************************************************* +* Copyright (c) 2021 Red Hat Inc. and others. +* All rights reserved. This program and the accompanying materials +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/epl-v20.html +* +* Contributors: +* Red Hat Inc. - initial API and implementation +*******************************************************************************/ +package org.eclipse.lemminx.settings; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; + +import java.lang.reflect.Field; + +import org.eclipse.lemminx.extensions.contentmodel.settings.XMLValidationSettings; +import org.eclipse.lsp4j.PublishDiagnosticsCapabilities; +import org.junit.jupiter.api.Test; + +public class SettingsMergeTest { + + @Test + public void testValidationSettingsMerge() throws IllegalArgumentException, IllegalAccessException { + XMLValidationSettings settings = new XMLValidationSettings(); + settings.setEnabled(false); + settings.setDisallowDocTypeDecl(true); + settings.setNoGrammar("ignore"); + settings.setResolveExternalEntities(true); + settings.setCapabilities(new PublishDiagnosticsCapabilities()); + settings.setNamespaces(null); + settings.setSchema(null); + XMLValidationSettings mergeTargetSettings = new XMLValidationSettings(); + mergeTargetSettings.merge(settings); + assertEquals(settings, mergeTargetSettings); + } + +}