You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an autoimport completion provider similar to pyright's. This is their implementation:
Mine will index all available python files and determine the availible names and type of each kind to provide pylsp. (Working on the itemkind part right now. )
Say we have this file as an __init__.py (this is all parsed in ast by file) (this example is truncated from arrow)
from .factoryimportArrowFactory__all__= ["ArrowFactory"]
Earlier I just said, __all__ has ArrowFactory, that's the avalible names in this module. But now I want to know the ItemKind of ArrowFactory. Since each file is parsed seperately, determining the type of ArrowFactory is impossible without importing the module afaik.
Should I give ArrowFactory a default itemkind, and what itemkind? And do you think it is fine if I just use __all__ in __init__.py files?
(Pyright seems to have solved by only indexing the standard library (which can just be imported without using ast, and are largely single- file modules anyway), so we can't use it as a reference.)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm working on an autoimport completion provider similar to pyright's. This is their implementation:
Mine will index all available python files and determine the availible names and type of each kind to provide pylsp. (Working on the itemkind part right now. )
Say we have this file as an
__init__.py
(this is all parsed in ast by file) (this example is truncated from arrow)Earlier I just said,
__all__
hasArrowFactory
, that's the avalible names in this module. But now I want to know the ItemKind ofArrowFactory
. Since each file is parsed seperately, determining the type ofArrowFactory
is impossible without importing the module afaik.Should I give
ArrowFactory
a default itemkind, and what itemkind? And do you think it is fine if I just use__all__
in__init__.py
files?(Pyright seems to have solved by only indexing the standard library (which can just be imported without using ast, and are largely single- file modules anyway), so we can't use it as a reference.)
Beta Was this translation helpful? Give feedback.
All reactions