Skip to content

Support 'tsconfig.json' when converting TextChanges to CodeEdits#24667

Merged
2 commits merged into
masterfrom
textChangesToCodeEdits_tsconfig
Jun 7, 2018
Merged

Support 'tsconfig.json' when converting TextChanges to CodeEdits#24667
2 commits merged into
masterfrom
textChangesToCodeEdits_tsconfig

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jun 4, 2018

Fixes #24613

Note: the bug I'm fixing reproduces even given only one project, but I'm pretty sure that the original cause of the issue was that the extra project had "files" in its tsconfig, so that was updated.

@ghost ghost requested a review from sheetalkamat June 4, 2018 21:03
@ghost ghost force-pushed the textChangesToCodeEdits_tsconfig branch from 4609f30 to f29469b Compare June 4, 2018 21:42
Comment thread src/compiler/program.ts Outdated

function getSourceFileByPath(path: Path): SourceFile | undefined {
return filesByName.get(path);
return options.configFile && toPath(options.configFile.fileName) === path ? options.configFile : filesByName.get(path);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we do this on the project level instead in the program? it just feels wrong to have program return a sourceFile that is not part of it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe we should create a new method on Project to getSourceFileOrConfigFile and use that instead.

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Jun 7, 2018

Please port to release-2.9 as well.

@ghost ghost merged commit 399ae51 into master Jun 7, 2018
@ghost ghost deleted the textChangesToCodeEdits_tsconfig branch June 7, 2018 21:30
ghost pushed a commit that referenced this pull request Jun 7, 2018
)

* Support 'tsconfig.json' when converting TextChanges to CodeEdits

* Create Project#getSourceFileOrConfigFile to use instead
ghost pushed a commit that referenced this pull request Jun 7, 2018
) (#24772)

* Support 'tsconfig.json' when converting TextChanges to CodeEdits

* Create Project#getSourceFileOrConfigFile to use instead
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move-to-File throws when the originating file is in multiple projects

2 participants