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?
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.
For php there is such an option built-in: PHP > Validate: Run. onSave or onType.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With