Misc: Permit refactorings/intentions/quick fixes inside script files

#KT-20123 Fixed
This commit is contained in:
Alexey Sedunov
2018-05-10 20:08:55 +03:00
parent a5a13b74f5
commit 805010e75c
2 changed files with 2 additions and 2 deletions

View File

@@ -45,7 +45,7 @@ abstract class QuickFixActionBase<out T : PsiElement>(element: T) : IntentionAct
val element = element ?: return false
return element.isValid &&
!element.project.isDisposed &&
(file.manager.isInProject(file) || file is KtCodeFragment) &&
(file.manager.isInProject(file) || file is KtCodeFragment || (file is KtFile && file.isScript())) &&
(file is KtFile || isCrossLanguageFix) &&
isAvailableImpl(project, editor, file)
}

View File

@@ -456,7 +456,7 @@ fun PsiElement.canRefactor(): Boolean {
this is KtElement ||
this is PsiMember && language == JavaLanguage.INSTANCE ||
this is PsiDirectory ->
ProjectRootsUtil.isInProjectSource(this)
ProjectRootsUtil.isInProjectSource(this) || ((containingFile as? KtFile)?.isScript() ?: false)
else ->
false
}