Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delay automatic compilation in Visual Studio 2019

Using Visual Studio 2019 Professional v16.8.2. Whenever code is modified, automatic re-compile is triggered in the background. This has the effect of marking/unmarking error squiggles, adding/removing items from the Error List window, and Intellisense related to these errors.

To demonstrate, ensure Tools > Options > Text Editor > General > Show error squiggles is enabled and view the Error List window. Take any large C++ or C# project which compiles correctly, and deliberately add a closing brace } somewhere in a method. In one small example for me, this generated 251 errors and related error squiggles, though it is possible to generate thousands of errors this way. Now repeatedly delete and then re-add the closing brace...Visual Studio starts to lag as it tries to mark/unmark, and add/remove all these errors.

When typing fast, pasting code, or just using the IDE as a text editor, this is distracting and incredibly annoying.

Is it possible to configure a delay from last keypress before automatic compilation? Ideally I'd like something like ~2000ms, or even the ability to only re-compile manually.

like image 274
AlainD Avatar asked Nov 19 '25 18:11

AlainD


1 Answers

It's working as intended.

It's a function of the Precompiler and Intellisense. Their whole purpose is to catch compiler errors before you try to compile your code which may take a long time (re: your example of "a large project").


There was an update to VS2019 today as of this posting and I just noticed an option under Tools > Options... > Text Editor > Advanced labeled "Auto cancel long running auxiliary operations on typing" with the following radiobox settings:

  • Automatically adjust maximum allowed typing latency
  • Maximum allowed typing latency in milliseconds [textbox]

The first option is the one selected by default. You might try changing the setting to force a maximum allowed time to 2000ms (or whatever suits your needs) and see if that helps.


As a side note: I have the exact opposite problem: the squiggles don't go away even on perfectly normal and well-formed code until I save and/or manually compile. (It's a crap shoot on which one actually works first.)

like image 73
Casey Avatar answered Nov 21 '25 08:11

Casey



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!