From 0ff0c90da0c2e95e9ef867f477806d25986c9a0e Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Mon, 28 Aug 2023 16:56:45 +0200 Subject: [PATCH] feat: expose Qute server settings Signed-off-by: Fred Bricon --- .../diagnostics/LSPDiagnosticAnnotator.java | 14 +- .../diagnostics/SeverityMapping.java | 103 ++++++++++ .../settings/MicroProfileInspectionsInfo.java | 78 +++----- .../lsp4mp4ij/settings/ProblemSeverity.java | 46 ----- .../UserDefinedMicroProfileSettings.java | 29 ++- .../quarkus/lsp/QuarkusLanguageClient.java | 2 +- .../intellij/quarkus/lsp/QuarkusServer.java | 3 +- .../intellij/qute/lsp/QuteLanguageClient.java | 41 +++- .../intellij/qute/lsp/QuteServer.java | 8 +- .../AbstractDelegateInspection.java | 22 +++ .../QuteUndefinedNamespaceInspection.java | 21 ++ .../QuteUndefinedObjectInspection.java | 21 ++ .../qute/settings/QuteConfigurable.java | 88 +++++++++ .../qute/settings/QuteInspectionsInfo.java | 57 ++++++ .../intellij/qute/settings/QuteView.java | 90 +++++++++ .../settings/UserDefinedQuteSettings.java | 186 ++++++++++++++++++ src/main/resources/META-INF/lsp4ij-qute.xml | 28 +++ .../QuteUndefinedNamespace.html | 17 ++ .../QuteUndefinedObject.html | 17 ++ .../resources/messages/QuteBundle.properties | 10 + 20 files changed, 757 insertions(+), 124 deletions(-) create mode 100644 src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/diagnostics/SeverityMapping.java delete mode 100644 src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/ProblemSeverity.java create mode 100644 src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/AbstractDelegateInspection.java create mode 100644 src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedNamespaceInspection.java create mode 100644 src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedObjectInspection.java create mode 100644 src/main/java/com/redhat/devtools/intellij/qute/settings/QuteConfigurable.java create mode 100644 src/main/java/com/redhat/devtools/intellij/qute/settings/QuteInspectionsInfo.java create mode 100644 src/main/java/com/redhat/devtools/intellij/qute/settings/QuteView.java create mode 100644 src/main/java/com/redhat/devtools/intellij/qute/settings/UserDefinedQuteSettings.java create mode 100644 src/main/resources/inspectionDescriptions/QuteUndefinedNamespace.html create mode 100644 src/main/resources/inspectionDescriptions/QuteUndefinedObject.html diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/diagnostics/LSPDiagnosticAnnotator.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/diagnostics/LSPDiagnosticAnnotator.java index 9d549dc2f..bc4eb4c34 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/diagnostics/LSPDiagnosticAnnotator.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/diagnostics/LSPDiagnosticAnnotator.java @@ -34,6 +34,8 @@ import java.util.Collection; import java.util.List; +import static com.redhat.devtools.intellij.lsp4ij.operations.diagnostics.SeverityMapping.toHighlightSeverity; + /** * Intellij {@link ExternalAnnotator} implementation which get the current LSP diagnostics for a given file and translate * them into Intellij {@link com.intellij.lang.annotation.Annotation}. @@ -95,16 +97,4 @@ private static void createAnnotation(Diagnostic diagnostic, Document document, L builder.create(); } - private static HighlightSeverity toHighlightSeverity(DiagnosticSeverity severity) { - switch (severity) { - case Warning: - return HighlightSeverity.WEAK_WARNING; - case Hint: - case Information: - return HighlightSeverity.INFORMATION; - default: - return HighlightSeverity.ERROR; - } - } - } \ No newline at end of file diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/diagnostics/SeverityMapping.java b/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/diagnostics/SeverityMapping.java new file mode 100644 index 000000000..ab1a74d90 --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/lsp4ij/operations/diagnostics/SeverityMapping.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * 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.lsp4ij.operations.diagnostics; + +import com.intellij.codeHighlighting.HighlightDisplayLevel; +import com.intellij.codeInsight.daemon.HighlightDisplayKey; +import com.intellij.codeInspection.InspectionProfile; +import com.intellij.lang.annotation.HighlightSeverity; +import org.eclipse.lsp4j.DiagnosticSeverity; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Utility class to map language servers' {@link DiagnosticSeverity} to Intellij's {@link HighlightSeverity}, and vice-versa. + */ +public class SeverityMapping { + + public static String NONE_SEVERITY = "none"; + + private SeverityMapping() { + } + + /** + * Maps language server's {@link DiagnosticSeverity} to Intellij's {@link HighlightSeverity} + * @param severity the {@link DiagnosticSeverity} to map + * @return the matching {@link HighlightSeverity} + */ + public static @NotNull HighlightSeverity toHighlightSeverity(@Nullable DiagnosticSeverity severity) { + if (severity == null) { + return HighlightSeverity.INFORMATION; + } + switch (severity) { + case Warning: + return HighlightSeverity.WEAK_WARNING; + case Hint: + case Information: + return HighlightSeverity.INFORMATION; + default: + return HighlightSeverity.ERROR; + } + } + + /** + * Maps {@link HighlightSeverity} to {@link DiagnosticSeverity} levels used by language servers. + * + * + * @param severity the severity to map to a {@link DiagnosticSeverity} + * @return the matching {@link DiagnosticSeverity} + */ + public static @Nullable DiagnosticSeverity getSeverity(@NotNull HighlightSeverity severity) { + if (HighlightSeverity.INFORMATION.compareTo(severity) > 0) { + return null; + } + if (HighlightSeverity.WEAK_WARNING.compareTo(severity) > 0) { + return DiagnosticSeverity.Information; + } + if (HighlightSeverity.ERROR.compareTo(severity) > 0) { + return DiagnosticSeverity.Warning; + } + return DiagnosticSeverity.Error; + } + + /** + * Returns {@link DiagnosticSeverity} as lower case, or none if severity is null. + * @param severity the {@link DiagnosticSeverity} to transform as {@link String} + * @return {@link DiagnosticSeverity} as lower case, or none if severity is null. + */ + public static @NotNull String toString(@Nullable DiagnosticSeverity severity) { + return (severity == null)? NONE_SEVERITY : severity.name().toLowerCase(); + } + + public static DiagnosticSeverity getSeverity(String inspectionId, InspectionProfile profile) { + if (!isInspectionEnabled(inspectionId, profile)) { + return null; + } + return getSeverity(getErrorLevel(inspectionId, profile)); + } + + private static @NotNull HighlightSeverity getErrorLevel(String inspectionId, InspectionProfile profile) { + HighlightDisplayLevel level = profile.getErrorLevel(HighlightDisplayKey.find(inspectionId), null); + return level.getSeverity(); + } + + private static boolean isInspectionEnabled(@NotNull String inspectionId, @NotNull InspectionProfile profile) { + return profile.isToolEnabled(HighlightDisplayKey.find(inspectionId)); + } +} diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileInspectionsInfo.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileInspectionsInfo.java index da47383a6..df6607bf8 100644 --- a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileInspectionsInfo.java +++ b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/MicroProfileInspectionsInfo.java @@ -19,7 +19,9 @@ import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.project.Project; import com.intellij.profile.codeInspection.InspectionProfileManager; +import com.redhat.devtools.intellij.lsp4ij.operations.diagnostics.SeverityMapping; import com.redhat.devtools.intellij.lsp4mp4ij.psi.core.inspections.*; +import org.eclipse.lsp4j.DiagnosticSeverity; import org.jetbrains.annotations.NotNull; import java.util.Objects; @@ -31,13 +33,12 @@ public class MicroProfileInspectionsInfo { //See https://github.com/eclipse/lsp4mp/blob/6b483c4d292bfebabd13311d6217291da2d5d169/microprofile.ls/org.eclipse.lsp4mp.ls/src/main/java/org/eclipse/lsp4mp/settings/MicroProfileValidationSettings.java#L36 - private boolean enabled = true; - private ProblemSeverity syntaxSeverity = ProblemSeverity.error; - private ProblemSeverity unknownSeverity = ProblemSeverity.warning; - private ProblemSeverity duplicateSeverity = ProblemSeverity.warning; - private ProblemSeverity valueSeverity = ProblemSeverity.error; - private ProblemSeverity requiredSeverity = ProblemSeverity.none; - private ProblemSeverity expressionSeverity = ProblemSeverity.error; + private DiagnosticSeverity syntaxSeverity = DiagnosticSeverity.Error; + private DiagnosticSeverity unknownSeverity = DiagnosticSeverity.Warning; + private DiagnosticSeverity duplicateSeverity = DiagnosticSeverity.Warning; + private DiagnosticSeverity valueSeverity = DiagnosticSeverity.Error; + private DiagnosticSeverity requiredSeverity = null; + private DiagnosticSeverity expressionSeverity = DiagnosticSeverity.Error; private MicroProfileInspectionsInfo() { } @@ -45,70 +46,36 @@ private MicroProfileInspectionsInfo() { public static MicroProfileInspectionsInfo getMicroProfileInspectionInfo(Project project) { MicroProfileInspectionsInfo wrapper = new MicroProfileInspectionsInfo(); InspectionProfile profile = InspectionProfileManager.getInstance(project).getCurrentProfile(); - boolean syntaxEnabled = isInspectionEnabled(MicroProfilePropertiesSyntaxInspection.ID, profile); - boolean unknownEnabled = isInspectionEnabled(MicroProfilePropertiesUnknownInspection.ID, profile); - boolean duplicatedEnabled = isInspectionEnabled(MicroProfilePropertiesDuplicatesInspection.ID, profile); - boolean valueEnabled = isInspectionEnabled(MicroProfilePropertiesValueInspection.ID, profile); - boolean requiredEnabled = isInspectionEnabled(MicroProfilePropertiesRequiredInspection.ID, profile); - boolean expressionsEnabled = isInspectionEnabled(MicroProfilePropertiesExpressionsInspection.ID, profile); - wrapper.enabled = syntaxEnabled - || unknownEnabled - || duplicatedEnabled - || valueEnabled - || requiredEnabled - || expressionsEnabled; - - wrapper.syntaxSeverity = getSeverity(syntaxEnabled, MicroProfilePropertiesSyntaxInspection.ID, profile); - wrapper.unknownSeverity = getSeverity(unknownEnabled, MicroProfilePropertiesUnknownInspection.ID, profile); - wrapper.duplicateSeverity = getSeverity(duplicatedEnabled, MicroProfilePropertiesDuplicatesInspection.ID, profile); - wrapper.valueSeverity = getSeverity(valueEnabled, MicroProfilePropertiesValueInspection.ID, profile); - wrapper.requiredSeverity = getSeverity(requiredEnabled, MicroProfilePropertiesRequiredInspection.ID, profile); - wrapper.expressionSeverity = getSeverity(expressionsEnabled, MicroProfilePropertiesExpressionsInspection.ID, profile); + wrapper.syntaxSeverity = SeverityMapping.getSeverity(MicroProfilePropertiesSyntaxInspection.ID, profile); + wrapper.unknownSeverity = SeverityMapping.getSeverity(MicroProfilePropertiesUnknownInspection.ID, profile); + wrapper.duplicateSeverity = SeverityMapping.getSeverity(MicroProfilePropertiesDuplicatesInspection.ID, profile); + wrapper.valueSeverity = SeverityMapping.getSeverity(MicroProfilePropertiesValueInspection.ID, profile); + wrapper.requiredSeverity = SeverityMapping.getSeverity(MicroProfilePropertiesRequiredInspection.ID, profile); + wrapper.expressionSeverity = SeverityMapping.getSeverity(MicroProfilePropertiesExpressionsInspection.ID, profile); return wrapper; } - private static ProblemSeverity getSeverity(boolean enabled, String inspectionId, InspectionProfile profile) { - if (!enabled) { - return ProblemSeverity.none; - } - return ProblemSeverity.getSeverity(getErrorLevel(inspectionId, profile)); - - } - - private static @NotNull HighlightSeverity getErrorLevel(String inspectionId, InspectionProfile profile) { - HighlightDisplayLevel level = profile.getErrorLevel(HighlightDisplayKey.find(inspectionId), null); - return level.getSeverity(); - } - - private static boolean isInspectionEnabled(@NotNull String inspectionId, @NotNull InspectionProfile profile) { - return profile.isToolEnabled(HighlightDisplayKey.find(inspectionId)); - } - - public boolean enabled() { - return enabled; - } - - public ProblemSeverity unknownSeverity() { + public DiagnosticSeverity unknownSeverity() { return unknownSeverity; } - public ProblemSeverity valueSeverity() { + public DiagnosticSeverity valueSeverity() { return valueSeverity; } - public ProblemSeverity expressionSeverity() { + public DiagnosticSeverity expressionSeverity() { return expressionSeverity; } - public ProblemSeverity duplicateSeverity() { + public DiagnosticSeverity duplicateSeverity() { return duplicateSeverity; } - public ProblemSeverity syntaxSeverity() { + public DiagnosticSeverity syntaxSeverity() { return syntaxSeverity; } - public ProblemSeverity requiredSeverity() { + public DiagnosticSeverity requiredSeverity() { return requiredSeverity; } @@ -117,15 +84,14 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MicroProfileInspectionsInfo that = (MicroProfileInspectionsInfo) o; - return enabled == that.enabled - && syntaxSeverity == that.syntaxSeverity && unknownSeverity == that.unknownSeverity + return syntaxSeverity == that.syntaxSeverity && unknownSeverity == that.unknownSeverity && duplicateSeverity == that.duplicateSeverity && valueSeverity == that.valueSeverity && requiredSeverity == that.requiredSeverity && expressionSeverity == that.expressionSeverity; } @Override public int hashCode() { - return Objects.hash(enabled, syntaxSeverity, unknownSeverity, duplicateSeverity, valueSeverity, requiredSeverity, + return Objects.hash(syntaxSeverity, unknownSeverity, duplicateSeverity, valueSeverity, requiredSeverity, expressionSeverity); } } diff --git a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/ProblemSeverity.java b/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/ProblemSeverity.java deleted file mode 100644 index f935dad27..000000000 --- a/src/main/java/com/redhat/devtools/intellij/lsp4mp4ij/settings/ProblemSeverity.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * 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.settings; - -import com.intellij.lang.annotation.HighlightSeverity; -import org.jetbrains.annotations.NotNull; - -/** - * Problem severity levels used by LSP4MP - */ -//TODO move to lsp4ij? -public enum ProblemSeverity { - none, warning, error; - - /** - * Maps {@link HighlightSeverity} to {@link ProblemSeverity} levels used by LSP4MP. - * - * - * @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 750c88029..5a8c99a31 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 @@ -19,6 +19,8 @@ import com.intellij.openapi.project.Project; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.xmlb.annotations.Tag; +import com.redhat.devtools.intellij.lsp4ij.operations.diagnostics.SeverityMapping; +import org.eclipse.lsp4j.DiagnosticSeverity; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -44,6 +46,12 @@ public class UserDefinedMicroProfileSettings implements PersistentStateComponent private volatile MyState myState = new MyState(); + private final Project project; + + public UserDefinedMicroProfileSettings(Project project) { + this.project = project; + } + private final List myChangeHandlers = ContainerUtil.createConcurrentList(); public static @NotNull UserDefinedMicroProfileSettings getInstance(@NotNull Project project) { @@ -63,6 +71,13 @@ public void fireStateChanged() { handler.run(); } } + public boolean isValidationEnabled() { + return myState.myValidationEnabled; + } + + public void setValidationEnabled(boolean validationEnabled) { + myState.myValidationEnabled = validationEnabled; + } // ---------- Properties @@ -103,8 +118,8 @@ public void loadState(@NotNull MyState state) { * * @return the proper settings expected by the MicroProfile language server. */ - public Map toSettingsForMicroProfileLS(MicroProfileInspectionsInfo inspectionsInfo) { - + public Map toSettingsForMicroProfileLS() { + MicroProfileInspectionsInfo inspectionsInfo = MicroProfileInspectionsInfo.getMicroProfileInspectionInfo(project); Map settings = new HashMap<>(); Map microprofile = new HashMap<>(); settings.put("microprofile", microprofile); @@ -125,7 +140,7 @@ public Map toSettingsForMicroProfileLS(MicroProfileInspectionsIn Map validation = new HashMap<>(); tools.put("validation", validation); - validation.put("enabled", inspectionsInfo.enabled()); + validation.put("enabled", isValidationEnabled()); validation.put("syntax", getSeverityNode(inspectionsInfo.syntaxSeverity())); validation.put("unknown", getSeverityNode(inspectionsInfo.unknownSeverity())); validation.put("duplicate", getSeverityNode(inspectionsInfo.duplicateSeverity())); @@ -135,12 +150,16 @@ public Map toSettingsForMicroProfileLS(MicroProfileInspectionsIn return settings; } - private Map getSeverityNode(ProblemSeverity severity) { - return Collections.singletonMap("severity", severity.name()); + private Map getSeverityNode(DiagnosticSeverity severity) { + return Collections.singletonMap("severity", SeverityMapping.toString(severity)); } public static class MyState { + + @Tag("validationEnabled") + public boolean myValidationEnabled = true; + @Tag("inlayHintEnabled") public boolean myInlayHintEnabled = true; 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 f453f86fa..ca4020279 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 @@ -74,7 +74,7 @@ public void dispose() { @Override protected Object createSettings() { - return UserDefinedMicroProfileSettings.getInstance(getProject()).toSettingsForMicroProfileLS(inspectionsInfo); + return UserDefinedMicroProfileSettings.getInstance(getProject()).toSettingsForMicroProfileLS(); } private void sendPropertiesChangeEvent(List scope, Set uris) { 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 12c025e5e..8854529ec 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 @@ -53,8 +53,7 @@ public QuarkusServer(Project project) { @Override public Object getInitializationOptions(URI rootUri) { Map root = new HashMap<>(); - MicroProfileInspectionsInfo inspectionsInfo = MicroProfileInspectionsInfo.getMicroProfileInspectionInfo(project); - Map settings = UserDefinedMicroProfileSettings.getInstance(project).toSettingsForMicroProfileLS(inspectionsInfo); + Map settings = UserDefinedMicroProfileSettings.getInstance(project).toSettingsForMicroProfileLS(); root.put("settings", settings); Map extendedClientCapabilities = new HashMap<>(); diff --git a/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java b/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java index 741067acb..605972c03 100644 --- a/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java +++ b/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteLanguageClient.java @@ -10,19 +10,28 @@ ******************************************************************************/ package com.redhat.devtools.intellij.qute.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.lsp4mp4ij.psi.core.project.PsiMicroProfileProjectManager; import com.redhat.devtools.intellij.lsp4mp4ij.psi.internal.core.ls.PsiUtilsLSImpl; import com.redhat.devtools.intellij.lsp4ij.client.IndexAwareLanguageClient; import com.redhat.devtools.intellij.lsp4mp4ij.classpath.ClasspathResourceChangedManager; +import com.redhat.devtools.intellij.lsp4mp4ij.settings.UserDefinedMicroProfileSettings; import com.redhat.devtools.intellij.qute.psi.QuteSupportForJava; import com.redhat.devtools.intellij.qute.psi.QuteSupportForTemplate; import com.redhat.devtools.intellij.qute.psi.utils.PsiQuteProjectUtils; +import com.redhat.devtools.intellij.qute.settings.QuteInspectionsInfo; +import com.redhat.devtools.intellij.qute.settings.UserDefinedQuteSettings; import com.redhat.qute.commons.GenerateMissingJavaMemberParams; import com.redhat.qute.commons.JavaTypeInfo; import com.redhat.qute.commons.ProjectInfo; @@ -49,11 +58,13 @@ import org.eclipse.lsp4j.Location; import org.eclipse.lsp4j.PublishDiagnosticsParams; import org.eclipse.lsp4j.WorkspaceEdit; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -61,19 +72,25 @@ /** * Qute language client. */ -public class QuteLanguageClient extends IndexAwareLanguageClient implements QuteLanguageClientAPI, ClasspathResourceChangedManager.Listener { +public class QuteLanguageClient extends IndexAwareLanguageClient implements QuteLanguageClientAPI, ClasspathResourceChangedManager.Listener, ProfileChangeAdapter { private final MessageBusConnection connection; + private QuteInspectionsInfo inspectionsInfo; + public QuteLanguageClient(Project project) { super(project); connection = project.getMessageBus().connect(project); connection.subscribe(ClasspathResourceChangedManager.TOPIC, this); + inspectionsInfo = QuteInspectionsInfo.getQuteInspectionsInfo(project); + connection.subscribe(ProfileChangeAdapter.TOPIC, this); + UserDefinedQuteSettings.getInstance(project).addChangeHandler(getDidChangeConfigurationListener()); } @Override public void dispose() { super.dispose(); connection.disconnect(); + UserDefinedQuteSettings.getInstance(getProject()).removeChangeHandler(getDidChangeConfigurationListener()); } /** @@ -91,6 +108,28 @@ private void notifyQuteDataModelChanged(Set uris) { } } + @Override + protected Object createSettings() { + return UserDefinedQuteSettings.getInstance(getProject()).toSettingsForQuteLS(); + } + + @Override + public void profileChanged(@NotNull InspectionProfile profile) { + // Track Qute inspections settings (declared in Editor/Inspection/Qute UI settings) changed, + // convert them to matching Qute configuration and push them via 'workspace/didChangeConfiguration'. + QuteInspectionsInfo newInspectionState = QuteInspectionsInfo.getQuteInspectionsInfo(getProject()); + if (!Objects.equals(newInspectionState, inspectionsInfo)) { + inspectionsInfo = newInspectionState; + ApplicationManager.getApplication().invokeLater(() -> { + new Task.Backgroundable(getProject(), "Updating Qute LS 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/qute/lsp/QuteServer.java b/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteServer.java index a999a8a12..fcd5c49fb 100644 --- a/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteServer.java +++ b/src/main/java/com/redhat/devtools/intellij/qute/lsp/QuteServer.java @@ -14,9 +14,12 @@ 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.UserDefinedMicroProfileSettings; import com.redhat.devtools.intellij.quarkus.TelemetryService; import com.redhat.devtools.intellij.lsp4ij.server.JavaProcessCommandBuilder; import com.redhat.devtools.intellij.lsp4ij.server.ProcessStreamConnectionProvider; +import com.redhat.devtools.intellij.qute.settings.QuteInspectionsInfo; +import com.redhat.devtools.intellij.qute.settings.UserDefinedQuteSettings; import java.io.File; import java.net.URI; @@ -30,7 +33,10 @@ */ public class QuteServer extends ProcessStreamConnectionProvider { + private final Project project; + public QuteServer(Project project) { + this.project = project; IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.getId("com.redhat.devtools.intellij.quarkus")); File quteServerPath = new File(descriptor.getPath(), "lib/server/com.redhat.qute.ls-uber.jar"); @@ -46,7 +52,7 @@ public QuteServer(Project project) { @Override public Object getInitializationOptions(URI rootUri) { Map root = new HashMap<>(); - Map settings = QuteUtils.getQuteSettings(); + Map settings = UserDefinedQuteSettings.getInstance(project).toSettingsForQuteLS(); Map extendedClientCapabilities = new HashMap<>(); Map commands = new HashMap<>(); Map commandsKind = new HashMap<>(); diff --git a/src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/AbstractDelegateInspection.java b/src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/AbstractDelegateInspection.java new file mode 100644 index 000000000..6e248a850 --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/qute/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.qute.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/qute/psi/core/inspections/QuteUndefinedNamespaceInspection.java b/src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedNamespaceInspection.java new file mode 100644 index 000000000..29a3ea16e --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedNamespaceInspection.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.qute.psi.core.inspections; + +/** + * Dummy inspection for undefined namespaces in Qute templates + */ +public class QuteUndefinedNamespaceInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(QuteUndefinedNamespaceInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedObjectInspection.java b/src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedObjectInspection.java new file mode 100644 index 000000000..1fce8e42f --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/qute/psi/core/inspections/QuteUndefinedObjectInspection.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.qute.psi.core.inspections; + +/** + * Dummy inspection for undefined objects in Qute templates + */ +public class QuteUndefinedObjectInspection extends AbstractDelegateInspection { + public static final String ID = getShortName(QuteUndefinedObjectInspection.class.getSimpleName()); +} diff --git a/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteConfigurable.java b/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteConfigurable.java new file mode 100644 index 000000000..307d57cdf --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteConfigurable.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * 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.qute.settings; + +import com.intellij.openapi.options.ConfigurationException; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.NamedConfigurable; +import com.intellij.openapi.util.NlsContexts; +import com.redhat.devtools.intellij.qute.QuteBundle; + +import javax.swing.*; + +/** + * Qute configuration. + */ +public class QuteConfigurable extends NamedConfigurable { + + private final Project project; + private QuteView myView; + + public QuteConfigurable(Project project) { + this.project = project; + } + + @Override + public UserDefinedQuteSettings getEditableObject() { + return UserDefinedQuteSettings.getInstance(project); + } + + @Override + public @NlsContexts.DetailedDescription String getBannerSlogan() { + return null; + } + + @Override + public JComponent createOptionsPanel() { + if (myView == null) { + myView = new QuteView(); + } + return myView.getComponent(); + } + + @Override + public void setDisplayName(String name) { + } + + @Override + public @NlsContexts.ConfigurableName String getDisplayName() { + return QuteBundle.message("qute.settings.title"); + } + + + @Override + public void reset() { + if (myView == null) return; + UserDefinedQuteSettings settings = UserDefinedQuteSettings.getInstance(project); + myView.setValidationEnabled(settings.isValidationEnabled()); + myView.setNativeModeSupportEnabled(settings.isNativeModeSupportEnabled()); + } + + @Override + public boolean isModified() { + if (myView == null) return false; + UserDefinedQuteSettings settings = UserDefinedQuteSettings.getInstance(project); + return myView.isValidationEnabled() != settings.isValidationEnabled() || + myView.isNativeModeSupportEnabled() != settings.isNativeModeSupportEnabled(); + } + + @Override + public void apply() throws ConfigurationException { + if (myView == null) return; + UserDefinedQuteSettings settings = UserDefinedQuteSettings.getInstance(project); + settings.setValidationEnabled(myView.isValidationEnabled()); + settings.setNativeModeSupportEnabled(myView.isNativeModeSupportEnabled()); + settings.fireStateChanged(); + } +} diff --git a/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteInspectionsInfo.java b/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteInspectionsInfo.java new file mode 100644 index 000000000..e066e5972 --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteInspectionsInfo.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * 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.qute.settings; + +import com.intellij.codeHighlighting.HighlightDisplayLevel; +import com.intellij.codeInsight.daemon.HighlightDisplayKey; +import com.intellij.codeInspection.InspectionProfile; +import com.intellij.lang.annotation.HighlightSeverity; +import com.intellij.openapi.project.Project; +import com.intellij.profile.codeInspection.InspectionProfileManager; +import com.redhat.devtools.intellij.lsp4ij.operations.diagnostics.SeverityMapping; +import com.redhat.devtools.intellij.qute.psi.core.inspections.QuteUndefinedNamespaceInspection; +import com.redhat.devtools.intellij.qute.psi.core.inspections.QuteUndefinedObjectInspection; +import org.eclipse.lsp4j.DiagnosticSeverity; +import org.gradle.configurationcache.problems.ProblemSeverity; +import org.jetbrains.annotations.NotNull; + +/** + * Contains Qute inspection settings relevant to Qute LS configuration + */ +//TODO switch to a record, when Java 17 is required +public class QuteInspectionsInfo { + + private DiagnosticSeverity undefinedObjectSeverity = DiagnosticSeverity.Warning; + private DiagnosticSeverity undefinedNamespaceSeverity = DiagnosticSeverity.Warning; + + private QuteInspectionsInfo() { + } + + public static QuteInspectionsInfo getQuteInspectionsInfo(Project project) { + QuteInspectionsInfo wrapper = new QuteInspectionsInfo(); + InspectionProfile profile = InspectionProfileManager.getInstance(project).getCurrentProfile(); + wrapper.undefinedObjectSeverity = SeverityMapping.getSeverity(QuteUndefinedObjectInspection.ID, profile); + wrapper.undefinedNamespaceSeverity = SeverityMapping.getSeverity(QuteUndefinedNamespaceInspection.ID, profile); + return wrapper; + } + + public DiagnosticSeverity undefinedObjectSeverity() { + return undefinedObjectSeverity; + } + + public DiagnosticSeverity undefinedNamespaceSeverity() { + return undefinedNamespaceSeverity; + } + +} diff --git a/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteView.java b/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteView.java new file mode 100644 index 000000000..46d5da9bf --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/qute/settings/QuteView.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * 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.qute.settings; + +import com.intellij.openapi.Disposable; +import com.intellij.ui.components.JBCheckBox; +import com.intellij.util.ui.FormBuilder; +import com.intellij.util.ui.JBUI; +import com.intellij.util.ui.UI; +import com.redhat.devtools.intellij.qute.QuteBundle; + +import javax.swing.*; + +/** + * Qute support view. + */ +public class QuteView implements Disposable { + + private final JPanel myMainPanel; + + private JBCheckBox validationEnabledCheckBox = new JBCheckBox(QuteBundle.message("qute.setting.validation.enabled")); + private JBCheckBox nativeModeSupportEnabledCheckBox = new JBCheckBox(QuteBundle.message("qute.setting.validation.native.enabled")); + + public QuteView() { + this.myMainPanel = JBUI.Panels.simplePanel(10,10) + .addToCenter(createSettings()); + } + + private JPanel createSettings() { + return FormBuilder.createFormBuilder() + .addComponent(validationEnabledCheckBox) + .addComponent(nativeModeSupportEnabledCheckBox) + .addComponentFillVertically(new JPanel(), 0) + .getPanel(); + } + + private JComponent createDescription(String description) { + /** + * Normally comments are below the controls. + * Here we want the comments to precede the controls, we therefore create an empty, 0-sized panel. + */ + JPanel titledComponent = UI.PanelFactory.grid().createPanel(); + titledComponent.setMinimumSize(JBUI.emptySize()); + titledComponent.setPreferredSize(JBUI.emptySize()); + if (description != null && !description.isBlank()) { + titledComponent = UI.PanelFactory.panel(titledComponent) + .withComment(description) + .resizeX(true) + .resizeY(true) + .createPanel(); + } + return titledComponent; + } + + public JComponent getComponent() { + return myMainPanel; + } + + @Override + public void dispose() { + + } + + public boolean isValidationEnabled() { + return validationEnabledCheckBox.isSelected(); + } + + public void setValidationEnabled(boolean enabled) { + validationEnabledCheckBox.setSelected(enabled); + } + + public boolean isNativeModeSupportEnabled() { + return nativeModeSupportEnabledCheckBox.isSelected(); + } + + public void setNativeModeSupportEnabled(boolean enabled) { + nativeModeSupportEnabledCheckBox.setSelected(enabled); + } +} diff --git a/src/main/java/com/redhat/devtools/intellij/qute/settings/UserDefinedQuteSettings.java b/src/main/java/com/redhat/devtools/intellij/qute/settings/UserDefinedQuteSettings.java new file mode 100644 index 000000000..25328b59a --- /dev/null +++ b/src/main/java/com/redhat/devtools/intellij/qute/settings/UserDefinedQuteSettings.java @@ -0,0 +1,186 @@ +/******************************************************************************* + * 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.qute.settings; + +import com.intellij.openapi.components.PersistentStateComponent; +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.redhat.devtools.intellij.lsp4ij.operations.diagnostics.SeverityMapping; +import org.eclipse.lsp4j.DiagnosticSeverity; +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; + +/** + * User defined Qute settings + * + *
    + *
  • validation
  • + *
+ */ +@State( + name = "QuteSettingsState", + storages = {@Storage("quteSettings.xml")} +) +public class UserDefinedQuteSettings implements PersistentStateComponent { + + private volatile MyState myState = new MyState(); + + private final Project project; + + public UserDefinedQuteSettings(Project project) { + this.project = project; + } + + private final List myChangeHandlers = ContainerUtil.createConcurrentList(); + + public static @NotNull UserDefinedQuteSettings getInstance(@NotNull Project project) { + return project.getService(UserDefinedQuteSettings.class); + } + + public void addChangeHandler(Runnable runnable) { + myChangeHandlers.add(runnable); + } + + public void removeChangeHandler(Runnable runnable) { + myChangeHandlers.remove(runnable); + } + + public void fireStateChanged() { + for (Runnable handler : myChangeHandlers) { + handler.run(); + } + } + + public boolean isValidationEnabled() { + return myState.myValidationEnabled; + } + + public void setValidationEnabled(boolean validationEnabled) { + myState.myValidationEnabled = validationEnabled; + } + + @Nullable + @Override + public MyState getState() { + return myState; + } + + @Override + public void loadState(@NotNull MyState state) { + myState = state; + for (Runnable handler : myChangeHandlers) { + handler.run(); + } + } + + /** + * Returns the proper settings expected by the Qute language server. + * + * @return the proper settings expected by the Qute language server. + */ + public Map toSettingsForQuteLS() { + /* + "settings": { + "qute": { + "server": { + "vmargs": "-Xmx100M -XX:+UseG1GC -XX:+UseStringDeduplication -Xlog:disable" + }, + "templates": { + "languageMismatch": "force" + }, + "trace": { + "server": "verbose" + }, + "codeLens": { + "enabled": true + }, + "inlayHint": { + "enabled": true, + "showSectionParameterType": true, + "showSectionParameterDefaultValue": true + }, + "native": { + "enabled": false + }, + "validation": { + "enabled": true, + "excluded": [], + "undefinedObject": { + "severity": "warning" + }, + "undefinedNamespace": { + "severity": "warning" + } + } + } + */ + QuteInspectionsInfo inspectionsInfo = QuteInspectionsInfo.getQuteInspectionsInfo(project); + Map settings = new HashMap<>(); + + Map qute = new HashMap<>(); + settings.put("qute", qute); + qute.put("workspaceFolders", new HashMap()); + + // Inlay hint + qute.put("inlayHint", Collections.singletonMap("enabled", true)); + + //Code lens + qute.put("codelens", Collections.singletonMap("enabled", true)); + + //Native mode support + qute.put("native", Collections.singletonMap("enabled", isNativeModeSupportEnabled())); + + // Validation + Map validation = new HashMap<>(); + qute.put("validation", validation); + validation.put("enabled", isValidationEnabled()); + validation.put("undefinedObject", getSeverityNode(inspectionsInfo.undefinedObjectSeverity())); + validation.put("undefinedNamespace", getSeverityNode(inspectionsInfo.undefinedNamespaceSeverity())); + return settings; + } + + private Map getSeverityNode(DiagnosticSeverity severity) { + return Collections.singletonMap("severity", SeverityMapping.toString(severity)); + } + + public boolean isNativeModeSupportEnabled() { + return myState.myNativeModeSupportEnabled; + } + + public void setNativeModeSupportEnabled(boolean nativeModeSupportEnabled) { + myState.myNativeModeSupportEnabled = nativeModeSupportEnabled; + } + + public static class MyState { + + @Tag("validationEnabled") + public boolean myValidationEnabled = true; + + @Tag("nativeModeSupportEnabled") + public boolean myNativeModeSupportEnabled; + + MyState() { + } + + } + +} diff --git a/src/main/resources/META-INF/lsp4ij-qute.xml b/src/main/resources/META-INF/lsp4ij-qute.xml index 2e2e43b31..1a063fdf6 100644 --- a/src/main/resources/META-INF/lsp4ij-qute.xml +++ b/src/main/resources/META-INF/lsp4ij-qute.xml @@ -45,6 +45,34 @@ implementationClass="com.redhat.devtools.intellij.lsp4ij.operations.documentLink.LSPDocumentLinkAnnotator"/> + + + + + diff --git a/src/main/resources/inspectionDescriptions/QuteUndefinedNamespace.html b/src/main/resources/inspectionDescriptions/QuteUndefinedNamespace.html new file mode 100644 index 000000000..927a10935 --- /dev/null +++ b/src/main/resources/inspectionDescriptions/QuteUndefinedNamespace.html @@ -0,0 +1,17 @@ + + +Reports undefined namespaces in Qute templates files. +

+
+

+ ⚠ This inspection is used to configure the Qute support server in Settings | Languages & Frameworks | Language Servers.

+ Consequently, some limitations apply: +

+
    +
  • Scope: values are ignored
  • +
  • Severity: only Error and (Weak) Warning are respected. Other values mean no errors will be reported
  • +
  • Highlighting in Editor: values are ignored
  • +
+
+ + \ No newline at end of file diff --git a/src/main/resources/inspectionDescriptions/QuteUndefinedObject.html b/src/main/resources/inspectionDescriptions/QuteUndefinedObject.html new file mode 100644 index 000000000..b115d3f78 --- /dev/null +++ b/src/main/resources/inspectionDescriptions/QuteUndefinedObject.html @@ -0,0 +1,17 @@ + + +Reports undefined objects in Qute templates files. +

+
+

+ ⚠ This inspection is used to configure the Qute support server in Settings | Languages & Frameworks | Language Servers.

+ Consequently, some limitations apply: +

+
    +
  • Scope: values are ignored
  • +
  • Severity: only Error and (Weak) Warning are respected. Other values mean no errors will be reported
  • +
  • Highlighting in Editor: values are ignored
  • +
+
+ + \ No newline at end of file diff --git a/src/main/resources/messages/QuteBundle.properties b/src/main/resources/messages/QuteBundle.properties index 95fb60633..e46ee236b 100644 --- a/src/main/resources/messages/QuteBundle.properties +++ b/src/main/resources/messages/QuteBundle.properties @@ -20,3 +20,13 @@ options.qute.attribute.descriptor.string=String options.qute.attribute.descriptor.numeric=Numeric options.qute.attribute.descriptor.boolean=Boolean options.qute.attribute.descriptor.keyword=Keyword + +qute.settings.title=Qute + + +qute.inspection.group.name=Qute +qute.templates.inspection.group.name=Templates +qute.templates.validation.undefinedNamespace=Undefined namespaces +qute.templates.validation.undefinedObject=Undefined objects +qute.setting.validation.enabled=Enable validation +qute.setting.validation.native.enabled=Enable native image mode support