From be1e8fcfdaa7b5a4211cf6f4e09d45ebc23ba9b7 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Mon, 20 Jun 2016 16:01:17 +0300 Subject: [PATCH] Disable templates that are available on "TOP_LEVEL" in scripts --- .../kotlin/idea/liveTemplates/KotlinTemplateContextType.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/idea/idea-live-templates/src/org/jetbrains/kotlin/idea/liveTemplates/KotlinTemplateContextType.java b/idea/idea-live-templates/src/org/jetbrains/kotlin/idea/liveTemplates/KotlinTemplateContextType.java index 4976245ddb9..6fb81cf8b1d 100644 --- a/idea/idea-live-templates/src/org/jetbrains/kotlin/idea/liveTemplates/KotlinTemplateContextType.java +++ b/idea/idea-live-templates/src/org/jetbrains/kotlin/idea/liveTemplates/KotlinTemplateContextType.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. + * Copyright 2010-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -118,6 +118,9 @@ public abstract class KotlinTemplateContextType extends TemplateContextType { || e instanceof KtClassOrObject) { return false; } + if (e instanceof KtScriptInitializer) { + return false; + } e = e.getParent(); } return true;