Define language settings in the language crate

This commit is contained in:
Max Brunsfeld 2023-05-11 14:40:35 -07:00
parent 9ae10a5dd9
commit 39618ae32d
54 changed files with 1348 additions and 1161 deletions

View file

@ -270,6 +270,7 @@ impl PickerDelegate for FileFinderDelegate {
mod tests {
use super::*;
use editor::Editor;
use gpui::TestAppContext;
use menu::{Confirm, SelectNext};
use serde_json::json;
use workspace::{AppState, Workspace};
@ -283,12 +284,7 @@ mod tests {
#[gpui::test]
async fn test_matching_paths(cx: &mut gpui::TestAppContext) {
let app_state = cx.update(|cx| {
super::init(cx);
editor::init(cx);
AppState::test(cx)
});
let app_state = init_test(cx);
app_state
.fs
.as_fake()
@ -339,7 +335,7 @@ mod tests {
#[gpui::test]
async fn test_matching_cancellation(cx: &mut gpui::TestAppContext) {
let app_state = cx.update(AppState::test);
let app_state = init_test(cx);
app_state
.fs
.as_fake()
@ -408,7 +404,7 @@ mod tests {
#[gpui::test]
async fn test_ignored_files(cx: &mut gpui::TestAppContext) {
let app_state = cx.update(AppState::test);
let app_state = init_test(cx);
app_state
.fs
.as_fake()
@ -462,7 +458,7 @@ mod tests {
#[gpui::test]
async fn test_single_file_worktrees(cx: &mut gpui::TestAppContext) {
let app_state = cx.update(AppState::test);
let app_state = init_test(cx);
app_state
.fs
.as_fake()
@ -516,9 +512,7 @@ mod tests {
#[gpui::test]
async fn test_multiple_matches_with_same_relative_path(cx: &mut gpui::TestAppContext) {
cx.foreground().forbid_parking();
let app_state = cx.update(AppState::test);
let app_state = init_test(cx);
app_state
.fs
.as_fake()
@ -570,9 +564,7 @@ mod tests {
#[gpui::test]
async fn test_path_distance_ordering(cx: &mut gpui::TestAppContext) {
cx.foreground().forbid_parking();
let app_state = cx.update(AppState::test);
let app_state = init_test(cx);
app_state
.fs
.as_fake()
@ -622,7 +614,7 @@ mod tests {
#[gpui::test]
async fn test_search_worktree_without_files(cx: &mut gpui::TestAppContext) {
let app_state = cx.update(AppState::test);
let app_state = init_test(cx);
app_state
.fs
.as_fake()
@ -658,4 +650,15 @@ mod tests {
assert_eq!(finder.delegate().matches.len(), 0);
});
}
fn init_test(cx: &mut TestAppContext) -> Arc<AppState> {
cx.foreground().forbid_parking();
cx.update(|cx| {
let state = AppState::test(cx);
language::init(cx);
super::init(cx);
editor::init(cx);
state
})
}
}