Is it possible to get Visual Studio Code to give a warning if a method which does not exist has been imported from a file?
So in the example below, I would like if the editor would warn that there is no fun2
method in the file utilities.py
# File called `utilities.py`
def fun1(a, b):
return a b
from utility import fun1, fun2
temp1 = fun1(1,2)
temp2 = fun2(1,2)
In VS Code, I can see a difference in colours in the two functions, so it seems to know that it is not available:
CodePudding user response:
Methods one:
Add the following configuration in settings.json to enable linting and set linter to pylint
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
You will get error: No name 'fun2' in module 'utility' pylint(no-name-in-module)
Methods two:
Change python.analysis.typeCheckingMode to basic or strict in settings
You can also add the following directly to the set
"python.analysis.typeCheckingMode": "strict",