Skip to content

Fix detecting default project when file is part for more than one project but not part of default configured project (eg because its output of that projet) - #38429

Merged
Sheetal Nandi (sheetalkamat) merged 1 commit into
masterfrom
defaultConfigProject
May 12, 2020
Merged

Conversation

@sheetalkamat

Copy link
Copy Markdown
Member

Fixes #38366

…ject but not part of default configured project (eg because its output of that projet)

Fixes #38366
@sheetalkamat

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) cherry pick this to release-3.9

@sheetalkamat

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) cherry-pick this to release-3.9

@typescript-bot

TypeScript Bot (typescript-bot) commented May 8, 2020

Copy link
Copy Markdown
Contributor

Heya Sheetal Nandi (@sheetalkamat), I've started to run the task to cherry-pick this into release-3.9 on this PR at 6e3c1d1. You can monitor the build here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Sheetal Nandi (@sheetalkamat), I've opened #38431 for you.

TypeScript Bot (typescript-bot) pushed a commit to typescript-bot/TypeScript that referenced this pull request May 8, 2020
Component commits:
6e3c1d1 Fix detecting default project when file is part for more than one project but not part of default configured project (eg because its output of that projet) Fixes microsoft#38366
return project?.isSolution() ?
project.getDefaultChildProjectFromSolution(info) :
project;
project && projectContainsInfoDirectly(project, info) ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do the other callers of getConfigFileNameForFile and findConfiguredProjectByProjectName need this check too?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No.. this is the change to determine default project for the file...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure I follow. Why is direct containment more important for the default project than for other projects?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

findConfiguredProjectByProjectName project finds the configured project by the given name and has nothing to do with scriptinfo.
Similary getConfigFileNameForFile finds config file name by traversing directories for tsconfig/jsconfig json files. Nothing else matters.

This function is what determines the default project for given script info and hence the additional logic

@amcasey Andrew Casey (amcasey) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand why the change covers all the scenarios it needs to, but I believe it's correct in the scenario it does cover, so I'm fine with merging and discussing offline.

@sheetalkamat
Sheetal Nandi (sheetalkamat) deleted the defaultConfigProject branch May 12, 2020 17:17
Sheetal Nandi (sheetalkamat) added a commit that referenced this pull request May 12, 2020
Component commits:
6e3c1d1 Fix detecting default project when file is part for more than one project but not part of default configured project (eg because its output of that projet) Fixes #38366

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
AllenLee (cangSDARM) added a commit to cangSDARM/TypeScript that referenced this pull request May 13, 2020
* upstream/master:
  Update user baselines
  Fix detecting default project when file is part for more than one project but not part of default configured project (eg because its output of that projet) (microsoft#38429)
  fix(37877): include in NavigationBar default exported child items (microsoft#38255)
  fix: add missing semi-colon to `__exportStar` unnamed function
  Update baselines.
  Add and use the 'intersperse' helper function.
  Don't add duplicates of JSDoc comments.
  Added tests for union types with identical doc comments.
  feat(38225): change diagnostic message for remove braces from arrow function body
  Add outlining spans for object destructuring elements
@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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Project does not contain document" Error Causes Types to Stop Resolving in VS Code

3 participants