Skip to content

Let AutoImportProviderProject resolve JS when allowJs and maxNodeModulesJsDepth allows #45524

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

Merged
merged 2 commits into from
Aug 25, 2021

Conversation

andrewbranch
Copy link
Member

Fixes #45109 (the bug part of it—might open a new issue to track the feature idea)

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Aug 19, 2021
@@ -1078,9 +1078,9 @@ namespace ts {
}

/* @internal */
export function tryResolveJSModule(moduleName: string, initialDir: string, host: ModuleResolutionHost): string | undefined {
export function tryResolveJSModule(moduleName: string, initialDir: string, host: ModuleResolutionHost) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function was never used before now 👀

@@ -829,7 +829,7 @@ namespace Harness.LanguageService {

setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any {
// eslint-disable-next-line no-restricted-globals
return setTimeout(callback, ms, args);
return setTimeout(callback, ms, ...args);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least a 5-year-old bug right here

@amcasey
Copy link
Member

amcasey commented Aug 20, 2021

Under what circumstances is maxNodeModulesJsDepth set?

@andrewbranch
Copy link
Member Author

@amcasey any time a user sets it in a project config file, but perhaps most relevantly, it’s one of the options VS Code sends for all inferred JS projects, so it’s set for all JS users who don’t have any config files.

Copy link
Member

@amcasey amcasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks correct, but let's keep an eye on the perf impact. Does the existing auto-imports telemetry give us enough information to filter to unconfigured JS workspaces?

@andrewbranch
Copy link
Member Author

I don’t think so—there’s nothing in the completions telemetry that would indicate what kind of project we’re in, but maybe there’s something from another event that we could join on the session id?

@andrewbranch
Copy link
Member Author

Following up on telemetry separately. We need a small change in TS, but more importantly we’re chasing down an issue with GDPR classification integration between TS and VS Code.

@andrewbranch andrewbranch merged commit 30103de into microsoft:main Aug 25, 2021
@andrewbranch andrewbranch deleted the bug/45109 branch August 25, 2021 22:06
BobobUnicorn pushed a commit to BobobUnicorn/TypeScript that referenced this pull request Oct 24, 2021
…lesJsDepth allows (microsoft#45524)

* Let AutoImportProviderProject resolve JS when allowJs and maxNodeModulesJsDepth allows

* Simplify function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linked dependencies resolves to file system path
3 participants