Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to show the inlay hint for logging #1239

Merged
merged 10 commits into from
Oct 24, 2024
Merged

Conversation

ekalenchuk
Copy link

@ekalenchuk ekalenchuk commented Oct 13, 2024

Inlay hint on a package level:
image

Inlay hint on a class level:
image

Inlay hint on a class with a super class
image

Inlay hint on a class with a nested class
image

Execute HTTP Call to SAP Commerce...
image

@ekalenchuk ekalenchuk changed the title Logging Added ability to show the inlay hint for logging Oct 13, 2024
@mlytvyn mlytvyn added this to the Release 2024.3.0 milestone Oct 13, 2024
}

fun handleClick(editor: Editor, element: PsiElement, loggerIdentifier: String) {
val actionGroup = DefaultActionGroup().apply {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define new action group and action via xml, later in the code get that action group via ActionManager.getInstance().getAction(..). See example - ccv2.toolbar.actions.

Move logic responsible for availability of the action to the action itself, its presentation configuration set via update method. Rely on dataContext to pass required data to be used in the action itself.

p.s. it can stay as a first start, but it will produce too many unwanted instances of the Actions.

val title = "Logger - $resultMessage"
Notifications.create(
NotificationType.INFORMATION, title,
"Set the log level: $logLevel for $logIdentifier. Server response: ${result.statusCode}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better wording may improve understanding, kinda: "Log level set to FATAL for server server alias."

)

val resultMessage = if (result.statusCode == 200) "Success" else "Failed"
val title = "Logger - $resultMessage"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need in extra variable, feel free to inline it and change to actionable. some extras related to UI development can be found here https://plugins.jetbrains.com/docs/intellij/notification-types.html#what-notification-to-use.

.build();
}

if (json.get("stacktraceText") != null && isNotEmpty(json.get("stacktraceText").toString())) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stacktraceText looks like a candidate for a new variable

@@ -295,4 +295,60 @@ public HybrisHttpResult executeSolrSearch(final Project project, @Nullable final
return null;
}
}

public @NotNull
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use 1 line for public ... method(

}
}

class LoggerAction(private val logLevel: String, val logIdentifier: String, val icon: Icon) : AnAction(logLevel, "", icon) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mlytvyn mlytvyn changed the base branch from release/2024.3.0 to main October 21, 2024 16:35
@ekalenchuk ekalenchuk marked this pull request as ready for review October 23, 2024 08:36
@mlytvyn mlytvyn merged commit b519481 into epam:main Oct 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants