Commits

Ali Gholami Rudi  committed ed8e59b

codeassist: builtin should be typepref

  • Participants
  • Parent commits 194b9d9

Comments (0)

Files changed (2)

File rope/contrib/codeassist.py

 
     Return a sorted list of the given `CodeAssistProposal`\s.
 
-    `typepref` can be a list of proposal kinds.  Defaults to ``['local',
-    'parameter_keyword', 'global', 'attribute', 'template', 'builtin',
-    'keyword']``.
+    `kindpref` can be a list of proposal kinds.  Defaults to
+    ``['local', 'parameter_keyword', 'global', 'attribute',
+    'template', 'keyword']``.
 
     `typepref` can be a list of proposal types.  Defaults to
     ``['class', 'function', 'variable', 'parameter', 'imported',
-    None]``.  (`None` stands for completions with no type like
-    keywords.)
+    'builtin', None]``.  (`None` stands for completions with no type
+    like keywords.)
 
     """
     sorter = _ProposalSorter(proposals, kindpref, typepref)
         for name, pyname in names.items():
             if name.startswith(self.starting):
                 kind = 'local'
-                if isinstance(pyname, builtins.BuiltinName):
-                    kind = 'builtin'
-                elif scope.get_kind() == 'Module':
+                if scope.get_kind() == 'Module':
                     kind = 'global'
-                if lineno is None or self.later_locals or kind == 'builtin' or \
+                if lineno is None or self.later_locals or \
                    not self._is_defined_after(scope, pyname, lineno):
                     result[name] = CompletionProposal(
                         name, kind, self._get_pyname_type(pyname))
         self.proposals = code_assist_proposals
         if kindpref is None:
             kindpref = ['local', 'parameter_keyword', 'global', 'attribute',
-                        'template', 'builtin', 'keyword']
+                        'template', 'keyword']
         self.kindpref = kindpref
         if typepref is None:
             typepref = ['class', 'function', 'variable',
-                        'parameter', 'imported', None]
+                        'parameter', 'imported', 'builtin', None]
         self.typerank = dict((type, index)
                               for index, type in enumerate(typepref))
 

File ropetest/contrib/codeassisttest.py

     def test_including_matching_builtins_types(self):
         code = 'my_var = Excep'
         result = self._assist(code)
-        self.assert_completion_in_result('Exception', 'builtin', result)
-        self.assert_completion_not_in_result('zip', 'builtin', result)
+        self.assert_completion_in_result('Exception', 'global', result)
+        self.assert_completion_not_in_result('zip', 'global', result)
 
     def test_including_matching_builtins_functions(self):
         code = 'my_var = zi'
         result = self._assist(code)
-        self.assert_completion_in_result('zip', 'builtin', result)
+        self.assert_completion_in_result('zip', 'global', result)
 
     def test_including_keywords(self):
         code = 'fo'
     def test_completing_excepts_in_uncomplete_try_blocks(self):
         code = 'try:\n    pass\nexcept Exc'
         result = self._assist(code)
-        self.assert_completion_in_result('Exception', 'builtin', result)
+        self.assert_completion_in_result('Exception', 'global', result)
 
     def test_nested_blocks(self):
         code = 'a_var = 10\ntry:\n    try:\n        a_v'