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

Add ScoutTemplateContextType #13

Draft
wants to merge 1 commit into
base: releases/13.0
Choose a base branch
from

Conversation

fschinkel
Copy link
Member

Restrict liveTemplates for DoNodes to DoEntities.

@fschinkel fschinkel self-assigned this Apr 18, 2023
@fschinkel fschinkel removed the request for review from mvilliger April 18, 2023 14:10
@fschinkel fschinkel changed the title Add ScoutTemplateContextType WIP: Add ScoutTemplateContextType Apr 18, 2023
Restrict liveTemplates for DoNodes to DoEntities.
@fschinkel fschinkel changed the base branch from releases/13.0 to releases/12.0 April 18, 2023 14:16
@fschinkel fschinkel changed the base branch from releases/12.0 to releases/13.0 April 18, 2023 14:16
@fschinkel fschinkel force-pushed the features/fschinkel/13.0/ScoutTemplateContextType branch from c7f469e to 696d06d Compare April 18, 2023 14:19
val module = element.containingModule() ?: return false
val clazz = PsiTreeUtil.getParentOfType(element, PsiClass::class.java) ?: return false
return IdeaEnvironment.callInIdeaEnvironmentSync(module.project, IdeaProgress.empty()) { env, _ ->
val type = clazz.toScoutType(env) ?: return@callInIdeaEnvironmentSync false
Copy link
Member

Choose a reason for hiding this comment

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

Is the transformation from PsiClass to IType really necessary? Because this loads the classpath and is therefore quite expensive just to perform a check of the super-hierarchy. Maybe use InheritanceUtil on clazz instead?
Then the IdeaEnvironment must not be created explicitly and the code becomes much simpler?

@fschinkel fschinkel marked this pull request as draft May 8, 2023 13:29
@fschinkel fschinkel changed the title WIP: Add ScoutTemplateContextType Add ScoutTemplateContextType May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants