Home > Back-end >  VS code extension for knowing where function is called from
VS code extension for knowing where function is called from

Time:10-05

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.

CodePudding user response:

enter image description here

Explain: Browser log should show the whole callstack where the error should throw

CodePudding user response:

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.

VS Code Option Go to References

  • Related