Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Jul 21, 2018

Fixes #23407

Note: converted importFixes from passing around symbolToken to position because we may get an import completion at a location with no Identifier there yet.

@ghost ghost force-pushed the importCompletions_importType branch from b025f65 to 317a77d Compare July 21, 2018 02:06
@ghost ghost force-pushed the importCompletions_importType branch from 317a77d to 9feb4de Compare July 21, 2018 02:10
@ghost ghost requested review from sheetalkamat and amcasey July 23, 2018 16:51
function getFixForImport(
exportInfos: ReadonlyArray<SymbolExportInfo>,
symbolName: string,
symbolToken: Node | undefined,
position: number | undefined,
program: Program,
sourceFile: SourceFile,
host: LanguageServiceHost,
preferences: UserPreferences,
): ReadonlyArray<ImportFix> {
const checker = program.getTypeChecker();
Copy link
Member

Choose a reason for hiding this comment

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

Why not exit early here when position is undefined ? without doing any of the work.

Copy link
Author

Choose a reason for hiding this comment

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

We actually might return a result if we don't need to add a qualifier to the use. We would add an import at the top of the file and not need position.

@ghost ghost merged commit 0227997 into master Jul 26, 2018
@ghost ghost deleted the importCompletions_importType branch July 26, 2018 23:17
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.

1 participant