From 242a5e3ee03a8d52ab4a0db5537f37bcd108cbc2 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Fri, 20 Dec 2013 17:08:50 +0400 Subject: [PATCH 1/3] Switched back to char-based triple quotes detection for docstring element types (PY-11585) --- .../src/com/jetbrains/python/lexer/PyStringLiteralLexer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/lexer/PyStringLiteralLexer.java b/python/src/com/jetbrains/python/lexer/PyStringLiteralLexer.java index 10c8c9be41cb..4ed6435982c7 100644 --- a/python/src/com/jetbrains/python/lexer/PyStringLiteralLexer.java +++ b/python/src/com/jetbrains/python/lexer/PyStringLiteralLexer.java @@ -57,7 +57,6 @@ public class PyStringLiteralLexer extends LexerBase { */ public PyStringLiteralLexer(final IElementType originalLiteralToken) { myOriginalLiteralToken = originalLiteralToken; - myIsTriple = PyTokenTypes.TRIPLE_NODES.contains(myOriginalLiteralToken); } public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) { @@ -85,6 +84,8 @@ public class PyStringLiteralLexer extends LexerBase { assert (c == '"') || (c == '\'') : "String must be quoted by single or double quote. Found '" + c + "' in string " + buffer; myQuoteChar = c; + myIsTriple = (buffer.length() > i + 2) && (buffer.charAt(i + 1) == c) && (buffer.charAt(i + 2) == c); + // calculate myEnd at last myEnd = locateToken(myStart); } From 3a3bbfff65d89ec6ec10fa588a798fd5fa5a4716 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Mon, 23 Dec 2013 15:52:47 +0400 Subject: [PATCH 2/3] Made builtins cache valid only if it has a valid reference to the builtins file (PY-11665) A temporary builtins cache with no builtins file has been considered valid before and thus has been never invalidated. --- python/src/com/jetbrains/python/psi/impl/PyBuiltinCache.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/psi/impl/PyBuiltinCache.java b/python/src/com/jetbrains/python/psi/impl/PyBuiltinCache.java index 64382fa698dd..b545290c13c6 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyBuiltinCache.java +++ b/python/src/com/jetbrains/python/psi/impl/PyBuiltinCache.java @@ -172,7 +172,7 @@ public class PyBuiltinCache { } public boolean isValid() { - return myBuiltinsFile == null || myBuiltinsFile.isValid(); + return myBuiltinsFile != null && myBuiltinsFile.isValid(); } /** From 9e8ef9207c6232c1ef573e511025828e21176517 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Mon, 23 Dec 2013 16:14:25 +0400 Subject: [PATCH 3/3] Added error message for missing python-skeletons diagnostics (PY-10411) --- .../codeInsight/userSkeletons/PyUserSkeletonsUtil.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsUtil.java b/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsUtil.java index da0ad54784d0..2d0fd8d42868 100644 --- a/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsUtil.java +++ b/python/src/com/jetbrains/python/codeInsight/userSkeletons/PyUserSkeletonsUtil.java @@ -17,6 +17,7 @@ package com.jetbrains.python.codeInsight.userSkeletons; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.PathManager; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; @@ -53,7 +54,10 @@ import java.util.List; */ public class PyUserSkeletonsUtil { public static final String USER_SKELETONS_DIR = "python-skeletons"; + private static final Logger LOG = Logger.getInstance("#com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsUtil"); + @Nullable private static VirtualFile ourUserSkeletonsDirectory; + private static boolean ourNoSkeletonsErrorReported = false; @NotNull private static List getPossibleUserSkeletonsPaths() { @@ -75,6 +79,10 @@ public class PyUserSkeletonsUtil { } } } + if (!ourNoSkeletonsErrorReported && ourUserSkeletonsDirectory == null) { + ourNoSkeletonsErrorReported = true; + LOG.error("python-skeletons directory not found in paths: " + getPossibleUserSkeletonsPaths()); + } return ourUserSkeletonsDirectory; }