diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/client/LanguageClientImpl.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/client/LanguageClientImpl.java index 7318513da..64b5c9274 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4ij/client/LanguageClientImpl.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/client/LanguageClientImpl.java @@ -119,19 +119,21 @@ protected synchronized Runnable getDidChangeConfigurationListener() { if (didChangeConfigurationListener != null) { return didChangeConfigurationListener; } - didChangeConfigurationListener = () -> { - LanguageServer languageServer = getLanguageServer(); - if (languageServer == null) { - return; - } - Object settings = createSettings(); - if(settings == null) { - return; - } - DidChangeConfigurationParams params = new DidChangeConfigurationParams(settings); - languageServer.getWorkspaceService().didChangeConfiguration(params); - }; + didChangeConfigurationListener = this::triggerChangeConfiguration; return didChangeConfigurationListener; } + protected void triggerChangeConfiguration() { + LanguageServer languageServer = getLanguageServer(); + if (languageServer == null) { + return; + } + Object settings = createSettings(); + if(settings == null) { + return; + } + DidChangeConfigurationParams params = new DidChangeConfigurationParams(settings); + languageServer.getWorkspaceService().didChangeConfiguration(params); + } + } diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/AbstractDelegateInspection.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/AbstractDelegateInspection.java new file mode 100644 index 000000000..9c5f28726 --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/AbstractDelegateInspection.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2023 Red Hat Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + * + * Contributors: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections; + +import com.intellij.codeInspection.LocalInspectionTool; + +/** + * No-op {@link LocalInspectionTool} used as a basis for mapping inspection severities to matching LSP severities. + */ +public abstract class AbstractDelegateInspection extends LocalInspectionTool { +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesDuplicatesInspection.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesDuplicatesInspection.java new file mode 100644 index 000000000..3f3fc890a --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesDuplicatesInspection.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2023 Red Hat Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + * + * Contributors: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections; + +/** + * Dummy inspection for duplicate properties in Microprofile properties files + */ +public class MicroProfilePropertiesDuplicatesInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(MicroProfilePropertiesDuplicatesInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesExpressionsInspection.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesExpressionsInspection.java new file mode 100644 index 000000000..7b2949fda --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesExpressionsInspection.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2023 Red Hat Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + * + * Contributors: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections; + +/** + * Dummy inspection for expression values in Microprofile properties files + */ +public class MicroProfilePropertiesExpressionsInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(MicroProfilePropertiesExpressionsInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesRequiredInspection.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesRequiredInspection.java new file mode 100644 index 000000000..33c4aa717 --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesRequiredInspection.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2023 Red Hat Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + * + * Contributors: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections; + +/** + * Dummy inspection for missing required properties in Microprofile properties files + */ +public class MicroProfilePropertiesRequiredInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(MicroProfilePropertiesRequiredInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesSyntaxInspection.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesSyntaxInspection.java new file mode 100644 index 000000000..e13c0bf3b --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesSyntaxInspection.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2023 Red Hat Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + * + * Contributors: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections; + +/** + * Dummy inspection for property syntax errors in Microprofile properties files + */ +public class MicroProfilePropertiesSyntaxInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(MicroProfilePropertiesSyntaxInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesUnassignedInspection.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesUnassignedInspection.java new file mode 100644 index 000000000..ec5ce14ee --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesUnassignedInspection.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2023 Red Hat Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + * + * Contributors: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections; + +/** + * Dummy inspection for unassigned properties in Microprofile properties files + */ +public class MicroProfilePropertiesUnassignedInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(MicroProfilePropertiesUnassignedInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesUnknownInspection.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesUnknownInspection.java new file mode 100644 index 000000000..1672ea0e8 --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesUnknownInspection.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2023 Red Hat Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + * + * Contributors: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections; + +/** + * Dummy inspection for unknown properties in Microprofile properties files + */ +public class MicroProfilePropertiesUnknownInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(MicroProfilePropertiesUnknownInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesValueInspection.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesValueInspection.java new file mode 100644 index 000000000..8d805c567 --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/psi/core/inspections/MicroProfilePropertiesValueInspection.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2023 Red Hat Inc. and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + * + * Contributors: + * Red Hat Inc. - initial API and implementation + *******************************************************************************/ +package com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections; + +/** + * Dummy inspection for invalid values in Microprofile properties files + */ +public class MicroProfilePropertiesValueInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(MicroProfilePropertiesValueInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileConfigurable.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileConfigurable.java index cb7502ac7..490297414 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileConfigurable.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileConfigurable.java @@ -28,7 +28,7 @@ public class MicroProfileConfigurable extends NamedConfigurable + *
  • Any severity below HighlightSeverity.WEAK_WARNING is mapped to ProblemSeverity.none
  • + *
  • Any severity below HighlightSeverity.ERROR is mapped to ProblemSeverity.warning
  • + *
  • Any other severity is mapped to ProblemSeverity.error
  • + * + * + * @param highlightSeverity the severity to map to a {@link ProblemSeverity} + * @return the matching {@link ProblemSeverity} + */ + public static @NotNull ProblemSeverity getSeverity(@NotNull HighlightSeverity highlightSeverity) { + if (HighlightSeverity.WEAK_WARNING.compareTo(highlightSeverity) > 0) { + return none; + } + if (HighlightSeverity.ERROR.compareTo(highlightSeverity) > 0) { + return warning; + } + return error; + } +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/UserDefinedMicroProfileSettings.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/UserDefinedMicroProfileSettings.java index 1ae376a1d..49191ef17 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/UserDefinedMicroProfileSettings.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/UserDefinedMicroProfileSettings.java @@ -14,16 +14,15 @@ package com.redhat.devtools.intellij.lsp4mp4ij.settings; import com.intellij.openapi.components.PersistentStateComponent; -import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.openapi.project.Project; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.annotations.Tag; -import com.jetbrains.jsonSchema.JsonSchemaCatalogProjectConfiguration; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,6 +31,7 @@ * User defined MicroProfile settings for: * * @@ -42,7 +42,7 @@ ) public class UserDefinedMicroProfileSettings implements PersistentStateComponent { - public volatile MyState myState = new MyState(); + private volatile MyState myState = new MyState(); private final List myChangeHandlers = ContainerUtil.createConcurrentList(); @@ -103,7 +103,8 @@ public void loadState(@NotNull MyState state) { * * @return the proper settings expected by the MicroProfile language server. */ - public Map toSettingsForMicroProfileLS() { + public Map toSettingsForMicroProfileLS(MicroProfileInspectionsInfo inspectionsInfo) { + Map settings = new HashMap<>(); Map microprofile = new HashMap<>(); settings.put("microprofile", microprofile); @@ -122,10 +123,26 @@ public Map toSettingsForMicroProfileLS() { codeLens.put("urlCodeLensEnabled", isUrlCodeLensEnabled()); tools.put("codeLens", codeLens); + Map validation = new HashMap<>(); + + tools.put("validation", validation); + validation.put("enabled", inspectionsInfo.enabled()); + validation.put("syntax", getSeverityNode(inspectionsInfo.syntaxSeverity())); + validation.put("unknown", getSeverityNode(inspectionsInfo.unknownSeverity())); + validation.put("duplicate", getSeverityNode(inspectionsInfo.duplicateSeverity())); + validation.put("value", getSeverityNode(inspectionsInfo.valueSeverity())); + validation.put("required", getSeverityNode(inspectionsInfo.requiredSeverity())); + validation.put("expression", getSeverityNode(inspectionsInfo.expressionSeverity())); + validation.put("unassigned", getSeverityNode(inspectionsInfo.unassignedSeverity())); return settings; } - static class MyState { + private Map getSeverityNode(ProblemSeverity severity) { + return Collections.singletonMap("severity", severity.name()); + } + + + public static class MyState { @Tag("inlayHintEnabled") public boolean myInlayHintEnabled = true; diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/properties/MicroProfilePropertiesView.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/properties/MicroProfilePropertiesView.java index 83323b368..aac6546d7 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/properties/MicroProfilePropertiesView.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/properties/MicroProfilePropertiesView.java @@ -31,7 +31,7 @@ public class MicroProfilePropertiesView implements Disposable { private final JPanel myMainPanel; - private JBCheckBox inlayHintCheckBox = new JBCheckBox(MicroProfileBundle.message("microprofile.properties.inlayHint.enabled")); + private final JBCheckBox inlayHintCheckBox = new JBCheckBox(MicroProfileBundle.message("microprofile.properties.inlayHint.enabled")); public MicroProfilePropertiesView() { JComponent descriptionPanel = createDescription(null); diff --git a/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java b/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java index 5e27be2bc..a214b2dbe 100644 --- a/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java +++ b/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusLanguageClient.java @@ -10,44 +10,57 @@ ******************************************************************************/ package com.redhat.devtools.intellij.quarkus.lsp; +import com.intellij.codeInspection.InspectionProfile; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.module.Module; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.profile.ProfileChangeAdapter; import com.intellij.util.messages.MessageBusConnection; import com.redhat.devtools.intellij.lsp4ij.client.CoalesceByKey; +import com.redhat.devtools.intellij.lsp4ij.client.IndexAwareLanguageClient; +import com.redhat.devtools.intellij.lsp4mp4ij.classpath.ClasspathResourceChangedManager; import com.redhat.devtools.intellij.lsp4mp4ij.psi.core.ProjectLabelManager; import com.redhat.devtools.intellij.lsp4mp4ij.psi.core.PropertiesManager; import com.redhat.devtools.intellij.lsp4mp4ij.psi.core.PropertiesManagerForJava; import com.redhat.devtools.intellij.lsp4mp4ij.psi.core.project.PsiMicroProfileProjectManager; import com.redhat.devtools.intellij.lsp4mp4ij.psi.core.utils.IPsiUtils; import com.redhat.devtools.intellij.lsp4mp4ij.psi.internal.core.ls.PsiUtilsLSImpl; +import com.redhat.devtools.intellij.lsp4mp4ij.settings.MicroProfileInspectionsInfo; import com.redhat.devtools.intellij.lsp4mp4ij.settings.UserDefinedMicroProfileSettings; import com.redhat.devtools.intellij.quarkus.QuarkusModuleUtil; -import com.redhat.devtools.intellij.lsp4ij.client.IndexAwareLanguageClient; -import com.redhat.devtools.intellij.lsp4mp4ij.classpath.ClasspathResourceChangedManager; import org.eclipse.lsp4j.*; import org.eclipse.lsp4mp.commons.*; import org.eclipse.lsp4mp.commons.codeaction.CodeActionResolveData; import org.eclipse.lsp4mp.commons.utils.JSONUtility; import org.eclipse.lsp4mp.ls.api.MicroProfileLanguageClientAPI; import org.eclipse.lsp4mp.ls.api.MicroProfileLanguageServerAPI; +import org.jetbrains.annotations.NotNull; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; -public class QuarkusLanguageClient extends IndexAwareLanguageClient implements MicroProfileLanguageClientAPI, ClasspathResourceChangedManager.Listener { +public class QuarkusLanguageClient extends IndexAwareLanguageClient implements MicroProfileLanguageClientAPI, ClasspathResourceChangedManager.Listener, ProfileChangeAdapter { private final MessageBusConnection connection; + private MicroProfileInspectionsInfo inspectionsInfo; + public QuarkusLanguageClient(Project project) { super(project); connection = project.getMessageBus().connect(project); connection.subscribe(ClasspathResourceChangedManager.TOPIC, this); + inspectionsInfo = MicroProfileInspectionsInfo.getMicroProfileInspectionInfo(project); + connection.subscribe(ProfileChangeAdapter.TOPIC, this); // Track MicroProfile settings changed to push them to the language server with LSP didChangeConfiguration. UserDefinedMicroProfileSettings.getInstance(project).addChangeHandler(getDidChangeConfigurationListener()); } @@ -61,7 +74,7 @@ public void dispose() { @Override protected Object createSettings() { - return UserDefinedMicroProfileSettings.getInstance(getProject()).toSettingsForMicroProfileLS(); + return UserDefinedMicroProfileSettings.getInstance(getProject()).toSettingsForMicroProfileLS(inspectionsInfo); } private void sendPropertiesChangeEvent(List scope, Set uris) { @@ -74,6 +87,24 @@ private void sendPropertiesChangeEvent(List scope, } } + @Override + public void profileChanged(@NotNull InspectionProfile profile) { + MicroProfileInspectionsInfo newInspectionState = MicroProfileInspectionsInfo.getMicroProfileInspectionInfo(getProject()); + if (!Objects.equals(newInspectionState, inspectionsInfo)) { + inspectionsInfo = newInspectionState; + ApplicationManager.getApplication().invokeLater(() -> { + new Task.Backgroundable(getProject(), "Updating configuration...", true) { + @Override + public void run(@NotNull ProgressIndicator progressIndicator) { + triggerChangeConfiguration(); + } + }.queue(); + }, ModalityState.defaultModalityState(), getProject().getDisposed()); + + + } + } + @Override public void librariesChanged() { if (isDisposed()) { diff --git a/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java b/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java index 3f24a2047..12c025e5e 100644 --- a/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java +++ b/src/main/java/com/redhat/devtools/intellij/quarkus/lsp/QuarkusServer.java @@ -14,6 +14,7 @@ import com.intellij.ide.plugins.PluginManager; import com.intellij.openapi.extensions.PluginId; import com.intellij.openapi.project.Project; +import com.redhat.devtools.intellij.lsp4mp4ij.settings.MicroProfileInspectionsInfo; import com.redhat.devtools.intellij.quarkus.TelemetryService; import com.redhat.devtools.intellij.lsp4ij.server.JavaProcessCommandBuilder; import com.redhat.devtools.intellij.lsp4ij.server.ProcessStreamConnectionProvider; @@ -51,9 +52,9 @@ public QuarkusServer(Project project) { @Override public Object getInitializationOptions(URI rootUri) { - Map root = new HashMap<>(); - Map settings = UserDefinedMicroProfileSettings.getInstance(project).toSettingsForMicroProfileLS(); + MicroProfileInspectionsInfo inspectionsInfo = MicroProfileInspectionsInfo.getMicroProfileInspectionInfo(project); + Map settings = UserDefinedMicroProfileSettings.getInstance(project).toSettingsForMicroProfileLS(inspectionsInfo); root.put("settings", settings); Map extendedClientCapabilities = new HashMap<>(); diff --git a/src/main/resources/META-INF/lsp4ij-quarkus.xml b/src/main/resources/META-INF/lsp4ij-quarkus.xml index 9e149efbc..9b283d488 100644 --- a/src/main/resources/META-INF/lsp4ij-quarkus.xml +++ b/src/main/resources/META-INF/lsp4ij-quarkus.xml @@ -58,6 +58,70 @@ implementationClass="com.redhat.devtools.intellij.lsp4ij.operations.documentLink.LSPDocumentLinkAnnotator"/> + + + + + + + + diff --git a/src/main/resources/inspectionDescriptions/MicroProfilePropertiesDuplicates.html b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesDuplicates.html new file mode 100644 index 000000000..235c9fb7b --- /dev/null +++ b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesDuplicates.html @@ -0,0 +1,5 @@ + + +Reports duplicate properties in MicroProfile .properties files. + + \ No newline at end of file diff --git a/src/main/resources/inspectionDescriptions/MicroProfilePropertiesExpressions.html b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesExpressions.html new file mode 100644 index 000000000..51ab3a8fb --- /dev/null +++ b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesExpressions.html @@ -0,0 +1,5 @@ + + +Reports invalid expressions in values of MicroProfile .properties files. + + \ No newline at end of file diff --git a/src/main/resources/inspectionDescriptions/MicroProfilePropertiesRequired.html b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesRequired.html new file mode 100644 index 000000000..5a39e1c6b --- /dev/null +++ b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesRequired.html @@ -0,0 +1,5 @@ + + +Reports required properties missing from MicroProfile .properties files. + + \ No newline at end of file diff --git a/src/main/resources/inspectionDescriptions/MicroProfilePropertiesSyntax.html b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesSyntax.html new file mode 100644 index 000000000..db00ca8ba --- /dev/null +++ b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesSyntax.html @@ -0,0 +1,5 @@ + + +Reports syntax errors in MicroProfile .properties files. + + \ No newline at end of file diff --git a/src/main/resources/inspectionDescriptions/MicroProfilePropertiesUnassigned.html b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesUnassigned.html new file mode 100644 index 000000000..8b7c63585 --- /dev/null +++ b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesUnassigned.html @@ -0,0 +1,5 @@ + + +Reports unassigned properties in MicroProfile .properties files. + + \ No newline at end of file diff --git a/src/main/resources/inspectionDescriptions/MicroProfilePropertiesUnknown.html b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesUnknown.html new file mode 100644 index 000000000..aefdbf2bf --- /dev/null +++ b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesUnknown.html @@ -0,0 +1,5 @@ + + +Reports unknown properties in MicroProfile .properties files. + + \ No newline at end of file diff --git a/src/main/resources/inspectionDescriptions/MicroProfilePropertiesValue.html b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesValue.html new file mode 100644 index 000000000..0783549f2 --- /dev/null +++ b/src/main/resources/inspectionDescriptions/MicroProfilePropertiesValue.html @@ -0,0 +1,5 @@ + + +Reports invalid values in MicroProfile .properties files. + + \ No newline at end of file diff --git a/src/main/resources/messages/MicroProfileBundle.properties b/src/main/resources/messages/MicroProfileBundle.properties index e65a34570..5594e7127 100644 --- a/src/main/resources/messages/MicroProfileBundle.properties +++ b/src/main/resources/messages/MicroProfileBundle.properties @@ -15,12 +15,19 @@ microprofile=MicroProfile microprofile.title=MicroProfile microprofile.description=Configure MicroProfile support in Java and 'microprofile-config.properties' files. - +microprofile.properties.inspection.group.name=Properties +microprofile.inspection.group.name=MicroProfile ## MicroProfile UI settings page for properties files microprofile.properties=Properties microprofile.properties.title=MicroProfile configuration in microprofile-config.properties microprofile.properties.inlayHint.enabled=Show evaluated property expression as inlay hint? - +microprofile.properties.validation.syntax=Syntax checking +microprofile.properties.validation.unknown=Unknown properties +microprofile.properties.validation.duplicate=Duplicate properties +microprofile.properties.validation.value=Invalid values +microprofile.properties.validation.required=Required properties +microprofile.properties.validation.expression=Property expressions +microprofile.properties.validation.unassigned=Unassigned properties ## MicroProfile UI settings page for Java files microprofile.java=Java microprofile.java.title=MicroProfile configuration in Java files