From ff428fd6f78de223ceea377bec663a75d9a0ec96 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Fri, 14 Dec 2012 18:26:32 +0100 Subject: [PATCH] Add path completion to os.path.join elements. --- .../python/psi/impl/PyPathEvaluator.java | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/python/src/com/jetbrains/python/psi/impl/PyPathEvaluator.java b/python/src/com/jetbrains/python/psi/impl/PyPathEvaluator.java index 2adb08df2c81..3b0acc5cd7f2 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyPathEvaluator.java +++ b/python/src/com/jetbrains/python/psi/impl/PyPathEvaluator.java @@ -28,7 +28,7 @@ public class PyPathEvaluator { } @Nullable - public static String evaluate(PyExpression expr, String path) { + public static String evaluate(PyExpression expr, String containingFilePath) { if (expr == null) { return null; } @@ -36,27 +36,15 @@ public class PyPathEvaluator { final PyCallExpression call = (PyCallExpression)expr; final PyExpression[] args = call.getArguments(); if (call.isCalleeText(PyNames.DIRNAME) && args.length == 1) { - String argValue = evaluate(args[0], path); + String argValue = evaluate(args[0], containingFilePath); return argValue == null ? null : new File(argValue).getParent(); } else if (call.isCalleeText(PyNames.JOIN) && args.length >= 1) { - String result = null; - for (int i = 0; i