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

fall back to chokidar file watcher if the lsp client doesn't support capabilities.workspace.didChangeWatchedFiles.dynamicRegistration #1011

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DetachHead
Copy link
Owner

fixes #1010

…'t support `capabilities.workspace.didChangeWatchedFiles.dynamicRegistration`
@DetachHead DetachHead force-pushed the fallback-filewatcher branch from d08a3cd to d6d9ad1 Compare January 23, 2025 14:57
…se language server class which is used by browser-basedpyright and can't import node fs modules
@DetachHead DetachHead changed the title attempt to fall back to chokidar file watcher if the lsp client doesn't support capabilities.workspace.didChangeWatchedFiles.dynamicRegistration fall back to chokidar file watcher if the lsp client doesn't support capabilities.workspace.didChangeWatchedFiles.dynamicRegistration Jan 23, 2025
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 "sol1" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "sol1" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:37:34 - error: Cannot access attribute "lhs" for class "Integer"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:38:34 - error: Cannot access attribute "lhs" for class "Integer"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:39:34 - error: Cannot access attribute "lhs" for class "Integer"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:40:34 - error: Cannot access attribute "lhs" for class "Integer"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:41:34 - error: Cannot access attribute "lhs" for class "Integer"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:42:34 - error: Cannot access attribute "lhs" for class "Integer"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:43:34 - error: Cannot access attribute "lhs" for class "Integer"
+     Attribute "lhs" is unknown (reportAttributeAccessIssue)
-     Type of "sol3" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "sol3" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
-     Type of "eqn" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "eqn" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
-     Type of "sol" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "sol" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
-     Type of "sol" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "sol" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
-     Type of "eqs" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eqs" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
+     Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
-     Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)

... (truncated 4027 lines) ...

spack (https://github.com/spack/spack)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/cumulative-vrange-middle/package.py:18:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/cumulative-vrange-middle/package.py:18:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/cumulative-vrange-root/package.py:18:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/cumulative-vrange-root/package.py:18:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/cumulative-vrange-root/package.py:19:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/cumulative-vrange-root/package.py:19:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-mid1/package.py:26:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-mid1/package.py:26:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-mid2/package.py:26:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-mid2/package.py:26:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-top/package.py:26:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-top/package.py:26:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-top/package.py:27:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-top/package.py:27:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-top/package.py:28:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-diamond-patch-top/package.py:28:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-with-variants-if-develop/package.py:15:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-with-variants-if-develop/package.py:15:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-with-variants-if-develop-root/package.py:14:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dep-with-variants-if-develop-root/package.py:14:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/depb/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/depb/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dependency-foo-bar/package.py:21:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dependency-foo-bar/package.py:21:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dependent-install/package.py:17:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dependent-install/package.py:17:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dependent-install/package.py:18:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dependent-install/package.py:18:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dependent-of-dev-build/package.py:15:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dependent-of-dev-build/package.py:15:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/depends-on-define-cmake-prefix-paths/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/depends-on-define-cmake-prefix-paths/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/depends-on-develop/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/depends-on-develop/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)

... (truncated 474 lines) ...

AutoSplit (https://github.com/Toufool/AutoSplit): 310.63x slower (0.1s -> 18.4s in a single noisy sample)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant