I want VScode to inform where a defined function is being called from.
file utils.js
function counter(){
console.log('counter');
}
export default counter;
file index.js:
import counter from './utils';
counter();
I want to know in counter function definition in utils.js that it is being used at index.js
if the function counter is called in different files I want to get the information about where the function is being used | called from.
I want VScode to inform where a defined function is being called from.
file utils.js
function counter(){
console.log('counter');
}
export default counter;
file index.js:
import counter from './utils';
counter();
I want to know in counter function definition in utils.js that it is being used at index.js
if the function counter is called in different files I want to get the information about where the function is being used | called from.
Share Improve this question edited Oct 4, 2022 at 15:48 Mark 185k30 gold badges542 silver badges552 bronze badges asked Oct 4, 2022 at 5:09 Anish ShresthaAnish Shrestha 632 silver badges8 bronze badges3 Answers
Reset to default 3Thanks for the answers. I found that VScode has an inbuilt reference locater. Just right-click the function and select the option find all references, and VScode will locate all the references to that functions Shortcut: Alt + Shift + F12
As stated by @hUwUtao, the callstack has the information about the callers of your counter()
function when it is executing. If you want to find references without executing, VS Code can do this by right-clicking the function, then selecting Go to References, as seen in the following screenshot.
Explain: Browser log should show the whole callstack where the error should throw