diff --git a/latte-plugin.jar b/latte-plugin.jar
index 796d2ba..c84ce3c 100644
Binary files a/latte-plugin.jar and b/latte-plugin.jar differ
diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml
index dfffff3..9a6b63c 100644
--- a/resources/META-INF/plugin.xml
+++ b/resources/META-INF/plugin.xml
@@ -21,7 +21,7 @@
1.0.2
- added code style settings (settings for use tabs or spaces) (issue #46, #30)
- - added support for define variable in tag {default $foo}
+ - added support for define variable in tag {default $foo = 123}
- added class namespaces completion
- added support for define variables by {php [$foo, $bar] = $arr}
- implemented some performance improvements
@@ -30,6 +30,7 @@
- fixed filters on variables (issue #47)
- fixed wrong indent for elseifset (issue #42)
- fixed multiple variable definitions in for/foreach cycles
+ - fixed auto-complete (disabled in strings, more improvements)
- increased minimum compatibility to 2018.3
1.0.1
diff --git a/src/com/jantvrdik/intellij/latte/completion/LatteCompletionContributor.java b/src/com/jantvrdik/intellij/latte/completion/LatteCompletionContributor.java
index 7271678..ffc16c4 100644
--- a/src/com/jantvrdik/intellij/latte/completion/LatteCompletionContributor.java
+++ b/src/com/jantvrdik/intellij/latte/completion/LatteCompletionContributor.java
@@ -86,9 +86,11 @@ protected void addCompletions(@NotNull CompletionParameters parameters, Processi
return;
}
- LatteMacro macro = LatteConfiguration.INSTANCE.getMacro(element.getProject(), macroClassic.getOpenTag().getMacroName());
- if (macro == null || !macro.allowedModifiers) {
- return;
+ if (!((LatteMacroModifier) element).isVariableModifier()) {
+ LatteMacro macro = LatteConfiguration.INSTANCE.getMacro(element.getProject(), macroClassic.getOpenTag().getMacroName());
+ if (macro == null || !macro.allowedModifiers) {
+ return;
+ }
}
Map customModifiers = LatteConfiguration.INSTANCE.getCustomModifiers(element.getProject());
diff --git a/src/com/jantvrdik/intellij/latte/completion/providers/LattePhpCompletionProvider.java b/src/com/jantvrdik/intellij/latte/completion/providers/LattePhpCompletionProvider.java
index 7af353e..b5696a8 100644
--- a/src/com/jantvrdik/intellij/latte/completion/providers/LattePhpCompletionProvider.java
+++ b/src/com/jantvrdik/intellij/latte/completion/providers/LattePhpCompletionProvider.java
@@ -53,16 +53,16 @@ protected void addCompletions(
} else if (element instanceof LattePhpProperty || (element instanceof LattePhpMethod && !((LattePhpMethod) element).isStatic())) {
attachPhpCompletions(result, (BaseLattePhpElement) element, false);
- } else {
+ } else if (!(element instanceof LatteMacroModifier) && !(element instanceof LattePhpString)) {
+ classCompletionProvider.addCompletions(parameters, context, result);
+ namespaceCompletionProvider.addCompletions(parameters, context, result);
+
if (LatteUtil.matchParentMacroName(element, "varType") || LatteUtil.matchParentMacroName(element, "var")) {
attachVarTypes(result);
- }
- if (!(element instanceof LatteMacroModifier)) {
- classCompletionProvider.addCompletions(parameters, context, result);
+ } else {
variableCompletionProvider.addCompletions(parameters, context, result);
functionCompletionProvider.addCompletions(parameters, context, result);
- namespaceCompletionProvider.addCompletions(parameters, context, result);
}
}
}
diff --git a/src/com/jantvrdik/intellij/latte/parser/LatteParser.bnf b/src/com/jantvrdik/intellij/latte/parser/LatteParser.bnf
index c0efd98..89f46ed 100644
--- a/src/com/jantvrdik/intellij/latte/parser/LatteParser.bnf
+++ b/src/com/jantvrdik/intellij/latte/parser/LatteParser.bnf
@@ -168,13 +168,14 @@ phpMethodDefinition ::= T_WHITESPACE? (T_PHP_DOUBLE_COLON | T_PHP_OBJECT_O
private
phpArgumentList ::= (T_PHP_LEFT_NORMAL_BRACE T_WHITESPACE? T_PHP_RIGHT_NORMAL_BRACE) | (T_PHP_LEFT_NORMAL_BRACE phpMethodArgs T_PHP_RIGHT_NORMAL_BRACE)
-private
phpInBrackets ::= T_PHP_LEFT_NORMAL_BRACE T_WHITESPACE? phpArgument+ T_WHITESPACE? T_PHP_RIGHT_NORMAL_BRACE
phpMethodArgs ::= T_WHITESPACE? phpArgument+ ( T_WHITESPACE? "," T_WHITESPACE? phpArgument+ )* T_WHITESPACE?
+phpString ::= phpSingleQuotedString | phpDoubleQuotedString | T_MACRO_ARGS_STRING
+
private
-phpArgument ::= phpSingleQuotedString | phpDoubleQuotedString | T_MACRO_ARGS_STRING | T_MACRO_ARGS_NUMBER | phpArrayOfVariables | phpClass | phpDefinition
+phpArgument ::= phpString | T_MACRO_ARGS_NUMBER | phpArrayOfVariables | phpClass | phpDefinition
| phpStatic | phpFunctionCall | phpInBrackets | phpVariable | T_PHP_CONTENT_TYPE | T_PHP_OBJECT_OPERATOR
| T_PHP_OPERATOR | T_PHP_DOUBLE_COLON | T_PHP_DOUBLE_ARROW | T_PHP_METHOD | T_PHP_TYPE | T_PHP_KEYWORD
| T_PHP_CLASS | T_PHP_AS | T_PHP_CAST | T_PHP_EXPRESSION | T_PHP_LEFT_BRACKET | T_PHP_RIGHT_BRACKET | T_PHP_NULL
diff --git a/src/com/jantvrdik/intellij/latte/psi/impl/LattePsiImplUtil.java b/src/com/jantvrdik/intellij/latte/psi/impl/LattePsiImplUtil.java
index ec2d2a8..1b4c34c 100644
--- a/src/com/jantvrdik/intellij/latte/psi/impl/LattePsiImplUtil.java
+++ b/src/com/jantvrdik/intellij/latte/psi/impl/LattePsiImplUtil.java
@@ -146,21 +146,8 @@ public static String getModifierName(@NotNull LatteMacroModifier element) {
}
public static boolean isVariableModifier(@NotNull LatteMacroModifier element) {
- PsiElement prevElement = PsiTreeUtil.skipWhitespacesBackward(element);
- PsiElement nextElement = PsiTreeUtil.skipWhitespacesForward(element);
- if (
- prevElement != null && nextElement != null
- && prevElement.getNode().getElementType().equals(LatteTypes.T_PHP_OR_INCLUSIVE)
- ) {
- LattePhpVariable prevVariable = PsiTreeUtil.getPrevSiblingOfType(prevElement, LattePhpVariable.class);
- if (prevVariable != null) {
- PsiElement beforeVariable = prevVariable.getPrevSibling();
- if (beforeVariable != null && beforeVariable.getNode().getElementType().equals(LatteTypes.T_PHP_LEFT_NORMAL_BRACE)) {
- return true;
- }
- }
- }
- return false;
+ LattePhpInBrackets variableModifier = PsiTreeUtil.getParentOfType(element, LattePhpInBrackets.class);
+ return variableModifier != null;
}
@Nullable