Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Visual Studio Code, is it possible to delay displaying inline errors when editing C# code, perhaps until I save the file?

I'm using Visual Studio Code primarily to edit C# code, and it automatically detects errors in the code as I type. However because it updates this every second or so, that means that the moment I start typing something on a line and pause even for a brief moment, I've technically introduced a syntax error and it highlights it with a red underline, until finally the whole line is typed.

This is very distracting! I like having it tell me where errors are, but I'd much rather have it wait until I've finished what I'm typing, or even better when I've saved the file, since at that point I expect the code to be correct.

Is there any way to configure VS Code to do this?

like image 627
Bri Bri Avatar asked Feb 01 '26 10:02

Bri Bri


1 Answers

I think the answer to this is that there is still no way to add a delay to the code validation. See Intellisense, Add an option to delay validation (and thus wavy lines in code).

The unsatisfactory solution provided there is to disable validation altogether until a save operation:

On second thought , this is exactly what tasks already do. Just disable the built-in js/ts validator using javascript.validate.enable: false + typescript.validate.enable: false and setup a task to build your project instead. It should only update errors when the file on disk changes (i.e. you save it). You can also configure autosave if wish to have this happen after a delay

You would have to see if your cSharp language server provides an option to run validation onSave or onType.

  • I just looked through all the settings for csharp and omnisharp in vscode and found nothing similar to the validate only on save option or to disable validation altogether.

For php there is such an option built-in: PHP > Validate: Run. onSave or onType.

like image 185
Mark Avatar answered Feb 03 '26 22:02

Mark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!