mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ELTokenTypes introduced, fixed issue with hanging during el parsing, CssElementFactory opened for Fabrique
This commit is contained in:
@@ -33,9 +33,14 @@ package com.intellij.psi.tree.jsp;
|
||||
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.lang.Language;
|
||||
|
||||
public class IJspElementType extends IElementType {
|
||||
public IJspElementType(String debugName) {
|
||||
super(debugName, StdFileTypes.JSP.getLanguage());
|
||||
this(debugName, StdFileTypes.JSP.getLanguage());
|
||||
}
|
||||
|
||||
protected IJspElementType(String debugName, Language language) {
|
||||
super(debugName, language);
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.html.HtmlTag;
|
||||
import com.intellij.psi.impl.source.xml.XmlTokenImpl;
|
||||
import com.intellij.psi.jsp.*;
|
||||
import com.intellij.psi.jsp.el.ELTokenType;
|
||||
import com.intellij.psi.jsp.el.ELExpressionHolder;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.tree.java.IJavaElementType;
|
||||
@@ -139,7 +141,7 @@ public class TypedHandler implements TypedActionHandler {
|
||||
super(_baseHandler);
|
||||
|
||||
myElHandler = new SimpleTokenSetQuoteHandler(
|
||||
new IElementType[] {JspTokenType.JSP_EL_STRING_LITERAL}
|
||||
new IElementType[] {ELTokenType.JSP_EL_STRING_LITERAL}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -422,6 +424,8 @@ public class TypedHandler implements TypedActionHandler {
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
final int offset = editor.getCaretModel().getOffset();
|
||||
PsiElement elementAt = file.findElementAt(offset-1);
|
||||
elementAt = PsiTreeUtil.getParentOfType(elementAt,ELExpressionHolder.class);
|
||||
elementAt = (elementAt!=null)?elementAt.getFirstChild():null;
|
||||
|
||||
// TODO: handle it with insertAfterRParen(...)
|
||||
if (elementAt!=null && !JspxCompletionData.isJavaContext(elementAt)) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.JavaDocTokenType;
|
||||
import com.intellij.psi.JavaTokenType;
|
||||
import com.intellij.psi.jsp.JspTokenType;
|
||||
import com.intellij.psi.jsp.el.ELTokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.java.IJavaDocElementType;
|
||||
import com.intellij.psi.tree.java.IJavaElementType;
|
||||
@@ -124,8 +125,8 @@ public class BraceMatchingUtil {
|
||||
PAIRING_TOKENS.put(JspTokenType.JSP_ACTION_ATTRIBUTE_VALUE_START_DELIMITER, JspTokenType.JSP_ACTION_ATTRIBUTE_VALUE_END_DELIMITER);
|
||||
PAIRING_TOKENS.put(JspTokenType.JSP_DIRECTIVE_ATTRIBUTE_VALUE_START_DELIMITER, JspTokenType.JSP_DIRECTIVE_ATTRIBUTE_VALUE_END_DELIMITER);
|
||||
PAIRING_TOKENS.put(JavaDocTokenType.DOC_INLINE_TAG_START, JavaDocTokenType.DOC_INLINE_TAG_END);
|
||||
PAIRING_TOKENS.put(JspTokenType.JSP_EL_RBRACKET, JspTokenType.JSP_EL_LBRACKET);
|
||||
PAIRING_TOKENS.put(JspTokenType.JSP_EL_RPARENTH, JspTokenType.JSP_EL_LPARENTH);
|
||||
PAIRING_TOKENS.put(ELTokenType.JSP_EL_RBRACKET, ELTokenType.JSP_EL_LBRACKET);
|
||||
PAIRING_TOKENS.put(ELTokenType.JSP_EL_RPARENTH, ELTokenType.JSP_EL_LPARENTH);
|
||||
}
|
||||
|
||||
public int getTokenGroup(IElementType tokenType) {
|
||||
@@ -165,8 +166,8 @@ public class BraceMatchingUtil {
|
||||
tokenType == JspTokenType.JSP_ACTION_START ||
|
||||
tokenType == JspTokenType.JSP_ACTION_ATTRIBUTE_VALUE_START_DELIMITER ||
|
||||
tokenType == JspTokenType.JSP_DIRECTIVE_ATTRIBUTE_VALUE_START_DELIMITER ||
|
||||
tokenType == JspTokenType.JSP_EL_LBRACKET ||
|
||||
tokenType == JspTokenType.JSP_EL_LPARENTH ||
|
||||
tokenType == ELTokenType.JSP_EL_LBRACKET ||
|
||||
tokenType == ELTokenType.JSP_EL_LPARENTH ||
|
||||
tokenType == JavaDocTokenType.DOC_INLINE_TAG_START;
|
||||
}
|
||||
|
||||
@@ -185,8 +186,8 @@ public class BraceMatchingUtil {
|
||||
tokenType == JspTokenType.JSP_EMPTY_ACTION_END ||
|
||||
tokenType == JspTokenType.JSP_ACTION_ATTRIBUTE_VALUE_END_DELIMITER ||
|
||||
tokenType == JspTokenType.JSP_DIRECTIVE_ATTRIBUTE_VALUE_END_DELIMITER ||
|
||||
tokenType == JspTokenType.JSP_EL_RBRACKET ||
|
||||
tokenType == JspTokenType.JSP_EL_RPARENTH ||
|
||||
tokenType == ELTokenType.JSP_EL_RBRACKET ||
|
||||
tokenType == ELTokenType.JSP_EL_RPARENTH ||
|
||||
tokenType == JavaDocTokenType.DOC_INLINE_TAG_END) {
|
||||
return true;
|
||||
}
|
||||
@@ -261,10 +262,10 @@ public class BraceMatchingUtil {
|
||||
if (ch == ')') return JavaTokenType.RPARENTH;
|
||||
if (ch == '(') return JavaTokenType.LPARENTH;
|
||||
} else if(tokenType instanceof IJspElementType) {
|
||||
if (ch == ']') return JspTokenType.JSP_EL_RBRACKET;
|
||||
if (ch == '[') return JspTokenType.JSP_EL_LBRACKET;
|
||||
if (ch == ')') return JspTokenType.JSP_EL_RPARENTH;
|
||||
if (ch == '(') return JspTokenType.JSP_EL_LPARENTH;
|
||||
if (ch == ']') return ELTokenType.JSP_EL_RBRACKET;
|
||||
if (ch == '[') return ELTokenType.JSP_EL_LBRACKET;
|
||||
if (ch == ')') return ELTokenType.JSP_EL_RPARENTH;
|
||||
if (ch == '(') return ELTokenType.JSP_EL_LPARENTH;
|
||||
}
|
||||
|
||||
return null; //TODO: add more here!
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import com.intellij.psi.jsp.JspTokenType;
|
||||
import com.intellij.psi.jsp.el.ELTokenType;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
|
||||
@@ -70,7 +71,7 @@ public class HtmlHighlightingLexer extends BaseHtmlLexer {
|
||||
registerHandler(XmlTokenType.XML_COMMENT_CHARACTERS,value);
|
||||
|
||||
if (withEl) {
|
||||
registerHandler(JspTokenType.JSP_EL_CONTENT, new ElEmbeddmentHandler());
|
||||
registerHandler(ELTokenType.JSP_EL_CONTENT, new ElEmbeddmentHandler());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ public class HtmlHighlightingLexer extends BaseHtmlLexer {
|
||||
}
|
||||
}
|
||||
newLexer = scriptLexer;
|
||||
} else if (super.getTokenType() == JspTokenType.JSP_EL_CONTENT) {
|
||||
} else if (super.getTokenType() == ELTokenType.JSP_EL_CONTENT) {
|
||||
if (elLexer==null) elLexer = new _ELLexer();
|
||||
newLexer = elLexer;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.intellij.psi.impl.source.jsp.jspJava.JspText;
|
||||
import com.intellij.psi.impl.source.tree.java.*;
|
||||
import com.intellij.psi.impl.source.xml.*;
|
||||
import com.intellij.psi.jsp.JspTokenType;
|
||||
import com.intellij.psi.jsp.el.ELTokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.java.IJavaDocElementType;
|
||||
import com.intellij.psi.tree.java.IJavaElementType;
|
||||
@@ -520,9 +521,6 @@ public class Factory implements Constants {
|
||||
}
|
||||
else if (type == ANNOTATION_PARAMETER_LIST) {
|
||||
element = new PsiAnnotationParameterListImpl();
|
||||
} else if (type == CustomHighlighterTokenType.CUSTOM_CONTENT ||
|
||||
type == JspTokenType.JSP_EL_HOLDER) {
|
||||
element = new XmlAnotherLanguageContent(type) {};
|
||||
}
|
||||
else {
|
||||
if (type instanceof IAspectElementType) {
|
||||
|
||||
Reference in New Issue
Block a user