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

add deprecated tag to completions #1083

Merged
merged 6 commits into from
Feb 17, 2025
Merged

Conversation

DetachHead
Copy link
Owner

fixes #1078

doesn't work and i can't figure out why. something to do with onCompletion and onCompletionResolve. if i add the tag in onCOmpletion it works but if i do it in onCompletionResolve it doesn't, buit i don't think adding it to onCompletion is a good idea because it needs to evaluate the type of all the completion items which would probably be bad for performance

This comment has been minimized.

@DetachHead DetachHead marked this pull request as ready for review February 15, 2025 02:39
@DetachHead
Copy link
Owner Author

see #1078 (comment), it works just not in vscode

…oesn't support tags in completionResolve but should work in other clients that support it
@DetachHead DetachHead force-pushed the deprecated-tag-completions branch from 4f9ef81 to d15341b Compare February 15, 2025 03:35
@DetachHead DetachHead enabled auto-merge (rebase) February 15, 2025 03:43
@DetachHead DetachHead disabled auto-merge February 15, 2025 03:43

This comment has been minimized.

…mpletion` instead of `completionItem/resolve` because most clients don't support it in `completionItem/resolve`
…ions if the client doesn't support tags in `completionItem/resolve`
@DetachHead DetachHead force-pushed the deprecated-tag-completions branch from 5f91273 to ba1564f Compare February 16, 2025 10:32
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 "classify_diop" is "(eq: Unknown, _dict: bool = True) -> tuple[Unknown | list[Basic], dict[Unknown, int] | defaultdict[Unknown, int] | Any | Unknown, str]" (reportUnknownVariableType)
+     Type of "classify_diop" is "(eq: Unknown, _dict: bool = True) -> tuple[Unknown | list[Unknown], dict[Unknown, Unknown] | Unknown, str]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:60:31 - warning: Return type of lambda, "tuple[Unknown | list[Basic], dict[Unknown, int] | defaultdict[Unknown, int] | Any | Unknown, str]", is partially unknown (reportUnknownLambdaType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:60:31 - warning: Return type of lambda, "tuple[Unknown | list[Unknown], dict[Unknown, Unknown] | Unknown, str]", is partially unknown (reportUnknownLambdaType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:61:32 - warning: Return type of lambda, "tuple[Unknown | list[Basic], dict[Unknown, int] | defaultdict[Unknown, int] | Any | Unknown, str]", is partially unknown (reportUnknownLambdaType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:61:32 - warning: Return type of lambda, "tuple[Unknown | list[Unknown], dict[Unknown, Unknown] | Unknown, str]", is partially unknown (reportUnknownLambdaType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:62:41 - warning: Return type of lambda, "tuple[Unknown | list[Basic], dict[Unknown, int] | defaultdict[Unknown, int] | Any | Unknown, str]", is partially unknown (reportUnknownLambdaType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:62:41 - warning: Return type of lambda, "tuple[Unknown | list[Unknown], dict[Unknown, Unknown] | Unknown, str]", is partially unknown (reportUnknownLambdaType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:63:41 - warning: Return type of lambda, "tuple[Unknown | list[Basic], dict[Unknown, int] | defaultdict[Unknown, int] | Any | Unknown, str]", is partially unknown (reportUnknownLambdaType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:63:41 - warning: Return type of lambda, "tuple[Unknown | list[Unknown], dict[Unknown, Unknown] | Unknown, str]", is partially unknown (reportUnknownLambdaType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:623:41 - warning: Return type of lambda, "tuple[Unknown | list[Basic], dict[Unknown, int] | defaultdict[Unknown, int] | Any | Unknown, str]", is partially unknown (reportUnknownLambdaType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/diophantine/tests/test_diophantine.py:623:41 - warning: Return type of lambda, "tuple[Unknown | list[Unknown], dict[Unknown, Unknown] | Unknown, str]", is partially unknown (reportUnknownLambdaType)
-     Type of "gcd" is "(f: Unknown, g: Unknown | None = None, ...) -> (Any | Unknown | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Expr | Float | Poly)" (reportUnknownVariableType)
+     Type of "gcd" is "(f: Unknown, g: Unknown | None = None, ...) -> (Unknown | Any | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Float | Poly)" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:51:13 - warning: Type of "eq" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:51:13 - warning: Type of "eq" is unknown (reportUnknownVariableType)
-     Type of "eq" is "Unknown | Expr | Any" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:52:25 - warning: Argument type is unknown
+     Argument corresponds to parameter "expr" in function "collect" (reportUnknownArgumentType)
-     Type of "k" is "Any | Unknown | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Expr | Float | Poly" (reportUnknownVariableType)
+     Type of "k" is "Unknown | Any | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Float | Poly" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:186:27 - warning: Argument type is unknown
+     Argument corresponds to parameter "expr" in function "collect" (reportUnknownArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:231:5 - warning: Return type, "Equality | Unknown | None", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:231:5 - warning: Return type, "Equality | Unknown | Relational | Unequality | Integer | None", is partially unknown (reportUnknownParameterType)
-     Type of "sol" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "sol" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:268:20 - warning: Return type, "Equality | Unknown", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:268:20 - warning: Return type, "Equality | Unknown | Relational | Unequality | Integer", is partially unknown (reportUnknownVariableType)
-     Type of "sol" is "Equality | Unknown" (reportUnknownVariableType)
+     Type of "sol" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:272:12 - warning: Return type, "Equality | Unknown | None", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/hypergeometric.py:272:12 - warning: Return type, "Equality | Unknown | Relational | Unequality | Integer | None", is partially unknown (reportUnknownVariableType)
-     Type of "div" is "(f: Unknown, g: Unknown, ...) -> (tuple[Unknown, Unknown] | tuple[Unknown | Poly, Unknown | Poly])" (reportUnknownVariableType)
+     Type of "div" is "(f: Unknown, g: Unknown, ...) -> tuple[Unknown, Unknown]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:54:5 - warning: Return type, "list[Equality | Unknown] | None", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:54:5 - warning: Return type, "list[Equality | Unknown | Relational | Unequality | Integer] | None", is partially unknown (reportUnknownParameterType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:111:32 - warning: Return type, "list[Equality | Unknown]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:111:32 - warning: Return type, "list[Equality | Unknown | Relational | Unequality | Integer]", is partially unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:115:24 - warning: Return type, "list[Equality | Unknown]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:115:24 - warning: Return type, "list[Equality | Unknown | Relational | Unequality | Integer]", is partially unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:118:24 - warning: Return type, "list[Equality | Unknown]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:118:24 - warning: Return type, "list[Equality | Unknown | Relational | Unequality | Integer]", is partially unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:122:16 - warning: Return type, "list[Equality | Unknown]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:122:16 - warning: Return type, "list[Equality | Unknown | Relational | Unequality | Integer]", is partially unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:126:5 - warning: Return type, "list[Equality | Unknown] | None", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:126:5 - warning: Return type, "list[Equality | Unknown | Relational | Unequality | Integer] | None", is partially unknown (reportUnknownParameterType)
-     Type of "sol" is "list[Equality | Unknown] | None" (reportUnknownVariableType)
+     Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer] | None" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:158:20 - warning: Return type, "list[Equality | Unknown]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:158:20 - warning: Return type, "list[Equality | Unknown | Relational | Unequality | Integer]", is partially unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:159:12 - warning: Return type, "list[Equality | Unknown] | None", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/lie_group.py:159:12 - warning: Return type, "list[Equality | Unknown | Relational | Unequality | Integer] | None", is partially unknown (reportUnknownVariableType)
-     Type of "polyy" is "Unknown | dict[tuple[int, ...], Any] | dict[Unknown, Unknown]" (reportUnknownVariableType)
+     Type of "polyy" is "dict[tuple[int], Unknown] | dict[Unknown, Unknown] | dict[tuple[int, ...], Any]" (reportUnknownVariableType)

... (truncated 5297 lines) ...

jinja (https://github.com/pallets/jinja): 11766.49x slower (0.0s -> 15.6s in a single noisy sample)

pycryptodome (https://github.com/Legrandin/pycryptodome): 4.67x slower (6.3s -> 29.5s in a single noisy sample)

@disrupted
Copy link
Contributor

it works really well for me! 🎉

@DetachHead
Copy link
Owner Author

i'm going to test it out a bit more on a large project and see how it goes. if there's no noticeable performance issues i'll merge it

@DetachHead
Copy link
Owner Author

seems fine to me

@DetachHead DetachHead merged commit a4b7a93 into main Feb 17, 2025
20 checks passed
@DetachHead DetachHead deleted the deprecated-tag-completions branch February 17, 2025 12:27
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.

Mark deprecated CompletionItem
2 participants