GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Handle when default project for file is solution with file actually referenced by one of the project references by sheetalkamat · Pull Request #37239 · microsoft/TypeScript

Conversation

@sheetalkamat

@sheetalkamat Sheetal Nandi (sheetalkamat) commented Mar 6, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fixes #36708, #27372

Now when we find that the project is a solution project, we try to open referenced projects to see if we can find project that contains the opened file.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

robpalme, krzkaczor, brieb, Bnaya, js87zz, vladmarica, wkronemeijer, hyperupcall, bodinsamuel, ahnpnl, and 4 more reacted with thumbs up emoji robpalme, brieb, masoudgs, amitbeck, and sushruth reacted with hooray emoji robpalme, molisani, nicojs, brieb, greyscaled, ahnpnl, msholty-fd, AverageHelper, hiddenboox, and sushruth reacted with heart emoji robpalme, brieb, AAsghar7, AverageHelper, and sushruth reacted with rocket emoji
All reactions
  • 👍 14 reactions
  • 🎉 5 reactions
  • ❤️ 10 reactions
  • 🚀 5 reactions
Sheetal Nandi (sheetalkamat) added 9 commits March 5, 2020 17:14
@sheetalkamat
Add test where file from referenced project of solution belongs to in…
0716898
…ferred project instead of referenced project
@sheetalkamat
Try to find project from project references if the default config pro…
47946ff
…ject is solution

Fixes #36708
@sheetalkamat
Add test to verify the correct collection of projects
8b9c1f9
@sheetalkamat
Handle when default config project is indirectly referenced in the so…
1e41cd8
…lution
@sheetalkamat
Include public API tests in unittests
2e7ae2b
@sheetalkamat
Make sure default project for script info is calculated correctly
57bad74
@sheetalkamat
Handle reload projects
01bfca9
@sheetalkamat
Ensure to load solution project tree when project is referenced by so…
f64ffe9
…lution
@sheetalkamat
Find all refs when the file is referenced via d.ts
914f358
@typescript-bot TypeScript Bot (typescript-bot) assigned Sheetal Nandi (sheetalkamat) Mar 6, 2020
@typescript-bot TypeScript Bot (typescript-bot) added the Author: Team label Mar 6, 2020
@sheetalkamat
Sheetal Nandi (sheetalkamat) requested review from Andrew Casey (amcasey), Andrew Branch (andrewbranch), Nathan Shively-Sanders (sandersn) and Ben Lichtman (uniqueiniquity) and removed request for Andrew Casey (amcasey) and Nathan Shively-Sanders (sandersn) March 6, 2020 01:20
uniqueiniquity
Ben Lichtman (uniqueiniquity) reviewed Mar 6, 2020
View reviewed changes
Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@amcasey

Andrew Casey (amcasey) commented Mar 6, 2020

Copy link
Copy Markdown
Member

A solution project is a composite project with references to other projects, but no files of its own?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@uniqueiniquity

Ben Lichtman (uniqueiniquity) commented Mar 6, 2020

Copy link
Copy Markdown
Contributor

Andrew Casey (@amcasey) That appears to be the case, but I would appreciate confirmation as well. Also, how common is that as a pattern?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

amcasey
Andrew Casey (amcasey) reviewed Mar 6, 2020
View reviewed changes
Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

amcasey
Andrew Casey (amcasey) reviewed Mar 6, 2020
View reviewed changes
Comment thread src/server/project.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

amcasey
Andrew Casey (amcasey) reviewed Mar 6, 2020
View reviewed changes
Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

amcasey
Andrew Casey (amcasey) reviewed Mar 6, 2020
View reviewed changes
Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sheetalkamat Sheetal Nandi (sheetalkamat) mentioned this pull request Mar 10, 2020
TypeScript: compilerOptions.types not respected when using project references #27372
Closed
@sheetalkamat

Sheetal Nandi (sheetalkamat) commented Mar 10, 2020

Copy link
Copy Markdown
Member Author

A solution project is project with project referenes but no files on its own.. (Eg https://github.com/microsoft/TypeScript/blob/master/src/tsconfig.json)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sheetalkamat

Sheetal Nandi (sheetalkamat) commented Mar 10, 2020

Copy link
Copy Markdown
Member Author

Note that we already handle solutions for scenarios like our own repo.. Wherein the tsconfig for compiler is in its own folder and named tsconfig.json so found for the file open in src\compiler ... This tries to solve cases if say that tsconfig was named tsconfig.compiler.json or was in src\compiler or src itself instead. Good repro scenario to look at would be the issues this PR is fixing.. #27372 has a link to https://github.com/OliverJAsh/jest-ts-project-references which demos the issue.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@DanielRosenwasser

Daniel Rosenwasser (DanielRosenwasser) commented Mar 10, 2020

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) pack this

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@typescript-bot

TypeScript Bot (typescript-bot) commented Mar 10, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/67599/artifacts?artifactName=tgz&fileId=ED6224134493FAA69B7797634F6182922F217A4923B3181D8B91B238C9CBB63002&fileName=/typescript-3.9.0-insiders.20200310.tgz"
    }
}

and then running npm install.


There is also a playground for this build.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

amcasey
Andrew Casey (amcasey) reviewed Mar 11, 2020
View reviewed changes
Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

amcasey
Andrew Casey (amcasey) reviewed Mar 11, 2020
View reviewed changes
Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sheetalkamat
Fix typo
62ef1ef
amcasey
Andrew Casey (amcasey) reviewed Mar 12, 2020
View reviewed changes

@amcasey Andrew Casey (amcasey) left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

How did you identify the code paths that needed to be updated (i.e. how do you know you didn't miss one)?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/server/editorServices.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@sheetalkamat

Sheetal Nandi (sheetalkamat) commented Mar 12, 2020

Copy link
Copy Markdown
Member Author

How did you identify the code paths that needed to be updated (i.e. how do you know you didn't miss one)?

Well i looked at all the calls to getConfigFileNameForFile which is where after finding solution project, we are changing the behavior

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amcasey

Andrew Casey (amcasey) commented Mar 13, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

How did you identify the code paths that needed to be updated (i.e. how do you know you didn't miss one)?

Well i looked at all the calls to getConfigFileNameForFile which is where after finding solution project, we are changing the behavior

It sounds like anyone who calls getConfigFileNameForFile in the future will need to think about this as well. Is there some way we could organize the code to guard against a new caller failing to do so? Perhaps it could become a private helper of findConfiguredProjectByProjectName, for example?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amcasey

Andrew Casey (amcasey) commented Mar 13, 2020

Copy link
Copy Markdown
Member

Confirmed that #36708 and #27372 no longer repro. The tests work better if I launch the version of VS Code running against this change. 😝

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

amcasey
Andrew Casey (amcasey) approved these changes Mar 13, 2020
View reviewed changes

@amcasey Andrew Casey (amcasey) left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm mildly concerned about missing a case now or in the future, but this looks correct to the extent of my ability to verify it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sheetalkamat
Sheetal Nandi (sheetalkamat) merged commit ba39113 into master Mar 13, 2020
@sheetalkamat
Sheetal Nandi (sheetalkamat) deleted the projectRefOpen branch March 13, 2020 17:47
@filipesilva Filipe Silva (filipesilva) mentioned this pull request Mar 30, 2020
tsconfig paths and module resolution errors in VS Code angular/angular-cli#8138
Closed
@kripod

Kristóf Poduszló (kripod) commented Apr 5, 2020

Copy link
Copy Markdown

Can a solution tsconfig.json file contain solution-wide compilerOptions? Is the configuration below valid?

// tsconfig.json
{
  "files": [],
  "references": [
    { "path": "./packages/client/tsconfig.json" },
    { "path": "./packages/server/tsconfig.json" },
  ],
  "compilerOptions": {
    "noEmit": true,
    "allowJs": true,
    "checkJs": true,
    "strict": true,
    "target": "ES2019",
    "module": "ESNext",
    "moduleResolution": "Node",
    "esModuleInterop": true,
    "isolatedModules": true,
    "jsx": "react"
  }
}
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@amcasey

Andrew Casey (amcasey) commented Apr 6, 2020

Copy link
Copy Markdown
Member

Kristóf Poduszló (@kripod) I think you're asking whether your client and server projects will automatically pick up those compiler options - no, they won't. If you want to inherit the configuration, you need to use extends in the derived/child projects.

kripod, leonadler, and AverageHelper reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced May 9, 2020
Compiler options not working as expected when using project references kulshekhar/ts-jest#766
Closed
Tests fail when using TypeScript project references kulshekhar/ts-jest#1648
Open
@ahnpnl Ahn (ahnpnl) mentioned this pull request May 31, 2020
ts-jest doesn't respect outDir and rootDir when using project references kulshekhar/ts-jest#1698
Closed
@martaver

Sebastian Nemeth (martaver) commented May 31, 2020

Copy link
Copy Markdown

Is this patch available in typescript@dev or typescript@next...?

If so, then the use case described in: kulshekhar/ts-jest#1698 isn't resolved by this PR.

This is relevant because ts-jest is dependent on this API for resolving modules that are project references, and if this PR is supposed to fix that - it hasn't.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sheetalkamat

Sheetal Nandi (sheetalkamat) commented Jun 1, 2020

Copy link
Copy Markdown
Member Author

Sebastian Nemeth (@martaver) I am not sure what you are asking here. i cloned the repo, checkout branch and opened vscode and that seems to work without reporting errors.

The build steps do not use tsc so it would be hard to tell whats going on. you would need to seek help from the package that is building it.

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ahnpnl

Ahn (ahnpnl) commented Jul 26, 2020

Copy link
Copy Markdown

Hi, I want to implement the same behavior programmatically with LanguageService interface but I am kind of lost when reading this PR. Do you have any help documentation to implement similarly ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aleclarson

Alec Larson (aleclarson) commented Nov 9, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

https://github.com/microsoft/TypeScript/blob/06a2210eb53cfce968dc855fcc13738d95d4556a/src/tsconfig.json

How are "solution projects" useful in that example? Doesn't the language server look for the nearest tsconfig.json before compiling a module (by checking each ancestor, bottom-up)? In that example, the "solution project" seems superfluous.

PS: We would appreciate a response to #33407. I'd prefer to use an overrides key that can target specific globs, without the need to create a separate .json module.

{
	"include": ["src"],
	"compilerOptions": {
		// These options are inherited by override globs.
		"moduleResolution": "node",
		"strict": true 
	},
	"overrides": [
		{
			"include": ["**/__tests__"],
			"compilerOptions": {
				"types": ["jest", "node"]
			}
		}
	]
}
danielfinke, kentcdodds, and ChristopherHaws reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kyliau Keen (kyliau) mentioned this pull request Nov 10, 2020
fix: LS not showing existing diagnostics on file open angular/vscode-ng-language-service#966
Merged
@aleclarson Alec Larson (aleclarson) mentioned this pull request Nov 12, 2020
disable certain global types for specific files, or specify type roots for specific files. #37053
Open
5 tasks done
@aleclarson

Alec Larson (aleclarson) commented Nov 12, 2020

Copy link
Copy Markdown

I've tried this approach without success. See anything wrong in this gist?
https://gist.github.com/aleclarson/6ae9a3b6b9d06c492fb9a3b6ec395411

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Andrew Huth (ahuth) added a commit to chanzuckerberg/frontend-libs that referenced this pull request Nov 17, 2020
@ahuth
Add simple test for prepareStory
9cd5468
Note that without extending the top-level tsconfig.json from tsconfig.base.json, the right compiler options weren't being applied for the tests, even though they are inherited by the individual project tsconfig.jsons (react and esModuleInterop).

Extending the top level one from the base solves the issue, but feels wrong... I would've thought that because each project gets the right config, the tests should've worked right. Also building works fine, but it is Jest or ts-jest causing the issue.

Pretty sure this is related to
- kulshekhar/ts-jest#1648
- microsoft/TypeScript#37239
Andrew Huth (ahuth) added a commit to chanzuckerberg/frontend-libs that referenced this pull request Nov 17, 2020
@ahuth
Add simple test for prepareStory
b8bc12d
Note that without extending the top-level tsconfig.json from tsconfig.base.json, the right compiler options weren't being applied for the tests, even though they are inherited by the individual project tsconfig.jsons (react and esModuleInterop).

Extending the top level one from the base solves the issue, but feels wrong... I would've thought that because each project gets the right config, the tests should've worked right. Also building works fine, but it is Jest or ts-jest causing the issue.

Pretty sure this is related to
- kulshekhar/ts-jest#1648
- microsoft/TypeScript#37239
Andrew Huth (ahuth) added a commit to chanzuckerberg/frontend-libs that referenced this pull request Nov 18, 2020
@ahuth
Add simple test for prepareStory
b068bcb
Note that without extending the top-level tsconfig.json from tsconfig.base.json, the right compiler options weren't being applied for the tests, even though they are inherited by the individual project tsconfig.jsons (react and esModuleInterop).

Extending the top level one from the base solves the issue, but feels wrong... I would've thought that because each project gets the right config, the tests should've worked right. Also building works fine, but it is Jest or ts-jest causing the issue.

Pretty sure this is related to
- kulshekhar/ts-jest#1648
- microsoft/TypeScript#37239
@rattrayalex

Alex Rattray (rattrayalex) commented May 11, 2021

Copy link
Copy Markdown

I also could not get this to work, with roughly this setup:

// tsconfig.base.json
{
  "compilerOptions": {"strictNullChecks": true}
}

// tsconfig.js.json
{
  "extends": "./tsconfig.base.json",
  "include": ["**/*.jsx?"],
  "compilerOptions": {"checkJs": true, "allowJs": true, "noImplicitAny": false}
}

// tsconfig.ts.json
{
  "extends": "./tsconfig.base.json",
  "include": ["**/*.tsx?"],
}

// tsconfig.json
{
  "files": [],
  "references": [
    { "path": "./tsconfig.js.json" },
    { "path": "./tsconfig.ts.json" }
  ]
}

VS Code behaved as if not tsconfig were detected.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Aug 14, 2022
Remove span tag in title and unnecessary TOC in Ko microsoft/TypeScript-Website-Localizations#164
Merged
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@sandersn Nathan Shively-Sanders (sandersn) Awaiting requested review from sandersn
@andrewbranch Andrew Branch (andrewbranch) Awaiting requested review from andrewbranch
2 more reviewers
@uniqueiniquity Ben Lichtman (uniqueiniquity) uniqueiniquity left review comments
@amcasey Andrew Casey (amcasey) amcasey approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@sheetalkamat Sheetal Nandi (sheetalkamat)

Labels

Author: Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

"Cannot find module" when using project references

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@sheetalkamat @amcasey @uniqueiniquity @DanielRosenwasser @typescript-bot @kripod @martaver @ahnpnl @aleclarson @rattrayalex
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.