Fix cargo test -p editor for Linux/Wayland (#49730)

Jakub Konka created

`cargo test -p editor` now builds on Linux/Wayland

Release Notes:

- N/A

Change summary

crates/editor/src/editor.rs | 8 ++++----
crates/gpui/Cargo.toml      | 4 +++-
2 files changed, 7 insertions(+), 5 deletions(-)

Detailed changes

crates/editor/src/editor.rs 🔗

@@ -6334,7 +6334,7 @@ impl Editor {
         self.completion_tasks.push((id, task));
     }
 
-    #[cfg(feature = "test-support")]
+    #[cfg(any(test, feature = "test-support"))]
     pub fn current_completions(&self) -> Option<Vec<project::Completion>> {
         let menu = self.context_menu.borrow();
         if let CodeContextMenu::Completions(menu) = menu.as_ref()? {
@@ -23573,7 +23573,7 @@ impl Editor {
             .insert(TypeId::of::<T>(), (color_fetcher, gutter_highlights));
     }
 
-    #[cfg(feature = "test-support")]
+    #[cfg(any(test, feature = "test-support"))]
     pub fn all_text_highlights(
         &self,
         window: &mut Window,
@@ -23597,7 +23597,7 @@ impl Editor {
         })
     }
 
-    #[cfg(feature = "test-support")]
+    #[cfg(any(test, feature = "test-support"))]
     pub fn all_text_background_highlights(
         &self,
         window: &mut Window,
@@ -23627,7 +23627,7 @@ impl Editor {
         res
     }
 
-    #[cfg(feature = "test-support")]
+    #[cfg(any(test, feature = "test-support"))]
     pub fn search_background_highlights(&mut self, cx: &mut Context<Self>) -> Vec<Range<Point>> {
         let snapshot = self.buffer().read(cx).snapshot(cx);
 

crates/gpui/Cargo.toml 🔗

@@ -31,7 +31,9 @@ leak-detection = ["backtrace"]
 wayland = [
     "bitflags",
 ]
-x11 = []
+x11 = [
+    "scap?/x11",
+]
 screen-capture = [
     "scap",
 ]