Skip to content

Commit

Permalink
Back out "Turn on eqwalizer in the IDE for tests"
Browse files Browse the repository at this point in the history
Summary:
Original commit changeset: 787eed17e5d9

Original Phabricator Diff: D65346099

Reviewed By: ilya-klyuchnikov

Differential Revision: D65420060

fbshipit-source-id: 458e30b433294a226e4de0ae37c4277ee21a2087
  • Loading branch information
alanz authored and facebook-github-bot committed Nov 4, 2024
1 parent eb8f59b commit 6e21099
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 31 deletions.
8 changes: 2 additions & 6 deletions crates/elp/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -989,12 +989,8 @@ impl Server {
.filter_map(|file_id| {
Some((
file_id,
snapshot
.eqwalizer_diagnostics(file_id, include_otp)
.unwrap_or_default(),
snapshot
.eqwalizer_types(file_id, include_otp)
.unwrap_or_default(),
snapshot.eqwalizer_diagnostics(file_id, include_otp)?,
snapshot.eqwalizer_types(file_id, include_otp)?,
))
})
.collect();
Expand Down
7 changes: 1 addition & 6 deletions crates/elp/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,7 @@ impl Snapshot {
let file_url = self.file_id_to_url(file_id);
let _timer = timeit_with_telemetry!(TelemetryData::EqwalizerDiagnostics { file_url });
self.analysis
.eqwalizer_diagnostics_for_file(
file_id,
EqwalizerIncludes::none()
.include_generated()
.include_tests(),
)
.eqwalizer_diagnostics_for_file(file_id, EqwalizerIncludes::none().include_generated())
.ok()?
}

Expand Down
22 changes: 3 additions & 19 deletions crates/ide_db/src/eqwalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::sync::Arc;

use elp_base_db::salsa;
use elp_base_db::FileId;
use elp_base_db::FileKind;
use elp_base_db::FileRange;
use elp_base_db::FileSource;
use elp_base_db::ModuleName;
Expand All @@ -36,7 +35,6 @@ use elp_types_db::eqwalizer;
use elp_types_db::eqwalizer::types::Type;
use elp_types_db::EqwalizerIncludes;
use elp_types_db::IncludeGenerated;
use elp_types_db::IncludeTests;
use fxhash::FxHashSet;
use parking_lot::Mutex;

Expand Down Expand Up @@ -121,12 +119,7 @@ fn type_at_position(
db: &dyn EqwalizerDatabase,
range: FileRange,
) -> Option<Arc<(eqwalizer::types::Type, FileRange)>> {
if !db.is_eqwalizer_enabled(
range.file_id,
EqwalizerIncludes::none()
.include_generated()
.include_tests(),
) {
if !db.is_eqwalizer_enabled(range.file_id, EqwalizerIncludes::none().include_generated()) {
return None;
}
let project_id = db.file_app_data(range.file_id)?.project_id;
Expand Down Expand Up @@ -161,12 +154,7 @@ fn type_at_position(
}

fn types_for_file(db: &dyn EqwalizerDatabase, file_id: FileId) -> Option<Arc<Vec<(Pos, Type)>>> {
if !db.is_eqwalizer_enabled(
file_id,
EqwalizerIncludes::none()
.include_generated()
.include_tests(),
) {
if !db.is_eqwalizer_enabled(file_id, EqwalizerIncludes::none().include_generated()) {
return None;
}
let project_id = db.file_app_data(file_id)?.project_id;
Expand All @@ -191,9 +179,6 @@ fn is_eqwalizer_enabled(
return false;
}

let is_enabled_test = eqwalizer_includes.include_tests == IncludeTests::Yes
&& db.file_kind(file_id) == FileKind::TestModule;

// Context for T171541590
let _ = stdx::panic_context::enter(format!("\nis_eqwalizer_enabled: {:?}", file_id));
let source_root = db.file_source_root(file_id);
Expand All @@ -209,8 +194,7 @@ fn is_eqwalizer_enabled(
let is_src = module_index.file_source_for_file(file_id) == Some(FileSource::Src);
let app_or_global_opt_in =
eqwalizer_config.enable_all || db.has_eqwalizer_app_marker(source_root);
let opt_in = (app_or_global_opt_in && (is_src || is_enabled_test))
|| db.has_eqwalizer_module_marker(file_id);
let opt_in = (app_or_global_opt_in && is_src) || db.has_eqwalizer_module_marker(file_id);
let ignored = db.has_eqwalizer_ignore_marker(file_id);
opt_in && !ignored
}
Expand Down

0 comments on commit 6e21099

Please sign in to comment.