Rename build_view to new_view and build_model to new_model

The word "new" is shorter and blends in with `new` constructors that are common
in Rust. Been meaning to do this for a while.
This commit is contained in:
Nathan Sobo 2024-01-01 12:01:29 -07:00
parent 219999cd8d
commit db1cf8f6e1
97 changed files with 470 additions and 494 deletions

View file

@ -78,7 +78,7 @@ pub(crate) struct LogMenuItem {
actions!(debug, [OpenLanguageServerLogs]);
pub fn init(cx: &mut AppContext) {
let log_store = cx.build_model(|cx| LogStore::new(cx));
let log_store = cx.new_model(|cx| LogStore::new(cx));
cx.observe_new_views(move |workspace: &mut Workspace, cx| {
let project = workspace.project();
@ -93,7 +93,7 @@ pub fn init(cx: &mut AppContext) {
let project = workspace.project().read(cx);
if project.is_local() {
workspace.add_item(
Box::new(cx.build_view(|cx| {
Box::new(cx.new_view(|cx| {
LspLogView::new(workspace.project().clone(), log_store.clone(), cx)
})),
cx,
@ -444,7 +444,7 @@ impl LspLogView {
log_contents: String,
cx: &mut ViewContext<Self>,
) -> (View<Editor>, Subscription) {
let editor = cx.build_view(|cx| {
let editor = cx.new_view(|cx| {
let mut editor = Editor::multi_line(cx);
editor.set_text(log_contents, cx);
editor.move_to_end(&MoveToEnd, cx);

View file

@ -46,7 +46,7 @@ async fn test_lsp_logs(cx: &mut TestAppContext) {
project.languages().add(Arc::new(rust_language));
});
let log_store = cx.build_model(|cx| LogStore::new(cx));
let log_store = cx.new_model(|cx| LogStore::new(cx));
log_store.update(cx, |store, cx| store.add_project(&project, cx));
let _rust_buffer = project

View file

@ -24,7 +24,7 @@ pub fn init(cx: &mut AppContext) {
let active_item = workspace.active_item(cx);
let workspace_handle = workspace.weak_handle();
let syntax_tree_view =
cx.build_view(|cx| SyntaxTreeView::new(workspace_handle, active_item, cx));
cx.new_view(|cx| SyntaxTreeView::new(workspace_handle, active_item, cx));
workspace.split_item(SplitDirection::Right, Box::new(syntax_tree_view), cx)
});
})
@ -417,7 +417,7 @@ impl Item for SyntaxTreeView {
where
Self: Sized,
{
Some(cx.build_view(|cx| {
Some(cx.new_view(|cx| {
let mut clone = Self::new(self.workspace_handle.clone(), None, cx);
if let Some(editor) = &self.editor {
clone.set_editor(editor.editor.clone(), cx)