Disabling Intellisense with VS 2022 editing non-source files - visual-studio

I'm editing some .INI files with detailed comments in VS 2022 (v. 17.3.6), and it keeps bugging me with auto completion, word guessing, and ending quotes where unneeded...
Is there a simple way to stop it from helping me?
As I go back and forth to C# files is helpful, but not with plain text!

Tools -> Options -> IntelliCode
Change the settings from there.

Related

Visual Studio dialog: You are renaming a script file

We keep getting the following dialog in Visual Studio when renaming files:
While I admire the effort of this option it simple doesn't work as intended and so we would like to disable this option.
My Google-fu hasn't been strong enough, does anybody know how to disable (or what extension produces) this option?
Thanks in advance!
I fixed this on my machine by going to Visual Studio -> Tools -> Options -> Projects and Solutions then uncheck the Prompt for symbolic renaming when renaming files checkbox.

Disable Visual Studio code formatting in Razor

This has been asked before: Why doesn't Visual Studio code formatting work properly for Razor markup?
But that question is a couple years old. And Razor formatting is still completely unacceptable. I have given up on fixing it.
Can I disable ALL Visual Studio formatting for CSHTML files? If not, can I disable all Visual Studio formatting entirely? Any 3rd party hacks I can use? There's got to be something!
I've upgraded to 2013 and the formatting is just as bad.
[EDIT]: 2015 is god-awful as well. I REALLY wish they would fix this.
[EDIT]: 2017 is god-awful as well. I REALLY wish they would fix this.
[EDIT]: 2019 is god-awful as well. I REALLY wish they would fix this. That said, Microsoft released a new formatting engine for .Net Core only.
[EDIT]: 2022 is... Well you know. If they ignore this 12 more years I may retire before seeing it fixed!
Under Tools -> Options -> Text Editor -> HTML -> Advanced
there is a key value item Paste which says "Format on paste" and has a boolean value next to it. Changing this to false has disabled formatting on paste for me in razor syntax.
I am using VS Professional 2013, Version 12.0.30110.00 Update 1
You cannot. This is built in "feature" of VS since the first .net version (visual studio 2002/2003).
There are tons of connect report about the formatting bugs, but Microsoft ignores them completly, or pushing the fix to the "next version". You can see an example Microsoft answer here.
You can post your own feedback to Microsoft Team here
The places to look:
Tools -> Options -> Web Essentials -> HTML -> Auto-format HTML on Enter
(Requires installation of Web Essentials extension)
Set to False
Tools -> Options -> Text Editor -> HTML -> Advanced -> Format on Paste
Set to False
With these settings I have no trouble in Visual Studio 2013.
I used to have to press Ctrl-Z far too often, and if you forgot untangling the mess once your code was written and tested was a huge pain. I feel Microsoft could do alot to help users configure this as well as make it more accessible.
What did the trick for me was pressing CTRL+Z after pasting, then the formatting is removed.
In my case R# ended up being the culprit, can be disabled here:
ReSharper > Options > Code Editing > Razor > Editor & Formatting
https://www.jetbrains.com/help/resharper/2016.1/Reference__Options__Languages__Razor__Editor.html
Unfortunately the only way to prevent autoformatting on paste is to comment out the location where you're going to paste some new code and after the pasting operation to remove the commenting instructions.
Search & Replace seems not to trigger auto-formatting. But pasting reformats the entire code block.
This is terrible beyond words. It makes Visual Studio IDE virtually unusable for Razor editing. One has to use an external editor for Razor files.
What's even worse, even the latest Visual Studio 2013 Update 1 crashes while editing Razor views all the time.
The fun part is, you can disable C# formatting and HTML formatting but not Razor formatting.
I've unchecked "Tools > Options > Text Editor > C# > Formatting > Automatically format on paste" and the same for HTML.
Which results in the following fun experience in cshtml files:
Paste HTML code: no format
Paste C# code: no format
Paste Razor code: format everything wrong
And since there is no option to change the Razor options, you have to live with this I guess.
My "solution": paste and ctrl-z to undo the auto format
I do not have a .Net Core project nor Blazor. So unfortunately I cannot test this. But a new formatting engine has been released by Microsoft for these languages.
https://devblogs.microsoft.com/aspnet/new-experimental-razor-editor-for-visual-studio/
Requires the latest edition of Visual Studio 2019.
I found these settings in Resharper 2019, which have improved my experience:
The below does not directly answer the posed question, but offers a potential fix that may be helpful.
In my situation, the auto formatting was only preforming exceptionally poorly for some files. This turned out to be related to the type of line feed used.
To resolve:
I enabled advanced save options
When saving the problematic files, I selected Windows (CR LF) as the line feed type
Supporting docs
After doing this, autoformat appeared to behave better

Visual Studio replace tab with 4 spaces?

Is there a way to set TAB button to work as 4 spaces in Visual Studio 2010 instead of going to Edit->Advanced->Untabify Selected Lines?
You can edit this behavior in:
Tools->Options->Text Editor->All Languages->Tabs
Change Tab to use "Insert Spaces" instead of "Keep Tabs".
Note you can also specify this per language if you wish to have different behavior in a specific language.
First set in the following path Tools->Options->Text Editor->All Languages->Tabs
if still didn't work modify as mentioned below
Go to Edit->Advanced->Set Indentation ->Spaces
For VS2010 and above (VS2010 needs a plugin).
If you have checked/set the options of the tab size in Visual Studio but it still won't work. Then check if you have a .editorconfig file in your project! This will override the Visual Studio settings. Edit the tab-size in that file.
This can happen if you install an Angular application in your project with the Angular-Cli.
See MSDN blog
None of these answer were working for me on my macbook pro. So what i had to do was go to:
Preferences -> Source Code -> Code Formatting -> C# source code.
From here I could change my style and spacing tabs etc. This is the only project i have where the lead developer has different formatting than i do. It was a pain in the butt that my IDE would format my code different than theirs.
If you don't see the formatting option, you can do Tools->Import and Export settings to import the missing one.
For Visual Studio 2019 users:
By the comment under accepted answer, link:
Well... This is "almost" still the same in VS 2019... if you already done that and seems not to work, go to: Tools > Options, and then Text Editor > Advanced > Uncheck "Use adaptive formatting" as seen here

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.

Resources