Eclipse pydev auto-suggestions don't work in some cases

前端 未结 3 1812
长发绾君心
长发绾君心 2021-01-12 14:49

My question is probably stupid and I hope somebody has succeeded in solving this issue.

Sometimes I cannot see right suggestions in auto-completion box (Eclipse 3.5.

3条回答
  •  时光取名叫无心
    2021-01-12 15:05

    I know @type in docstring works. As in:

    from collections import deque
    
    def foo(a):
    ''' code completion sample
    @type a: deque
    '''
    return a.popleft()  # Code completion will work here
    

    I have not been able to find a way to do it inline within code (except in ways mentioned elsewhere where you simply pretend to assign the variable an instance of a type) as in:

    from collections import deque
    
    def foo(a):
    ''' code completion sample '''
    if false: a = deque()
    return a.popleft()  # Code completion will also work here
    

    But I'm not fond of this method because it probably imposes some performance / code size penalty. I don't know / haven't checked if Python is smart enough to remove this assignment during compile time.

    Thanks to SiSoie, here's a link to page explaining possibilities.

提交回复
热议问题