From 8352e59133702c3f38733de73ba5494f2b278cbc Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 15 Aug 2012 14:41:52 +0200 Subject: [PATCH] tune collectionElementName() live template macro to work better in Jinja2 templates --- .../python/codeInsight/CollectionElementNameMacro.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/src/com/jetbrains/python/codeInsight/CollectionElementNameMacro.java b/python/src/com/jetbrains/python/codeInsight/CollectionElementNameMacro.java index 0edb55d9cd52..80ba6a1cf94d 100644 --- a/python/src/com/jetbrains/python/codeInsight/CollectionElementNameMacro.java +++ b/python/src/com/jetbrains/python/codeInsight/CollectionElementNameMacro.java @@ -39,6 +39,12 @@ public class CollectionElementNameMacro extends Macro { if (lastDot >= 0) { param = param.substring(lastDot+1); } + if (param.endsWith(")")) { + int lastParen = param.lastIndexOf('('); + if (lastParen > 0) { + param = param.substring(0, lastParen); + } + } final String result = smartUnpluralize(param); return new TextResult(result); }