-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix jsdoc type resolution #24106
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
Closed
Closed
Fix jsdoc type resolution #24106
Conversation
This file contains hidden or 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
Still doesn't work correctly for multiple merges
Fix js initializer merging
…eds-to-be-handled-in-excludeSpecs Add declarationDir to excludeSpec
Add deferred to project telemetry
LEGO: Merge pull request 24077
LEGO: Merge pull request 24097
Fix async generator rejection handling
Cut back on more 'caught exceptions' from vfs
Breaks type parameter resolution that is looked up through prototype methods, though. I need to fix that still.
* Use SHA256 hash for project info telemetry * Update API baselines
…ort/export appears at top-level. (#24101)
…ined indexed acceses (#24072)
…24169) * codeFixInferFromUsage: Avoid duplicate fix for variable declaration * Include VariableDeclaration initializer as a candidate type
… running user tests
* Use jsdoc aliases if visible when printing types * Modify implementation a bit, add test that aughta change in the new future * Accept baselines- hold off on typedef template lookup change
… and quick info (#23492) * Correctly show instantiated signatures for JSX element signature help * Also bundle fix for quickinfo * Use more complete cache to avoid duplicate errors
It's throwing an exception (since there's no program from which to retrieve the SourceFile) and there's no reason to fix it since the same files are open in the semantic server.
Don't collect open-file telemetry on the syntax server
Remove assert in `symbolToParameterDeclaration`
LEGO: Merge pull request 24183
mhegazy
approved these changes
May 16, 2018
* Sort the whole diagnostic * Also strip references to our repos node_modules, since removing it is hard
LEGO: Merge pull request 24188
add quick fix for import type missing typeof
* Add initial tests * Add types * Half of parsing (builds but does not pass tests) * Parsing done; types are uglier; doesn't crash but doesn't pass * Bind callback tag Builds but tests still don't pass * Only bind param tags inside callback tags * Fix binding switch to only handle param tags once * Checking is 1/3 done or so. Now I'm going to go rename some members to be more uniform. I hate unnnecessary conditionals. * Rename typeExpression to type (for some jsdoc) (maybe I'll rename more later) * Rename the rest of typeExpressions Turns out there is a constraint in services such that they all need to be named the same. * Few more checker changes * Revert "Rename the rest of typeExpressions" This reverts commit f41a96b. * Revert "Rename typeExpression to type (for some jsdoc)" This reverts commit 7d2233a. * Finish undoing typeExpression rename * Rename and improve getTypeParametersForAliasSymbol Plus some other small fixes * Core checking works, but is flabbergastingly messy I'm serious. * Callback return types work now * Fix crash in services * Make github diff smaller * Try to make github diff even smaller * Fix rename for callback tag * Fix nav bar for callback tag Also clean up some now-redundant code there to find the name of typedefs. * Handle ooorder callback tags Also get rid of redundant typedef name code *in the binder*. It's everywhere! * Add ooorder callback tag test * Parse comments for typedef/callback+display param comments * Always export callbacks This requires almost no new code since it is basically the same as typedefs * Update baselines * Fix support for nested namespaced callbacks And add test * Callbacks support type parameters 1. Haven't run it with all tests 2. Haven't tested typedef tags yet 3. Still allows shared symbols when on function or class declarations. * Template tags are now bound correctly * Test oorder template tags It works. * Parser cleanup * Cleanup types and utilities As much as possible, and not as much as I would like. * Handle callback more often in services * Cleanup of binder and checker * More checker cleanup * Remove TODOs and one more cleanup * Support parameter-less callback tags * Remove extra bind call on template type parameters * Bind template tag containers Doesn't quite work with typedefs, but that's because it's now stricter, without the typedef fixes. I'm going to merge with jsdoc/callback and see how it goes. * Fix fourslash failures * Stop pre-binding js type aliases Next up, stop pre-binding js type parameters * Further cleanup of delayed js type alias binding * Stop prebinding template tags too This gets rid of prebinding entirely * Remove TODO * Fix lint * Finish merge with use-jsdoc-aliases * Update callback tag baselines * Rename getTypeParametersForAliasSymbol The real fix is *probably* to rename Type.aliasTypeArguments to aliasTypeParameters, but I want to make sure and then put it in a separate PR.
I've managed to mangle this PR beyond recognition. I'm going to open a new one. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
@param
tags previously used the default walk up the syntax tree, which is incorrect. Type parameters are bound by the containing function, so the walk should start from the parameter itself, not the@param
tag.Notes
getJSSpecialAssignment
, the predicate for prototype methods is a subset of the predicate ingetHostSignatureFromJSDoc
, so the prototype method check needs to come first in order to correctly look up types on the source constructor function.An example of prototype method type resolution is something like this:
Fixes #22621
Edit: Now also fixes #20832