-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Newly created files don't belong to typescript project on MacOS #45721
Comments
Hello, The problem come from Thanks. |
@orblazer Thanks a lot, seems this temporary solution works for me. |
Hmm, I canβt reproduce this. Iβm on macOS 12.1 Beta, VS Code 1.63.0-insider, and TypeScript 4.4.2 (also tried latest nightly). How are you creating/opening the new file |
@andrewbranch I'm now on macOS 11.6.1, VSCode 1.63.2, and TypeScript 4.5.4, that problem still occurs to me. I will try to get a tsserver log. |
@andrewbranch It seems that |
I'm also seeing the same issue for the last few... weeks? It's especially annoying during branch switches, because any files that were moved/created/deleted between the branches will be subject to this bug.
Thanks, this trick saved me a lot of time! |
Use wildcard paths to include all TS/JS files in the source folders. This ensures that VSCode recognizes new files, indexes them, and allows e.g. ESLint to recognize them. Workaround from @orblazer at microsoft/TypeScript#45721
β¦source folders. This ensures that VSCode recognizes new files, indexes them, and allows e.g. ESLint to recognize them. Workaround from @orblazer at microsoft/TypeScript#45721
I thought these were the same. And I still canβt reproduce the issue. @lgarron are you still able to reproduce this if you revert changing the glob format? Another issue about glob weirdness, though perhaps ultimately unrelated: #46788 |
@andrewbranch There are two files |
Indeed:
|
For what it's worth, I'm also able to repro in Codespaces using https://github.com/cubing/cubing.js/tree/exclude-glob-for-ts45721
If I create a copy of the file at If I go back to a commit with the globs and restart the TS server, then it works again. So it's quite reproducible for our repo. |
I can reproduce in Codespaces and have traced the likely root cause down to the huge differences between file watching on Linux vs. other OSes. This does not explain your observations of it being broken on macOS, which I still canβt reproduce π€ |
Actually, to clarify, in Codespaces Iβm seeing the bad behavior all the time. I havenβt yet seen why this would depend on the glob format. |
@andrewbranch No |
Welp, thatβs why your repro was not a repro for me π Fixed at #47418 |
This problem seems to have returned in the latest version of TypeScript and VSCode. |
There are many reasons this can happen and it depends a lot on your configuration. Please log new issues(s) with concrete repro steps. |
Bug Report
π Search Terms
Maybe
ts
,vscode
,file is not part of ts project
,newly created
?π Version & Regression Information
Tested on the following typescript versions:
vscode version: 1.60.0
β― Playground Link
https://github.com/yifanwww/ts-bug-repo
This is a very simple project...
π Actual behavior
Open that project via vscode(whatever open folder directly or open the workspace file).
Open the file
src/index.ts
to get tsserver started, then create a new filesrc/test.ts
.There should be an error
cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module.ts(1208)
, but actually it got no error.Execute vscode command
Typescript: Go to Project Configuration
, a panel appears with infoFile is not part of a Typescript project. Click here to learn more.
In that new ts file, no auto-completion and no auto-import to use the function
fn
which is declared insrc/index.ts
.I have to restart tsserver or reload vscode.
I have checked these issues but still don't know how to solve this problem.
This bug never happens on my win laptop, but does always happen on my mac laptop.
π Expected behavior
The file gets added into the existing typescript project.
BTW, If you need
tsserver.log
, please tell me how to get it.The text was updated successfully, but these errors were encountered: