Skip to content

Fix #7611: Add support for String Literal Types in find all refs and occurances #8366

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

Merged
merged 3 commits into from
May 2, 2016

Conversation

mhegazy
Copy link
Contributor

@mhegazy mhegazy commented Apr 29, 2016

Fixes #7611


const references: ReferenceEntry[] = [];

forEach(sourceFiles, sourceFile => {
Copy link
Member

Choose a reason for hiding this comment

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

Just use a for-of

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Apr 29, 2016

Can you add a test where an ordinary string literal (of type string) don't get affected by a rename?

@mhegazy
Copy link
Contributor Author

mhegazy commented May 1, 2016

@DanielRosenwasser any more comments?

const declarations = symbol.getDeclarations();
if (declarations && declarations.length > 0) {
// Disallow rename for elements that are defined in the standard TypeScript library.
if (forEach(declarations, isDefinedInLibraryFile)) {
Copy link
Member

Choose a reason for hiding this comment

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

You should just do a pass at the end for all the references you get, instead of doing this logic here and below

@DanielRosenwasser
Copy link
Member

I meant a test in which contextually typed strings are considered references, but others of the same content are not.

Other than that and my last feedback, looks great 👍

@mhegazy mhegazy merged commit afaffb1 into master May 2, 2016
@mhegazy mhegazy deleted the Fix7611-2 branch May 2, 2016 18:29
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
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.

None yet

3 participants