Visual studio stuck cursor - c#

In unity and visual studio , some of the scripts I am creating ,wont let me use shortcuts, cant write where I put the cursor, cant even use ctrl+F, this is new and really stopping my workflow. Have you got any workarounds for this bug?
When I type it seems like the place where all the words are typed from it is always the same and won't change no matter if I click on a different place in the script.
If I restart visual studio, the problem for those scripts will stop, but other scripts will have the same problem then.
I am using visual studio 17 15.9 and Unity 2018.3.b10
Thank you for your help

Ok, I found a workaround. My scripts in visual studio were coming up on the tabs with a 1 or 2 after the name of the script, like they were duplicates. The solution was to close them pressing x, then find them in the solution explorer, repeating this until that number was gone.
After this, that problem is gone.

Related

Visual Studio 2022 not showing syntax errors and Intellisense is not working properly

Working on a project I made a class with properties and when I tried to auto-generate a class constructor I got an error saying something on lines of "auto generation of class constructor failed... and will be disabled" and ever sense then the "generate constructor" option has been taken off the Refactor menu and on top of that I don't get syntax error highlighting anymore and intellisense doesn't seem to be working proper or at all.
I tried using going into Tools > Options > Text Editor > various fields including "C#" and "general") and I don't see anything obviously wrong. I also tried to use Visual Studio Installer to try to repair and that didn't do anything. I am completely out of ideas and I can't find anything that is remotely close to my case. TIA
I can't add this reply as a comment as I don't have 50 reputation.
I created a .Net 6.0 C# console project in Visual Studio 2022, add a class, and add two private fields. Selecting these two fields, press Alt+Enter to quickly generate the constructor. I did not encounter your issue.
Please try:
Go to Visual Studio Installer, click Modify, uncheck IntelliCode in Individual components, then click Modify button to save the change, wait for the installation to complete, and then reinstall IntelliCode.
In Visual Studio, go to Tools->Options->IntelliCode to check if the setting is Default.
Go to Tools menu, and select Options. Under Intellicode select General. Just uncheck “C# Suggestions”. Then restart Visual Studio and check that intellisence and syntax errors are appearing.
Note, I was not able to figure out what this option does, as the C# code suggestions seemed to continue to work as expected.

Unity Scripts edited in Visual studio don't provide autocomplete on certain lines

When I edit the C# Unity Scripts, they open in Visual Studio. I've noticed that the autocomplete works on some lines but it doesn't in others.
Here you can see what's going on:
As you can see I get the autocomplete for GetComponent function only when I type inside the line 19.
I also tried this:
By moving the whole Start() function, autocomplete seems to work, but when moving back to the original place, it seems to stop working again.
By further testing, I noticed that autocomplete does not work on lines 11 through 14 and works on any other line.
I tried updating Visual Studio, deleting and recreating the C# Script, regenerated the project files and even reimporting all assets. Nothing worked.
Unity Version: 2020.2.7f1
Visual studio: 8.9.2
OS: macOS 11.2.3
Hm, that's strange. Try to go into the unity editor, go to edit/preferences/external Tools and select the VisualStudio version you are using as the external script-editor.

Visual Studio Code intellisense for Unity not working

so I've been trying to get Visual Studio Code set up to work with Unity.
Here is the list of extensions I have for Unity:
C# version 1.21.17
Debugger for Unity version 2.7.5
Unity Tools version 1.2.3
Unity Code Snippets version 1.3.0
So I have the IntelliSense working for methods like Awake, Start, OnCollisionEnter2D etc., but when I try to get methods like GetComponent they dont show up, which can be quite bothering as I am trying to learn and still dont know thte methods so well as to know all of their parameters and the exact way they are named.
So as it turns out(For some reason), the problem was that even though it appeared that when double clicking a script in Unity opened up the entire project folder in VS Code, I could see all the files and that stuff for some reason that was not properly loaded. I tried reopening the project folder from VS Code, rather than from unity and it all worked out. Now I am able to use IntelliSense to its full extent. Leaving this in case others are struggling with this.
Once you've opened up the project folder from vs code, if you leave it open, double clicking scripts from unity will work fine, no need to manually open thtem from vs code everytime you want to edit a script.
Sometimes it happens if you don't set VSCode as the default editor for Unity scripts.
In Unity go to Edit > Preferences > External Tools > External script editor and choose Visual Studio Code.

Visual Studio doesn't show me the red squiggle Intellisense errors [duplicate]

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.

Visual studio intellisense does not see new methods until restart?

I have a fairly large C# project with many files, classes etc. Everything works fine but if I move to say ClassA and add a new method or property and then move to another file in the solution and attempt to access it the intellisense reports it does not exist and underlines it in red. If I build the solution it will correctly build without errors and the red lines will disappear until I start editing the file again and then the red lines will come back and be reported as errors.
Saving the solution and all files does not help, but if I restart visual studio it will then work as intended unless I add more new methods/properties to an existing class then I have to restart again or suffer same problem.
I had this problem a long time ago with visual studio express and I could never fix it but it went away when I upgraded to a newer visual studio. Now the problem has come back with Visual Studio 2013 Ultimate on windows 8.1 and I can't find any solution again :(
Verify that your intellisense options are still properly configured.
Go to Tools => Options => Text Editor => C# => Intellisense.
Make sure that under "Completion Lists"
(checked) Show completion list after a character is typed
Make sure that under "Selection in completion list" you have:
Committed by typing the following characters: {}[]().,:;+-*/%&|^!~=<>?##'"\
and
(checked) Committed by pressing the space bar

Categories