none
Go To Definition (F12) - Not working properly for function and variable (JAVASCRIPT FILES)

    Question

  • Hi,

    When we are trying to access a function declaration into a JS file using the Go To Definition function of VS, it triggers and error saying it cannot find the definition.

    For exemple we have a "login()", function which is call into a JS file. This function is referenced into another js file, Visual Studio cannot reach it.

    It only reach definition when the function is declared on the same js file (not in another).

    For information all the js file are part of the  VS solution, and are not outside the project.

    Any idea?

    Thank you in advance for your answer.

    Kind Regards.
    Wednesday, April 13, 2016 4:00 PM

Answers

  • Hi Sontae,

    Do you mean you call a javascript function in another javascript file?

    Please check whether you have reference the javascript file which contains the function you call. If not, please reference it with following code. And you also can drag and drop the javascrip file into your current file. After that, you can press F12 to use the  Go To Definition function.

    Best Regards,
    Weiwei

    Thursday, April 14, 2016 6:31 AM
    Moderator

All replies

  • Hi Sontae,

    Do you mean you call a javascript function in another javascript file?

    Please check whether you have reference the javascript file which contains the function you call. If not, please reference it with following code. And you also can drag and drop the javascrip file into your current file. After that, you can press F12 to use the  Go To Definition function.

    Best Regards,
    Weiwei

    Thursday, April 14, 2016 6:31 AM
    Moderator
  • Hi,

    And thank you for your answer.

    However, it's too bad Visual Studio to not reference javascript file by itself, as many ide do....

    I cannot implement javascript reference in the file, as I have no idea where javascripts prototype or function are implemented because we have project with more than a thousand of js files...

    The only solution we have found is to use the plugin "WebEssential" and press shift+F12 to find usage of the function in the code, its' worth than nothing...

    Thank you!

    Regards.

    • Marked as answer by Sontae Thursday, April 21, 2016 12:38 PM
    • Unmarked as answer by Sontae Thursday, April 21, 2016 12:39 PM
    Thursday, April 21, 2016 12:38 PM