emacs-lsp / lsp-pyright

lsp-mode :heart: pyright
https://emacs-lsp.github.io/lsp-pyright
GNU General Public License v3.0
291 stars 25 forks source link

stub file not read when checking buffer #85

Open CamJN opened 1 year ago

CamJN commented 1 year ago

I have a __init__.py file with some code and a __init__.pyi stub file, the types are kept in the pyi file for better backwards compatibility. In emacs, with python-mode and lsp-mode enabled in the __init__.py buffer the stub file is not read when pyright performs error checking, so I get errors like:

   15  14 error    l-d---b  Type annotation is missing for parameter "pid"     
   15  14 error    l-d---b  Type of parameter "pid" is unknown                 
   15  19 error    l-d---b  Type annotation is missing for parameter "encoding"
   15  19 error    l-d---b  Type of parameter "encoding" is unknown            
   15  29 error    l-d---b  Type annotation is missing for parameter "skip"    
   15  39 error    l-d---b  Type annotation is missing for parameter "nuls"    
   17  20 error    l-d---b  Argument type is unknown                           
   17  44 error    l-d---b  Argument type is unknown                           
   19  19 error    l-d---b  Type annotation is missing for parameter "pid"     
   19  19 error    l-d---b  Type of parameter "pid" is unknown                 
   19  24 error    l-d---b  Type annotation is missing for parameter "encoding"
   19  24 error    l-d---b  Type of parameter "encoding" is unknown            
   21  21 error    l-d---b  Argument type is unknown                           
   21  48 error    l-d---b  Argument type is unknown                           

But the types are present in the stub file as verified with pyright --verifytypes getargv on the cli.

CamJN commented 1 year ago

I’ve tried putting the stubs in a typings sub directory, didn’t work; I also tried setting the stub path in pyproject.toml to src, also didn’t work.