-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Code completion crashes when localStorage, postcss-object-fit-images, or gulp-watch packages are imported #27857
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
Comments
Repro: /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @Filename: /a.js
////function f() {}
////if (something)
//// module.exports = f;
////else
//// module.exports = 42;
// @Filename: /b.js
////export const foo = 0;
// @Filename: /c.js
////foo
goTo.file("/c.js");
verify.importFixAtPosition([
`???`,
]); There's no error if I remove |
No, it does not fix it. Sounds similar, but there's no module.exports merge. And the crash doesn't go down the wrong branch of getTypeOfSymbol, although that's not necessarily indicative. |
One important trigger of the problem is that the two export assignments differ: one is an alias and the other is a value. The resulting symbol merges, unlike in TS, ending up with the flags |
An alias with Value flags blocks alias resolution, which is why checker.resolveExternalModuleSymbol incorrectly returns an alias (which getDefaultExportInfoWorker tries to resolve itself, but fails). The fix might be to allow only all-Alias or all-Value module-export assignments. I'll have to see whether this causes a bunch of real-world failures though. |
Never mind; resolveSymbol has a special-case explicitly for assignment declarations. I just need to use |
@sandersn I've just checked the issue in our full project too with the current build: [email protected] and the auto complete seems to be working \o/ Thank you for fixing it. |
TypeScript Version: 3.2.0-dev.20181011
TypeScript Version: 3.1.3
Search Terms: code completion, auto import, intellisense
Code
You can check out this repo to reproduce the issue: repo link
If any of the following dependencies are imported in the project the code completion feature crashes:
localStorage
,postcss-object-fit-images
orgulp-watch
. Without them the feature works just fine.Expected behavior: code completion works when the mentioned dependencies are imported
Actual behavior: code completion crashes if any of the following dependencies are imported in the project:
localStorage
,postcss-object-fit-images
orgulp-watch
Related Issues: #27640
The text was updated successfully, but these errors were encountered: