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

findAllReferences/rename: Search in all open projects #25648

Merged
4 commits merged into from Jul 20, 2018
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jul 13, 2018

Previously if a project A depended on a project B, we would find references in both only if the reference request started at A. Now the request can start in B, and we will find references in A as long project A has been opened.

@ghost ghost requested review from sheetalkamat and RyanCavanaugh July 13, 2018 22:14
@ghost ghost force-pushed the findAllRefs_upstream branch from 366568c to 0265fff Compare July 13, 2018 22:47
@@ -738,6 +738,10 @@ namespace ts {
getDiagnosticsProducingTypeChecker,
getCommonSourceDirectory,
emit,
getDeclarationEmitPath: fileName => {
const file = getSourceFile(fileName);
Copy link
Contributor

@mhegazy mhegazy Jul 16, 2018

Choose a reason for hiding this comment

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

why does this need to be on the program? getDeclarationEmitOutputFilePath is already available outside this closure?

Copy link
Author

Choose a reason for hiding this comment

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

getEmitHost() isn't though. That function appears to need host.getCompilerOptions, host.getCurrentDirectory, host.getCommonSourceDirectory, and host.getCanonicalFileName. getCurrentDirectory and getCanonicalFileName can be answered without a Program, but I don't think the other two can.

Copy link
Member

Choose a reason for hiding this comment

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

getCurrentDirectory and getCanonicalFileName should be there on project and can be answered from there.

Copy link
Author

Choose a reason for hiding this comment

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

That still leaves getCompilerOptions and getCommonSourceDirectory unfortunately.

Copy link
Member

Choose a reason for hiding this comment

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

getCompilerOptions is also present on project and getCommonSourceDirectory can be added as a private method to the project that redirects to the program ?

combineProjectOutputWorker(
projects,
defaultProject,
{ fileName: "<arbitrary>", position: 0 }, // Location is ignored by callback
Copy link
Member

Choose a reason for hiding this comment

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

Why cant you pass null instead ? If location is ignored in combineProjectOutputWorker Dont think you should have need to create default value just for passing sake.

projectAndLocation: ProjectAndLocation,
function getDefinitionInProject(definition: sourcemaps.SourceMappableLocation | undefined, definingProject: Project, project: Project): sourcemaps.SourceMappableLocation | undefined {
if (!definition || project.containsFile(toNormalizedPath(definition.fileName))) return definition;
const mappedDefinition = definingProject.getLanguageService().getSourceMapper().tryGetGeneratedLocation(definition);
Copy link
Member

Choose a reason for hiding this comment

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

You also want to check if definingProject.languageServiceEnabled

Copy link
Author

Choose a reason for hiding this comment

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

That comes from this.getDefaultProject, shouldn't it always be enabled?

@ghost ghost force-pushed the findAllRefs_upstream branch from b8f9274 to bd64c07 Compare July 19, 2018 23:24
@ghost
Copy link
Author

ghost commented Jul 20, 2018

@sheetalkamat Please re-review

@mhegazy
Copy link
Contributor

mhegazy commented Jul 20, 2018

@andy-ms please port to release-3.0 as well

@ghost ghost merged commit 93722c8 into master Jul 20, 2018
@ghost ghost deleted the findAllRefs_upstream branch July 20, 2018 23:54
ghost pushed a commit that referenced this pull request Jul 20, 2018
* findAllReferences/rename: Search in all open projects

* Avoid needing a dummy location when location is unused

* Remove Program#getDeclarationEmitPath

* Only iterate over enabled projects
ghost pushed a commit that referenced this pull request Jul 21, 2018
* findAllReferences/rename: Search in all open projects

* Avoid needing a dummy location when location is unused

* Remove Program#getDeclarationEmitPath

* Only iterate over enabled projects
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants