Pycharm Code Completion does not work in methods or functions
Question:
Answers:
This is the way it should work, and it has nothing to do with being inside or outside a method or function.
Your function does not have type hints (type annotations generally speaking), so Pycharm’s type checker can’t infer the type of text
, and it assigns the Any
type to texts
.
Instead, if you put a type hint like text: str
, then texts
will be treated like a List[str]
:
and Pycharm’s autocomplete will show its methods:
This is the way it should work, and it has nothing to do with being inside or outside a method or function.
Your function does not have type hints (type annotations generally speaking), so Pycharm’s type checker can’t infer the type of text
, and it assigns the Any
type to texts
.
Instead, if you put a type hint like text: str
, then texts
will be treated like a List[str]
:
and Pycharm’s autocomplete will show its methods: