Skip to content

Commit

Permalink
fixing issue #298 (Fixing issue with extra closing brace when typing …
Browse files Browse the repository at this point in the history
…${ outside of strings)
  • Loading branch information
m0rkeulv committed Aug 24, 2024
1 parent d434c7b commit 2350d4c
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import com.intellij.plugins.haxe.lang.lexer.HaxeTokenTypes;
import com.intellij.plugins.haxe.lang.psi.HaxeComponentName;
import com.intellij.plugins.haxe.lang.psi.HaxePsiCompositeElement;
import com.intellij.plugins.haxe.lang.psi.HaxeStringLiteralExpression;
import com.intellij.plugins.haxe.lang.psi.HaxeType;
import com.intellij.plugins.haxe.util.HaxeDebugPsiUtil;
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
Expand Down Expand Up @@ -73,8 +73,14 @@ private static boolean checkAfterTypeOrComponentName(PsiFile file, int offset) {

private static boolean checkAfterDollarInString(PsiFile file, int offset) {
PsiElement at = file.findElementAt(offset - 1);
final String text = at != null ? at.getText() : "";
return text.endsWith("$") && PsiTreeUtil.getParentOfType(at, HaxePsiCompositeElement.class) != null;
if (at != null) {
HaxeStringLiteralExpression type = PsiTreeUtil.getParentOfType(at, HaxeStringLiteralExpression.class);
if (type != null) {
final String text = at.getText();
return text.endsWith("$") && PsiTreeUtil.getParentOfType(at, HaxePsiCompositeElement.class) != null;
}
}
return false;
}

@NotNull
Expand Down

0 comments on commit 2350d4c

Please sign in to comment.