Reputation: 632
Good Day!
I have very bad experience with Visual Studio 2022, Finally after I decide to move from 2015 to the newest version 2022 with the latest version of Devsense PHP Tools, A lot of bad situations start happening, begin with destroy all opened documents ordered over three monitors, some error messages while Go to Definition with PHP functions and classes and finally the worst at all, I can't use Go to Definition or F12 with JavaScript code and really don't know how to continue work with this, I have a huge JS files under namespaces and hundreds of functions.
I googled it and tried this solution "Tools > Options > Text Editor > JavaScript/TypeScript > Language Service > (CHECK) Disable dedicated syntax process (restart required)" but still can't use F12.
I tried to remove the "ASP.NET and Web Development" from Visual Studio Installer and re-install it but doesn't work.
I saw an article on Visual Studio Developers Community forum (here) and (here) and it seems like it has been fixed a long time ago.
Can anyone help?
Upvotes: 0
Views: 314
Reputation: 1191
After my test, I found that this phenomenon does exist. I created two JS files in the project:
main.js:
var message = MyApp.Utilities.sayHello("World");
console.log(message);
var sum = MyApp.Utilities.addNumbers(5, 7);
console.log(sum);
app.js:
var MyApp = MyApp || {};
MyApp.Utilities = {
sayHello: function (name) {
return "Hello, " + name + "!";
},
addNumbers: function (a, b) {
return a + b;
}
};
When I rebuild the solution and restart VS, the main.js content is displayed by default. No matter you click sayHello or addNumbers and use F12, you will not be redirected to the method defined in app.js. Even if you right-click sayHello or addNumbers and click go to definition, you will not be redirected to the method defined in app.js. The F12 go to definition function will only work when you click on the app.js file, load the content inside, and then return to main.js. This may be a bug in VS. If you find it troublesome to always open the JS file for method definition, I suggest you report this bug to DC. DC has many VS developers who should be able to help you.
Upvotes: 0