Merge branch 'python-fixes'

This commit is contained in:
Andrey Vlasovskikh
2013-12-23 17:58:05 +04:00
3 changed files with 11 additions and 2 deletions
@@ -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<String> 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;
}
@@ -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);
}
@@ -172,7 +172,7 @@ public class PyBuiltinCache {
}
public boolean isValid() {
return myBuiltinsFile == null || myBuiltinsFile.isValid();
return myBuiltinsFile != null && myBuiltinsFile.isValid();
}
/**