mirror of https://github.com/astral-sh/ruff
[ty] Add support for re-exports and `__all__` to auto-import
This commit (mostly) re-implements the support for `__all__` in ty-proper, but inside the auto-import AST scanner. When `__all__` isn't present in a module, we fall back to conventions to determine whether a symbol is exported or not: https://docs.python.org/3/library/index.html However, in keeping with current practice for non-auto-import completions, we continue to provide sunder and dunder names as re-exports. When `__all__` is present, we respect it strictly. That is, a symbol is exported *if and only if* it's in `__all__`. This is somewhat stricter than pylance seemingly is. I felt like it was a good idea to start here, and we can relax it based on user demand (perhaps through a setting).
This commit is contained in:
parent
086f1e0b89
commit
8c72b296c9
File diff suppressed because it is too large
Load Diff
|
|
@ -6,7 +6,7 @@ expression: completions
|
|||
{
|
||||
"label": "Literal (import typing)",
|
||||
"kind": 6,
|
||||
"sortText": " 50",
|
||||
"sortText": " 58",
|
||||
"insertText": "Literal",
|
||||
"additionalTextEdits": [
|
||||
{
|
||||
|
|
@ -27,7 +27,7 @@ expression: completions
|
|||
{
|
||||
"label": "LiteralString (import typing)",
|
||||
"kind": 6,
|
||||
"sortText": " 51",
|
||||
"sortText": " 59",
|
||||
"insertText": "LiteralString",
|
||||
"additionalTextEdits": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ expression: completions
|
|||
{
|
||||
"label": "Literal (import typing)",
|
||||
"kind": 6,
|
||||
"sortText": " 50",
|
||||
"sortText": " 58",
|
||||
"insertText": "Literal",
|
||||
"additionalTextEdits": [
|
||||
{
|
||||
|
|
@ -27,7 +27,7 @@ expression: completions
|
|||
{
|
||||
"label": "LiteralString (import typing)",
|
||||
"kind": 6,
|
||||
"sortText": " 51",
|
||||
"sortText": " 59",
|
||||
"insertText": "LiteralString",
|
||||
"additionalTextEdits": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ expression: completions
|
|||
{
|
||||
"label": "Literal (import typing)",
|
||||
"kind": 6,
|
||||
"sortText": " 50",
|
||||
"sortText": " 58",
|
||||
"insertText": "Literal",
|
||||
"additionalTextEdits": [
|
||||
{
|
||||
|
|
@ -27,7 +27,7 @@ expression: completions
|
|||
{
|
||||
"label": "LiteralString (import typing)",
|
||||
"kind": 6,
|
||||
"sortText": " 51",
|
||||
"sortText": " 59",
|
||||
"insertText": "LiteralString",
|
||||
"additionalTextEdits": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ expression: completions
|
|||
{
|
||||
"label": "Literal (import typing)",
|
||||
"kind": 6,
|
||||
"sortText": " 50",
|
||||
"sortText": " 58",
|
||||
"insertText": "Literal",
|
||||
"additionalTextEdits": [
|
||||
{
|
||||
|
|
@ -27,7 +27,7 @@ expression: completions
|
|||
{
|
||||
"label": "LiteralString (import typing)",
|
||||
"kind": 6,
|
||||
"sortText": " 51",
|
||||
"sortText": " 59",
|
||||
"insertText": "LiteralString",
|
||||
"additionalTextEdits": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue