Visual Studio's 'Go To Definition' doesn't work on javascript libraries - visual-studio

I'm using visual studio to edit a basic webpage I'm making, which uses the VisJS library. Intellisense magically works:
However, on that same object when I try to 'Go To Definition', it can't find it:
It would also be really nice to see what parameters the Network constructor takes as well.
How do I get this to work?

I experienced a similar problem on Visual Studio 2017, where Go To Definition wasn't working with JavaScript files.
The solution was going to:
Tools > Options > Text Editor > JavaScript/TypeScript > Language Service
There are 2 checkboxes there, one of them is:
Disable dedicated syntax process (restart required)
I unchecked it, restarted VS, and F12 then worked as usual.

Related

Remove automatic addition of using statements on Visual Studio on using methods not in the current namespace [duplicate]

I am using Visual Studio with Unity. When I copy and paste a code in Visual Studio. It automatically adds an unnecessary namespace on the top. It is pretty annoying to see if there have many unused namespaces over time. May I ask if is this a bug or how can I turn off the auto import namespace when copy paste?
From the suggested name, I think Visual Studio confuses the "length" and "Length"
Here are the steps to reproduce the problem
On the top of the page in Visual Studio, go to Tools > Options > Text Editor > C# > Advanced > Uncheck the option for "Add missing using directives on paste" then click OK on the bottom of the page. And then restart Visual Studio.
Might be useful to some to note that tab completion will still auto-add missing using directives.
Here is an example with the option checked (the example specifics are not relevant but in this case an attribute is being pasted to an ASP.Net Core Razor Page):
Here is an example with the option unchecked:

visual studio right click missing find all refences and go to definition disabled

I am using Visual Studio 2010, suddenly from right click menu Go to Defination option is disabled and even F12 does not work. Find all referneces option is missing from the menu... i use them a lot, how can I get them work
I had the same problem with Microsoft Visual Studio 2013 Premium.
Fixed it by following the steps:
Close your solution.
Delete hidden .suo file in folder where your solution's .sln file exists.
Open your solution.
Rebuild your solution.
F12 should now work.
To reiterate what #eodabash said on 2014-04-07 was EXACTLY it.
I'm using Visual Studio 2013 Premium and I too lost Go To Definition functionality when the file was file containing the class was not opened.
Resolution:
Tools > Options > Text Editor > File Extension
Notice extension, "cs" was missing from list.
Type, "cs" in the Extension box
Select, "Microsoft Visual C#" under Editor
Click, Add. Click, Ok.
BOOM!
My issue was NOT an extension. It was NOT the .suo files. It was NOT a reinstall issue. It worked in C++ but NOT C#.
It WAS the file extensions option were not associated with C#. (facepalm)
I am working on a solution with C++ combined with C# which is set to VS 2010 compiler but I edit it with the 2013 IDE. All of this is orchestrated with the MS-TFS. I searched for both *.ncb and *.sou files but couldn't find them. Eventually I saw eodabash's comment of changing the File Extension option, and hey presto, it works for me...
Fortran is not listed in Tools > Options > Text Editor > File Extension, so this route did not work for me.
What worked for me was:
Tools > Options > Text Editor > Fortran > Advanced > Enable Find All References.
Set the above field to True. Also
Tools > Options > Text Editor > Fortran > Advanced > Enable Go To Definition.
This field may need to be changed to true.
For me, rebuilding the solution, then closing the file in visual studio and reopening it fixed it.
Verify the source file is part of the solution you have open. - Sigh.
(For me, I was looking for 'Go to Definition' for a source file in a completely different solution than what I had opened in Visual Studio. I opened the correct solution, verified 'Go To Definition' was functional, then grabbed a much needed cup of coffee.)

Visual Studio not displaying compile time errors in editor

For example, when I write:
string x = "turtle";
x.Go();
There is no red squiggly line detecting the absence of the Go() method on String.
Only when I compile does the error get detected.
I've just upgraded to Windows 7, I have Visual Studio 2008.
In my old environment the errors were detected before the actual compile.
Is there a setting that I am missing?
EDIT: "Tools -> Options -> Text Editor -> C# -> Underline errors in the editor" is checked.
I dont have the "Live Semantic" option. Maybe I need to go to SP1?
You need to turn on the underline errors in the editor and show live semantic errors options in Visual Studio.
These options can be found here:
Tools > Options > Text Editor > C# > Advanced > Editor Help
Edit: You will need to install SP1 for this functionality to work.
Select Tool -> Options, then Text Editor. Under the language you are using (ie C#), go to the Advanced and make sure the Underline errors in the editor and Show live semantic errors are checked
Stop the project.
Open Folder Project.
Delete .vs folder (he is a hidden folder)
Then restart Visual Studio
EDIT:
This approach has been around since the 2012 version of Visual Studio. This folder consists of keeping all breakpoint information and other settings saved. It is not known why, the configurations arrive at a time when the errors of compilations no longer appear. Deleting the .vs folder will "reset" your breakpoints forcing you to do them again if you need to.
For visual studio 2015 and higher:
Go to: Tools > Options > Text Editor > C# > Advanced > Editor Help
Then select: Enable Full solution analysis
I had the same issue and had SP1 installed and had Underline errors in the editor and Show live semantic errors checked in VS2008's options.
My solution was to download Microsoft Visual Studio 2008 Service Pack 1 (Installer) and re-install the package. It wasn't classified as a 'repair' or a 're-install' despite the fact it was already installed, but it worked.
Restarting VS solved my problem once.
my solution; I know it won't help like 80% of the viewers, but for the sake of who it will:
i have had a lot of noise in the IOS part of the solution, a VS bug that showed a lot of errors that weren't supposed to appear, so I just deleted the IOS part because I didn't really needed it as I didn't even had a Mac server to test it on... Something happened after that and the squiggly line returned! Seriously, VS team, fix your bugs...
JavaScript Type Checking
Sometimes type checking your JavaScript code can help you spot mistakes you might have not caught otherwise. You can run the TypeScript type checker against your existing JavaScript code by simply adding a // #ts-check comment to the top of your file.
// #ts-nocheck
let easy = true;
easy = 42;
Tip: You can also enable the checks workspace or application wide by adding "javascript.implicitProjectConfig.checkJs": true to your workspace or user settings and explicitly ignoring files or lines using // #ts-nocheck and // #ts-ignore. Check out the docs on JavaScript in VS Code to learn more.
In my case the problem was that I created a file with .s extension instead of .cs an then changed the extension to .cs once it was created.
I deleted it and created again correctly and now VS is underlining the errors in this file.

Visual Studio Editor does not underline errors anymore

My Visual Studio (2008) Editor has stopped to underline Errors (this nifty wavy red lines). I can't really tell when, but it can be related to the installation of .Net Framework 3.5 SP 1 or the MVC Beta (which I guess is unlikely). Furthermore have I installed and uninstalled both CodeRush and Resharper for evaluation purposes (decided not to keep either one of them).
Does anyone know the problem and how to restore this functionality again?
Have you checked Tools→Options...→Text Editor→C#→Advanced→Underline errors in the editor?
I usually like to reset my settings after messing around with plugins, as they tend to mess with settings: Tools→Import and Export Settings...→Reset all settings.
About possible causes.
For VS 2012 and 2013 if you have more than one instance of Visual Studio on different machines binded to one "live" account and have installed ReSharper on one of them, it disables the native IntelliSense and error underlines (to replace by it's own rules) that will be synchronised through your account to another machine without ReSharper.
Found it in Visual Studio 2019 as: Tools > Options > Text Editor > General > Show error squiggles
This is generally called Disable Squiggly or Wavy lines in Visual Studio.
How you will do in Visual studio 2013?
TOOLS -> Options... -> Text Editor -> C/C++ -> Advanced -> Disable Squiggles: True/False (Under IntelliSense) -> Press OK
I know its an old question, and with various solutions, but I have fixed it in different way. I'm working with Unity3D on my C# code using VS2017, when suddenly VS decides to stop underlining error while im typing. However, if I close the file tab and reopen, it suddenly undelines the error.
For example:
class A {
public int x;
s;
}
should obvsiouly give an error for that lonely 's' symbol. But, VS doesn't underline it until I close and reopen this file tab.
Solution:
Copied the entire Unity Project folder (which is like a regular VS Solution folder basically) and worked with the new folder, which issue was gone there.
For visual studio 2017 act according to HeeJae's comments in:
https://developercommunity.visualstudio.com/content/problem/113112/design-time-error-checking-isnt-working.html
i.e:
Hi. you are probably hitting a known issue. can you try this?
1.Update to latest release If that doesn’t solve it
2.Go to Tools\Options\Projects and Solutions\General and uncheck “Allow parallel project initialization”.
3.Close VS.
4.Delete the “.vs” directory beside their solution file.
5.Reopen VS.
..
thank you
You can re-enable the "Allow parallel project initialization" option after the issue was solved.
I tried to upgrade VS, reset VS settings, clear VS cache and everything people do conventionally but none of them solved this issue! At the end the mentioned solution worked for me magically.
Good luck
Unloading and loading same project again from the solution does the trick. Just right click on the project and click "Unload Project". Once unloaded, again right click the same project and click "Reload Project". Error highlighting will return.
I had the same issue with 2017. There was a 'disable intelisense' option, make sure that is set to false.
For everyone wondering in 2021..
search for "C_Cpp.errorSquiggles" in the settings.
Make sure to have it active for the user, as well as the workspace.
No need to restart Visual Studio.
For me (VS 2019) , after trying the other answers also, setting the scope of analysis from "Current document" to Open document" brought back the missing error markers
Just go to settings and search for errors and Image in Error Squiggles. You can see the Error squiggles (Modified: Workspace - Right now you can't see it because I modified it). Just click on modified and you will see the disabled option. If by mistake you disabled it, just enable it and you can see the red line errors again in your code.
In latest edition, check for .vscode folder in same project folder. There will be a setting.json file in that. Delete the key value pair of "C_Cpp.errorSquiggles": "Disabled". Restart the vs code.

Customizing Visual Studio's Intellisense

A recent project had me working with C# again, and I noticed something I hadn't before -- C#'s Intellisense shows possible exceptions that can be thrown when calling a method
Since I work mostly with VB.NET applications, it'd be really nice to have this feature in those applications as well, but it's unfortunately absent from VB's Intellisense
Is there any quick and easy way I can customize Visual Studio's Intellisense to show exceptions (as well as other members from the XML comments)? Or am I looking at a full modification using the SDK?
Update: 29-Sep-2008 1:49 PM -- I figure this will be more complicated than simply changing a configuration setting. Since the comments are XML-based, I was hoping for an XSLT file somewhere buried in the Visual Studio directory, but nothing has turned up so far. Looks like I'm going to have to dig into the Visual Studio SDK.
Try going to Tool -> Options...
Then Text Editor -> Basic
and make sure both options "Auto list members" and "hide advanced members" are unchecked.
Also check "Parameter information".
I cannot validate this information because my current Visual Studio installation is C# standalone.
Regards,
Luís

Resources