diff --git a/xml/impl/resources/liveTemplates/zen_html.xml b/xml/impl/resources/liveTemplates/zen_html.xml
index 8a1d9cf97811..88adf4199854 100644
--- a/xml/impl/resources/liveTemplates/zen_html.xml
+++ b/xml/impl/resources/liveTemplates/zen_html.xml
@@ -4,7 +4,6 @@
-
-
-
-
-
-
@@ -57,28 +51,24 @@
-
-
-
-
-
@@ -106,7 +95,6 @@
-
@@ -114,7 +102,6 @@
-
@@ -122,7 +109,6 @@
-
@@ -130,7 +116,6 @@
-
@@ -138,7 +123,6 @@
-
@@ -146,7 +130,6 @@
-
@@ -154,35 +137,30 @@
-
-
-
-
-
@@ -190,28 +168,24 @@
-
-
-
-
@@ -228,7 +202,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -392,7 +349,6 @@
-
-
-
-
-
-
@@ -453,7 +404,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -769,7 +689,6 @@
-
-
@@ -788,7 +706,6 @@
-
@@ -796,7 +713,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1663,7 +1484,6 @@
-
-
-
-
-
-
-
-
@@ -1761,7 +1574,6 @@
-
-
-
-
-
-
-
-
@@ -1843,7 +1648,6 @@
-
@@ -1855,35 +1659,30 @@
-
-
-
-
-
@@ -1893,7 +1692,6 @@
-
@@ -1901,7 +1699,6 @@
-
@@ -1909,7 +1706,6 @@
-
-
\ No newline at end of file
diff --git a/xml/impl/src/com/intellij/codeInsight/template/HtmlTextContextType.java b/xml/impl/src/com/intellij/codeInsight/template/HtmlTextContextType.java
index c16509e45d2f..c0c2c98279fd 100644
--- a/xml/impl/src/com/intellij/codeInsight/template/HtmlTextContextType.java
+++ b/xml/impl/src/com/intellij/codeInsight/template/HtmlTextContextType.java
@@ -16,10 +16,12 @@
package com.intellij.codeInsight.template;
import com.intellij.codeInsight.CodeInsightBundle;
+import com.intellij.lang.Language;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiErrorElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtilCore;
import com.intellij.psi.xml.XmlComment;
import com.intellij.psi.xml.XmlDocument;
import com.intellij.psi.xml.XmlText;
@@ -36,10 +38,11 @@ public class HtmlTextContextType extends TemplateContextType {
@Override
public boolean isInContext(@NotNull PsiFile file, int offset) {
- if (!HtmlContextType.isMyLanguage(file.getLanguage())) {
+ Language language = PsiUtilCore.getLanguageAtOffset(file, offset);
+ if (!HtmlContextType.isMyLanguage(language)) {
return false;
}
- PsiElement element = file.findElementAt(offset);
+ PsiElement element = file.getViewProvider().findElementAt(offset, language);
return element == null || isInContext(element);
}