Don't mark builtin functions or keywords as unresolved
authorJulien Enselme <jenselme@netbeans.org>
Fri, 11 Sep 2015 16:28:37 +0200
changeset 1830989c06035f355
parent 18308 13d93fcd23a0
child 18310 9f0df96577b0
Don't mark builtin functions or keywords as unresolved
python.editor/src/org/netbeans/modules/python/editor/hints/UnresolvedDetector.java
python.editor/src/org/netbeans/modules/python/editor/lexer/PythonLexer.java
python.editor/src/org/netbeans/modules/python/editor/lexer/PythonLexerUtils.java
     1.1 --- a/python.editor/src/org/netbeans/modules/python/editor/hints/UnresolvedDetector.java	Sat Aug 15 01:49:37 2015 +0200
     1.2 +++ b/python.editor/src/org/netbeans/modules/python/editor/hints/UnresolvedDetector.java	Fri Sep 11 16:28:37 2015 +0200
     1.3 @@ -101,6 +101,11 @@
     1.4                  if (name == null) {
     1.5                      name = "";
     1.6                  }
     1.7 +                // Ignore keywords and builtin
     1.8 +                if (PythonLexerUtils.isKeywordOrBuiltin(name)) {
     1.9 +                    continue;
    1.10 +                }
    1.11 +
    1.12                  List<HintFix> fixList = new ArrayList<>(3);
    1.13                  // Is is a reference to a module?
    1.14                  boolean tryModule = false;
     2.1 --- a/python.editor/src/org/netbeans/modules/python/editor/lexer/PythonLexer.java	Sat Aug 15 01:49:37 2015 +0200
     2.2 +++ b/python.editor/src/org/netbeans/modules/python/editor/lexer/PythonLexer.java	Fri Sep 11 16:28:37 2015 +0200
     2.3 @@ -687,7 +687,7 @@
     2.4      public void release() {
     2.5      }
     2.6  
     2.7 -    private PythonTokenId getKeywordToken(CharSequence s) {
     2.8 +    private static PythonTokenId getKeywordToken(CharSequence s) {
     2.9          int length = s.length();
    2.10          if (length < 2) {
    2.11              return null;
    2.12 @@ -1151,4 +1151,8 @@
    2.13  
    2.14          return null;
    2.15      }
    2.16 +
    2.17 +    public static boolean isKeywordOrBuiltin(CharSequence name) {
    2.18 +        return getKeywordToken(name) != null;
    2.19 +    }
    2.20  }
     3.1 --- a/python.editor/src/org/netbeans/modules/python/editor/lexer/PythonLexerUtils.java	Sat Aug 15 01:49:37 2015 +0200
     3.2 +++ b/python.editor/src/org/netbeans/modules/python/editor/lexer/PythonLexerUtils.java	Fri Sep 11 16:28:37 2015 +0200
     3.3 @@ -555,4 +555,8 @@
     3.4  
     3.5          return lexOffset;
     3.6      }
     3.7 +
     3.8 +     public static boolean isKeywordOrBuiltin(CharSequence name) {
     3.9 +        return PythonLexer.isKeywordOrBuiltin(name);
    3.10 +    }
    3.11  }