Skip to content

[LSP] fix crash on inferred project JS files #847

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 1 commit into from
May 6, 2025

Conversation

andrewbranch
Copy link
Member

No description provided.

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 fixes a crash on inferred project JS files by properly recognizing JavaScript files in inferred projects.

  • Added a new test case for JS files in inferred projects.
  • Updated the compiler options in the inferred project creation to enable AllowJs.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/project/service_test.go Added a JS project test verifying that the project correctly handles JS files.
internal/project/service.go Updated the default inferred project creation to enable JS file support.

}
service, _ := projecttestutil.Setup(jsFiles)
service.OpenFile("/home/projects/TS/p1/index.js", jsFiles["/home/projects/TS/p1/index.js"], core.ScriptKindJS, "")
assert.Equal(t, len(service.Projects()), 1)
Copy link
Preview

Copilot AI May 6, 2025

Choose a reason for hiding this comment

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

The expected and actual arguments in assert.Equal appear to be reversed. Consider changing the order to assert.Equal(t, 1, len(service.Projects())) to follow testify's convention and improve error clarity.

Suggested change
assert.Equal(t, len(service.Projects()), 1)
assert.Equal(t, 1, len(service.Projects()))

Copilot uses AI. Check for mistakes.

@andrewbranch andrewbranch added this pull request to the merge queue May 6, 2025
Merged via the queue into microsoft:main with commit 62c8896 May 6, 2025
22 checks passed
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.

2 participants