ouilles / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

Feature Request: autocomplete feature on a parameter object inference #698

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. declare a function with an object parameter
2. type the parameter-variable and hit '.'

What is the expected output? 
no autocomplete available, e.g. list of functions and variables for that class 
does not show up.

What do you see instead?
autocomplete frame/window will be available based on the "assert isinstance()" 
called right after the function.

What version of the product are you using? On what operating system?
version 2.5.3.0 x86 on Windows 7

Please provide any additional information below.
We understood that because a function can accept any type of parameter in the 
function, it is hard for most IDE to determine what kind of object/type the 
variable is.

Certain IDE, like pyCharm and Visual Studio 2012 Shell Isolate(via extension 
"Python Tools") can support autocomplete on object parameters by inference 
based on an earlier declaration of the object type, which is done using assert 
isinstance() call.  The assert isinstace() hence force a type on a variable and 
those IDE can associate the said object.

Example:

def main():
  myvar = SomeCustomClass()

def foo(somevar):
  assert isinstance(somevar, SomeCustomClass) # force type SomeCustomClass
  somevar. # hitting '.' would list all member functions+variables of SomeCustomClass()

Original issue reported on code.google.com by johncru...@gmail.com on 13 Nov 2012 at 4:51

GoogleCodeExporter commented 9 years ago
What is the expected output? and What do you see instead? is mixed up.  Please 
swap it around :-) Thanks!

Original comment by johncru...@gmail.com on 13 Nov 2012 at 5:03