summaryrefslogtreecommitdiff
path: root/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-06-21 16:58:30 -0700
committerTor Norbye <tnorbye@google.com>2013-06-21 16:58:30 -0700
commitc6218e46d5d2017e987ecdbd99b318a95c42abc0 (patch)
tree85106b3c757a794fb274159cebe07c8d979740a5 /plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
parent0e154c74931b6ff5ad6e0ec512b32e30df3cb068 (diff)
downloadidea-c6218e46d5d2017e987ecdbd99b318a95c42abc0.tar.gz
Snapshot d8891a7de15cebb78b6ce5711e50e531b42c0baf from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: Ida9d1b0a2341112b9ebcf67bf560c8f62f0afdc6
Diffstat (limited to 'plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java')
-rw-r--r--plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
index be97f2c9a7af..364f241d253d 100644
--- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
+++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/InjectorUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2009 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.
@@ -233,9 +233,9 @@ public class InjectorUtils {
@Nullable
public static <T> T findNearestComment(PsiElement element, NullableFunction<PsiComment, T> processor) {
if (element instanceof PsiComment) return null;
- PsiComment comment;
+ PsiComment comment = null;
PsiElement start = element;
- for (int i = 0; i < 3 && start != null; i++) {
+ for (int i=0; i<2 && start != null; i++) {
if (start instanceof PsiFile) return null;
for (PsiElement e = start.getPrevSibling(); e != null; e = e.getPrevSibling()) {
if (e instanceof PsiComment) {
@@ -244,14 +244,14 @@ public class InjectorUtils {
if (value != null) return value;
else continue;
}
- else if (e instanceof PsiWhiteSpace || e.getText().trim().isEmpty()) continue;
+ else if (e instanceof PsiWhiteSpace) continue;
else if (e instanceof PsiLanguageInjectionHost) {
if (StringUtil.isEmptyOrSpaces(e.getText())) continue;
else return null;
}
break;
}
- start = start.getParent();
+ start = element.getParent();
}
return null;
}