diff --git a/client/commands/pyre_language_server.py b/client/commands/pyre_language_server.py index 77a408d8a6..6ae688c585 100644 --- a/client/commands/pyre_language_server.py +++ b/client/commands/pyre_language_server.py @@ -730,14 +730,20 @@ async def _query_buck_for_type_errors( file=argfile, ) argfile.flush() + if ( + self.get_language_server_features().type_errors_preemptible.is_enabled() + or self.get_language_server_features().per_target_isolation_dir.is_disabled() + ): + preemptible = [ + "--preemptible=ondifferentstate", + ] + else: + preemptible = [] if self.get_language_server_features().per_target_isolation_dir.is_enabled(): isolation_dir = [f"--isolation-dir={PTT_ISOLATION_PREFIX}"] - preemptible = [] else: isolation_dir = [] - preemptible = [ - "--preemptible=ondifferentstate", - ] + type_check_parameters = [ "buck2", *isolation_dir, @@ -1016,6 +1022,10 @@ async def handle_overlay_type_errors( "new_file_loaded": new_file_loaded, "isolation_dir": isolation_dir, "sharding_enabled": self.get_language_server_features().type_error_sharding.is_enabled(), + "preemptible": ( + self.get_language_server_features().type_errors_preemptible.is_enabled() + or self.get_language_server_features().per_target_isolation_dir.is_disabled() + ), }, **daemon_status_before.as_telemetry_dict(), }, diff --git a/client/language_server/features.py b/client/language_server/features.py index 12cc478156..6bbf88cd4f 100644 --- a/client/language_server/features.py +++ b/client/language_server/features.py @@ -100,6 +100,7 @@ def is_disabled(self) -> bool: PerTargetTypeErrorsAvailability = CustomAvailability PerTargetIsolationDirAvailability = CustomAvailability TypeErrorShardingAvailability = CustomAvailability +TypeErrorsPreemptibleAvailability = CustomAvailability PythonAutoTargetsAvailability = CustomAvailability SystemPyAutoTargetsAvailability = CustomAvailability # TODO: T204372341 remove this once we have rolled out addition and removal features @@ -127,6 +128,9 @@ class LanguageServerFeatures: type_error_sharding: TypeErrorShardingAvailability = ( TypeErrorShardingAvailability.from_enabled(False) ) + type_errors_preemptible: TypeErrorsPreemptibleAvailability = ( + TypeErrorsPreemptibleAvailability.from_enabled(False) + ) unsaved_changes: UnsavedChangesAvailability = UnsavedChangesAvailability.DISABLED telemetry: TelemetryAvailability = TelemetryAvailability.DISABLED completion: CompletionAvailability = CompletionAvailability.DISABLED