Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix import suggestion code actions not working when no workspace is open #824

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

DetachHead
Copy link
Owner

fixes #792

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

sympy (https://github.com/sympy/sympy)
-     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any | Self@Expr))" (reportUnknownMemberType)
+     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any))" (reportUnknownMemberType)
-     Type of "i_part" is "Unknown | Order | Any | Self@Expr" (reportUnknownVariableType)
+     Type of "i_part" is "Unknown | Order | Any" (reportUnknownVariableType)
-     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any | Self@Expr)) | Any" (reportUnknownMemberType)
+     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any)) | Any" (reportUnknownMemberType)
-     Type of "ivl" is "Unknown | Any" (reportUnknownVariableType)
+     Type of "ivl" is "Any | Unknown" (reportUnknownVariableType)
-     Type of "as_set" is "Any | (() -> Unknown) | Unknown" (reportUnknownMemberType)
+     Type of "as_set" is "Any | Unknown" (reportUnknownMemberType)
-     Type of "sqrtdenest" is "(expr: Unknown, max_iter: int = 3) -> Unknown" (reportUnknownVariableType)
+     Type of "sqrtdenest" is "(expr: Unknown, max_iter: int = 3) -> (Unknown | Mul | Pow | Order | Expr | Add | None)" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2788:21 - warning: Type of "b" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2788:21 - warning: Type of "b" is unknown (reportUnknownVariableType)
-     Type of "b" is "Mul | Unknown | Integer | Expr" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2788:24 - warning: Type of "e" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2788:24 - warning: Type of "e" is unknown (reportUnknownVariableType)
-     Type of "e" is "Unknown | Expr | Mul | None" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2788:28 - warning: Type of "as_base_exp" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2788:28 - warning: Type of "as_base_exp" is unknown (reportUnknownMemberType)
-     Type of "as_base_exp" is "Unknown | (() -> (tuple[Mul, Unknown] | tuple[Mul, Expr | None])) | (() -> (tuple[Unknown | Integer, Unknown | Mul] | tuple[Expr, Expr])) | (() -> tuple[Expr, Expr])" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2788:44 - error: "as_base_exp" is not a known attribute of "None" (reportOptionalMemberAccess)
-     Type of "check" is "list[Unknown | Mul | Pow | Order | Expr | Add | None]" (reportUnknownVariableType)
+     Type of "check" is "list[Unknown]" (reportUnknownVariableType)
-     Type of "extend" is "(iterable: Iterable[Unknown | Mul | Pow | Order | Expr | Add | None], /) -> None" (reportUnknownMemberType)
+     Type of "extend" is "(iterable: Iterable[Unknown], /) -> None" (reportUnknownMemberType)
-     Type of "extend" is "(iterable: Iterable[Unknown | Mul | Pow | Order | Expr | Add | None], /) -> None" (reportUnknownMemberType)
+     Type of "extend" is "(iterable: Iterable[Unknown], /) -> None" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2793:21 - warning: Type of "s" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2793:21 - warning: Type of "s" is unknown (reportUnknownVariableType)
-     Type of "s" is "Unknown | Mul | Pow | Order | Expr | Add | None" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2794:44 - warning: Argument type is unknown
+     Argument corresponds to parameter "sol" in function "checksol" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/solvers.py:2798:36 - warning: Argument type is unknown
+     Argument corresponds to parameter "object" in function "append" (reportUnknownArgumentType)
-     Type of "g" is "Unknown | Order | Any | Self@Expr" (reportUnknownVariableType)
+     Type of "g" is "Unknown | Order | Any" (reportUnknownVariableType)
-     Type of "h" is "Unknown | Order | Any | Self@Expr" (reportUnknownVariableType)
+     Type of "h" is "Unknown | Order | Any" (reportUnknownVariableType)
-     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any | Self@Expr))" (reportUnknownMemberType)
+     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any))" (reportUnknownMemberType)
-     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any | Self@Expr))" (reportUnknownMemberType)
+     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any))" (reportUnknownMemberType)
-     Type of "g" is "Unknown | Order | Basic | Self@Expr | Any" (reportUnknownVariableType)
+     Type of "g" is "Unknown | Order | Basic | Any" (reportUnknownVariableType)
-     Type of "h" is "Unknown | Order | Basic | Self@Expr | Any" (reportUnknownVariableType)
+     Type of "h" is "Unknown | Order | Basic | Any" (reportUnknownVariableType)
-     Type of "subs" is "Unknown | ((...) -> (Unknown | Order | Basic)) | Any | ((...) -> (Unknown | Self@Expr | Basic))" (reportUnknownMemberType)
+     Type of "subs" is "Unknown | ((...) -> (Unknown | Order | Basic)) | Any" (reportUnknownMemberType)
-     Type of "subs" is "Unknown | ((...) -> (Unknown | Order | Basic)) | Any | ((...) -> (Unknown | Self@Expr | Basic))" (reportUnknownMemberType)
+     Type of "subs" is "Unknown | ((...) -> (Unknown | Order | Basic)) | Any" (reportUnknownMemberType)
-     Type of "g" is "Unknown | Order | Any | Self@Expr" (reportUnknownVariableType)
+     Type of "g" is "Unknown | Order | Any" (reportUnknownVariableType)
-     Type of "h" is "Unknown | Order | Any | Self@Expr" (reportUnknownVariableType)
+     Type of "h" is "Unknown | Order | Any" (reportUnknownVariableType)
-     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any | Self@Expr))" (reportUnknownMemberType)
+     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any))" (reportUnknownMemberType)
-     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any | Self@Expr))" (reportUnknownMemberType)
+     Type of "expand" is "Unknown | ((deep: bool = True, modulus: Unknown | None = None, power_base: bool = True, power_exp: bool = True, mul: bool = True, log: bool = True, multinomial: bool = True, basic: bool = True, **hints: Unknown) -> (Unknown | Order | Any))" (reportUnknownMemberType)
-     Type of "g" is "Unknown | Order | Basic | Self@Expr | Any" (reportUnknownVariableType)
+     Type of "g" is "Unknown | Order | Basic | Any" (reportUnknownVariableType)
-     Type of "h" is "Unknown | Order | Basic | Self@Expr | Any" (reportUnknownVariableType)
+     Type of "h" is "Unknown | Order | Basic | Any" (reportUnknownVariableType)
-     Type of "subs" is "Unknown | ((...) -> (Unknown | Order | Basic)) | Any | ((...) -> (Unknown | Self@Expr | Basic))" (reportUnknownMemberType)
+     Type of "subs" is "Unknown | ((...) -> (Unknown | Order | Basic)) | Any" (reportUnknownMemberType)
-     Type of "subs" is "Unknown | ((...) -> (Unknown | Order | Basic)) | Any | ((...) -> (Unknown | Self@Expr | Basic))" (reportUnknownMemberType)
+     Type of "subs" is "Unknown | ((...) -> (Unknown | Order | Basic)) | Any" (reportUnknownMemberType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/solveset.py:1012:12 - error: Operator ">" not supported for types "Any | type[Unknown] | type[Order] | type[Basic] | type[Self@Expr]" and "Any | type[Unknown] | type[Order] | type[Basic] | type[Self@Expr]"
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/solveset.py:1012:12 - error: Operator ">" not supported for types "Any | type[Unknown] | type[Order] | type[Basic]" and "Any | type[Unknown] | type[Order] | type[Basic]"
-     Operator ">" not supported for types "type[Unknown]" and "type[Expr]*"

... (truncated 509 lines) ...

asynq (https://github.com/quora/asynq): 296.82x slower (0.0s -> 14.5s in a single noisy sample)

spack (https://github.com/spack/spack)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/x264/package.py:19:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/x264/package.py:19:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/x264/package.py:21:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/x264/package.py:21:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xalan-c/package.py:25:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xalan-c/package.py:25:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xalan-c/package.py:26:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xalan-c/package.py:26:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xalan-c/package.py:36:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xalan-c/package.py:36:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xalan-c/package.py:37:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xalan-c/package.py:37:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xapian-core/package.py:24:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xapian-core/package.py:24:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xapian-core/package.py:25:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xapian-core/package.py:25:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xapian-core/package.py:27:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xapian-core/package.py:27:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:24:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:24:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:26:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:26:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:27:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:27:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:28:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:28:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:29:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:29:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:31:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:31:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:32:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:32:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:33:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xauth/package.py:33:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xbacklight/package.py:24:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xbacklight/package.py:24:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xbacklight/package.py:26:5 - warning: Result of call expression is of type "(pkg: PackageBase) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin/packages/xbacklight/package.py:26:5 - warning: Result of call expression is of type "((pkg: PackageBase) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)

... (truncated 34 lines) ...

imagehash (https://github.com/JohannesBuchner/imagehash): 341.35x slower (0.0s -> 14.2s in a single noisy sample)

@DetachHead DetachHead merged commit 26a3cfa into main Oct 29, 2024
20 checks passed
@DetachHead DetachHead deleted the fix-code-actions-when-no-workspace branch October 29, 2024 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code actions are broken from v1.8.0 when opening a file directly instead of a workspace
1 participant