Skip to content
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 ts-project #35794

Closed
jrieken opened this issue Dec 18, 2019 · 14 comments · Fixed by #36271
Closed

Newly created files don't belong to ts-project #35794

jrieken opened this issue Dec 18, 2019 · 14 comments · Fixed by #36271
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@jrieken
Copy link
Member

jrieken commented Dec 18, 2019

TS Issue template filled out by @mjbvz from original report

TypeScript Version: 3.7.3

Repo steps:

  1. In the VS Code code base
  2. Open src/vs/workbench/contrib/codeActions/common/codeActions.contribution.ts
  3. Wait for JS/TS to finish initializing
  4. Select the lines:
Registry.as<IConfigurationRegistry>(Extensions.Configuration)
	.registerConfiguration(editorConfiguration);
  1. Run the move to new file refactoring

Bug
The newly created file is not part of any project

@mjbvz mjbvz transferred this issue from microsoft/vscode Dec 20, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Dec 20, 2019

Here's a tsserver.log for the above repo. The important bit is that newFile.ts is stuck in a new inferred project instead of the main project:

Info 2398 [17:57:12.924] Open files: 
Info 2398 [17:57:12.924] 	FileName: /Users/matb/projects/vscode/src/vs/workbench/contrib/codeActions/common/codeActions.contribution.ts ProjectRootPath: /Users/matb/projects/vscode
Info 2398 [17:57:12.924] 		Projects: /Users/matb/projects/vscode/src/tsconfig.json
Info 2398 [17:57:12.924] 	FileName: /Users/matb/projects/vscode/src/vs/workbench/contrib/codeActions/common/newFile.ts ProjectRootPath: /Users/matb/projects/vscode
Info 2398 [17:57:12.925] 		Projects: /dev/null/inferredProject1*

@mjbvz mjbvz removed their assignment Dec 20, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Dec 20, 2019

Just tested this in typescript: 3.8.0-dev.20191219 and it seems to work properly

@jrieken Can you also please try upgrading to use typescript@next by installing this extension. Try using that version of TS for a few days while working on VS Code and let us know if you hit the problem again

@jrieken
Copy link
Member Author

jrieken commented Jan 10, 2020

This also happens with 3.8.0-dev.20201009

@sheetalkamat
Copy link
Member

I don't seem to repro this...

tsserver.log

Can you get the latest tsserver log, may be it will reveal something.

Info 2348 [10:35:38.323] Open files: 
Info 2348 [10:35:38.323] 	FileName: c:/github/vscode/src/vs/workbench/contrib/codeActions/common/codeActions.contribution.ts ProjectRootPath: c:/github/vscode
Info 2348 [10:35:38.323] 		Projects: c:/github/vscode/src/tsconfig.json
Info 2348 [10:35:38.323] 	FileName: c:/github/vscode/src/vs/workbench/contrib/codeActions/common/newFile.ts ProjectRootPath: c:/github/vscode
Info 2348 [10:35:38.323] 		Projects: c:/github/vscode/src/tsconfig.json

@jrieken
Copy link
Member Author

jrieken commented Jan 13, 2020

tsserver.log

There you go - created callHierarchyFoo.ts and copied this import import { IModelService } from 'vs/editor/common/services/modelService'; which yields in a compile error. Using ts 3.8.0-dev-20200111

@sheetalkamat
Copy link
Member

@jrieken Thank you for the log.. This seems to arise only if the file creation watcher is invoked after file is opened (because of some perf optimized code we have on how we handle new file that is open created/deleted).

@realh
Copy link

realh commented Jan 16, 2020

This seems to arise only if the file creation watcher is invoked after file is opened (because of some perf optimized code we have on how we handle new file that is open created/deleted).

So it's some sort of race condition? In #88787 I mentioned my project was on a sshfs mount (via wifi). Could the lag from the filing system be exacerbating it?

sheetalkamat added a commit that referenced this issue Jan 17, 2020
…get it at that time if no project is specified

Fixes #35794
sheetalkamat added a commit that referenced this issue Jan 17, 2020
…get it at that time if no project is specified

Fixes #35794
@sheetalkamat sheetalkamat added the Fix Available A PR has been opened for this issue label Jan 17, 2020
@sheetalkamat sheetalkamat added this to the TypeScript 3.8.1 milestone Jan 17, 2020
sheetalkamat added a commit that referenced this issue Jan 21, 2020
…get it at that time if no project is specified

Fixes #35794
@lstkz
Copy link

lstkz commented Jan 24, 2020

@sheetalkamat
Is it possible to include this fix to 3.7? 🙏
As described here microsoft/vscode#88660, this issue is very frustrating for me. Sometimes, I must restart TS from the command pallet 20 times per day 😕

@orta
Copy link
Contributor

orta commented Jan 24, 2020

Independent of the release, you can use this extension to use an up-to-date copy of the TS tooling for VS code. ( Once the PR is merged )

sheetalkamat added a commit that referenced this issue Jan 25, 2020
…ened in editor (#36271)

* If script info is not attached to the project on which wild card is invoked, update it.

* Instead of getting default project before starting error list timer, get it at that time if no project is specified
Fixes #35794

* Fix the open File watch triggered setting
@lstkz
Copy link

lstkz commented Jan 25, 2020

Does 3.8.0-dev.20200125 include this commit or I have to wait for 0126? I was able to repeat this issue in 0125.

@lstkz
Copy link

lstkz commented Jan 28, 2020

@orta @sheetalkamat
The issue is not fixed. I am able to reproduce it in 3.8.0-dev.20200128.

@sheetalkamat
Copy link
Member

@BetterCallSKY The original repro is fixed. I verified it again just to make sure. You would need to create new issue with repro to be able to investigate this.

@lstkz
Copy link

lstkz commented Jan 28, 2020

@sheetalkamat
I created here microsoft/vscode#88660, but it's closed.

#35794 (comment)
My tsserver.log is very similar. When I create a new file, VSCode/TS creates a new project for it.

@sheetalkamat
Copy link
Member

sheetalkamat commented Jan 28, 2020

You would want to create new issue in typescript repo with repro and tsserver log since the log mentioned in comment is exact repro I see as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
6 participants