Skip to content

Set maxNodeModuleJsDepth in JS-containing projects #1213

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 6 commits into from
Jun 20, 2025

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Jun 17, 2025

Could use a test, but this looks correct to me in theory.

Fixes #1209

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for setting a maximum depth for Node.js modules in projects that contain JavaScript files. Key changes include:

  • Introducing a new field (rootJSFileCount) to track the count of JS files.
  • Updating project configuration in updateProgram() to set a default MaxNodeModuleJsDepth when JS files are present.
  • Refactoring root file management by replacing direct map access with helper methods that update the JS file count.

@jakebailey jakebailey requested a review from sheetalkamat June 19, 2025 22:23
func (p *Project) setRootFileNameOfInferred(path tspath.Path, fileName string) {
has := p.rootFileNames.Has(path)
p.rootFileNames.Set(path, fileName)
if p.kind == KindInferred {
Copy link
Member

Choose a reason for hiding this comment

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

no need to check this ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I feel like I should at least assert it for these functions? There's no guards elsewhere.

@sheetalkamat sheetalkamat added this pull request to the merge queue Jun 20, 2025
Merged via the queue into main with commit 16ce71d Jun 20, 2025
22 checks passed
@sheetalkamat sheetalkamat deleted the jabaile/lsp-node-modules-js-depth branch June 20, 2025 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set maxNodeModuleJsDepth in editor
2 participants