I am using lsp for Python. I was wondering for an object's function, if there is no definition for it, can lsp give an error/warning or underline using flycheck or jedi? I know this is challenging I just wonder that's possible or not.
example python code:
class World():
def hello():
print("hello")
obj = World()
obj.hello()()
obj.foo() # <=== hoping to see: No definitions found for: foo and underline foo()
~~~~~~~~~
Since foo() is not an object under World; I want lsp to give me a warning message letting me know that that function does not exist under the object definition.
Example configuration could be seen here: https://github.com/rksm/emacs-rust-config
Comment out the lines
9..35and48and add the following(use-package python :ensure nil)save and install packages. Then open a python file, and M-x lsp to start lsp,
This is a function to programatically check if a given object has a method with an arbitrary name:
It returns a boolean instead of erroring out and interrupting the program's execution. From there, you can give a flycheck warning or do pretty much whatever you want if the information. It is only checking for instance methods but can be easily adapted to also check for class methods or functions not associated with objects.