-
Notifications
You must be signed in to change notification settings - Fork 38
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
Browser support #514
Merged
Merged
Browser support #514
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I've seen it give syntax errors and basic completions. No types are available except the one that I've rammed into the file system as a proof of concept. There are a couple of changes outside of the new package that need some careful consideration. Lots could be broken here as a variety of NodeJS modules have been stubbed out or polyfilled.
Reducing the diff between this and server.ts.
It's a syntax error so immediately scuppers things for Safari. This seems to be sufficient to get it running. Minimal testing so far but a big step forward. This specific change seems safe and well tested.
Uses an abstraction over Web Workers and worker_threads. A bit of a pain due to transferList. It requires a bit of a dance to create the Workers, particularly as Safari has no nested worker support. Browser clients will need updating to the new incantation. Also adds minimal file system operations. These are a stop-gap solution.
Interesting to see the import resolver hook and the nascent host abstraction.
Update from upstream. Align URI parsing in browser-server.ts with corresponding changes to server.ts (we have several more occurrences in our added FS APIs).
…r' into browser # Conflicts: # packages/pyright-internal/jest.config.js # packages/pyright-internal/src/analyzer/backgroundAnalysisProgram.ts # packages/pyright-internal/src/analyzer/sourceFile.ts # packages/pyright-internal/src/backgroundAnalysis.ts # packages/pyright-internal/src/backgroundAnalysisBase.ts # packages/pyright-internal/src/backgroundThreadBase.ts # packages/pyright-internal/src/languageServerBase.ts
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…out and it works at runtime
…atch the other packages
This comment has been minimized.
This comment has been minimized.
# Conflicts: # packages/pyright-internal/src/analyzer/cacheManager.ts
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
- Type of "P" is "(condition: Unknown, given_condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Any | BernoulliDistribution | Probability | Self@Expr | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Lambda | int | None)" (reportUnknownVariableType)
+ Type of "P" is "(condition: Unknown, given_condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Any | BernoulliDistribution | Probability | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Lambda | Relational | Unequality | int | None)" (reportUnknownVariableType)
- Type of "E" is "(expr: Unknown, condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Basic | Expectation | tuple[Unknown, ...] | Sum | Self@Expr | Order | Any | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | None)" (reportUnknownVariableType)
+ Type of "E" is "(expr: Unknown, condition: Unknown | None = None, numsamples: Unknown | None = None, evaluate: bool = True, **kwargs: Unknown) -> (Unknown | Basic | Expectation | tuple[Unknown, ...] | Sum | Order | Any | Piecewise | Equality | Relational | Unequality | Integral | ExpectationMatrix | None)" (reportUnknownVariableType)
- Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+ Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
- Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+ Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
- /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:39:12 - error: Operator "-" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Any | Unknown | Expr | int"
+ /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:39:12 - error: Operator "-" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Any | Unknown | Expr | int"
- Operator "-" not supported for types "Expr*" and "Expr"
- Operator "-" not supported for types "Expr*" and "int"
+ Operator "-" not supported for types "None" and "Expr"
+ Operator "-" not supported for types "None" and "int"
- Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+ Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
- /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:39:37 - error: Operator "**" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Literal[2]"
+ /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:39:37 - error: Operator "**" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Literal[2]"
- Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+ Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
- Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+ Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
- /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:69:12 - error: Operator "-" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Any | Unknown | Expr | int"
+ /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:69:12 - error: Operator "-" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Any | Unknown | Expr | int"
- Operator "-" not supported for types "Expr*" and "Expr"
- Operator "-" not supported for types "Expr*" and "int"
+ Operator "-" not supported for types "None" and "Expr"
+ Operator "-" not supported for types "None" and "int"
- Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
+ Type of "expectation" is "(expr: Unknown, var: Unknown, evaluate: bool = True, **kwargs: Unknown) -> (Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None)" (reportUnknownMemberType)
- /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:69:37 - error: Operator "**" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Self@Expr | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Literal[2]"
+ /tmp/mypy_primer/projects/sympy/sympy/stats/tests/test_discrete_rv.py:69:37 - error: Operator "**" not supported for types "Any | Unknown | tuple[Unknown, ...] | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Literal[0] | None" and "Literal[2]"
- Type of "rewrite" is "Unknown | Any | ((..., deep: bool = True) -> (BernoulliDistribution | Any)) | ((..., deep: bool = True) -> (Probability | Any)) | ((..., deep: bool = True) -> (Self@Expr | Any)) | ((..., deep: bool = True) -> (Sum | Any)) | ((..., deep: bool = True) -> (Order | Any)) | ((..., deep: bool = True) -> (Piecewise | Any)) | ((..., deep: bool = True) -> (Basic | Any)) | ((..., deep: bool = True) -> (Equality | Any)) | ((..., deep: bool = True) -> (Relational | Any)) | ((..., deep: bool = True) -> (Unequality | Any)) | ((..., deep: bool = True) -> (Lambda | Any))" (reportUnknownMemberType)
+ Type of "rewrite" is "Unknown | Any | ((..., deep: bool = True) -> (BernoulliDistribution | Any)) | ((..., deep: bool = True) -> (Probability | Any)) | ((..., deep: bool = True) -> (Sum | Any)) | ((..., deep: bool = True) -> (Order | Any)) | ((..., deep: bool = True) -> (Piecewise | Any)) | ((..., deep: bool = True) -> (Basic | Any)) | ((..., deep: bool = True) -> (Equality | Any)) | ((..., deep: bool = True) -> (Lambda | Any)) | ((..., deep: bool = True) -> (Relational | Any)) | ((..., deep: bool = True) -> (Unequality | Any))" (reportUnknownMemberType)
- Argument type is "BernoulliDistribution | Any | Probability | Self@Expr | Sum | Order | Piecewise | Basic | Equality | Relational | Unequality | Lambda | Unknown" (reportUnknownArgumentType)
+ Argument type is "BernoulliDistribution | Any | Probability | Sum | Order | Piecewise | Basic | Equality | Lambda | Relational | Unequality | Unknown" (reportUnknownArgumentType)
- Type of "rewrite" is "Unknown | Any | ((..., deep: bool = True) -> (BernoulliDistribution | Any)) | ((..., deep: bool = True) -> (Probability | Any)) | ((..., deep: bool = True) -> (Self@Expr | Any)) | ((..., deep: bool = True) -> (Sum | Any)) | ((..., deep: bool = True) -> (Order | Any)) | ((..., deep: bool = True) -> (Piecewise | Any)) | ((..., deep: bool = True) -> (Basic | Any)) | ((..., deep: bool = True) -> (Equality | Any)) | ((..., deep: bool = True) -> (Relational | Any)) | ((..., deep: bool = True) -> (Unequality | Any)) | ((..., deep: bool = True) -> (Lambda | Any))" (reportUnknownMemberType)
... (truncated 758 lines) ...
|
This was referenced Aug 11, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
doesn't address #295, this is only for the playground