Created
October 16, 2020 13:55
-
-
Save wolframkriesing/2d8602b42ed5929b77b14ebf9c1dc322 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variant 1 | |
// Works as expected. | |
// I did: | |
// - select the first ocurence of `() => { console.log(); }` in line 8 AND | |
// - call WebStorm action "Introduce Variable" | |
// Webstorm offers me to replace all 3 places where the selected code is used (line 8, 10 and 13). | |
someFn({log: () => { console.log(); }}); | |
const fn1 = () => { | |
someFn({log: () => { console.log(); }}); | |
} | |
const fn2 = () => { | |
someFn({log: () => { console.log(); }}); | |
} | |
// BUT | |
// Variant 2 | |
// Does NOT work as expected. | |
// I did: | |
// - select the `() => { console.log(); }` in line 27 AND | |
// - call WebStorm action "Introduce Variable" | |
// Webstorm does NOT offer to replace all 2 occurences where the selected code is used, it only introduces a local variable above line 27 | |
// I would expect it to look outside of it's accessible scope and find the occurence in line 30 too. | |
const fn1 = () => { | |
someFn({log: () => { console.log(); }}); | |
} | |
const fn2 = () => { | |
someFn({log: () => { console.log(); }}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment