Skip to content

TS module not found until server is restarted #59129

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

Closed
connor4312 opened this issue Jul 2, 2024 · 8 comments
Closed

TS module not found until server is restarted #59129

connor4312 opened this issue Jul 2, 2024 · 8 comments
Assignees
Labels
Fixed A PR has been merged for this issue

Comments

@connor4312
Copy link
Member

In VS Code, using the workspace TS version (5.6.0-dev.20240618)

  1. Create a new TS file
  2. Try to import an existing module
  3. Get a "not found" error until you restart the TS language server

image

@mjbvz
Copy link
Contributor

mjbvz commented Jul 3, 2024

Seems to work fine for me. Can you try collecting the TS Server log:

  1. Set "typescript.tsserver.log": "verbose",
  2. Restart VS Code and reproduce the problem (try doing a minimal number of steps to keep the log small)
  3. In VS Code, run the TypeScript: Open TS Server log command

That should help us understand what's going on

@connor4312
Copy link
Member Author

Here: https://gist.github.com/connor4312/9f76269aba865563f8117f6c7c4f84c9

I created a file called another.ts and imported labelForTestInState. TS created the auto-import but the import had the same "module not found" diagnostic.

@mjbvz mjbvz transferred this issue from microsoft/vscode Jul 3, 2024
@mjbvz mjbvz removed their assignment Jul 3, 2024
@mjbvz
Copy link
Contributor

mjbvz commented Jul 3, 2024

Thanks @connor4312

IN the logs, I can see that another.ts ends up in the inferred project instead of the main project:

Info 8566 [09:13:01.831] 	FileName: c:/Users/conno/Github/vscode/src/vs/workbench/contrib/testing/common/constants.ts ProjectRootPath: c:/Users/conno/Github/vscode
Info 8566 [09:13:01.831] 		Projects: c:/Users/conno/Github/vscode/src/tsconfig.json
Info 8566 [09:13:01.831] 	FileName: c:/Users/conno/Github/vscode/src/vs/workbench/contrib/testing/common/another.ts ProjectRootPath: c:/Users/conno/Github/vscode
Info 8566 [09:13:01.831] 		Projects: /dev/null/inferredProject1*

@andrewbranch
Copy link
Member

Do you happen to know if this was a recent regression? Did you test on a previous version?

@andrewbranch andrewbranch added the Needs Investigation This issue needs a team member to investigate its status. label Jul 5, 2024
@connor4312
Copy link
Member Author

I have seen this happen before, but I think it's been a while (a few releases at least.)

@connor4312
Copy link
Member Author

Unfortunately I don't have intellicode installed

@bragagia
Copy link

I deleted my previous comment just after posting because the issue was actually not resolved and the error where not showing during my tests for some other random reason.

But great news, I actually found a new solution which is to disable the enableProjectDiagnostics option. -> microsoft/vscode#168410

settings.json:

"typescript.tsserver.experimental.enableProjectDiagnostics": false,

That's unfortunate because now only opened files report error, but that's still better than having random errors on every new files.

@sheetalkamat
Copy link
Member

sheetalkamat commented Oct 4, 2024

I think this is fixed by #59625. Please provide repro and log and open a new issue if its not fixed.

@sheetalkamat sheetalkamat added Fixed A PR has been merged for this issue and removed Needs Investigation This issue needs a team member to investigate its status. labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

5 participants