Skip to content

Commit

Permalink
Ignore 'UndefinedObject' problem code action should appear only if LSP
Browse files Browse the repository at this point in the history
client can support update configuration.

Signed-off-by: azerr <azerr@redhat.com>
  • Loading branch information
angelozerr committed Apr 20, 2023
1 parent f185bd5 commit c3fa97b
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import com.redhat.qute.project.datamodel.ExtendedDataModelParameter;
import com.redhat.qute.project.datamodel.ExtendedDataModelTemplate;
import com.redhat.qute.project.datamodel.resolvers.ValueResolver;
import com.redhat.qute.services.commands.QuteClientCommandConstants;
import com.redhat.qute.services.diagnostics.QuteErrorCode;
import com.redhat.qute.utils.StringUtils;
import com.redhat.qute.utils.UserTagUtils;
Expand Down Expand Up @@ -83,9 +84,13 @@ public void doCodeActions(CodeActionRequest request, List<CompletableFuture<Void
// CodeAction to append ?? to object to make it optional
doCodeActionToAddOptionalSuffix(template, diagnostic, codeActions);

// CodeAction to set validation severity to ignore
doCodeActionToSetIgnoreSeverity(template, diagnostic, QuteErrorCode.UndefinedObject, codeActions,
UNDEFINED_OBJECT_SEVERITY_SETTING);
boolean canUpdateConfiguration = request.getSharedSettings().getCommandCapabilities()
.isCommandSupported(QuteClientCommandConstants.COMMAND_CONFIGURATION_UPDATE);
if (canUpdateConfiguration) {
// CodeAction to set validation severity to ignore
doCodeActionToSetIgnoreSeverity(template, diagnostic, QuteErrorCode.UndefinedObject, codeActions,
UNDEFINED_OBJECT_SEVERITY_SETTING);
}

} catch (BadLocationException e) {
LOGGER.log(Level.SEVERE, "Creation of undefined object code action failed", e);
Expand Down

0 comments on commit c3fa97b

Please sign in to comment.