-
Notifications
You must be signed in to change notification settings - Fork 770
New auto-import infrastructure #2390
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
Open
andrewbranch
wants to merge
89
commits into
microsoft:main
Choose a base branch
from
andrewbranch:autoimport
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7,252
−4,386
Open
Changes from all commits
Commits
Show all changes
89 commits
Select commit
Hold shift + click to select a range
da0e338
WIP
andrewbranch ea7ec1b
WIP
andrewbranch 5d88696
Merge branch 'main' into autoimport
andrewbranch 3482314
WIP add to existing, resolve fix
andrewbranch 654a104
Move change tracker, converters, utils to separate packages
andrewbranch 50be94c
WIP fix edits
andrewbranch 4e1e5ea
Move organizeimports
andrewbranch 76a99d7
Get hand-written tests working
andrewbranch c357794
Remove trie and use word indices instead
andrewbranch 56e22dd
Merge branch 'main' into autoimport
andrewbranch df73b49
WIP snapshot integration
andrewbranch a185c2b
node_modules index building, WIP snapshot host
andrewbranch 8bcce85
Wire up to snapshot
andrewbranch 0f47ffb
System end to end
andrewbranch 7fb4085
Merge branch 'main' into autoimport
andrewbranch 7877d4e
Specifier cache, small fixes
andrewbranch fb3318e
Optimize a bit
andrewbranch 1516a80
Start deleting stuff, convert fourslash tests
andrewbranch 13e1c46
Move ScriptElementKind to lsutil
andrewbranch 207c7e2
Merge branch 'main' into autoimport
andrewbranch 01ade0f
Revert submodule change
andrewbranch 04bbed1
Minimal checker-based alias resolution
andrewbranch a34e2c1
Second resolution pass for ambient modules
andrewbranch 86506fc
Chip away at test failures
andrewbranch 8053a4f
Try searching dependencies for more files
andrewbranch 8b43d2b
Handle package shadowing
andrewbranch 9587948
WIP sort fixes
andrewbranch 33f3282
Chip away at tests more
andrewbranch 9392b86
Clean up export extracting, implement useRequire
andrewbranch 4bc5e2d
Fix more tests
andrewbranch 4ce391f
Finish going through existing enabled tests
andrewbranch d0f1fe5
Enable other passing tests
andrewbranch 91d910d
Log more stats, try local name resolution before checker usage
andrewbranch 2b8b2a9
Merge branch 'main' into autoimport
andrewbranch 8b006b2
WIP codefixes
andrewbranch 3c7e27b
WIP code fix
andrewbranch 732793f
Initial plan
Copilot 87b670a
Port getFixesInfoForNonUMDImport to use new autoimport.View
Copilot 7f2d093
Apply formatting
Copilot 1bcf069
Convert UMD and type-only fixes to use autoimport.Fix
Copilot 1e0ca2b
Fix panics and add type-only import support
Copilot 46f3e40
Add JSDoc import type fix support
Copilot 96af867
Improve error handling for JSDoc import type fix
Copilot a7e6432
Continue fixing tests
andrewbranch 6af6a81
Continue fixing tests
andrewbranch 4a30356
Handle node_modules that are excluded by package.json but imported by…
andrewbranch bd11dde
Update failing tests
andrewbranch 3c4ef31
Delete old code
andrewbranch c4e0fb7
Add basic benchmark
andrewbranch f7719d9
Use one alias resolver + checker per node_modules package so intra-pa…
andrewbranch 4f6ff35
Start hammering out lifecycle bugs
andrewbranch 98ee737
Add more lifecycle tests
andrewbranch e9ba700
Merge branch 'main' into autoimport
andrewbranch a003bb6
Fix test
andrewbranch 34f1f4d
Clean up dirty state handling some
andrewbranch 873b1b5
Comment
andrewbranch cbb1b88
Keep testing
andrewbranch bf709e8
Merge branch 'main' into autoimport
andrewbranch 89632e7
WIP respecting new preferences and fixing tests
andrewbranch 67d47ac
Copy missing promoteFromTypeOnly logic
andrewbranch c03e965
Handle endings
andrewbranch 538408c
Better panic message
andrewbranch 3a2f182
Disable JavaScript entrypoints for now
andrewbranch 6ba0adf
Add logging for skipped files
andrewbranch 7441386
Don’t retain any files
andrewbranch c37ee83
Delete commented out code
andrewbranch 97564ac
Implement watch
andrewbranch 8fd03b9
Warm auto-import registry on file edit
andrewbranch 0c1db12
Fix some tests, delete some dead code
andrewbranch 9b84b1c
Sort only as much as needed in the server, and then deterministically…
andrewbranch ce4a9bf
Optimize isFixPossiblyReExportingImportingFile
andrewbranch 390882d
Bail out of expensive error checking during alias resolution
andrewbranch 723a9d0
Update failing tests
andrewbranch b13b974
Finish wildcard exports TODO
andrewbranch 4b87128
Finish more TODOs
andrewbranch c140faf
Fix module augmentation TODO
andrewbranch eb6cc62
Merge branch 'main' into autoimport
andrewbranch 4d49179
Delete zero value
andrewbranch 243d025
Only scrape dependencies and peerDependencies
andrewbranch 30d24e8
Fix tests, fix type/value filtering
andrewbranch 3b0ff4a
Lint/generate
andrewbranch 639d047
Fix target grouping for export *
andrewbranch 32f401a
Delete unused properties
andrewbranch 24f9c97
Fix crashing tests
andrewbranch 6b0992a
Fix race
andrewbranch 44e5546
Fix other race
andrewbranch 296b888
Address project update to-do
andrewbranch 2e3bada
Tolerate erroneously mixed export kinds
andrewbranch 36cc710
PR feedback
andrewbranch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14430,6 +14430,9 @@ func (c *Checker) getEmitSyntaxForModuleSpecifierExpression(usage *ast.Node) cor | |
| } | ||
|
|
||
| func (c *Checker) errorNoModuleMemberSymbol(moduleSymbol *ast.Symbol, targetSymbol *ast.Symbol, node *ast.Node, name *ast.Node) { | ||
| if c.compilerOptions.NoCheck.IsTrue() { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Auto-imports uses checkers for minimal alias resolution, and these code paths go way down a rabbit hole hitting the file system and using the node builder to generate errors. Added some targeted short circuits. |
||
| return | ||
| } | ||
| moduleName := c.getFullyQualifiedName(moduleSymbol, node) | ||
| declarationName := scanner.DeclarationNameToString(name) | ||
| var suggestion *ast.Symbol | ||
|
|
@@ -14641,6 +14644,7 @@ func (c *Checker) markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration *ast.N | |
|
|
||
| func (c *Checker) resolveExternalModuleName(location *ast.Node, moduleReferenceExpression *ast.Node, ignoreErrors bool) *ast.Symbol { | ||
| errorMessage := diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations | ||
| ignoreErrors = ignoreErrors || c.compilerOptions.NoCheck.IsTrue() | ||
| return c.resolveExternalModuleNameWorker(location, moduleReferenceExpression, core.IfElse(ignoreErrors, nil, errorMessage), ignoreErrors, false /*isForAugmentation*/) | ||
| } | ||
|
|
||
|
|
||
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven’t looked at #2336 yet, but this could be what’s missing to show a stack trace.