From dc64ec9cc8e1c3237152d419e66b03ba4edb8c13 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 31 Mar 2025 20:55:27 +0200 Subject: [PATCH] chore: Bump Rust edition to 2024 (#27800) Follow-up to https://github.com/zed-industries/zed/pull/27791 Release Notes: - N/A --- Cargo.toml | 2 +- .../src/activity_indicator.rs | 10 +- crates/anthropic/src/anthropic.rs | 4 +- crates/askpass/src/askpass.rs | 4 +- crates/assets/src/assets.rs | 9 +- crates/assistant/src/assistant.rs | 2 +- .../assistant/src/assistant_configuration.rs | 4 +- crates/assistant/src/assistant_panel.rs | 37 +- crates/assistant/src/inline_assistant.rs | 39 +- .../src/terminal_inline_assistant.rs | 16 +- crates/assistant2/src/active_thread.rs | 16 +- crates/assistant2/src/assistant.rs | 2 +- .../assistant2/src/assistant_configuration.rs | 2 +- .../add_context_server_modal.rs | 4 +- .../manage_profiles_modal.rs | 8 +- .../assistant_configuration/tool_picker.rs | 6 +- crates/assistant2/src/assistant_diff.rs | 52 +-- .../src/assistant_model_selector.rs | 2 +- crates/assistant2/src/assistant_panel.rs | 20 +- crates/assistant2/src/buffer_codegen.rs | 14 +- crates/assistant2/src/context_picker.rs | 10 +- .../src/context_picker/completion_provider.rs | 4 +- .../context_picker/fetch_context_picker.rs | 12 +- .../src/context_picker/file_context_picker.rs | 6 +- .../context_picker/symbol_context_picker.rs | 4 +- .../context_picker/thread_context_picker.rs | 2 +- crates/assistant2/src/context_store.rs | 4 +- crates/assistant2/src/context_strip.rs | 10 +- crates/assistant2/src/history_store.rs | 2 +- crates/assistant2/src/inline_assistant.rs | 20 +- crates/assistant2/src/inline_prompt_editor.rs | 90 ++-- crates/assistant2/src/message_editor.rs | 10 +- crates/assistant2/src/profile_selector.rs | 8 +- crates/assistant2/src/terminal_codegen.rs | 4 +- .../src/terminal_inline_assistant.rs | 10 +- crates/assistant2/src/thread.rs | 4 +- crates/assistant2/src/thread_history.rs | 6 +- crates/assistant2/src/thread_store.rs | 8 +- crates/assistant2/src/tool_use.rs | 2 +- .../assistant2/src/ui/agent_notification.rs | 8 +- crates/assistant2/src/ui/context_pill.rs | 2 +- .../assistant_context_editor/src/context.rs | 16 +- .../src/context/context_tests.rs | 8 +- .../src/context_editor.rs | 40 +- .../src/context_history.rs | 18 +- .../src/context_store.rs | 91 ++-- crates/assistant_context_editor/src/patch.rs | 6 +- .../src/slash_command.rs | 6 +- .../src/slash_command_picker.rs | 2 +- .../assistant_eval/src/headless_assistant.rs | 4 +- crates/assistant_eval/src/main.rs | 2 +- .../src/assistant_settings.rs | 2 +- .../src/assistant_slash_command.rs | 6 +- .../src/extension_slash_command.rs | 2 +- .../src/cargo_workspace_command.rs | 4 +- .../src/context_server_command.rs | 4 +- .../src/default_command.rs | 4 +- .../src/delta_command.rs | 4 +- .../src/diagnostics_command.rs | 6 +- .../src/docs_command.rs | 6 +- .../src/fetch_command.rs | 6 +- .../src/file_command.rs | 30 +- .../src/now_command.rs | 2 +- .../src/prompt_command.rs | 4 +- .../src/selection_command.rs | 4 +- .../src/streaming_example_command.rs | 4 +- .../src/symbols_command.rs | 2 +- .../src/tab_command.rs | 4 +- .../src/terminal_command.rs | 6 +- crates/assistant_tools/src/bash_tool.rs | 2 +- crates/assistant_tools/src/batch_tool.rs | 2 +- .../assistant_tools/src/code_symbols_tool.rs | 2 +- crates/assistant_tools/src/copy_path_tool.rs | 2 +- .../src/create_directory_tool.rs | 2 +- .../assistant_tools/src/create_file_tool.rs | 2 +- .../assistant_tools/src/delete_path_tool.rs | 4 +- .../assistant_tools/src/diagnostics_tool.rs | 2 +- crates/assistant_tools/src/edit_files_tool.rs | 6 +- .../src/edit_files_tool/log.rs | 6 +- crates/assistant_tools/src/fetch_tool.rs | 4 +- .../src/find_replace_file_tool.rs | 2 +- .../src/list_directory_tool.rs | 2 +- crates/assistant_tools/src/move_path_tool.rs | 2 +- crates/assistant_tools/src/now_tool.rs | 2 +- crates/assistant_tools/src/open_tool.rs | 2 +- .../assistant_tools/src/path_search_tool.rs | 2 +- crates/assistant_tools/src/read_file_tool.rs | 2 +- .../assistant_tools/src/regex_search_tool.rs | 4 +- crates/assistant_tools/src/replace.rs | 4 +- crates/assistant_tools/src/schema.rs | 2 +- .../assistant_tools/src/symbol_info_tool.rs | 2 +- crates/assistant_tools/src/thinking_tool.rs | 2 +- crates/audio/src/assets.rs | 2 +- crates/auto_update/src/auto_update.rs | 14 +- crates/auto_update_ui/src/auto_update_ui.rs | 6 +- crates/bedrock/src/bedrock.rs | 2 +- crates/breadcrumbs/src/breadcrumbs.rs | 4 +- crates/buffer_diff/src/buffer_diff.rs | 2 +- crates/call/src/call_impl/mod.rs | 6 +- crates/call/src/call_impl/participant.rs | 4 +- crates/call/src/call_impl/room.rs | 8 +- crates/channel/src/channel.rs | 6 +- crates/channel/src/channel_buffer.rs | 2 +- crates/channel/src/channel_chat.rs | 13 +- crates/channel/src/channel_store.rs | 12 +- crates/channel/src/channel_store_tests.rs | 2 +- crates/cli/src/main.rs | 14 +- crates/client/src/client.rs | 10 +- crates/client/src/socks.rs | 2 +- crates/client/src/test.rs | 6 +- crates/client/src/user.rs | 8 +- crates/collab/src/api.rs | 6 +- crates/collab/src/api/billing.rs | 13 +- crates/collab/src/api/contributors.rs | 2 +- crates/collab/src/api/events.rs | 4 +- crates/collab/src/api/extensions.rs | 8 +- crates/collab/src/auth.rs | 10 +- crates/collab/src/db.rs | 10 +- crates/collab/src/db/ids.rs | 2 +- crates/collab/src/db/queries/channels.rs | 2 +- crates/collab/src/db/queries/messages.rs | 2 +- crates/collab/src/db/tables/channel_member.rs | 2 +- crates/collab/src/db/tests.rs | 2 +- crates/collab/src/db/tests/buffer_tests.rs | 9 +- crates/collab/src/db/tests/channel_tests.rs | 45 +- crates/collab/src/db/tests/embedding_tests.rs | 2 +- crates/collab/src/db/tests/extension_tests.rs | 11 +- crates/collab/src/env.rs | 2 +- crates/collab/src/llm.rs | 12 +- crates/collab/src/llm/db.rs | 4 +- crates/collab/src/llm/db/ids.rs | 2 +- crates/collab/src/llm/db/queries/providers.rs | 2 +- .../collab/src/llm/db/tests/billing_tests.rs | 5 +- crates/collab/src/llm/db/tests/usage_tests.rs | 5 +- crates/collab/src/llm/token.rs | 6 +- crates/collab/src/main.rs | 14 +- crates/collab/src/migrations.rs | 4 +- crates/collab/src/rate_limiter.rs | 2 +- crates/collab/src/rpc.rs | 30 +- crates/collab/src/rpc/connection_pool.rs | 15 +- crates/collab/src/seed.rs | 2 +- crates/collab/src/stripe_billing.rs | 2 +- crates/collab/src/tests.rs | 4 +- .../collab/src/tests/channel_buffer_tests.rs | 4 +- .../collab/src/tests/channel_guest_tests.rs | 36 +- crates/collab/src/tests/channel_tests.rs | 34 +- crates/collab/src/tests/editor_tests.rs | 10 +- crates/collab/src/tests/following_tests.rs | 8 +- crates/collab/src/tests/integration_tests.rs | 47 ++- crates/collab/src/tests/notification_tests.rs | 2 +- .../src/tests/random_channel_buffer_tests.rs | 2 +- .../random_project_collaboration_tests.rs | 18 +- .../src/tests/randomized_test_helpers.rs | 4 +- .../remote_editing_collaboration_tests.rs | 10 +- crates/collab/src/tests/test_server.rs | 16 +- crates/collab/src/user_backfiller.rs | 2 +- crates/collab_ui/src/channel_view.rs | 14 +- crates/collab_ui/src/chat_panel.rs | 20 +- .../src/chat_panel/message_editor.rs | 8 +- crates/collab_ui/src/collab_panel.rs | 40 +- .../src/collab_panel/channel_modal.rs | 12 +- .../src/collab_panel/contact_finder.rs | 2 +- crates/collab_ui/src/collab_ui.rs | 4 +- crates/collab_ui/src/notification_panel.rs | 14 +- .../src/notifications/collab_notification.rs | 2 +- .../incoming_call_notification.rs | 4 +- .../project_shared_notification.rs | 4 +- crates/command_palette/src/command_palette.rs | 4 +- crates/component/src/component.rs | 2 +- .../src/component_preview.rs | 10 +- crates/context_server/src/client.rs | 10 +- crates/context_server/src/context_server.rs | 2 +- .../context_server/src/context_server_tool.rs | 2 +- crates/context_server/src/manager.rs | 5 +- .../src/context_server_settings.rs | 2 +- crates/copilot/src/copilot.rs | 18 +- crates/copilot/src/copilot_chat.rs | 6 +- .../src/copilot_completion_provider.rs | 8 +- crates/copilot/src/sign_in.rs | 10 +- crates/dap/src/adapters.rs | 4 +- crates/dap/src/client.rs | 10 +- crates/dap/src/proto_conversions.rs | 2 +- crates/dap/src/transport.rs | 8 +- crates/dap_adapters/src/dap_adapters.rs | 6 +- crates/dap_adapters/src/gdb.rs | 2 +- crates/db/src/db.rs | 4 +- crates/debugger_tools/src/dap_log.rs | 12 +- crates/debugger_ui/src/attach_modal.rs | 2 +- crates/debugger_ui/src/debugger_panel.rs | 19 +- crates/debugger_ui/src/session.rs | 10 +- crates/debugger_ui/src/session/failed.rs | 2 +- crates/debugger_ui/src/session/inert.rs | 8 +- crates/debugger_ui/src/session/running.rs | 10 +- .../src/session/running/console.rs | 2 +- .../src/session/running/loaded_source_list.rs | 2 +- .../src/session/running/module_list.rs | 4 +- .../src/session/running/stack_frame_list.rs | 8 +- .../src/session/running/variable_list.rs | 8 +- crates/debugger_ui/src/session/starting.rs | 6 +- crates/debugger_ui/src/tests/attach_modal.rs | 2 +- .../debugger_ui/src/tests/debugger_panel.rs | 98 +++-- crates/debugger_ui/src/tests/module_list.rs | 4 +- .../debugger_ui/src/tests/stack_frame_list.rs | 2 +- crates/debugger_ui/src/tests/variable_list.rs | 6 +- crates/deepseek/src/deepseek.rs | 4 +- crates/diagnostics/src/diagnostics.rs | 15 +- crates/diagnostics/src/diagnostics_tests.rs | 8 +- crates/diagnostics/src/items.rs | 4 +- crates/diagnostics/src/toolbar_controls.rs | 2 +- crates/editor/src/clangd_ext.rs | 2 +- crates/editor/src/code_context_menus.rs | 17 +- crates/editor/src/commit_tooltip.rs | 4 +- crates/editor/src/display_map.rs | 20 +- crates/editor/src/display_map/block_map.rs | 44 +- crates/editor/src/display_map/crease_map.rs | 34 +- crates/editor/src/display_map/fold_map.rs | 72 ++-- crates/editor/src/display_map/inlay_map.rs | 44 +- crates/editor/src/display_map/tab_map.rs | 6 +- crates/editor/src/display_map/wrap_map.rs | 28 +- crates/editor/src/editor.rs | 95 ++--- crates/editor/src/editor_settings_controls.rs | 4 +- crates/editor/src/editor_tests.rs | 22 +- crates/editor/src/element.rs | 48 +-- crates/editor/src/git/blame.rs | 5 +- crates/editor/src/hover_links.rs | 38 +- crates/editor/src/hover_popover.rs | 16 +- crates/editor/src/inlay_hint_cache.rs | 12 +- crates/editor/src/inline_completion_tests.rs | 4 +- crates/editor/src/items.rs | 40 +- crates/editor/src/jsx_tag_auto_close.rs | 2 +- crates/editor/src/mouse_context_menu.rs | 10 +- crates/editor/src/movement.rs | 6 +- crates/editor/src/proposed_changes_editor.rs | 6 +- crates/editor/src/rust_analyzer_ext.rs | 6 +- crates/editor/src/scroll.rs | 6 +- crates/editor/src/scroll/actions.rs | 6 +- crates/editor/src/scroll/autoscroll.rs | 4 +- crates/editor/src/scroll/scroll_amount.rs | 2 +- crates/editor/src/selections_collection.rs | 4 +- crates/editor/src/signature_help.rs | 8 +- crates/editor/src/test.rs | 6 +- .../src/test/editor_lsp_test_context.rs | 2 +- crates/editor/src/test/editor_test_context.rs | 10 +- crates/evals/src/eval.rs | 6 +- crates/extension/src/extension.rs | 2 +- crates/extension/src/extension_builder.rs | 6 +- crates/extension/src/extension_manifest.rs | 26 +- crates/extension_api/src/extension_api.rs | 14 +- crates/extension_api/src/http_client.rs | 2 +- crates/extension_api/src/settings.rs | 2 +- crates/extension_cli/src/main.rs | 6 +- crates/extension_host/src/extension_host.rs | 23 +- .../src/extension_store_test.rs | 6 +- crates/extension_host/src/headless_host.rs | 4 +- crates/extension_host/src/wasm_host.rs | 8 +- crates/extension_host/src/wasm_host/wit.rs | 8 +- .../src/wasm_host/wit/since_v0_0_1.rs | 2 +- .../src/wasm_host/wit/since_v0_1_0.rs | 10 +- .../src/wasm_host/wit/since_v0_4_0.rs | 10 +- .../src/components/extension_card.rs | 2 +- .../src/components/feature_upsell.rs | 2 +- crates/extensions_ui/src/extension_suggest.rs | 2 +- .../src/extension_version_selector.rs | 6 +- crates/extensions_ui/src/extensions_ui.rs | 14 +- crates/feature_flags/src/feature_flags.rs | 2 +- crates/feedback/src/feedback.rs | 2 +- crates/feedback/src/feedback_modal.rs | 2 +- crates/file_finder/src/file_finder.rs | 18 +- crates/file_finder/src/file_finder_tests.rs | 2 +- crates/file_finder/src/new_path_prompt.rs | 4 +- crates/file_finder/src/open_path_prompt.rs | 6 +- crates/fs/src/fake_git_repo.rs | 2 +- crates/fs/src/fs.rs | 14 +- crates/fs/src/fs_watcher.rs | 2 +- crates/fsevent/src/fsevent.rs | 2 +- crates/fuzzy/src/fuzzy.rs | 4 +- crates/fuzzy/src/paths.rs | 4 +- crates/fuzzy/src/strings.rs | 2 +- crates/git/src/blame.rs | 8 +- crates/git/src/commit.rs | 2 +- crates/git/src/git.rs | 2 +- crates/git/src/repository.rs | 25 +- crates/git/src/status.rs | 2 +- .../src/git_hosting_providers.rs | 4 +- .../src/providers/chromium.rs | 2 +- .../src/providers/codeberg.rs | 2 +- .../src/providers/github.rs | 2 +- .../src/providers/gitlab.rs | 2 +- crates/git_ui/src/askpass_modal.rs | 6 +- crates/git_ui/src/branch_picker.rs | 10 +- crates/git_ui/src/commit_modal.rs | 6 +- crates/git_ui/src/git_panel.rs | 388 +++++++++--------- crates/git_ui/src/git_ui.rs | 8 +- crates/git_ui/src/onboarding.rs | 6 +- crates/git_ui/src/picker_prompt.rs | 8 +- crates/git_ui/src/project_diff.rs | 88 ++-- crates/git_ui/src/repository_selector.rs | 4 +- crates/go_to_line/src/cursor_position.rs | 6 +- crates/go_to_line/src/go_to_line.rs | 6 +- crates/google_ai/src/google_ai.rs | 4 +- crates/gpui/examples/animation.rs | 6 +- crates/gpui/examples/data_table.rs | 6 +- crates/gpui/examples/gif_viewer.rs | 2 +- crates/gpui/examples/gradient.rs | 4 +- crates/gpui/examples/hello_world.rs | 4 +- crates/gpui/examples/image/image.rs | 6 +- crates/gpui/examples/image_loading.rs | 8 +- crates/gpui/examples/input.rs | 12 +- crates/gpui/examples/on_window_close_quit.rs | 4 +- crates/gpui/examples/opacity.rs | 37 +- crates/gpui/examples/ownership_post.rs | 2 +- crates/gpui/examples/painting.rs | 6 +- crates/gpui/examples/pattern.rs | 4 +- crates/gpui/examples/set_menus.rs | 2 +- crates/gpui/examples/shadow.rs | 4 +- crates/gpui/examples/svg/svg.rs | 4 +- crates/gpui/examples/text_layout.rs | 4 +- crates/gpui/examples/text_wrapper.rs | 4 +- crates/gpui/examples/uniform_list.rs | 4 +- crates/gpui/examples/window.rs | 4 +- crates/gpui/examples/window_positioning.rs | 6 +- crates/gpui/examples/window_shadow.rs | 6 +- crates/gpui/src/action.rs | 4 +- crates/gpui/src/app.rs | 42 +- crates/gpui/src/app/async_context.rs | 2 +- crates/gpui/src/app/entity_map.rs | 8 +- crates/gpui/src/app/test_context.rs | 2 +- crates/gpui/src/assets.rs | 2 +- crates/gpui/src/color.rs | 2 +- crates/gpui/src/element.rs | 4 +- crates/gpui/src/elements/anchored.rs | 4 +- crates/gpui/src/elements/common.rs | 2 +- crates/gpui/src/elements/div.rs | 12 +- crates/gpui/src/elements/img.rs | 14 +- crates/gpui/src/elements/list.rs | 12 +- crates/gpui/src/elements/svg.rs | 6 +- crates/gpui/src/elements/text.rs | 9 +- crates/gpui/src/elements/uniform_list.rs | 8 +- crates/gpui/src/executor.rs | 2 +- crates/gpui/src/gpui.rs | 2 +- crates/gpui/src/interactive.rs | 8 +- crates/gpui/src/keymap.rs | 68 +-- crates/gpui/src/keymap/context.rs | 2 +- crates/gpui/src/path_builder.rs | 2 +- crates/gpui/src/platform.rs | 18 +- crates/gpui/src/platform/blade/blade_atlas.rs | 4 +- crates/gpui/src/platform/linux/dispatcher.rs | 2 +- crates/gpui/src/platform/linux/platform.rs | 10 +- crates/gpui/src/platform/linux/text_system.rs | 8 +- .../gpui/src/platform/linux/wayland/client.rs | 23 +- .../src/platform/linux/wayland/clipboard.rs | 6 +- .../gpui/src/platform/linux/wayland/cursor.rs | 2 +- .../gpui/src/platform/linux/wayland/window.rs | 9 +- crates/gpui/src/platform/linux/x11/client.rs | 23 +- crates/gpui/src/platform/linux/x11/display.rs | 2 +- crates/gpui/src/platform/linux/x11/window.rs | 16 +- .../src/platform/linux/x11/xim_handler.rs | 2 +- crates/gpui/src/platform/mac.rs | 10 +- crates/gpui/src/platform/mac/dispatcher.rs | 2 +- crates/gpui/src/platform/mac/display.rs | 2 +- crates/gpui/src/platform/mac/display_link.rs | 2 +- crates/gpui/src/platform/mac/events.rs | 13 +- crates/gpui/src/platform/mac/metal_atlas.rs | 6 +- .../gpui/src/platform/mac/metal_renderer.rs | 8 +- crates/gpui/src/platform/mac/open_type.rs | 16 +- crates/gpui/src/platform/mac/platform.rs | 19 +- .../gpui/src/platform/mac/screen_capture.rs | 7 +- crates/gpui/src/platform/mac/text_system.rs | 16 +- crates/gpui/src/platform/mac/window.rs | 24 +- crates/gpui/src/platform/test/display.rs | 2 +- crates/gpui/src/platform/test/platform.rs | 8 +- crates/gpui/src/platform/windows/clipboard.rs | 4 +- .../gpui/src/platform/windows/direct_write.rs | 4 +- .../gpui/src/platform/windows/dispatcher.rs | 2 +- crates/gpui/src/platform/windows/display.rs | 4 +- crates/gpui/src/platform/windows/events.rs | 8 +- crates/gpui/src/platform/windows/platform.rs | 16 +- .../src/platform/windows/system_settings.rs | 6 +- crates/gpui/src/platform/windows/util.rs | 6 +- crates/gpui/src/platform/windows/window.rs | 4 +- crates/gpui/src/prelude.rs | 6 +- crates/gpui/src/scene.rs | 4 +- crates/gpui/src/style.rs | 10 +- crates/gpui/src/styled.rs | 8 +- crates/gpui/src/taffy.rs | 11 +- crates/gpui/src/text_system.rs | 6 +- crates/gpui/src/text_system/line.rs | 6 +- crates/gpui/src/text_system/line_layout.rs | 2 +- crates/gpui/src/text_system/line_wrapper.rs | 14 +- crates/gpui/src/window.rs | 32 +- crates/gpui/src/window/prompts.rs | 6 +- crates/gpui_macros/src/derive_app_context.rs | 2 +- crates/gpui_macros/src/derive_into_element.rs | 2 +- .../gpui_macros/src/derive_path_static_str.rs | 2 +- crates/gpui_macros/src/derive_render.rs | 2 +- .../gpui_macros/src/derive_visual_context.rs | 2 +- crates/gpui_macros/src/styles.rs | 4 +- crates/gpui_macros/src/test.rs | 4 +- .../src/structure/wikipedia.rs | 4 +- crates/http_client/src/github.rs | 4 +- crates/http_client/src/http_client.rs | 2 +- crates/image_viewer/src/image_info.rs | 2 +- crates/image_viewer/src/image_viewer.rs | 12 +- crates/indexed_docs/src/providers/rustdoc.rs | 11 +- .../src/providers/rustdoc/to_markdown.rs | 6 +- crates/indexed_docs/src/store.rs | 8 +- .../src/inline_completion_button.rs | 20 +- crates/install_cli/src/install_cli.rs | 4 +- crates/journal/src/journal.rs | 4 +- crates/language/src/buffer.rs | 113 ++--- crates/language/src/buffer_tests.rs | 18 +- crates/language/src/diagnostic_set.rs | 2 +- crates/language/src/language.rs | 12 +- crates/language/src/language_registry.rs | 15 +- crates/language/src/language_settings.rs | 16 +- crates/language/src/proto.rs | 4 +- crates/language/src/syntax_map.rs | 4 +- .../src/syntax_map/syntax_map_tests.rs | 2 +- crates/language/src/text_diff.rs | 3 +- .../src/extension_lsp_adapter.rs | 2 +- crates/language_model/src/fake_provider.rs | 2 +- crates/language_model/src/language_model.rs | 4 +- crates/language_model/src/registry.rs | 2 +- crates/language_model/src/request.rs | 6 +- crates/language_model/src/telemetry.rs | 4 +- .../src/language_model_selector.rs | 6 +- .../language_models/src/provider/anthropic.rs | 10 +- .../language_models/src/provider/bedrock.rs | 13 +- crates/language_models/src/provider/cloud.rs | 18 +- .../src/provider/copilot_chat.rs | 6 +- .../language_models/src/provider/deepseek.rs | 8 +- crates/language_models/src/provider/google.rs | 8 +- .../language_models/src/provider/lmstudio.rs | 10 +- .../language_models/src/provider/mistral.rs | 8 +- crates/language_models/src/provider/ollama.rs | 10 +- .../language_models/src/provider/open_ai.rs | 10 +- crates/language_models/src/settings.rs | 2 +- .../src/ui/instruction_list_item.rs | 2 +- .../src/active_buffer_language.rs | 4 +- .../src/language_selector.rs | 8 +- crates/language_tools/src/key_context_view.rs | 12 +- crates/language_tools/src/lsp_log.rs | 20 +- crates/language_tools/src/lsp_log_tests.rs | 2 +- crates/language_tools/src/syntax_tree_view.rs | 14 +- crates/languages/src/bash.rs | 2 +- crates/languages/src/c.rs | 8 +- crates/languages/src/css.rs | 4 +- crates/languages/src/go.rs | 6 +- crates/languages/src/json.rs | 10 +- crates/languages/src/lib.rs | 2 +- crates/languages/src/python.rs | 12 +- crates/languages/src/rust.rs | 8 +- crates/languages/src/tailwind.rs | 8 +- crates/languages/src/typescript.rs | 10 +- crates/languages/src/vtsls.rs | 6 +- crates/languages/src/yaml.rs | 8 +- crates/livekit_api/src/livekit_api.rs | 2 +- crates/livekit_api/src/token.rs | 2 +- crates/livekit_client/examples/test_app.rs | 22 +- crates/livekit_client/src/livekit_client.rs | 4 +- .../src/livekit_client/playback.rs | 22 +- .../src/mock_client/participant.rs | 2 +- .../src/mock_client/publication.rs | 2 +- .../livekit_client/src/mock_client/track.rs | 2 +- crates/livekit_client/src/test.rs | 6 +- crates/lmstudio/src/lmstudio.rs | 8 +- crates/lsp/src/input_handler.rs | 6 +- crates/lsp/src/lsp.rs | 12 +- crates/markdown/examples/markdown.rs | 6 +- crates/markdown/examples/markdown_as_child.rs | 4 +- crates/markdown/src/markdown.rs | 22 +- .../markdown_preview/src/markdown_elements.rs | 2 +- .../markdown_preview/src/markdown_parser.rs | 4 +- .../markdown_preview/src/markdown_preview.rs | 2 +- .../src/markdown_preview_view.rs | 12 +- .../markdown_preview/src/markdown_renderer.rs | 16 +- crates/media/src/media.rs | 10 +- crates/migrator/src/migrations.rs | 2 +- .../src/migrations/m_2025_01_02/settings.rs | 2 +- .../src/migrations/m_2025_01_29/keymap.rs | 2 +- .../src/migrations/m_2025_01_29/settings.rs | 2 +- .../src/migrations/m_2025_01_30/keymap.rs | 2 +- .../src/migrations/m_2025_01_30/settings.rs | 2 +- .../src/migrations/m_2025_03_03/keymap.rs | 2 +- .../src/migrations/m_2025_03_06/keymap.rs | 2 +- .../src/migrations/m_2025_03_29/settings.rs | 2 +- crates/mistral/src/mistral.rs | 4 +- crates/multi_buffer/src/multi_buffer.rs | 160 ++++---- crates/node_runtime/src/archive.rs | 4 +- crates/node_runtime/src/node_runtime.rs | 12 +- .../notifications/src/notification_store.rs | 6 +- crates/notifications/src/status_toast.rs | 2 +- crates/ollama/src/ollama.rs | 8 +- crates/open_ai/src/open_ai.rs | 4 +- crates/outline/src/outline.rs | 10 +- crates/outline_panel/src/outline_panel.rs | 46 +-- crates/panel/src/panel.rs | 4 +- crates/picker/src/head.rs | 4 +- .../src/highlighted_match_with_paths.rs | 2 +- crates/picker/src/picker.rs | 12 +- crates/prettier/src/prettier.rs | 4 +- crates/project/src/buffer_store.rs | 14 +- crates/project/src/debounced_delay.rs | 2 +- .../project/src/debugger/breakpoint_store.rs | 8 +- crates/project/src/debugger/dap_command.rs | 8 +- crates/project/src/debugger/dap_store.rs | 16 +- crates/project/src/debugger/locator_store.rs | 2 +- .../src/debugger/locator_store/cargo.rs | 2 +- crates/project/src/debugger/session.rs | 36 +- crates/project/src/environment.rs | 4 +- crates/project/src/git_store.rs | 20 +- crates/project/src/image_store.rs | 12 +- crates/project/src/lsp_command.rs | 11 +- crates/project/src/lsp_store.rs | 51 +-- .../project/src/lsp_store/lsp_ext_command.rs | 2 +- crates/project/src/manifest_tree.rs | 4 +- crates/project/src/manifest_tree/path_trie.rs | 2 +- .../project/src/manifest_tree/server_tree.rs | 6 +- crates/project/src/prettier_store.rs | 10 +- crates/project/src/project.rs | 71 ++-- crates/project/src/project_settings.rs | 10 +- crates/project/src/project_tests.rs | 24 +- crates/project/src/task_inventory.rs | 4 +- crates/project/src/task_store.rs | 8 +- crates/project/src/terminals.rs | 2 +- crates/project/src/toolchain_store.rs | 6 +- crates/project/src/worktree_store.rs | 12 +- crates/project_panel/src/project_panel.rs | 77 ++-- .../project_panel/src/project_panel_tests.rs | 9 +- crates/project_symbols/src/project_symbols.rs | 8 +- crates/prompt_library/src/prompt_library.rs | 14 +- crates/prompt_store/src/prompt_store.rs | 8 +- crates/proto/src/typed_envelope.rs | 2 +- .../src/disconnected_overlay.rs | 8 +- crates/recent_projects/src/recent_projects.rs | 14 +- crates/recent_projects/src/remote_servers.rs | 22 +- crates/recent_projects/src/ssh_connections.rs | 12 +- .../src/derive_refineable.rs | 4 +- crates/remote/src/ssh_session.rs | 16 +- crates/remote_server/src/headless_project.rs | 16 +- crates/remote_server/src/main.rs | 2 +- .../remote_server/src/remote_editing_tests.rs | 6 +- crates/remote_server/src/unix.rs | 14 +- .../repl/src/components/kernel_list_item.rs | 2 +- crates/repl/src/components/kernel_options.rs | 4 +- crates/repl/src/kernels/native_kernel.rs | 4 +- crates/repl/src/kernels/remote_kernels.rs | 2 +- crates/repl/src/notebook/cell.rs | 6 +- crates/repl/src/notebook/notebook_ui.rs | 8 +- crates/repl/src/outputs.rs | 6 +- crates/repl/src/outputs/image.rs | 7 +- crates/repl/src/outputs/markdown.rs | 2 +- crates/repl/src/outputs/plain.rs | 4 +- crates/repl/src/outputs/table.rs | 2 +- crates/repl/src/outputs/user_error.rs | 2 +- crates/repl/src/repl.rs | 2 +- crates/repl/src/repl_editor.rs | 2 +- crates/repl/src/repl_sessions_ui.rs | 10 +- crates/repl/src/repl_store.rs | 2 +- crates/repl/src/session.rs | 8 +- crates/reqwest_client/examples/client.rs | 2 +- crates/reqwest_client/src/reqwest_client.rs | 4 +- crates/rope/benches/rope_benchmark.rs | 2 +- crates/rope/src/rope.rs | 32 +- crates/rpc/src/auth.rs | 2 +- crates/rpc/src/conn.rs | 2 +- crates/rpc/src/notification.rs | 2 +- crates/rpc/src/peer.rs | 20 +- crates/rpc/src/proto_client.rs | 6 +- crates/rpc/src/rpc.rs | 2 +- crates/search/src/buffer_search.rs | 22 +- crates/search/src/buffer_search/registrar.rs | 2 +- crates/search/src/project_search.rs | 59 ++- crates/search/src/search.rs | 4 +- crates/search/src/search_bar.rs | 2 +- crates/semantic_index/src/chunking.rs | 4 +- crates/semantic_index/src/embedding.rs | 2 +- crates/semantic_index/src/embedding/cloud.rs | 6 +- .../semantic_index/src/embedding/lmstudio.rs | 2 +- crates/semantic_index/src/embedding/ollama.rs | 2 +- .../semantic_index/src/embedding/open_ai.rs | 2 +- crates/semantic_index/src/embedding_index.rs | 4 +- crates/semantic_index/src/project_index.rs | 2 +- .../src/project_index_debug_view.rs | 6 +- crates/semantic_index/src/semantic_index.rs | 2 +- crates/semantic_index/src/summary_index.rs | 6 +- .../semantic_version/src/semantic_version.rs | 4 +- crates/session/src/session.rs | 16 +- .../settings/src/editable_setting_control.rs | 2 +- crates/settings/src/keymap_file.rs | 10 +- crates/settings/src/settings.rs | 4 +- crates/settings/src/settings_file.rs | 4 +- crates/settings/src/settings_store.rs | 16 +- .../src/appearance_settings_controls.rs | 4 +- crates/settings_ui/src/settings_ui.rs | 4 +- crates/snippet/src/snippet.rs | 2 +- crates/snippet_provider/src/format.rs | 2 +- crates/snippet_provider/src/registry.rs | 2 +- crates/snippets_ui/src/snippets_ui.rs | 10 +- crates/sqlez/src/connection.rs | 18 +- crates/sqlez/src/migrations.rs | 2 +- crates/sqlez/src/savepoint.rs | 36 +- crates/sqlez/src/statement.rs | 16 +- crates/sqlez/src/thread_safe_connection.rs | 2 +- crates/story/src/story.rs | 4 +- crates/storybook/src/assets.rs | 2 +- .../src/stories/auto_height_editor.rs | 4 +- .../storybook/src/stories/default_colors.rs | 6 +- crates/storybook/src/stories/focus.rs | 2 +- crates/storybook/src/stories/kitchen_sink.rs | 2 +- crates/storybook/src/stories/picker.rs | 4 +- crates/storybook/src/stories/scroll.rs | 4 +- crates/storybook/src/stories/text.rs | 4 +- crates/storybook/src/story_selector.rs | 2 +- crates/storybook/src/storybook.rs | 2 +- crates/sum_tree/src/sum_tree.rs | 8 +- crates/supermaven/src/supermaven.rs | 8 +- crates/supermaven_api/src/supermaven_api.rs | 4 +- crates/tab_switcher/src/tab_switcher.rs | 12 +- crates/task/src/debug_format.rs | 4 +- crates/task/src/lib.rs | 2 +- crates/task/src/static_source.rs | 2 +- crates/task/src/task_template.rs | 13 +- crates/task/src/vscode_format.rs | 2 +- crates/tasks_ui/src/modal.rs | 16 +- crates/tasks_ui/src/tasks_ui.rs | 4 +- crates/terminal/src/mappings/mouse.rs | 2 +- crates/terminal/src/terminal.rs | 23 +- crates/terminal/src/terminal_settings.rs | 6 +- crates/terminal_view/src/persistence.rs | 9 +- crates/terminal_view/src/terminal_element.rs | 17 +- crates/terminal_view/src/terminal_panel.rs | 31 +- .../terminal_view/src/terminal_scrollbar.rs | 4 +- .../terminal_view/src/terminal_tab_tooltip.rs | 2 +- crates/terminal_view/src/terminal_view.rs | 28 +- crates/text/src/anchor.rs | 4 +- crates/text/src/locator.rs | 2 +- crates/text/src/text.rs | 4 +- crates/theme/src/default_colors.rs | 2 +- crates/theme/src/fallback_themes.rs | 7 +- crates/theme/src/registry.rs | 6 +- crates/theme/src/schema.rs | 2 +- crates/theme/src/settings.rs | 12 +- crates/theme/src/styles/accents.rs | 4 +- crates/theme/src/styles/players.rs | 2 +- crates/theme/src/styles/system.rs | 2 +- crates/theme/src/theme.rs | 4 +- crates/theme_importer/src/assets.rs | 2 +- crates/theme_importer/src/vscode/converter.rs | 2 +- .../theme_selector/src/icon_theme_selector.rs | 8 +- crates/theme_selector/src/theme_selector.rs | 12 +- crates/time_format/src/time_format.rs | 4 +- crates/title_bar/src/application_menu.rs | 2 +- crates/title_bar/src/collab.rs | 8 +- crates/title_bar/src/onboarding_banner.rs | 2 +- .../title_bar/src/platforms/platform_linux.rs | 2 +- .../src/platforms/platform_windows.rs | 2 +- crates/title_bar/src/title_bar.rs | 12 +- crates/title_bar/src/window_controls.rs | 2 +- .../src/active_toolchain.rs | 6 +- .../src/toolchain_selector.rs | 8 +- crates/ui/src/components/avatar.rs | 2 +- crates/ui/src/components/button/button.rs | 8 +- .../ui/src/components/button/button_icon.rs | 2 +- .../ui/src/components/button/button_like.rs | 6 +- .../ui/src/components/button/icon_button.rs | 2 +- .../ui/src/components/button/split_button.rs | 6 +- .../ui/src/components/button/toggle_button.rs | 2 +- crates/ui/src/components/content_group.rs | 2 +- crates/ui/src/components/context_menu.rs | 8 +- crates/ui/src/components/disclosure.rs | 2 +- crates/ui/src/components/dropdown_menu.rs | 2 +- crates/ui/src/components/facepile.rs | 2 +- crates/ui/src/components/group.rs | 2 +- crates/ui/src/components/icon.rs | 4 +- .../ui/src/components/icon/decorated_icon.rs | 2 +- .../ui/src/components/icon/icon_decoration.rs | 2 +- crates/ui/src/components/image.rs | 4 +- crates/ui/src/components/indent_guides.rs | 23 +- crates/ui/src/components/indicator.rs | 2 +- crates/ui/src/components/keybinding.rs | 6 +- crates/ui/src/components/keybinding_hint.rs | 2 +- .../src/components/label/highlighted_label.rs | 2 +- crates/ui/src/components/label/label.rs | 2 +- crates/ui/src/components/list/list.rs | 2 +- crates/ui/src/components/list/list_header.rs | 2 +- crates/ui/src/components/list/list_item.rs | 4 +- .../ui/src/components/list/list_sub_header.rs | 2 +- crates/ui/src/components/modal.rs | 4 +- .../components/notification/alert_modal.rs | 2 +- crates/ui/src/components/numeric_stepper.rs | 2 +- crates/ui/src/components/popover.rs | 2 +- crates/ui/src/components/popover_menu.rs | 8 +- crates/ui/src/components/right_click_menu.rs | 8 +- crates/ui/src/components/scrollbar.rs | 16 +- crates/ui/src/components/settings_group.rs | 2 +- crates/ui/src/components/stack.rs | 2 +- .../ui/src/components/stories/context_menu.rs | 4 +- .../ui/src/components/stories/disclosure.rs | 2 +- .../ui/src/components/stories/icon_button.rs | 2 +- .../ui/src/components/stories/keybinding.rs | 2 +- crates/ui/src/components/stories/list.rs | 2 +- .../ui/src/components/stories/list_header.rs | 2 +- crates/ui/src/components/stories/list_item.rs | 2 +- crates/ui/src/components/stories/tab.rs | 2 +- crates/ui/src/components/stories/tab_bar.rs | 2 +- .../src/components/stories/toggle_button.rs | 2 +- crates/ui/src/components/tab_bar.rs | 2 +- crates/ui/src/components/table.rs | 4 +- crates/ui/src/components/toggle.rs | 4 +- crates/ui/src/components/tooltip.rs | 2 +- crates/ui/src/prelude.rs | 20 +- crates/ui/src/styles/animation.rs | 2 +- crates/ui/src/styles/elevation.rs | 4 +- crates/ui/src/styles/spacing.rs | 2 +- crates/ui/src/styles/typography.rs | 6 +- crates/ui/src/styles/units.rs | 2 +- crates/ui/src/tests/path_str.rs | 2 +- crates/ui/src/traits/styled_ext.rs | 4 +- crates/ui/src/utils/with_rem_size.rs | 4 +- crates/ui_macros/src/derive_component.rs | 2 +- crates/ui_macros/src/derive_path_str.rs | 2 +- crates/ui_macros/src/dynamic_spacing.rs | 2 +- crates/ui_prompt/src/ui_prompt.rs | 7 +- crates/util/src/fs.rs | 2 +- crates/util/src/util.rs | 4 +- crates/util_macros/src/util_macros.rs | 2 +- crates/vim/src/change_list.rs | 6 +- crates/vim/src/command.rs | 12 +- crates/vim/src/digraph.rs | 6 +- crates/vim/src/helix.rs | 6 +- crates/vim/src/indent.rs | 4 +- crates/vim/src/insert.rs | 6 +- crates/vim/src/mode_indicator.rs | 4 +- crates/vim/src/motion.rs | 8 +- crates/vim/src/normal.rs | 11 +- crates/vim/src/normal/case.rs | 2 +- crates/vim/src/normal/change.rs | 4 +- crates/vim/src/normal/delete.rs | 4 +- crates/vim/src/normal/increment.rs | 6 +- crates/vim/src/normal/mark.rs | 4 +- crates/vim/src/normal/paste.rs | 10 +- crates/vim/src/normal/repeat.rs | 4 +- crates/vim/src/normal/scroll.rs | 6 +- crates/vim/src/normal/search.rs | 8 +- crates/vim/src/normal/substitute.rs | 6 +- crates/vim/src/normal/toggle_comments.rs | 4 +- crates/vim/src/normal/yank.rs | 2 +- crates/vim/src/object.rs | 6 +- crates/vim/src/replace.rs | 8 +- crates/vim/src/rewrap.rs | 6 +- crates/vim/src/state.rs | 6 +- crates/vim/src/surrounds.rs | 6 +- crates/vim/src/test.rs | 10 +- .../src/test/neovim_backed_test_context.rs | 4 +- crates/vim/src/test/neovim_connection.rs | 2 +- crates/vim/src/test/vim_test_context.rs | 2 +- crates/vim/src/vim.rs | 10 +- crates/vim/src/visual.rs | 8 +- crates/welcome/src/base_keymap_picker.rs | 12 +- crates/welcome/src/multibuffer_hint.rs | 4 +- crates/welcome/src/welcome.rs | 13 +- crates/workspace/src/dock.rs | 13 +- crates/workspace/src/item.rs | 8 +- crates/workspace/src/notifications.rs | 12 +- crates/workspace/src/pane.rs | 37 +- crates/workspace/src/pane_group.rs | 14 +- crates/workspace/src/persistence.rs | 8 +- crates/workspace/src/persistence/model.rs | 6 +- crates/workspace/src/searchable.rs | 2 +- crates/workspace/src/shared_screen.rs | 10 +- crates/workspace/src/theme_preview.rs | 10 +- crates/workspace/src/toast_layer.rs | 2 +- crates/workspace/src/workspace.rs | 54 +-- crates/worktree/src/worktree.rs | 31 +- crates/worktree/src/worktree_tests.rs | 36 +- crates/zed/src/main.rs | 28 +- crates/zed/src/reliability.rs | 13 +- crates/zed/src/zed.rs | 60 +-- .../zed/src/zed/inline_completion_registry.rs | 2 +- crates/zed/src/zed/open_listener.rs | 14 +- crates/zed/src/zed/quick_action_bar.rs | 8 +- .../zed/quick_action_bar/markdown_preview.rs | 4 +- .../zed/src/zed/quick_action_bar/repl_menu.rs | 11 +- crates/zed/src/zed/windows_only_instance.rs | 10 +- crates/zed_actions/src/lib.rs | 2 +- crates/zeta/src/completion_diff_element.rs | 4 +- crates/zeta/src/init.rs | 2 +- crates/zeta/src/input_excerpt.rs | 4 +- crates/zeta/src/onboarding_modal.rs | 12 +- crates/zeta/src/rate_completion_modal.rs | 4 +- crates/zeta/src/zeta.rs | 22 +- crates/zlog/src/zlog.rs | 2 +- extensions/glsl/src/glsl.rs | 2 +- extensions/html/src/html.rs | 2 +- extensions/perplexity/src/perplexity.rs | 2 +- extensions/proto/src/proto.rs | 2 +- extensions/ruff/src/ruff.rs | 2 +- extensions/snippets/src/snippets.rs | 2 +- tooling/xtask/src/tasks/clippy.rs | 2 +- tooling/xtask/src/tasks/licenses.rs | 2 +- tooling/xtask/src/tasks/package_conformity.rs | 2 +- 802 files changed, 3766 insertions(+), 3653 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5535c89196725bcda86e8f85b726ae15928ccdec..bbec1874f08faab2e5b6a5df048e14961bb5d00d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -198,7 +198,7 @@ default-members = ["crates/zed"] [workspace.package] publish = false -edition = "2021" +edition = "2024" [workspace.dependencies] diff --git a/crates/activity_indicator/src/activity_indicator.rs b/crates/activity_indicator/src/activity_indicator.rs index dbe3596a43434cd841bdde9c561e067a7977c935..8a0df784a841b44557fd2983216483e25e4b5d57 100644 --- a/crates/activity_indicator/src/activity_indicator.rs +++ b/crates/activity_indicator/src/activity_indicator.rs @@ -3,9 +3,9 @@ use editor::Editor; use extension_host::ExtensionStore; use futures::StreamExt; use gpui::{ - actions, percentage, Animation, AnimationExt as _, App, Context, CursorStyle, Entity, - EventEmitter, InteractiveElement as _, ParentElement as _, Render, SharedString, - StatefulInteractiveElement, Styled, Transformation, Window, + Animation, AnimationExt as _, App, Context, CursorStyle, Entity, EventEmitter, + InteractiveElement as _, ParentElement as _, Render, SharedString, StatefulInteractiveElement, + Styled, Transformation, Window, actions, percentage, }; use language::{BinaryStatus, LanguageRegistry, LanguageServerId}; use project::{ @@ -14,9 +14,9 @@ use project::{ }; use smallvec::SmallVec; use std::{cmp::Reverse, fmt::Write, sync::Arc, time::Duration}; -use ui::{prelude::*, ButtonLike, ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip}; +use ui::{ButtonLike, ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; use util::truncate_and_trailoff; -use workspace::{item::ItemHandle, StatusItemView, Workspace}; +use workspace::{StatusItemView, Workspace, item::ItemHandle}; actions!(activity_indicator, [ShowErrorMessage]); diff --git a/crates/anthropic/src/anthropic.rs b/crates/anthropic/src/anthropic.rs index b4dd343d07fcba7e9ed3723ecaefb69f10afc57b..3345765643c853a9a5b4c302fd9f04fba6a4e9b0 100644 --- a/crates/anthropic/src/anthropic.rs +++ b/crates/anthropic/src/anthropic.rs @@ -2,9 +2,9 @@ mod supported_countries; use std::{pin::Pin, str::FromStr}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use chrono::{DateTime, Utc}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, Stream, StreamExt}; +use futures::{AsyncBufReadExt, AsyncReadExt, Stream, StreamExt, io::BufReader, stream::BoxStream}; use http_client::http::{HeaderMap, HeaderValue}; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; diff --git a/crates/askpass/src/askpass.rs b/crates/askpass/src/askpass.rs index cc2d235c0335598b8102fc7b7ace6418e4bf7be1..ee7dd9bc0e098f0a44661c0c83c2fa91a19fcd40 100644 --- a/crates/askpass/src/askpass.rs +++ b/crates/askpass/src/askpass.rs @@ -5,9 +5,9 @@ use std::time::Duration; use anyhow::Context as _; use futures::channel::{mpsc, oneshot}; #[cfg(unix)] -use futures::{io::BufReader, AsyncBufReadExt as _}; +use futures::{AsyncBufReadExt as _, io::BufReader}; #[cfg(unix)] -use futures::{select_biased, AsyncWriteExt as _, FutureExt as _}; +use futures::{AsyncWriteExt as _, FutureExt as _, select_biased}; use futures::{SinkExt, StreamExt}; use gpui::{AsyncApp, BackgroundExecutor, Task}; #[cfg(unix)] diff --git a/crates/assets/src/assets.rs b/crates/assets/src/assets.rs index 8f8831269bed0d7a924b12ad0dfb393a929d82f0..5ad0cb7954929a0f109a44cf600f5e5eceb2f86c 100644 --- a/crates/assets/src/assets.rs +++ b/crates/assets/src/assets.rs @@ -57,10 +57,11 @@ impl Assets { pub fn load_test_fonts(&self, cx: &App) { cx.text_system() - .add_fonts(vec![self - .load("fonts/plex-mono/ZedPlexMono-Regular.ttf") - .unwrap() - .unwrap()]) + .add_fonts(vec![ + self.load("fonts/plex-mono/ZedPlexMono-Regular.ttf") + .unwrap() + .unwrap(), + ]) .unwrap() } } diff --git a/crates/assistant/src/assistant.rs b/crates/assistant/src/assistant.rs index a236d1ff720aed32be0c3ca1e2570d63e5cec264..093713d2e7580be6d152d0fcce662be4e0429707 100644 --- a/crates/assistant/src/assistant.rs +++ b/crates/assistant/src/assistant.rs @@ -14,7 +14,7 @@ use client::Client; use command_palette_hooks::CommandPaletteFilter; use feature_flags::FeatureFlagAppExt; use fs::Fs; -use gpui::{actions, App, Global, ReadGlobal, UpdateGlobal}; +use gpui::{App, Global, ReadGlobal, UpdateGlobal, actions}; use language_model::{ LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage, }; diff --git a/crates/assistant/src/assistant_configuration.rs b/crates/assistant/src/assistant_configuration.rs index 711f4d98b898f4471b0a42f0f70fd5591488f8c2..cb3d268a63f947cb2687c980d366b81f729a5163 100644 --- a/crates/assistant/src/assistant_configuration.rs +++ b/crates/assistant/src/assistant_configuration.rs @@ -1,9 +1,9 @@ use std::sync::Arc; use collections::HashMap; -use gpui::{canvas, AnyView, App, EventEmitter, FocusHandle, Focusable, Subscription}; +use gpui::{AnyView, App, EventEmitter, FocusHandle, Focusable, Subscription, canvas}; use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry}; -use ui::{prelude::*, ElevationIndex}; +use ui::{ElevationIndex, prelude::*}; use workspace::Item; pub struct ConfigurationView { diff --git a/crates/assistant/src/assistant_panel.rs b/crates/assistant/src/assistant_panel.rs index 520d6f850ab65f19e9983ee4b0311e3d8dca6e78..1bb1ac0896b50d43e4d2b71f29ab823caa8e7dc8 100644 --- a/crates/assistant/src/assistant_panel.rs +++ b/crates/assistant/src/assistant_panel.rs @@ -1,43 +1,44 @@ -use crate::assistant_configuration::{ConfigurationView, ConfigurationViewEvent}; use crate::Assistant; +use crate::assistant_configuration::{ConfigurationView, ConfigurationViewEvent}; use crate::{ - terminal_inline_assistant::TerminalInlineAssistant, DeployHistory, InlineAssistant, NewChat, + DeployHistory, InlineAssistant, NewChat, terminal_inline_assistant::TerminalInlineAssistant, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_context_editor::{ - make_lsp_adapter_delegate, AssistantContext, AssistantPanelDelegate, ContextEditor, - ContextEditorToolbarItem, ContextEditorToolbarItemEvent, ContextHistory, ContextId, - ContextStore, ContextStoreEvent, InsertDraggedFiles, SlashCommandCompletionProvider, - DEFAULT_TAB_TITLE, + AssistantContext, AssistantPanelDelegate, ContextEditor, ContextEditorToolbarItem, + ContextEditorToolbarItemEvent, ContextHistory, ContextId, ContextStore, ContextStoreEvent, + DEFAULT_TAB_TITLE, InsertDraggedFiles, SlashCommandCompletionProvider, + make_lsp_adapter_delegate, }; use assistant_settings::{AssistantDockPosition, AssistantSettings}; use assistant_slash_command::SlashCommandWorkingSet; -use client::{proto, Client, Status}; +use client::{Client, Status, proto}; use editor::{Editor, EditorEvent}; use fs::Fs; use gpui::{ - prelude::*, Action, App, AsyncWindowContext, Entity, EventEmitter, ExternalPaths, FocusHandle, - Focusable, InteractiveElement, IntoElement, ParentElement, Pixels, Render, Styled, - Subscription, Task, UpdateGlobal, WeakEntity, + Action, App, AsyncWindowContext, Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable, + InteractiveElement, IntoElement, ParentElement, Pixels, Render, Styled, Subscription, Task, + UpdateGlobal, WeakEntity, prelude::*, }; use language::LanguageRegistry; use language_model::{ AuthenticateError, LanguageModelProviderId, LanguageModelRegistry, ZED_CLOUD_PROVIDER_ID, }; use project::Project; -use prompt_library::{open_prompt_library, PromptLibrary}; +use prompt_library::{PromptLibrary, open_prompt_library}; use prompt_store::PromptBuilder; -use search::{buffer_search::DivRegistrar, BufferSearchBar}; -use settings::{update_settings_file, Settings}; +use search::{BufferSearchBar, buffer_search::DivRegistrar}; +use settings::{Settings, update_settings_file}; use smol::stream::StreamExt; use std::{ops::ControlFlow, path::PathBuf, sync::Arc}; -use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; -use ui::{prelude::*, ContextMenu, PopoverMenu, Tooltip}; -use util::{maybe, ResultExt}; +use terminal_view::{TerminalView, terminal_panel::TerminalPanel}; +use ui::{ContextMenu, PopoverMenu, Tooltip, prelude::*}; +use util::{ResultExt, maybe}; use workspace::DraggedTab; use workspace::{ + DraggedSelection, Pane, ShowConfiguration, ToggleZoom, Workspace, dock::{DockPosition, Panel, PanelEvent}, - pane, DraggedSelection, Pane, ShowConfiguration, ToggleZoom, Workspace, + pane, }; use zed_actions::assistant::{InlineAssist, OpenPromptLibrary, ToggleFocus}; diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rs index da6fd986cd523056700725540492fec22f8169d3..45f426b3bb080c6bfc803e6613c8679047dc8001 100644 --- a/crates/assistant/src/inline_assistant.rs +++ b/crates/assistant/src/inline_assistant.rs @@ -2,39 +2,40 @@ use crate::{ Assistant, AssistantPanel, AssistantPanelEvent, CycleNextInlineAssist, CyclePreviousInlineAssist, }; -use anyhow::{anyhow, Context as _, Result}; -use assistant_context_editor::{humanize_token_count, RequestType}; +use anyhow::{Context as _, Result, anyhow}; +use assistant_context_editor::{RequestType, humanize_token_count}; use assistant_settings::AssistantSettings; -use client::{telemetry::Telemetry, ErrorExt}; -use collections::{hash_map, HashMap, HashSet, VecDeque}; +use client::{ErrorExt, telemetry::Telemetry}; +use collections::{HashMap, HashSet, VecDeque, hash_map}; use editor::{ + Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorElement, EditorEvent, EditorMode, + EditorStyle, ExcerptId, ExcerptRange, GutterDimensions, MultiBuffer, MultiBufferSnapshot, + ToOffset as _, ToPoint, actions::{MoveDown, MoveUp, SelectAll}, display_map::{ BlockContext, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock, ToDisplayPoint, }, - Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorElement, EditorEvent, EditorMode, - EditorStyle, ExcerptId, ExcerptRange, GutterDimensions, MultiBuffer, MultiBufferSnapshot, - ToOffset as _, ToPoint, }; use feature_flags::{ Assistant2FeatureFlag, FeatureFlagAppExt as _, FeatureFlagViewExt as _, ZedPro, }; use fs::Fs; use futures::{ + SinkExt, Stream, StreamExt, channel::mpsc, future::{BoxFuture, LocalBoxFuture}, - join, SinkExt, Stream, StreamExt, + join, }; use gpui::{ - anchored, deferred, point, AnyElement, App, ClickEvent, Context, CursorStyle, Entity, - EventEmitter, FocusHandle, Focusable, FontWeight, Global, HighlightStyle, Subscription, Task, - TextStyle, UpdateGlobal, WeakEntity, Window, + AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle, + Focusable, FontWeight, Global, HighlightStyle, Subscription, Task, TextStyle, UpdateGlobal, + WeakEntity, Window, anchored, deferred, point, }; -use language::{line_diff, Buffer, IndentKind, Point, Selection, TransactionId}; +use language::{Buffer, IndentKind, Point, Selection, TransactionId, line_diff}; use language_model::{ - report_assistant_event, LanguageModel, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, LanguageModelTextStream, Role, + LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, + LanguageModelTextStream, Role, report_assistant_event, }; use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu}; use multi_buffer::MultiBufferRow; @@ -42,7 +43,7 @@ use parking_lot::Mutex; use project::{CodeAction, LspAction, ProjectTransaction}; use prompt_store::PromptBuilder; use rope::Rope; -use settings::{update_settings_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, update_settings_file}; use smol::future::FutureExt; use std::{ cmp, @@ -61,10 +62,10 @@ use terminal_view::terminal_panel::TerminalPanel; use text::{OffsetRangeExt, ToPoint as _}; use theme::ThemeSettings; use ui::{ - prelude::*, text_for_action, CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, Tooltip, + CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, Tooltip, prelude::*, text_for_action, }; use util::{RangeExt, ResultExt}; -use workspace::{notifications::NotificationId, ItemHandle, Toast, Workspace}; +use workspace::{ItemHandle, Toast, Workspace, notifications::NotificationId}; pub fn init( fs: Arc, @@ -3710,8 +3711,8 @@ mod tests { use gpui::TestAppContext; use indoc::indoc; use language::{ - language_settings, tree_sitter_rust, Buffer, Language, LanguageConfig, LanguageMatcher, - Point, + Buffer, Language, LanguageConfig, LanguageMatcher, Point, language_settings, + tree_sitter_rust, }; use language_model::{LanguageModelRegistry, TokenUsage}; use rand::prelude::*; diff --git a/crates/assistant/src/terminal_inline_assistant.rs b/crates/assistant/src/terminal_inline_assistant.rs index b3132d44f2c5482acf97c73251678934f47adb33..3c561cf1d8071e9cf879a5c5781d65cd1bfef97f 100644 --- a/crates/assistant/src/terminal_inline_assistant.rs +++ b/crates/assistant/src/terminal_inline_assistant.rs @@ -1,27 +1,27 @@ use crate::{AssistantPanel, AssistantPanelEvent, DEFAULT_CONTEXT_LINES}; use anyhow::{Context as _, Result}; -use assistant_context_editor::{humanize_token_count, RequestType}; +use assistant_context_editor::{RequestType, humanize_token_count}; use assistant_settings::AssistantSettings; use client::telemetry::Telemetry; use collections::{HashMap, VecDeque}; use editor::{ - actions::{MoveDown, MoveUp, SelectAll}, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, MultiBuffer, + actions::{MoveDown, MoveUp, SelectAll}, }; use fs::Fs; -use futures::{channel::mpsc, SinkExt, StreamExt}; +use futures::{SinkExt, StreamExt, channel::mpsc}; use gpui::{ App, Context, Entity, EventEmitter, FocusHandle, Focusable, Global, Subscription, Task, TextStyle, UpdateGlobal, WeakEntity, }; use language::Buffer; use language_model::{ - report_assistant_event, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, Role, + LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role, + report_assistant_event, }; use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu}; use prompt_store::PromptBuilder; -use settings::{update_settings_file, Settings}; +use settings::{Settings, update_settings_file}; use std::{ cmp, sync::Arc, @@ -31,9 +31,9 @@ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use terminal::Terminal; use terminal_view::TerminalView; use theme::ThemeSettings; -use ui::{prelude::*, text_for_action, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*, text_for_action}; use util::ResultExt; -use workspace::{notifications::NotificationId, Toast, Workspace}; +use workspace::{Toast, Workspace, notifications::NotificationId}; pub fn init( fs: Arc, diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs index 1ded4c9615ac1ca8ac6a1fc7c6aca190f9bb696e..58db8f307f547e55c37aea425d365e7c4168f001 100644 --- a/crates/assistant2/src/active_thread.rs +++ b/crates/assistant2/src/active_thread.rs @@ -1,3 +1,4 @@ +use crate::AssistantPanel; use crate::context::{AssistantContext, ContextId}; use crate::thread::{ LastRestoreCheckpoint, MessageId, MessageSegment, RequestKind, Thread, ThreadError, @@ -6,16 +7,15 @@ use crate::thread::{ use crate::thread_store::ThreadStore; use crate::tool_use::{PendingToolUseStatus, ToolUse, ToolUseStatus}; use crate::ui::{AgentNotification, AgentNotificationEvent, ContextPill}; -use crate::AssistantPanel; use assistant_settings::{AssistantSettings, NotifyWhenAgentWaiting}; use collections::HashMap; use editor::{Editor, MultiBuffer}; use gpui::{ - linear_color_stop, linear_gradient, list, percentage, pulsating_between, AbsoluteLength, - Animation, AnimationExt, AnyElement, App, ClickEvent, DefiniteLength, EdgesRefinement, Empty, - Entity, Focusable, Hsla, Length, ListAlignment, ListState, MouseButton, PlatformDisplay, - ScrollHandle, Stateful, StyleRefinement, Subscription, Task, TextStyleRefinement, - Transformation, UnderlineStyle, WeakEntity, WindowHandle, + AbsoluteLength, Animation, AnimationExt, AnyElement, App, ClickEvent, DefiniteLength, + EdgesRefinement, Empty, Entity, Focusable, Hsla, Length, ListAlignment, ListState, MouseButton, + PlatformDisplay, ScrollHandle, Stateful, StyleRefinement, Subscription, Task, + TextStyleRefinement, Transformation, UnderlineStyle, WeakEntity, WindowHandle, + linear_color_stop, linear_gradient, list, percentage, pulsating_between, }; use language::{Buffer, LanguageRegistry}; use language_model::{LanguageModelRegistry, LanguageModelToolUseId, Role}; @@ -27,11 +27,11 @@ use std::sync::Arc; use std::time::Duration; use text::ToPoint; use theme::ThemeSettings; -use ui::{prelude::*, Disclosure, IconButton, KeyBinding, Scrollbar, ScrollbarState, Tooltip}; +use ui::{Disclosure, IconButton, KeyBinding, Scrollbar, ScrollbarState, Tooltip, prelude::*}; use util::ResultExt as _; use workspace::{OpenOptions, Workspace}; -use crate::context_store::{refresh_context_store_text, ContextStore}; +use crate::context_store::{ContextStore, refresh_context_store_text}; pub struct ActiveThread { language_registry: Arc, diff --git a/crates/assistant2/src/assistant.rs b/crates/assistant2/src/assistant.rs index ff17faa465d153c406071c680e6b38b3acbc5e69..4e8be9f881b3578124c8a48cd1e99b00b3b568c4 100644 --- a/crates/assistant2/src/assistant.rs +++ b/crates/assistant2/src/assistant.rs @@ -28,7 +28,7 @@ use client::Client; use command_palette_hooks::CommandPaletteFilter; use feature_flags::{Assistant2FeatureFlag, FeatureFlagAppExt}; use fs::Fs; -use gpui::{actions, impl_actions, App}; +use gpui::{App, actions, impl_actions}; use prompt_store::PromptBuilder; use schemars::JsonSchema; use serde::Deserialize; diff --git a/crates/assistant2/src/assistant_configuration.rs b/crates/assistant2/src/assistant_configuration.rs index 8fca785606d3a4b8f478682d8753ac06651bc78b..1b6b096ee47d31673c037f66c8646982a32efadb 100644 --- a/crates/assistant2/src/assistant_configuration.rs +++ b/crates/assistant2/src/assistant_configuration.rs @@ -9,7 +9,7 @@ use collections::HashMap; use context_server::manager::ContextServerManager; use gpui::{Action, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, Subscription}; use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry}; -use ui::{prelude::*, Disclosure, Divider, DividerColor, ElevationIndex, Indicator, Switch}; +use ui::{Disclosure, Divider, DividerColor, ElevationIndex, Indicator, Switch, prelude::*}; use util::ResultExt as _; use zed_actions::ExtensionCategoryFilter; diff --git a/crates/assistant2/src/assistant_configuration/add_context_server_modal.rs b/crates/assistant2/src/assistant_configuration/add_context_server_modal.rs index 1cfb97f4be48d041aa2b78150dbe8fc0c8a3d218..cc1f97a6438ebc7dd916869089f4e79fece1e45e 100644 --- a/crates/assistant2/src/assistant_configuration/add_context_server_modal.rs +++ b/crates/assistant2/src/assistant_configuration/add_context_server_modal.rs @@ -1,9 +1,9 @@ use context_server::{ContextServerSettings, ServerCommand, ServerConfig}; use editor::Editor; -use gpui::{prelude::*, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, WeakEntity}; +use gpui::{DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, WeakEntity, prelude::*}; use serde_json::json; use settings::update_settings_file; -use ui::{prelude::*, Modal, ModalFooter, ModalHeader, Section, Tooltip}; +use ui::{Modal, ModalFooter, ModalHeader, Section, Tooltip, prelude::*}; use workspace::{ModalView, Workspace}; use crate::AddContextServer; diff --git a/crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs b/crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs index e45af2d37e5787cff7a488fbf03da8d5170aaab7..434f44d97deb702bc70e54a079a26ada307758f3 100644 --- a/crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs +++ b/crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs @@ -11,12 +11,12 @@ use convert_case::{Case, Casing as _}; use editor::Editor; use fs::Fs; use gpui::{ - prelude::*, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Subscription, - WeakEntity, + DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Subscription, WeakEntity, + prelude::*, }; -use settings::{update_settings_file, Settings as _}; +use settings::{Settings as _, update_settings_file}; use ui::{ - prelude::*, KeyBinding, ListItem, ListItemSpacing, ListSeparator, Navigable, NavigableEntry, + KeyBinding, ListItem, ListItemSpacing, ListSeparator, Navigable, NavigableEntry, prelude::*, }; use workspace::{ModalView, Workspace}; diff --git a/crates/assistant2/src/assistant_configuration/tool_picker.rs b/crates/assistant2/src/assistant_configuration/tool_picker.rs index 210c8cf8c611ac8e55355fcaaff5d0b301ff6342..5c1ca4bed587a372f5a545c8ca8b23e79efbbd1a 100644 --- a/crates/assistant2/src/assistant_configuration/tool_picker.rs +++ b/crates/assistant2/src/assistant_configuration/tool_picker.rs @@ -6,11 +6,11 @@ use assistant_settings::{ }; use assistant_tool::{ToolSource, ToolWorkingSet}; use fs::Fs; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{App, Context, DismissEvent, Entity, EventEmitter, Focusable, Task, WeakEntity, Window}; use picker::{Picker, PickerDelegate}; -use settings::{update_settings_file, Settings as _}; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use settings::{Settings as _, update_settings_file}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt as _; use crate::ThreadStore; diff --git a/crates/assistant2/src/assistant_diff.rs b/crates/assistant2/src/assistant_diff.rs index 5d4f4dc5153e8cfc6ba8227533b293bd11e2bc46..32278663392765ee83da8629492d7151b008900f 100644 --- a/crates/assistant2/src/assistant_diff.rs +++ b/crates/assistant2/src/assistant_diff.rs @@ -3,12 +3,12 @@ use anyhow::Result; use buffer_diff::DiffHunkStatus; use collections::HashSet; use editor::{ - actions::{GoToHunk, GoToPreviousHunk}, Direction, Editor, EditorEvent, MultiBuffer, ToPoint, + actions::{GoToHunk, GoToPreviousHunk}, }; use gpui::{ - prelude::*, Action, AnyElement, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, - SharedString, Subscription, Task, WeakEntity, Window, + Action, AnyElement, AnyView, App, Entity, EventEmitter, FocusHandle, Focusable, SharedString, + Subscription, Task, WeakEntity, Window, prelude::*, }; use language::{Capability, DiskState, OffsetRangeExt, Point}; use multi_buffer::PathKey; @@ -18,12 +18,12 @@ use std::{ ops::Range, sync::Arc, }; -use ui::{prelude::*, IconButtonShape, KeyBinding, Tooltip}; +use ui::{IconButtonShape, KeyBinding, Tooltip, prelude::*}; use workspace::{ - item::{BreadcrumbText, ItemEvent, TabContentParams}, - searchable::SearchableItemHandle, Item, ItemHandle, ItemNavHistory, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + item::{BreadcrumbText, ItemEvent, TabContentParams}, + searchable::SearchableItemHandle, }; pub struct AssistantDiff { @@ -566,25 +566,27 @@ fn render_diff_hunk_controls( }), ] } else { - vec![Button::new(("review", row as u64), "Review") - .key_binding(KeyBinding::for_action_in( - &ToggleKeep, - &editor.read(cx).focus_handle(cx), - window, - cx, - )) - .on_click({ - let assistant_diff = assistant_diff.clone(); - move |_event, _window, cx| { - assistant_diff.update(cx, |diff, cx| { - diff.review_diff_hunks( - vec![hunk_range.start..hunk_range.start], - false, - cx, - ); - }); - } - })] + vec![ + Button::new(("review", row as u64), "Review") + .key_binding(KeyBinding::for_action_in( + &ToggleKeep, + &editor.read(cx).focus_handle(cx), + window, + cx, + )) + .on_click({ + let assistant_diff = assistant_diff.clone(); + move |_event, _window, cx| { + assistant_diff.update(cx, |diff, cx| { + diff.review_diff_hunks( + vec![hunk_range.start..hunk_range.start], + false, + cx, + ); + }); + } + }), + ] }) .when( !editor.read(cx).buffer().read(cx).all_diff_hunks_expanded(), diff --git a/crates/assistant2/src/assistant_model_selector.rs b/crates/assistant2/src/assistant_model_selector.rs index 90c88cb54702251c32fb14fee0dd74491a080a15..a8da7ca16edcc86c8a5ae580bac23646b78faa25 100644 --- a/crates/assistant2/src/assistant_model_selector.rs +++ b/crates/assistant2/src/assistant_model_selector.rs @@ -7,7 +7,7 @@ use language_model_selector::{ }; use settings::update_settings_file; use std::sync::Arc; -use ui::{prelude::*, ButtonLike, PopoverMenuHandle, Tooltip}; +use ui::{ButtonLike, PopoverMenuHandle, Tooltip, prelude::*}; pub struct AssistantModelSelector { selector: Entity, diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs index 40d0cd1f055bd7cfba74a4d2f2f131dba6f4fa56..c4f9bf747871c7d250a65eb0112a31c634349a68 100644 --- a/crates/assistant2/src/assistant_panel.rs +++ b/crates/assistant2/src/assistant_panel.rs @@ -1,10 +1,10 @@ use std::path::PathBuf; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_context_editor::{ - make_lsp_adapter_delegate, render_remaining_tokens, AssistantPanelDelegate, ConfigurationError, - ContextEditor, SlashCommandCompletionProvider, + AssistantPanelDelegate, ConfigurationError, ContextEditor, SlashCommandCompletionProvider, + make_lsp_adapter_delegate, render_remaining_tokens, }; use assistant_settings::{AssistantDockPosition, AssistantSettings}; use assistant_slash_command::SlashCommandWorkingSet; @@ -14,21 +14,21 @@ use client::zed_urls; use editor::{Editor, MultiBuffer}; use fs::Fs; use gpui::{ - action_with_deprecated_aliases, prelude::*, Action, AnyElement, App, AsyncWindowContext, - Corner, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, KeyContext, Pixels, - Subscription, Task, UpdateGlobal, WeakEntity, + Action, AnyElement, App, AsyncWindowContext, Corner, Entity, EventEmitter, FocusHandle, + Focusable, FontWeight, KeyContext, Pixels, Subscription, Task, UpdateGlobal, WeakEntity, + action_with_deprecated_aliases, prelude::*, }; use language::LanguageRegistry; use language_model::{LanguageModelProviderTosView, LanguageModelRegistry}; use project::Project; -use prompt_library::{open_prompt_library, PromptLibrary}; +use prompt_library::{PromptLibrary, open_prompt_library}; use prompt_store::PromptBuilder; -use settings::{update_settings_file, Settings}; +use settings::{Settings, update_settings_file}; use time::UtcOffset; -use ui::{prelude::*, ContextMenu, KeyBinding, PopoverMenu, PopoverMenuHandle, Tab, Tooltip}; +use ui::{ContextMenu, KeyBinding, PopoverMenu, PopoverMenuHandle, Tab, Tooltip, prelude::*}; use util::ResultExt as _; -use workspace::dock::{DockPosition, Panel, PanelEvent}; use workspace::Workspace; +use workspace::dock::{DockPosition, Panel, PanelEvent}; use zed_actions::assistant::ToggleFocus; use crate::active_thread::ActiveThread; diff --git a/crates/assistant2/src/buffer_codegen.rs b/crates/assistant2/src/buffer_codegen.rs index d13c31829beb56ffb6e5baa364415502d9b9d349..5ba3e3d05e4d4fcd2f423444ce4f2e001d0038a5 100644 --- a/crates/assistant2/src/buffer_codegen.rs +++ b/crates/assistant2/src/buffer_codegen.rs @@ -5,12 +5,12 @@ use anyhow::{Context as _, Result}; use client::telemetry::Telemetry; use collections::HashSet; use editor::{Anchor, AnchorRangeExt, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint}; -use futures::{channel::mpsc, future::LocalBoxFuture, join, SinkExt, Stream, StreamExt}; +use futures::{SinkExt, Stream, StreamExt, channel::mpsc, future::LocalBoxFuture, join}; use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Subscription, Task}; -use language::{line_diff, Buffer, IndentKind, Point, TransactionId}; +use language::{Buffer, IndentKind, Point, TransactionId, line_diff}; use language_model::{ - report_assistant_event, LanguageModel, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, LanguageModelTextStream, Role, + LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, + LanguageModelTextStream, Role, report_assistant_event, }; use multi_buffer::MultiBufferRow; use parking_lot::Mutex; @@ -1028,14 +1028,14 @@ impl Diff { mod tests { use super::*; use futures::{ - stream::{self}, Stream, + stream::{self}, }; use gpui::TestAppContext; use indoc::indoc; use language::{ - language_settings, tree_sitter_rust, Buffer, Language, LanguageConfig, LanguageMatcher, - Point, + Buffer, Language, LanguageConfig, LanguageMatcher, Point, language_settings, + tree_sitter_rust, }; use language_model::{LanguageModelRegistry, TokenUsage}; use rand::prelude::*; diff --git a/crates/assistant2/src/context_picker.rs b/crates/assistant2/src/context_picker.rs index 7e5537145a24c349995bc1a697d8bc10038d2dc7..bfbda8f1d7e98571af96314b87712f9ce1ce9a0c 100644 --- a/crates/assistant2/src/context_picker.rs +++ b/crates/assistant2/src/context_picker.rs @@ -8,7 +8,7 @@ use std::ops::Range; use std::path::PathBuf; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use editor::display_map::{Crease, FoldId}; use editor::{Anchor, AnchorRangeExt as _, Editor, ExcerptId, FoldPlaceholder, ToOffset}; use file_context_picker::render_file_context_entry; @@ -18,19 +18,19 @@ use gpui::{ use multi_buffer::MultiBufferRow; use project::ProjectPath; use symbol_context_picker::SymbolContextPicker; -use thread_context_picker::{render_thread_context_entry, ThreadContextEntry}; +use thread_context_picker::{ThreadContextEntry, render_thread_context_entry}; use ui::{ - prelude::*, ButtonLike, ContextMenu, ContextMenuEntry, ContextMenuItem, Disclosure, TintColor, + ButtonLike, ContextMenu, ContextMenuEntry, ContextMenuItem, Disclosure, TintColor, prelude::*, }; -use workspace::{notifications::NotifyResultExt, Workspace}; +use workspace::{Workspace, notifications::NotifyResultExt}; +use crate::AssistantPanel; pub use crate::context_picker::completion_provider::ContextPickerCompletionProvider; use crate::context_picker::fetch_context_picker::FetchContextPicker; use crate::context_picker::file_context_picker::FileContextPicker; use crate::context_picker::thread_context_picker::ThreadContextPicker; use crate::context_store::ContextStore; use crate::thread_store::ThreadStore; -use crate::AssistantPanel; #[derive(Debug, Clone, Copy)] pub enum ConfirmBehavior { diff --git a/crates/assistant2/src/context_picker/completion_provider.rs b/crates/assistant2/src/context_picker/completion_provider.rs index 6105f294e50416e63082049782b24741afa113b6..0e543526199b176239c8e506d499121170b84997 100644 --- a/crates/assistant2/src/context_picker/completion_provider.rs +++ b/crates/assistant2/src/context_picker/completion_provider.rs @@ -2,8 +2,8 @@ use std::cell::RefCell; use std::ops::Range; use std::path::Path; use std::rc::Rc; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use anyhow::Result; use editor::{CompletionProvider, Editor, ExcerptId}; @@ -24,7 +24,7 @@ use crate::thread_store::ThreadStore; use super::fetch_context_picker::fetch_url_content; use super::thread_context_picker::ThreadContextEntry; -use super::{recent_context_picker_entries, supported_context_picker_modes, ContextPickerMode}; +use super::{ContextPickerMode, recent_context_picker_entries, supported_context_picker_modes}; pub struct ContextPickerCompletionProvider { workspace: WeakEntity, diff --git a/crates/assistant2/src/context_picker/fetch_context_picker.rs b/crates/assistant2/src/context_picker/fetch_context_picker.rs index 1a4b94394670a87133701827d1bffb32e4667ee6..9cab02f4aef17ce35ffb506865f71fb9246eae18 100644 --- a/crates/assistant2/src/context_picker/fetch_context_picker.rs +++ b/crates/assistant2/src/context_picker/fetch_context_picker.rs @@ -2,13 +2,13 @@ use std::cell::RefCell; use std::rc::Rc; use std::sync::Arc; -use anyhow::{bail, Context as _, Result}; +use anyhow::{Context as _, Result, bail}; use futures::AsyncReadExt as _; use gpui::{App, DismissEvent, Entity, FocusHandle, Focusable, Task, WeakEntity}; -use html_to_markdown::{convert_html_to_markdown, markdown, TagHandler}; +use html_to_markdown::{TagHandler, convert_html_to_markdown, markdown}; use http_client::{AsyncBody, HttpClientWithUrl}; use picker::{Picker, PickerDelegate}; -use ui::{prelude::*, Context, ListItem, Window}; +use ui::{Context, ListItem, Window, prelude::*}; use workspace::Workspace; use crate::context_picker::{ConfirmBehavior, ContextPicker}; @@ -163,11 +163,7 @@ impl PickerDelegate for FetchContextPickerDelegate { type ListItem = ListItem; fn match_count(&self) -> usize { - if self.url.is_empty() { - 0 - } else { - 1 - } + if self.url.is_empty() { 0 } else { 1 } } fn no_matches_text(&self, _window: &mut Window, _cx: &mut App) -> Option { diff --git a/crates/assistant2/src/context_picker/file_context_picker.rs b/crates/assistant2/src/context_picker/file_context_picker.rs index 388fdcbc9f38c0f12a2f24919ef0344cbf9055c0..a96d0f986cacade1a98fbf84681df40c5a8fae9e 100644 --- a/crates/assistant2/src/context_picker/file_context_picker.rs +++ b/crates/assistant2/src/context_picker/file_context_picker.rs @@ -1,6 +1,6 @@ use std::path::Path; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use file_icons::FileIcons; use fuzzy::PathMatch; @@ -9,9 +9,9 @@ use gpui::{ }; use picker::{Picker, PickerDelegate}; use project::{PathMatchCandidateSet, ProjectPath, WorktreeId}; -use ui::{prelude::*, ListItem, Tooltip}; +use ui::{ListItem, Tooltip, prelude::*}; use util::ResultExt as _; -use workspace::{notifications::NotifyResultExt, Workspace}; +use workspace::{Workspace, notifications::NotifyResultExt}; use crate::context_picker::{ConfirmBehavior, ContextPicker}; use crate::context_store::{ContextStore, FileInclusion}; diff --git a/crates/assistant2/src/context_picker/symbol_context_picker.rs b/crates/assistant2/src/context_picker/symbol_context_picker.rs index d7924676118c7894602f30d407f1ea933ef1d558..9c7056deca915219360f77ad2c99edc6b6393cd0 100644 --- a/crates/assistant2/src/context_picker/symbol_context_picker.rs +++ b/crates/assistant2/src/context_picker/symbol_context_picker.rs @@ -1,6 +1,6 @@ use std::cmp::Reverse; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use anyhow::{Context as _, Result}; use fuzzy::{StringMatch, StringMatchCandidate}; @@ -11,7 +11,7 @@ use ordered_float::OrderedFloat; use picker::{Picker, PickerDelegate}; use project::{DocumentSymbol, Symbol}; use text::OffsetRangeExt; -use ui::{prelude::*, ListItem}; +use ui::{ListItem, prelude::*}; use util::ResultExt as _; use workspace::Workspace; diff --git a/crates/assistant2/src/context_picker/thread_context_picker.rs b/crates/assistant2/src/context_picker/thread_context_picker.rs index 4c51edae0971d852bd55ccd920d5a71819121b15..094209e9cfb6ed6e4bbcd730494a806ddb33efcd 100644 --- a/crates/assistant2/src/context_picker/thread_context_picker.rs +++ b/crates/assistant2/src/context_picker/thread_context_picker.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use fuzzy::StringMatchCandidate; use gpui::{App, DismissEvent, Entity, FocusHandle, Focusable, Task, WeakEntity}; use picker::{Picker, PickerDelegate}; -use ui::{prelude::*, ListItem}; +use ui::{ListItem, prelude::*}; use crate::context_picker::{ConfirmBehavior, ContextPicker}; use crate::context_store::{self, ContextStore}; diff --git a/crates/assistant2/src/context_store.rs b/crates/assistant2/src/context_store.rs index 5857a70b89f76cada3ea7ee118b7504050664055..8c6488db635cef70e3b2093bedc553bec29c3d73 100644 --- a/crates/assistant2/src/context_store.rs +++ b/crates/assistant2/src/context_store.rs @@ -2,9 +2,9 @@ use std::ops::Range; use std::path::{Path, PathBuf}; use std::sync::Arc; -use anyhow::{anyhow, bail, Result}; +use anyhow::{Result, anyhow, bail}; use collections::{BTreeMap, HashMap, HashSet}; -use futures::{self, future, Future, FutureExt}; +use futures::{self, Future, FutureExt, future}; use gpui::{App, AppContext as _, AsyncApp, Context, Entity, SharedString, Task, WeakEntity}; use language::Buffer; use project::{ProjectItem, ProjectPath, Worktree}; diff --git a/crates/assistant2/src/context_strip.rs b/crates/assistant2/src/context_strip.rs index 63d4ce6cbbd3304c0933e32dcac8633b86d95167..d98d131e7552dee45e5d99fb8ba467c99dadbbcf 100644 --- a/crates/assistant2/src/context_strip.rs +++ b/crates/assistant2/src/context_strip.rs @@ -9,8 +9,8 @@ use gpui::{ }; use itertools::Itertools; use language::Buffer; -use ui::{prelude::*, KeyBinding, PopoverMenu, PopoverMenuHandle, Tooltip}; -use workspace::{notifications::NotifyResultExt, Workspace}; +use ui::{KeyBinding, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; +use workspace::{Workspace, notifications::NotifyResultExt}; use crate::context::{ContextId, ContextKind}; use crate::context_picker::{ConfirmBehavior, ContextPicker}; @@ -239,11 +239,7 @@ impl ContextStrip { let eraser = if bounds.len() < 3 { 0 } else { 1 }; let pills = &bounds[1..bounds.len() - eraser]; - if pills.is_empty() { - None - } else { - Some(pills) - } + if pills.is_empty() { None } else { Some(pills) } } fn last_pill_index(&self) -> Option { diff --git a/crates/assistant2/src/history_store.rs b/crates/assistant2/src/history_store.rs index 49f935314dd673ad016e572e732e16a43fb15120..9fd3b5a0986d7db063869666fd5ecce41f85a0b3 100644 --- a/crates/assistant2/src/history_store.rs +++ b/crates/assistant2/src/history_store.rs @@ -1,6 +1,6 @@ use assistant_context_editor::SavedContextMetadata; use chrono::{DateTime, Utc}; -use gpui::{prelude::*, Entity}; +use gpui::{Entity, prelude::*}; use crate::thread_store::{SerializedThreadMetadata, ThreadStore}; diff --git a/crates/assistant2/src/inline_assistant.rs b/crates/assistant2/src/inline_assistant.rs index e31fa168b946f91e7ddf026e0f02587db9438e08..93b7616ffaefdbe6a43f26323835324b482083fa 100644 --- a/crates/assistant2/src/inline_assistant.rs +++ b/crates/assistant2/src/inline_assistant.rs @@ -7,24 +7,24 @@ use std::sync::Arc; use anyhow::{Context as _, Result}; use assistant_settings::AssistantSettings; use client::telemetry::Telemetry; -use collections::{hash_map, HashMap, HashSet, VecDeque}; +use collections::{HashMap, HashSet, VecDeque, hash_map}; use editor::{ + Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorEvent, ExcerptId, ExcerptRange, + GutterDimensions, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint, actions::SelectAll, display_map::{ BlockContext, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock, ToDisplayPoint, }, - Anchor, AnchorRangeExt, CodeActionProvider, Editor, EditorEvent, ExcerptId, ExcerptRange, - GutterDimensions, MultiBuffer, MultiBufferSnapshot, ToOffset as _, ToPoint, }; use feature_flags::{Assistant2FeatureFlag, FeatureFlagViewExt as _}; use fs::Fs; use gpui::{ - point, App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, - UpdateGlobal, WeakEntity, Window, + App, Context, Entity, Focusable, Global, HighlightStyle, Subscription, Task, UpdateGlobal, + WeakEntity, Window, point, }; use language::{Buffer, Point, Selection, TransactionId}; -use language_model::{report_assistant_event, LanguageModelRegistry}; +use language_model::{LanguageModelRegistry, report_assistant_event}; use multi_buffer::MultiBufferRow; use parking_lot::Mutex; use project::LspAction; @@ -32,20 +32,20 @@ use project::{CodeAction, ProjectTransaction}; use prompt_store::PromptBuilder; use settings::{Settings, SettingsStore}; use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; -use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; +use terminal_view::{TerminalView, terminal_panel::TerminalPanel}; use text::{OffsetRangeExt, ToPoint as _}; use ui::prelude::*; use util::RangeExt; use util::ResultExt; -use workspace::{dock::Panel, ShowConfiguration}; -use workspace::{notifications::NotificationId, ItemHandle, Toast, Workspace}; +use workspace::{ItemHandle, Toast, Workspace, notifications::NotificationId}; +use workspace::{ShowConfiguration, dock::Panel}; +use crate::AssistantPanel; use crate::buffer_codegen::{BufferCodegen, CodegenAlternative, CodegenEvent}; use crate::context_store::ContextStore; use crate::inline_prompt_editor::{CodegenStatus, InlineAssistId, PromptEditor, PromptEditorEvent}; use crate::terminal_inline_assistant::TerminalInlineAssistant; use crate::thread_store::ThreadStore; -use crate::AssistantPanel; pub fn init( fs: Arc, diff --git a/crates/assistant2/src/inline_prompt_editor.rs b/crates/assistant2/src/inline_prompt_editor.rs index 45385e25ff494515b38942f43101e0194b9410fc..baa72bd434e1b53e408f29a8b9de7e2eaf29f443 100644 --- a/crates/assistant2/src/inline_prompt_editor.rs +++ b/crates/assistant2/src/inline_prompt_editor.rs @@ -10,14 +10,14 @@ use crate::{RemoveAllContext, ToggleContextPicker}; use client::ErrorExt; use collections::VecDeque; use editor::{ - actions::{MoveDown, MoveUp}, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, GutterDimensions, MultiBuffer, + actions::{MoveDown, MoveUp}, }; use feature_flags::{FeatureFlagAppExt as _, ZedPro}; use fs::Fs; use gpui::{ - anchored, deferred, point, AnyElement, App, ClickEvent, Context, CursorStyle, Entity, - EventEmitter, FocusHandle, Focusable, FontWeight, Subscription, TextStyle, WeakEntity, Window, + AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle, + Focusable, FontWeight, Subscription, TextStyle, WeakEntity, Window, anchored, deferred, point, }; use language_model::{LanguageModel, LanguageModelRegistry}; use language_model_selector::ToggleModelSelector; @@ -28,7 +28,7 @@ use std::sync::Arc; use theme::ThemeSettings; use ui::utils::WithRemSize; use ui::{ - prelude::*, CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, PopoverMenuHandle, Tooltip, + CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, PopoverMenuHandle, Tooltip, prelude::*, }; use util::ResultExt; use workspace::Workspace; @@ -455,47 +455,55 @@ impl PromptEditor { match codegen_status { CodegenStatus::Idle => { - vec![Button::new("start", mode.start_label()) - .label_size(LabelSize::Small) - .icon(IconName::Return) - .icon_size(IconSize::XSmall) - .icon_color(Color::Muted) - .on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StartRequested))) - .into_any_element()] + vec![ + Button::new("start", mode.start_label()) + .label_size(LabelSize::Small) + .icon(IconName::Return) + .icon_size(IconSize::XSmall) + .icon_color(Color::Muted) + .on_click( + cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StartRequested)), + ) + .into_any_element(), + ] } - CodegenStatus::Pending => vec![IconButton::new("stop", IconName::Stop) - .icon_color(Color::Error) - .shape(IconButtonShape::Square) - .tooltip(move |window, cx| { - Tooltip::with_meta( - mode.tooltip_interrupt(), - Some(&menu::Cancel), - "Changes won't be discarded", - window, - cx, - ) - }) - .on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StopRequested))) - .into_any_element()], + CodegenStatus::Pending => vec![ + IconButton::new("stop", IconName::Stop) + .icon_color(Color::Error) + .shape(IconButtonShape::Square) + .tooltip(move |window, cx| { + Tooltip::with_meta( + mode.tooltip_interrupt(), + Some(&menu::Cancel), + "Changes won't be discarded", + window, + cx, + ) + }) + .on_click(cx.listener(|_, _, _, cx| cx.emit(PromptEditorEvent::StopRequested))) + .into_any_element(), + ], CodegenStatus::Done | CodegenStatus::Error(_) => { let has_error = matches!(codegen_status, CodegenStatus::Error(_)); if has_error || self.edited_since_done { - vec![IconButton::new("restart", IconName::RotateCw) - .icon_color(Color::Info) - .shape(IconButtonShape::Square) - .tooltip(move |window, cx| { - Tooltip::with_meta( - mode.tooltip_restart(), - Some(&menu::Confirm), - "Changes will be discarded", - window, - cx, - ) - }) - .on_click(cx.listener(|_, _, _, cx| { - cx.emit(PromptEditorEvent::StartRequested); - })) - .into_any_element()] + vec![ + IconButton::new("restart", IconName::RotateCw) + .icon_color(Color::Info) + .shape(IconButtonShape::Square) + .tooltip(move |window, cx| { + Tooltip::with_meta( + mode.tooltip_restart(), + Some(&menu::Confirm), + "Changes will be discarded", + window, + cx, + ) + }) + .on_click(cx.listener(|_, _, _, cx| { + cx.emit(PromptEditorEvent::StartRequested); + })) + .into_any_element(), + ] } else { let accept = IconButton::new("accept", IconName::Check) .icon_color(Color::Info) diff --git a/crates/assistant2/src/message_editor.rs b/crates/assistant2/src/message_editor.rs index 6c5d64a5d0fa3505d02c3bfdd8fc3db7165c98c7..5b4e11014e59ce811921ecbc7e07a072fa384d36 100644 --- a/crates/assistant2/src/message_editor.rs +++ b/crates/assistant2/src/message_editor.rs @@ -6,8 +6,8 @@ use editor::{ContextMenuOptions, ContextMenuPlacement, Editor, EditorElement, Ed use file_icons::FileIcons; use fs::Fs; use gpui::{ - linear_color_stop, linear_gradient, point, Animation, AnimationExt, App, DismissEvent, Entity, - Focusable, Subscription, TextStyle, WeakEntity, + Animation, AnimationExt, App, DismissEvent, Entity, Focusable, Subscription, TextStyle, + WeakEntity, linear_color_stop, linear_gradient, point, }; use language_model::LanguageModelRegistry; use language_model_selector::ToggleModelSelector; @@ -16,8 +16,8 @@ use settings::Settings; use std::time::Duration; use theme::ThemeSettings; use ui::{ - prelude::*, ButtonLike, Disclosure, KeyBinding, PlatformStyle, PopoverMenu, PopoverMenuHandle, - Tooltip, + ButtonLike, Disclosure, KeyBinding, PlatformStyle, PopoverMenu, PopoverMenuHandle, Tooltip, + prelude::*, }; use util::ResultExt; use vim_mode_setting::VimModeSetting; @@ -25,7 +25,7 @@ use workspace::Workspace; use crate::assistant_model_selector::AssistantModelSelector; use crate::context_picker::{ConfirmBehavior, ContextPicker, ContextPickerCompletionProvider}; -use crate::context_store::{refresh_context_store_text, ContextStore}; +use crate::context_store::{ContextStore, refresh_context_store_text}; use crate::context_strip::{ContextStrip, ContextStripEvent, SuggestContextKind}; use crate::profile_selector::ProfileSelector; use crate::thread::{RequestKind, Thread}; diff --git a/crates/assistant2/src/profile_selector.rs b/crates/assistant2/src/profile_selector.rs index 1f31a9867cee01d729120c666e0a29c40690e26b..477721b40f6260149887fae2d213460ce2a1130f 100644 --- a/crates/assistant2/src/profile_selector.rs +++ b/crates/assistant2/src/profile_selector.rs @@ -2,12 +2,12 @@ use std::sync::Arc; use assistant_settings::{AgentProfile, AssistantSettings}; use fs::Fs; -use gpui::{prelude::*, Action, Entity, FocusHandle, Subscription, WeakEntity}; +use gpui::{Action, Entity, FocusHandle, Subscription, WeakEntity, prelude::*}; use indexmap::IndexMap; -use settings::{update_settings_file, Settings as _, SettingsStore}; +use settings::{Settings as _, SettingsStore, update_settings_file}; use ui::{ - prelude::*, ButtonLike, ContextMenu, ContextMenuEntry, KeyBinding, PopoverMenu, - PopoverMenuHandle, + ButtonLike, ContextMenu, ContextMenuEntry, KeyBinding, PopoverMenu, PopoverMenuHandle, + prelude::*, }; use util::ResultExt as _; diff --git a/crates/assistant2/src/terminal_codegen.rs b/crates/assistant2/src/terminal_codegen.rs index 850beda22990c9114938086a4157ed597ebe8a08..a791de76b7df174874033cc1a638da7d4b497022 100644 --- a/crates/assistant2/src/terminal_codegen.rs +++ b/crates/assistant2/src/terminal_codegen.rs @@ -1,8 +1,8 @@ use crate::inline_prompt_editor::CodegenStatus; use client::telemetry::Telemetry; -use futures::{channel::mpsc, SinkExt, StreamExt}; +use futures::{SinkExt, StreamExt, channel::mpsc}; use gpui::{App, AppContext as _, Context, Entity, EventEmitter, Task}; -use language_model::{report_assistant_event, LanguageModelRegistry, LanguageModelRequest}; +use language_model::{LanguageModelRegistry, LanguageModelRequest, report_assistant_event}; use std::{sync::Arc, time::Instant}; use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use terminal::Terminal; diff --git a/crates/assistant2/src/terminal_inline_assistant.rs b/crates/assistant2/src/terminal_inline_assistant.rs index 42d183e7289c644c5cf3428d0ff32df66bb7f9be..54b771b0397d5177bcace405fec359b20b66a72e 100644 --- a/crates/assistant2/src/terminal_inline_assistant.rs +++ b/crates/assistant2/src/terminal_inline_assistant.rs @@ -3,18 +3,18 @@ use crate::context_store::ContextStore; use crate::inline_prompt_editor::{ CodegenStatus, PromptEditor, PromptEditorEvent, TerminalInlineAssistId, }; -use crate::terminal_codegen::{CodegenEvent, TerminalCodegen, CLEAR_INPUT}; +use crate::terminal_codegen::{CLEAR_INPUT, CodegenEvent, TerminalCodegen}; use crate::thread_store::ThreadStore; use anyhow::{Context as _, Result}; use client::telemetry::Telemetry; use collections::{HashMap, VecDeque}; -use editor::{actions::SelectAll, MultiBuffer}; +use editor::{MultiBuffer, actions::SelectAll}; use fs::Fs; use gpui::{App, Entity, Focusable, Global, Subscription, UpdateGlobal, WeakEntity}; use language::Buffer; use language_model::{ - report_assistant_event, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, Role, + LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role, + report_assistant_event, }; use prompt_store::PromptBuilder; use std::sync::Arc; @@ -22,7 +22,7 @@ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use terminal_view::TerminalView; use ui::prelude::*; use util::ResultExt; -use workspace::{notifications::NotificationId, Toast, Workspace}; +use workspace::{Toast, Workspace, notifications::NotificationId}; pub fn init( fs: Arc, diff --git a/crates/assistant2/src/thread.rs b/crates/assistant2/src/thread.rs index 374c06b5d65d8c77309f69c189aa3e295b8ebd06..2de372ff89721105b0a5c080c7bee60699b26c3e 100644 --- a/crates/assistant2/src/thread.rs +++ b/crates/assistant2/src/thread.rs @@ -26,10 +26,10 @@ use prompt_store::{ }; use serde::{Deserialize, Serialize}; use settings::Settings; -use util::{maybe, post_inc, ResultExt as _, TryFutureExt as _}; +use util::{ResultExt as _, TryFutureExt as _, maybe, post_inc}; use uuid::Uuid; -use crate::context::{attach_context_to_message, ContextId, ContextSnapshot}; +use crate::context::{ContextId, ContextSnapshot, attach_context_to_message}; use crate::thread_store::{ SerializedMessage, SerializedMessageSegment, SerializedThread, SerializedToolResult, SerializedToolUse, diff --git a/crates/assistant2/src/thread_history.rs b/crates/assistant2/src/thread_history.rs index ebbc4ec96b6c9351a0c841bb3e1ed230386f2111..7170cc02ebe6e1173855bd4217a8b702634404b1 100644 --- a/crates/assistant2/src/thread_history.rs +++ b/crates/assistant2/src/thread_history.rs @@ -1,10 +1,10 @@ use assistant_context_editor::SavedContextMetadata; use gpui::{ - uniform_list, App, Entity, FocusHandle, Focusable, ScrollStrategy, UniformListScrollHandle, - WeakEntity, + App, Entity, FocusHandle, Focusable, ScrollStrategy, UniformListScrollHandle, WeakEntity, + uniform_list, }; use time::{OffsetDateTime, UtcOffset}; -use ui::{prelude::*, IconButtonShape, ListItem, ListItemSpacing, Tooltip}; +use ui::{IconButtonShape, ListItem, ListItemSpacing, Tooltip, prelude::*}; use crate::history_store::{HistoryEntry, HistoryStore}; use crate::thread_store::SerializedThreadMetadata; diff --git a/crates/assistant2/src/thread_store.rs b/crates/assistant2/src/thread_store.rs index 474db2bcd8b5b1ad6d5b0e7d351b0139c3df6cba..86471215f83e8c479461c723d5d6df4f2abd2a17 100644 --- a/crates/assistant2/src/thread_store.rs +++ b/crates/assistant2/src/thread_store.rs @@ -2,20 +2,20 @@ use std::borrow::Cow; use std::path::PathBuf; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_settings::{AgentProfile, AssistantSettings}; use assistant_tool::{ToolId, ToolSource, ToolWorkingSet}; use chrono::{DateTime, Utc}; use collections::HashMap; use context_server::manager::ContextServerManager; use context_server::{ContextServerFactoryRegistry, ContextServerTool}; -use futures::future::{self, BoxFuture, Shared}; use futures::FutureExt as _; +use futures::future::{self, BoxFuture, Shared}; use gpui::{ - prelude::*, App, BackgroundExecutor, Context, Entity, Global, ReadGlobal, SharedString, Task, + App, BackgroundExecutor, Context, Entity, Global, ReadGlobal, SharedString, Task, prelude::*, }; -use heed::types::SerdeBincode; use heed::Database; +use heed::types::SerdeBincode; use language_model::{LanguageModelToolUseId, Role, TokenUsage}; use project::Project; use prompt_store::PromptBuilder; diff --git a/crates/assistant2/src/tool_use.rs b/crates/assistant2/src/tool_use.rs index 67bfbb6e889d41ac4a91faab44899e0c6b4cb971..602a8ab5aef77e732b765ea49b40965295f488a1 100644 --- a/crates/assistant2/src/tool_use.rs +++ b/crates/assistant2/src/tool_use.rs @@ -3,8 +3,8 @@ use std::sync::Arc; use anyhow::Result; use assistant_tool::{Tool, ToolWorkingSet}; use collections::HashMap; -use futures::future::Shared; use futures::FutureExt as _; +use futures::future::Shared; use gpui::{App, SharedString, Task}; use language_model::{ LanguageModelRequestMessage, LanguageModelToolResult, LanguageModelToolUse, diff --git a/crates/assistant2/src/ui/agent_notification.rs b/crates/assistant2/src/ui/agent_notification.rs index 56448b999a5b305332d608616a15f5c447ddee83..a0529b25b0b26e783886434ea61d8ab42f93116a 100644 --- a/crates/assistant2/src/ui/agent_notification.rs +++ b/crates/assistant2/src/ui/agent_notification.rs @@ -1,12 +1,12 @@ use gpui::{ - linear_color_stop, linear_gradient, point, App, Context, EventEmitter, IntoElement, - PlatformDisplay, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowDecorations, - WindowKind, WindowOptions, + App, Context, EventEmitter, IntoElement, PlatformDisplay, Size, Window, + WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind, WindowOptions, + linear_color_stop, linear_gradient, point, }; use release_channel::ReleaseChannel; use std::rc::Rc; use theme; -use ui::{prelude::*, Render}; +use ui::{Render, prelude::*}; pub struct AgentNotification { title: SharedString, diff --git a/crates/assistant2/src/ui/context_pill.rs b/crates/assistant2/src/ui/context_pill.rs index bc37583a2f35ea466caf3abcad3542472901b584..eeaf975192991bdaf23bb68b361e5aa60c6e43c5 100644 --- a/crates/assistant2/src/ui/context_pill.rs +++ b/crates/assistant2/src/ui/context_pill.rs @@ -1,7 +1,7 @@ use std::rc::Rc; use gpui::ClickEvent; -use ui::{prelude::*, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*}; use crate::context::{ContextKind, ContextSnapshot}; diff --git a/crates/assistant_context_editor/src/context.rs b/crates/assistant_context_editor/src/context.rs index 1ebb2a92899a33f9e782c16a3302c5a598f44dad..4b2747d9ad70e21fddd963c55320e3e449cad0f5 100644 --- a/crates/assistant_context_editor/src/context.rs +++ b/crates/assistant_context_editor/src/context.rs @@ -2,7 +2,7 @@ mod context_tests; use crate::patch::{AssistantEdit, AssistantPatch, AssistantPatchStatus}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection, SlashCommandResult, SlashCommandWorkingSet, @@ -12,17 +12,17 @@ use client::{self, proto, telemetry::Telemetry}; use clock::ReplicaId; use collections::{HashMap, HashSet}; use fs::{Fs, RemoveOptions}; -use futures::{future::Shared, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, future::Shared}; use gpui::{ App, AppContext as _, Context, Entity, EventEmitter, RenderImage, SharedString, Subscription, Task, }; use language::{AnchorRangeExt, Bias, Buffer, LanguageRegistry, OffsetRangeExt, Point, ToOffset}; use language_model::{ - report_assistant_event, LanguageModel, LanguageModelCacheConfiguration, - LanguageModelCompletionEvent, LanguageModelImage, LanguageModelRegistry, LanguageModelRequest, - LanguageModelRequestMessage, LanguageModelToolUseId, MaxMonthlySpendReachedError, - MessageContent, PaymentRequiredError, Role, StopReason, + LanguageModel, LanguageModelCacheConfiguration, LanguageModelCompletionEvent, + LanguageModelImage, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, + LanguageModelToolUseId, MaxMonthlySpendReachedError, MessageContent, PaymentRequiredError, + Role, StopReason, report_assistant_event, }; use open_ai::Model as OpenAiModel; use paths::contexts_dir; @@ -31,7 +31,7 @@ use prompt_store::PromptBuilder; use serde::{Deserialize, Serialize}; use smallvec::SmallVec; use std::{ - cmp::{max, Ordering}, + cmp::{Ordering, max}, fmt::Debug, iter, mem, ops::Range, @@ -43,7 +43,7 @@ use std::{ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use text::{BufferSnapshot, ToPoint}; use ui::IconName; -use util::{post_inc, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, post_inc}; use uuid::Uuid; #[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)] diff --git a/crates/assistant_context_editor/src/context/context_tests.rs b/crates/assistant_context_editor/src/context/context_tests.rs index ffa44defb0e52facc989510225e9fba051d7edd4..8293744831f84a76035cac524599788d964828e4 100644 --- a/crates/assistant_context_editor/src/context/context_tests.rs +++ b/crates/assistant_context_editor/src/context/context_tests.rs @@ -14,7 +14,7 @@ use futures::{ channel::mpsc, stream::{self, StreamExt}, }; -use gpui::{prelude::*, App, Entity, SharedString, Task, TestAppContext, WeakEntity}; +use gpui::{App, Entity, SharedString, Task, TestAppContext, WeakEntity, prelude::*}; use language::{Buffer, BufferSnapshot, LanguageRegistry, LspAdapterDelegate}; use language_model::{LanguageModelCacheConfiguration, LanguageModelRegistry, Role}; use parking_lot::Mutex; @@ -30,14 +30,14 @@ use std::{ ops::Range, path::Path, rc::Rc, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; -use text::{network::Network, OffsetRangeExt as _, ReplicaId, ToOffset}; +use text::{OffsetRangeExt as _, ReplicaId, ToOffset, network::Network}; use ui::{IconName, Window}; use unindent::Unindent; use util::{ - test::{generate_marked_text, marked_text_ranges}, RandomCharIter, + test::{generate_marked_text, marked_text_ranges}, }; use workspace::Workspace; diff --git a/crates/assistant_context_editor/src/context_editor.rs b/crates/assistant_context_editor/src/context_editor.rs index 74fca648e661bdb88b9f2c7a66e6c72bb37c17e2..c155c0b2bf79ca18da118100cd32949fb8d1b168 100644 --- a/crates/assistant_context_editor/src/context_editor.rs +++ b/crates/assistant_context_editor/src/context_editor.rs @@ -2,36 +2,36 @@ use anyhow::Result; use assistant_settings::AssistantSettings; use assistant_slash_command::{SlashCommand, SlashCommandOutputSection, SlashCommandWorkingSet}; use assistant_slash_commands::{ - selections_creases, DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, - FileSlashCommand, + DefaultSlashCommand, DocsSlashCommand, DocsSlashCommandArgs, FileSlashCommand, + selections_creases, }; use client::{proto, zed_urls}; -use collections::{hash_map, BTreeSet, HashMap, HashSet}; +use collections::{BTreeSet, HashMap, HashSet, hash_map}; use editor::{ + Anchor, Editor, EditorEvent, MenuInlineCompletionsPolicy, ProposedChangeLocation, + ProposedChangesEditor, RowExt, ToOffset as _, ToPoint, actions::{FoldAt, MoveToEndOfLine, Newline, ShowCompletions, UnfoldAt}, display_map::{ BlockContext, BlockId, BlockPlacement, BlockProperties, BlockStyle, Crease, CreaseMetadata, CustomBlockId, FoldId, RenderBlock, ToDisplayPoint, }, scroll::Autoscroll, - Anchor, Editor, EditorEvent, MenuInlineCompletionsPolicy, ProposedChangeLocation, - ProposedChangesEditor, RowExt, ToOffset as _, ToPoint, }; -use editor::{display_map::CreaseId, FoldPlaceholder}; +use editor::{FoldPlaceholder, display_map::CreaseId}; use fs::Fs; use futures::FutureExt; use gpui::{ - actions, div, img, impl_internal_actions, percentage, point, prelude::*, pulsating_between, - size, Animation, AnimationExt, AnyElement, AnyView, App, AsyncWindowContext, ClipboardEntry, + Animation, AnimationExt, AnyElement, AnyView, App, AsyncWindowContext, ClipboardEntry, ClipboardItem, CursorStyle, Empty, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, Global, InteractiveElement, IntoElement, ParentElement, Pixels, Render, RenderImage, SharedString, Size, StatefulInteractiveElement, Styled, Subscription, Task, Transformation, - WeakEntity, + WeakEntity, actions, div, img, impl_internal_actions, percentage, point, prelude::*, + pulsating_between, size, }; use indexed_docs::IndexedDocsStore; use language::{ - language_settings::{all_language_settings, SoftWrap}, BufferSnapshot, LspAdapterDelegate, ToOffset, + language_settings::{SoftWrap, all_language_settings}, }; use language_model::{ LanguageModelImage, LanguageModelProvider, LanguageModelProviderTosView, LanguageModelRegistry, @@ -46,33 +46,33 @@ use project::lsp_store::LocalLspAdapterDelegate; use project::{Project, Worktree}; use rope::Point; use serde::{Deserialize, Serialize}; -use settings::{update_settings_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, update_settings_file}; use std::{any::TypeId, borrow::Cow, cmp, ops::Range, path::PathBuf, sync::Arc, time::Duration}; use text::SelectionGoal; use ui::{ - prelude::*, ButtonLike, Disclosure, ElevationIndex, KeyBinding, PopoverMenuHandle, TintColor, - Tooltip, + ButtonLike, Disclosure, ElevationIndex, KeyBinding, PopoverMenuHandle, TintColor, Tooltip, + prelude::*, }; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use workspace::searchable::{Direction, SearchableItemHandle}; use workspace::{ + Save, ShowConfiguration, Toast, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, + Workspace, item::{self, FollowableItem, Item, ItemHandle}, notifications::NotificationId, pane::{self, SaveIntent}, searchable::{SearchEvent, SearchableItem}, - Save, ShowConfiguration, Toast, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, - Workspace, }; -use crate::{ - slash_command::SlashCommandCompletionProvider, slash_command_picker, - ThoughtProcessOutputSection, -}; use crate::{ AssistantContext, AssistantPatch, AssistantPatchStatus, CacheStatus, Content, ContextEvent, ContextId, InvokedSlashCommandId, InvokedSlashCommandStatus, Message, MessageId, MessageMetadata, MessageStatus, ParsedSlashCommand, PendingSlashCommandStatus, RequestType, }; +use crate::{ + ThoughtProcessOutputSection, slash_command::SlashCommandCompletionProvider, + slash_command_picker, +}; actions!( assistant, diff --git a/crates/assistant_context_editor/src/context_history.rs b/crates/assistant_context_editor/src/context_history.rs index 83df49e16ffb224b5928d4342eba1e5decb6626f..35b932158bad65357741d2c2e667680bd0c106e4 100644 --- a/crates/assistant_context_editor/src/context_history.rs +++ b/crates/assistant_context_editor/src/context_history.rs @@ -3,13 +3,13 @@ use std::sync::Arc; use gpui::{App, Entity, EventEmitter, FocusHandle, Focusable, Subscription, Task, WeakEntity}; use picker::{Picker, PickerDelegate}; use project::Project; -use ui::utils::{format_distance_from_now, DateTimeType}; -use ui::{prelude::*, Avatar, ListItem, ListItemSpacing}; +use ui::utils::{DateTimeType, format_distance_from_now}; +use ui::{Avatar, ListItem, ListItemSpacing, prelude::*}; use workspace::{Item, Workspace}; use crate::{ - AssistantPanelDelegate, ContextStore, RemoteContextMetadata, SavedContextMetadata, - DEFAULT_TAB_TITLE, + AssistantPanelDelegate, ContextStore, DEFAULT_TAB_TITLE, RemoteContextMetadata, + SavedContextMetadata, }; #[derive(Clone)] @@ -229,10 +229,12 @@ impl PickerDelegate for SavedContextPickerDelegate { .into_any_element(), ] } else { - vec![Label::new("Shared by host") - .color(Color::Muted) - .size(LabelSize::Small) - .into_any_element()] + vec![ + Label::new("Shared by host") + .color(Color::Muted) + .size(LabelSize::Small) + .into_any_element(), + ] }), ) } diff --git a/crates/assistant_context_editor/src/context_store.rs b/crates/assistant_context_editor/src/context_store.rs index af6a34f1c845ce70fb06e9943902d2a104d0188b..a7b33c279b7ef796595aaad7c71ef24c1f5ed50d 100644 --- a/crates/assistant_context_editor/src/context_store.rs +++ b/crates/assistant_context_editor/src/context_store.rs @@ -2,13 +2,13 @@ use crate::{ AssistantContext, ContextEvent, ContextId, ContextOperation, ContextVersion, SavedContext, SavedContextMetadata, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{SlashCommandId, SlashCommandWorkingSet}; -use client::{proto, telemetry::Telemetry, Client, TypedEnvelope}; +use client::{Client, TypedEnvelope, proto, telemetry::Telemetry}; use clock::ReplicaId; use collections::HashMap; -use context_server::manager::ContextServerManager; use context_server::ContextServerFactoryRegistry; +use context_server::manager::ContextServerManager; use fs::{Fs, RemoveOptions}; use futures::StreamExt; use fuzzy::StringMatchCandidate; @@ -104,52 +104,47 @@ impl ContextStore { const CONTEXT_WATCH_DURATION: Duration = Duration::from_millis(100); let (mut events, _) = fs.watch(contexts_dir(), CONTEXT_WATCH_DURATION).await; - let this = - cx.new(|cx: &mut Context| { - let context_server_factory_registry = - ContextServerFactoryRegistry::default_global(cx); - let context_server_manager = cx.new(|cx| { - ContextServerManager::new( - context_server_factory_registry, - project.clone(), - cx, - ) - }); - let mut this = Self { - contexts: Vec::new(), - contexts_metadata: Vec::new(), - context_server_manager, - context_server_slash_command_ids: HashMap::default(), - host_contexts: Vec::new(), - fs, - languages, - slash_commands, - telemetry, - _watch_updates: cx.spawn(async move |this, cx| { - async move { - while events.next().await.is_some() { - this.update(cx, |this, cx| this.reload(cx))?.await.log_err(); - } - anyhow::Ok(()) + let this = cx.new(|cx: &mut Context| { + let context_server_factory_registry = + ContextServerFactoryRegistry::default_global(cx); + let context_server_manager = cx.new(|cx| { + ContextServerManager::new(context_server_factory_registry, project.clone(), cx) + }); + let mut this = Self { + contexts: Vec::new(), + contexts_metadata: Vec::new(), + context_server_manager, + context_server_slash_command_ids: HashMap::default(), + host_contexts: Vec::new(), + fs, + languages, + slash_commands, + telemetry, + _watch_updates: cx.spawn(async move |this, cx| { + async move { + while events.next().await.is_some() { + this.update(cx, |this, cx| this.reload(cx))?.await.log_err(); } - .log_err() - .await - }), - client_subscription: None, - _project_subscriptions: vec![ - cx.subscribe(&project, Self::handle_project_event) - ], - project_is_shared: false, - client: project.read(cx).client(), - project: project.clone(), - prompt_builder, - }; - this.handle_project_shared(project.clone(), cx); - this.synchronize_contexts(cx); - this.register_context_server_handlers(cx); - this.reload(cx).detach_and_log_err(cx); - this - })?; + anyhow::Ok(()) + } + .log_err() + .await + }), + client_subscription: None, + _project_subscriptions: vec![ + cx.subscribe(&project, Self::handle_project_event), + ], + project_is_shared: false, + client: project.read(cx).client(), + project: project.clone(), + prompt_builder, + }; + this.handle_project_shared(project.clone(), cx); + this.synchronize_contexts(cx); + this.register_context_server_handlers(cx); + this.reload(cx).detach_and_log_err(cx); + this + })?; Ok(this) }) diff --git a/crates/assistant_context_editor/src/patch.rs b/crates/assistant_context_editor/src/patch.rs index e46c420fc559f929f2a3f36c42038549560c8dae..286bd38da1b095cf63a15a41f473de0ee88216be 100644 --- a/crates/assistant_context_editor/src/patch.rs +++ b/crates/assistant_context_editor/src/patch.rs @@ -1,7 +1,7 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use editor::ProposedChangesEditor; -use futures::{future, TryFutureExt as _}; +use futures::{TryFutureExt as _, future}; use gpui::{App, AppContext as _, AsyncApp, Entity, SharedString}; use language::{AutoindentMode, Buffer, BufferSnapshot}; use project::{Project, ProjectPath}; @@ -548,7 +548,7 @@ mod tests { use super::*; use gpui::App; use language::{ - language_settings::AllLanguageSettings, Language, LanguageConfig, LanguageMatcher, + Language, LanguageConfig, LanguageMatcher, language_settings::AllLanguageSettings, }; use settings::SettingsStore; use ui::BorrowAppContext; diff --git a/crates/assistant_context_editor/src/slash_command.rs b/crates/assistant_context_editor/src/slash_command.rs index a3897e3235823ba4cf24357d8002ad0b0be31a9c..481a408f4c44a7b697a386c1f9982ad8cd15d725 100644 --- a/crates/assistant_context_editor/src/slash_command.rs +++ b/crates/assistant_context_editor/src/slash_command.rs @@ -3,19 +3,19 @@ use anyhow::Result; pub use assistant_slash_command::SlashCommand; use assistant_slash_command::{AfterCompletion, SlashCommandLine, SlashCommandWorkingSet}; use editor::{CompletionProvider, Editor, ExcerptId}; -use fuzzy::{match_strings, StringMatchCandidate}; +use fuzzy::{StringMatchCandidate, match_strings}; use gpui::{App, AppContext as _, Context, Entity, Task, WeakEntity, Window}; use language::{Anchor, Buffer, ToPoint}; use parking_lot::Mutex; -use project::{lsp_store::CompletionDocumentation, CompletionIntent, CompletionSource}; +use project::{CompletionIntent, CompletionSource, lsp_store::CompletionDocumentation}; use rope::Point; use std::{ cell::RefCell, ops::Range, rc::Rc, sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, Ordering::SeqCst}, }, }; use workspace::Workspace; diff --git a/crates/assistant_context_editor/src/slash_command_picker.rs b/crates/assistant_context_editor/src/slash_command_picker.rs index 66663176397d660d07993e8d49bed3b642c9d3a8..384fdc5790050384b3c015785881c1a9182f5f87 100644 --- a/crates/assistant_context_editor/src/slash_command_picker.rs +++ b/crates/assistant_context_editor/src/slash_command_picker.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use assistant_slash_command::SlashCommandWorkingSet; use gpui::{AnyElement, AnyView, DismissEvent, SharedString, Task, WeakEntity}; use picker::{Picker, PickerDelegate, PickerEditorPosition}; -use ui::{prelude::*, ListItem, ListItemSpacing, PopoverMenu, PopoverTrigger, Tooltip}; +use ui::{ListItem, ListItemSpacing, PopoverMenu, PopoverTrigger, Tooltip, prelude::*}; use crate::context_editor::ContextEditor; diff --git a/crates/assistant_eval/src/headless_assistant.rs b/crates/assistant_eval/src/headless_assistant.rs index 69b8fa2fdc801a484a1302390336be1ed0991bc8..1c983b85dec0e4b3476b9cce9fc9c0698bb66735 100644 --- a/crates/assistant_eval/src/headless_assistant.rs +++ b/crates/assistant_eval/src/headless_assistant.rs @@ -1,11 +1,11 @@ use anyhow::anyhow; -use assistant2::{RequestKind, Thread, ThreadEvent, ThreadStore}; use assistant_tool::ToolWorkingSet; +use assistant2::{RequestKind, Thread, ThreadEvent, ThreadStore}; use client::{Client, UserStore}; use collections::HashMap; use dap::DapRegistry; use futures::StreamExt; -use gpui::{prelude::*, App, AsyncApp, Entity, SemanticVersion, Subscription, Task}; +use gpui::{App, AsyncApp, Entity, SemanticVersion, Subscription, Task, prelude::*}; use language::LanguageRegistry; use language_model::{ AuthenticateError, LanguageModel, LanguageModelProviderId, LanguageModelRegistry, diff --git a/crates/assistant_eval/src/main.rs b/crates/assistant_eval/src/main.rs index 786e858f6a9c1f2de30b3cfa34eaabb68f61fd41..129f4b14fd28c95e7b6a5df1007af7344bf2158b 100644 --- a/crates/assistant_eval/src/main.rs +++ b/crates/assistant_eval/src/main.rs @@ -6,7 +6,7 @@ use clap::Parser; use eval::{Eval, EvalOutput}; use futures::future; use gpui::{Application, AsyncApp}; -use headless_assistant::{authenticate_model_provider, find_model, HeadlessAppState}; +use headless_assistant::{HeadlessAppState, authenticate_model_provider, find_model}; use itertools::Itertools; use judge::Judge; use language_model::{LanguageModel, LanguageModelRegistry}; diff --git a/crates/assistant_settings/src/assistant_settings.rs b/crates/assistant_settings/src/assistant_settings.rs index b0a5ee79260db4566a1e61da51976dc1bf40f8d6..f496311486df5cdd8034d1445135fef50ef63066 100644 --- a/crates/assistant_settings/src/assistant_settings.rs +++ b/crates/assistant_settings/src/assistant_settings.rs @@ -11,7 +11,7 @@ use indexmap::IndexMap; use language_model::{CloudModel, LanguageModel}; use lmstudio::Model as LmStudioModel; use ollama::Model as OllamaModel; -use schemars::{schema::Schema, JsonSchema}; +use schemars::{JsonSchema, schema::Schema}; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; diff --git a/crates/assistant_slash_command/src/assistant_slash_command.rs b/crates/assistant_slash_command/src/assistant_slash_command.rs index ab5f9dad4a1dabfe12da68f09d8594da4516a568..ce8318ba1233449cf76d481be7ce0ad90d99b2e5 100644 --- a/crates/assistant_slash_command/src/assistant_slash_command.rs +++ b/crates/assistant_slash_command/src/assistant_slash_command.rs @@ -6,17 +6,17 @@ pub use crate::extension_slash_command::*; pub use crate::slash_command_registry::*; pub use crate::slash_command_working_set::*; use anyhow::Result; -use futures::stream::{self, BoxStream}; use futures::StreamExt; +use futures::stream::{self, BoxStream}; use gpui::{App, SharedString, Task, WeakEntity, Window}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate, OffsetRangeExt}; pub use language_model::Role; use serde::{Deserialize, Serialize}; use std::{ ops::Range, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; -use workspace::{ui::IconName, Workspace}; +use workspace::{Workspace, ui::IconName}; pub fn init(cx: &mut App) { SlashCommandRegistry::default_global(cx); diff --git a/crates/assistant_slash_command/src/extension_slash_command.rs b/crates/assistant_slash_command/src/extension_slash_command.rs index e56c4314aa28c48973daf496552ea0a81df1c0cb..6cc1f73c476d6d5332abc9e77bd56f54a88eceee 100644 --- a/crates/assistant_slash_command/src/extension_slash_command.rs +++ b/crates/assistant_slash_command/src/extension_slash_command.rs @@ -1,5 +1,5 @@ use std::path::PathBuf; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{Arc, atomic::AtomicBool}; use anyhow::Result; use async_trait::async_trait; diff --git a/crates/assistant_slash_commands/src/cargo_workspace_command.rs b/crates/assistant_slash_commands/src/cargo_workspace_command.rs index 196aa98fd93cf5e212afba9831d5460006d68a8a..8b088ea012de5f1ef6f7c787924c3cb2c6ec44c8 100644 --- a/crates/assistant_slash_commands/src/cargo_workspace_command.rs +++ b/crates/assistant_slash_commands/src/cargo_workspace_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -10,7 +10,7 @@ use project::{Project, ProjectPath}; use std::{ fmt::Write, path::Path, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/context_server_command.rs b/crates/assistant_slash_commands/src/context_server_command.rs index 42f814791dce12fcc66e43eeb48a2257f002d716..9ad25cadf97c63295b45d1d02fec92ca58ba58e9 100644 --- a/crates/assistant_slash_commands/src/context_server_command.rs +++ b/crates/assistant_slash_commands/src/context_server_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -10,8 +10,8 @@ use context_server::{ }; use gpui::{App, Entity, Task, WeakEntity, Window}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use text::LineEnding; use ui::{IconName, SharedString}; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/default_command.rs b/crates/assistant_slash_commands/src/default_command.rs index 6bc7e98a1b68b394aa934d3936d7ed242f968aa6..e5bda3c03b821c7f4fab1a06b226b252238baac3 100644 --- a/crates/assistant_slash_commands/src/default_command.rs +++ b/crates/assistant_slash_commands/src/default_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -8,7 +8,7 @@ use language::{BufferSnapshot, LspAdapterDelegate}; use prompt_store::PromptStore; use std::{ fmt::Write, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/delta_command.rs b/crates/assistant_slash_commands/src/delta_command.rs index 3199b426d47a5d08f2501b4fb87e0ee7cefb2ed9..491ed65d87621e1bfef8136d007e17b62e494629 100644 --- a/crates/assistant_slash_commands/src/delta_command.rs +++ b/crates/assistant_slash_commands/src/delta_command.rs @@ -1,5 +1,5 @@ use crate::file_command::{FileCommandMetadata, FileSlashCommand}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -8,7 +8,7 @@ use collections::HashSet; use futures::future; use gpui::{App, Task, WeakEntity, Window}; use language::{BufferSnapshot, LspAdapterDelegate}; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{Arc, atomic::AtomicBool}; use text::OffsetRangeExt; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/diagnostics_command.rs b/crates/assistant_slash_commands/src/diagnostics_command.rs index 716fcbcd1d526969fec1a49f56a4cda9092af405..b365de97d48764a9d11de556a2577729a1bcc57f 100644 --- a/crates/assistant_slash_commands/src/diagnostics_command.rs +++ b/crates/assistant_slash_commands/src/diagnostics_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -14,11 +14,11 @@ use rope::Point; use std::{ fmt::Write, path::{Path, PathBuf}, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use ui::prelude::*; -use util::paths::PathMatcher; use util::ResultExt; +use util::paths::PathMatcher; use workspace::Workspace; use crate::create_label_for_command; diff --git a/crates/assistant_slash_commands/src/docs_command.rs b/crates/assistant_slash_commands/src/docs_command.rs index 2114a9b9fda478760e7500341c3425bd4f187b3a..a9d7d1679e3b053b3c326b3ed6ca7a84c526e98f 100644 --- a/crates/assistant_slash_commands/src/docs_command.rs +++ b/crates/assistant_slash_commands/src/docs_command.rs @@ -1,9 +1,9 @@ use std::path::Path; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use std::time::Duration; -use anyhow::{anyhow, bail, Result}; +use anyhow::{Result, anyhow, bail}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -16,7 +16,7 @@ use indexed_docs::{ use language::{BufferSnapshot, LspAdapterDelegate}; use project::{Project, ProjectPath}; use ui::prelude::*; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use workspace::Workspace; pub struct DocsSlashCommand; diff --git a/crates/assistant_slash_commands/src/fetch_command.rs b/crates/assistant_slash_commands/src/fetch_command.rs index 8188766e7250bfcb6cb360c41c59733ff020711b..6c1badeb74182b9cd736c2dde9e2c9e4932a850c 100644 --- a/crates/assistant_slash_commands/src/fetch_command.rs +++ b/crates/assistant_slash_commands/src/fetch_command.rs @@ -1,16 +1,16 @@ use std::cell::RefCell; use std::rc::Rc; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, }; use futures::AsyncReadExt; use gpui::{Task, WeakEntity}; -use html_to_markdown::{convert_html_to_markdown, markdown, TagHandler}; +use html_to_markdown::{TagHandler, convert_html_to_markdown, markdown}; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use language::{BufferSnapshot, LspAdapterDelegate}; use ui::prelude::*; diff --git a/crates/assistant_slash_commands/src/file_command.rs b/crates/assistant_slash_commands/src/file_command.rs index e08913e5cc3d94e9d69a46bd7a52a0932b866514..a47f8ac96ad85d873b1820afe87c51c408de04a9 100644 --- a/crates/assistant_slash_commands/src/file_command.rs +++ b/crates/assistant_slash_commands/src/file_command.rs @@ -1,10 +1,10 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, }; -use futures::channel::mpsc; use futures::Stream; +use futures::channel::mpsc; use fuzzy::PathMatch; use gpui::{App, Entity, Task, WeakEntity}; use language::{BufferSnapshot, CodeLabel, HighlightId, LineEnding, LspAdapterDelegate}; @@ -15,7 +15,7 @@ use std::{ fmt::Write, ops::{Range, RangeInclusive}, path::{Path, PathBuf}, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use ui::prelude::*; use util::ResultExt; @@ -694,15 +694,21 @@ mod test { assert_eq!(result.sections.len(), 7); // Ensure that full file paths are included in the real output - assert!(result - .text - .contains(separator!("zed/assets/themes/andromeda/LICENSE"))); - assert!(result - .text - .contains(separator!("zed/assets/themes/ayu/LICENSE"))); - assert!(result - .text - .contains(separator!("zed/assets/themes/summercamp/LICENSE"))); + assert!( + result + .text + .contains(separator!("zed/assets/themes/andromeda/LICENSE")) + ); + assert!( + result + .text + .contains(separator!("zed/assets/themes/ayu/LICENSE")) + ); + assert!( + result + .text + .contains(separator!("zed/assets/themes/summercamp/LICENSE")) + ); assert_eq!(result.sections[5].label, "summercamp"); diff --git a/crates/assistant_slash_commands/src/now_command.rs b/crates/assistant_slash_commands/src/now_command.rs index 6d4ae75dd7c650dcc2ac07a02fc7d15605b3893d..e4abef2a7c80fbdc96df28cbd1072d180fd864f3 100644 --- a/crates/assistant_slash_commands/src/now_command.rs +++ b/crates/assistant_slash_commands/src/now_command.rs @@ -1,5 +1,5 @@ -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use anyhow::Result; use assistant_slash_command::{ diff --git a/crates/assistant_slash_commands/src/prompt_command.rs b/crates/assistant_slash_commands/src/prompt_command.rs index 73f75ceb05b47e410080aa5d425c737d564fda67..7d535f803a48ab5a1ad076fcb55822a29480debe 100644 --- a/crates/assistant_slash_commands/src/prompt_command.rs +++ b/crates/assistant_slash_commands/src/prompt_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, @@ -6,7 +6,7 @@ use assistant_slash_command::{ use gpui::{Task, WeakEntity}; use language::{BufferSnapshot, LspAdapterDelegate}; use prompt_store::PromptStore; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{Arc, atomic::AtomicBool}; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/selection_command.rs b/crates/assistant_slash_commands/src/selection_command.rs index fbe4d42bcb860900d62acbc68d1dc82933455d10..0d643b44ba163eb899ad2c0966c9f94d070efb6d 100644 --- a/crates/assistant_slash_commands/src/selection_command.rs +++ b/crates/assistant_slash_commands/src/selection_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent, SlashCommandOutputSection, SlashCommandResult, @@ -7,8 +7,8 @@ use editor::Editor; use futures::StreamExt; use gpui::{App, Context, SharedString, Task, WeakEntity, Window}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use ui::IconName; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/streaming_example_command.rs b/crates/assistant_slash_commands/src/streaming_example_command.rs index ac6b5a5f7e5ae44d7719edbd66ee09896e30f44a..3f56613bc2455d4bfdc63d74260f2873cd3799ec 100644 --- a/crates/assistant_slash_commands/src/streaming_example_command.rs +++ b/crates/assistant_slash_commands/src/streaming_example_command.rs @@ -1,5 +1,5 @@ -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use std::time::Duration; use anyhow::Result; @@ -11,8 +11,8 @@ use feature_flags::FeatureFlag; use futures::channel::mpsc; use gpui::{Task, WeakEntity}; use language::{BufferSnapshot, LspAdapterDelegate}; -use smol::stream::StreamExt; use smol::Timer; +use smol::stream::StreamExt; use ui::prelude::*; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/symbols_command.rs b/crates/assistant_slash_commands/src/symbols_command.rs index 533c561b137a578b75bb67f4f180111461815a07..ef9314643116689d36e99b2a9bcb7d69982a776f 100644 --- a/crates/assistant_slash_commands/src/symbols_command.rs +++ b/crates/assistant_slash_commands/src/symbols_command.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_slash_command::{ ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, SlashCommandResult, diff --git a/crates/assistant_slash_commands/src/tab_command.rs b/crates/assistant_slash_commands/src/tab_command.rs index c4953aec300df5f9b14eeeafe00e5a33ee63cfac..49e93f0ad8a90f8212003d7c64204ed54ab515ff 100644 --- a/crates/assistant_slash_commands/src/tab_command.rs +++ b/crates/assistant_slash_commands/src/tab_command.rs @@ -10,9 +10,9 @@ use gpui::{Task, WeakEntity}; use language::{BufferSnapshot, CodeLabel, HighlightId, LspAdapterDelegate}; use std::{ path::PathBuf, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; -use ui::{prelude::*, ActiveTheme, App, Window}; +use ui::{ActiveTheme, App, Window, prelude::*}; use util::ResultExt; use workspace::Workspace; diff --git a/crates/assistant_slash_commands/src/terminal_command.rs b/crates/assistant_slash_commands/src/terminal_command.rs index fe567e75016984cd76ee1dc384e6a5cde739acd5..b521e10f726152f36a11d9cbd5696fd7345f044d 100644 --- a/crates/assistant_slash_commands/src/terminal_command.rs +++ b/crates/assistant_slash_commands/src/terminal_command.rs @@ -1,5 +1,5 @@ -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; use anyhow::Result; use assistant_slash_command::{ @@ -8,9 +8,9 @@ use assistant_slash_command::{ }; use gpui::{App, Entity, Task, WeakEntity}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; -use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; +use terminal_view::{TerminalView, terminal_panel::TerminalPanel}; use ui::prelude::*; -use workspace::{dock::Panel, Workspace}; +use workspace::{Workspace, dock::Panel}; use super::create_label_for_command; diff --git a/crates/assistant_tools/src/bash_tool.rs b/crates/assistant_tools/src/bash_tool.rs index fb3c5c96d32ebe31786e31533a54c60bb74382c7..9423d3b81b64939830d3ea0189a1a98711e999b5 100644 --- a/crates/assistant_tools/src/bash_tool.rs +++ b/crates/assistant_tools/src/bash_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/batch_tool.rs b/crates/assistant_tools/src/batch_tool.rs index 8516f3062b8a83d1e2139c3180c2baf18404b7f2..919389b3a1d2b6ae7d0398dab0fd774b1c5b18f3 100644 --- a/crates/assistant_tools/src/batch_tool.rs +++ b/crates/assistant_tools/src/batch_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool, ToolWorkingSet}; use futures::future::join_all; use gpui::{App, AppContext, Entity, Task}; diff --git a/crates/assistant_tools/src/code_symbols_tool.rs b/crates/assistant_tools/src/code_symbols_tool.rs index 6abf44748410b2ac41a9e784161e9acacdd9da11..d139a313829fc41fd709d8e988a5d4484548df0b 100644 --- a/crates/assistant_tools/src/code_symbols_tool.rs +++ b/crates/assistant_tools/src/code_symbols_tool.rs @@ -2,7 +2,7 @@ use std::fmt::{self, Write}; use std::path::PathBuf; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use collections::IndexMap; use gpui::{App, AsyncApp, Entity, Task}; diff --git a/crates/assistant_tools/src/copy_path_tool.rs b/crates/assistant_tools/src/copy_path_tool.rs index f872703f8c878f5c0b9c1937aa6a987eb039546b..540da5ff7a3032182af98065200ce8a1a27f7071 100644 --- a/crates/assistant_tools/src/copy_path_tool.rs +++ b/crates/assistant_tools/src/copy_path_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::LanguageModelRequestMessage; diff --git a/crates/assistant_tools/src/create_directory_tool.rs b/crates/assistant_tools/src/create_directory_tool.rs index 0e8d77eda7e0eb234430dc76fd6de9089ebd7172..d5b948a2d9eafd5ccd3f2f21f3987c0cb77f0023 100644 --- a/crates/assistant_tools/src/create_directory_tool.rs +++ b/crates/assistant_tools/src/create_directory_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::LanguageModelRequestMessage; diff --git a/crates/assistant_tools/src/create_file_tool.rs b/crates/assistant_tools/src/create_file_tool.rs index 37c016821f1c9f8bd6351daaecad8e24a71f695b..d4f0f77e6488c3e24146f1631dc0b2711b02af33 100644 --- a/crates/assistant_tools/src/create_file_tool.rs +++ b/crates/assistant_tools/src/create_file_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::LanguageModelRequestMessage; diff --git a/crates/assistant_tools/src/delete_path_tool.rs b/crates/assistant_tools/src/delete_path_tool.rs index bd0ca72890f22881c9261cb7ba0d2e5c8c20f801..3eae3e1790d75aa8fcf04698de5d845411e589be 100644 --- a/crates/assistant_tools/src/delete_path_tool.rs +++ b/crates/assistant_tools/src/delete_path_tool.rs @@ -1,7 +1,7 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; -use futures::{channel::mpsc, SinkExt, StreamExt}; +use futures::{SinkExt, StreamExt, channel::mpsc}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use project::{Project, ProjectPath}; diff --git a/crates/assistant_tools/src/diagnostics_tool.rs b/crates/assistant_tools/src/diagnostics_tool.rs index 1dbcee0bca70762d03a43d37c064808d8fa7fce1..feb78dfe56a3bafcddb40049ce2955aeedcd9afd 100644 --- a/crates/assistant_tools/src/diagnostics_tool.rs +++ b/crates/assistant_tools/src/diagnostics_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language::{DiagnosticSeverity, OffsetRangeExt}; diff --git a/crates/assistant_tools/src/edit_files_tool.rs b/crates/assistant_tools/src/edit_files_tool.rs index 818e541e7a63e52213a68ad2098fdb6ad44a152d..579bd6e9b3e4a2c93cef95650f0afd2dddaaab6c 100644 --- a/crates/assistant_tools/src/edit_files_tool.rs +++ b/crates/assistant_tools/src/edit_files_tool.rs @@ -3,11 +3,11 @@ pub mod log; use crate::replace::{replace_exact, replace_with_flexible_indent}; use crate::schema::json_schema_for; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use collections::HashSet; -use edit_action::{edit_model_prompt, EditAction, EditActionParser}; -use futures::{channel::mpsc, SinkExt, StreamExt}; +use edit_action::{EditAction, EditActionParser, edit_model_prompt}; +use futures::{SinkExt, StreamExt, channel::mpsc}; use gpui::{App, AppContext, AsyncApp, Entity, Task}; use language_model::LanguageModelToolSchemaFormat; use language_model::{ diff --git a/crates/assistant_tools/src/edit_files_tool/log.rs b/crates/assistant_tools/src/edit_files_tool/log.rs index 31a3a98c8f7bfc09e7e6aae5e35d925a0e5d4b7c..b4c5523d91cc96aeeb0a4c26b95de6589ac9f3e7 100644 --- a/crates/assistant_tools/src/edit_files_tool/log.rs +++ b/crates/assistant_tools/src/edit_files_tool/log.rs @@ -3,13 +3,13 @@ use std::path::Path; use collections::HashSet; use feature_flags::FeatureFlagAppExt; use gpui::{ - actions, list, prelude::*, App, Empty, Entity, EventEmitter, FocusHandle, Focusable, Global, - ListAlignment, ListState, SharedString, Subscription, Window, + App, Empty, Entity, EventEmitter, FocusHandle, Focusable, Global, ListAlignment, ListState, + SharedString, Subscription, Window, actions, list, prelude::*, }; use release_channel::ReleaseChannel; use settings::Settings; use ui::prelude::*; -use workspace::{item::ItemEvent, Item, Workspace, WorkspaceId}; +use workspace::{Item, Workspace, WorkspaceId, item::ItemEvent}; use super::edit_action::EditAction; diff --git a/crates/assistant_tools/src/fetch_tool.rs b/crates/assistant_tools/src/fetch_tool.rs index 62df4860e645e59ff22b70a51afd9ac08bc4ef89..6c24bf3ba1fb647759c552ee8a2f029df99241ea 100644 --- a/crates/assistant_tools/src/fetch_tool.rs +++ b/crates/assistant_tools/src/fetch_tool.rs @@ -3,11 +3,11 @@ use std::rc::Rc; use std::sync::Arc; use crate::schema::json_schema_for; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use assistant_tool::{ActionLog, Tool}; use futures::AsyncReadExt as _; use gpui::{App, AppContext as _, Entity, Task}; -use html_to_markdown::{convert_html_to_markdown, markdown, TagHandler}; +use html_to_markdown::{TagHandler, convert_html_to_markdown, markdown}; use http_client::{AsyncBody, HttpClientWithUrl}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use project::Project; diff --git a/crates/assistant_tools/src/find_replace_file_tool.rs b/crates/assistant_tools/src/find_replace_file_tool.rs index 725ae746d7c0b5b46bb2ae67ac3597077811cb77..bed732f0609fb4007951c2f39e0c348fd1969bda 100644 --- a/crates/assistant_tools/src/find_replace_file_tool.rs +++ b/crates/assistant_tools/src/find_replace_file_tool.rs @@ -1,5 +1,5 @@ use crate::{replace::replace_with_flexible_indent, schema::json_schema_for}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/list_directory_tool.rs b/crates/assistant_tools/src/list_directory_tool.rs index 478dc7e572f1ed6c1925bb447cc13b999d4235b5..81ad0dd8017f278cce822841129e6d7682da83f0 100644 --- a/crates/assistant_tools/src/list_directory_tool.rs +++ b/crates/assistant_tools/src/list_directory_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/move_path_tool.rs b/crates/assistant_tools/src/move_path_tool.rs index 4377ae02806cb0ab18964d106aba96b2273c53ca..9f8e27c60ea6c77150df44caf46f6165d420c0c4 100644 --- a/crates/assistant_tools/src/move_path_tool.rs +++ b/crates/assistant_tools/src/move_path_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/now_tool.rs b/crates/assistant_tools/src/now_tool.rs index 796e2ab15a13e43be47f35c1f851bf2f9b65ab47..e793899855e3fdfc84c00b6ee1b88a1e07df238f 100644 --- a/crates/assistant_tools/src/now_tool.rs +++ b/crates/assistant_tools/src/now_tool.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use chrono::{Local, Utc}; use gpui::{App, Entity, Task}; diff --git a/crates/assistant_tools/src/open_tool.rs b/crates/assistant_tools/src/open_tool.rs index 5064d3d22f60b3cc79d415794c0e51bca8868e29..013ee4fcaf6b2ad6a4925ac9c839e92986591919 100644 --- a/crates/assistant_tools/src/open_tool.rs +++ b/crates/assistant_tools/src/open_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/path_search_tool.rs b/crates/assistant_tools/src/path_search_tool.rs index 649e3d8bde0e8c5f9befec544ebec563693de129..f7bdb0b8e584517e93c8299e4b733fff8a23cb2f 100644 --- a/crates/assistant_tools/src/path_search_tool.rs +++ b/crates/assistant_tools/src/path_search_tool.rs @@ -1,5 +1,5 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AppContext, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/assistant_tools/src/read_file_tool.rs b/crates/assistant_tools/src/read_file_tool.rs index 267655a1ecb760cb4f11ee1ceca85641b7e4f8a5..3c8a36dcccef2b0fc8a2ea494452c4e7a8a76ad8 100644 --- a/crates/assistant_tools/src/read_file_tool.rs +++ b/crates/assistant_tools/src/read_file_tool.rs @@ -2,7 +2,7 @@ use std::path::Path; use std::sync::Arc; use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use itertools::Itertools; diff --git a/crates/assistant_tools/src/regex_search_tool.rs b/crates/assistant_tools/src/regex_search_tool.rs index 7886c1b0f9e6a04a5d64b453c7b86d3002b0c310..d300f0ddc1fed78b5ad52732709fab2ebf64f1cb 100644 --- a/crates/assistant_tools/src/regex_search_tool.rs +++ b/crates/assistant_tools/src/regex_search_tool.rs @@ -1,13 +1,13 @@ use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use futures::StreamExt; use gpui::{App, Entity, Task}; use language::OffsetRangeExt; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; use project::{ - search::{SearchQuery, SearchResult}, Project, + search::{SearchQuery, SearchResult}, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/crates/assistant_tools/src/replace.rs b/crates/assistant_tools/src/replace.rs index 8a11910151b7f14c7ecf0358e58ffbb9b0eda257..bbfadf981e18b770bf45cf72a64286cfe324a4ca 100644 --- a/crates/assistant_tools/src/replace.rs +++ b/crates/assistant_tools/src/replace.rs @@ -1,7 +1,7 @@ use language::{BufferSnapshot, Diff, Point, ToOffset}; use project::search::SearchQuery; use std::iter; -use util::{paths::PathMatcher, ResultExt as _}; +use util::{ResultExt as _, paths::PathMatcher}; /// Performs an exact string replacement in a buffer, requiring precise character-for-character matching. /// Uses the search functionality to locate the first occurrence of the exact string. @@ -151,8 +151,8 @@ fn lines_with_min_indent(input: &str) -> (Vec<&str>, usize) { #[cfg(test)] mod tests { use super::*; - use gpui::prelude::*; use gpui::TestAppContext; + use gpui::prelude::*; use unindent::Unindent; #[gpui::test] diff --git a/crates/assistant_tools/src/schema.rs b/crates/assistant_tools/src/schema.rs index 7c767153fc4eea3f818db69697888593eba6721d..10ae594ecd0f9674f285c530d2cb650093bfa6d2 100644 --- a/crates/assistant_tools/src/schema.rs +++ b/crates/assistant_tools/src/schema.rs @@ -1,8 +1,8 @@ use anyhow::Result; use language_model::LanguageModelToolSchemaFormat; use schemars::{ - schema::{RootSchema, Schema, SchemaObject}, JsonSchema, + schema::{RootSchema, Schema, SchemaObject}, }; pub fn json_schema_for(format: LanguageModelToolSchemaFormat) -> serde_json::Value { diff --git a/crates/assistant_tools/src/symbol_info_tool.rs b/crates/assistant_tools/src/symbol_info_tool.rs index 9fab92497a1b702b4a590db225446ce4519a0676..b9be2bb8d423b457433008f5a1016323734c5aa8 100644 --- a/crates/assistant_tools/src/symbol_info_tool.rs +++ b/crates/assistant_tools/src/symbol_info_tool.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, AsyncApp, Entity, Task}; use language::{self, Anchor, Buffer, BufferSnapshot, Location, Point, ToPoint, ToPointUtf16}; diff --git a/crates/assistant_tools/src/thinking_tool.rs b/crates/assistant_tools/src/thinking_tool.rs index f4a0ab23421f000fee234b50d4a7a7222a5d3443..b189edc0b6ab0f20e96ea60fd15fb35673a7e4ec 100644 --- a/crates/assistant_tools/src/thinking_tool.rs +++ b/crates/assistant_tools/src/thinking_tool.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use crate::schema::json_schema_for; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_tool::{ActionLog, Tool}; use gpui::{App, Entity, Task}; use language_model::{LanguageModelRequestMessage, LanguageModelToolSchemaFormat}; diff --git a/crates/audio/src/assets.rs b/crates/audio/src/assets.rs index 19a53bcc0fb1d10d0c10e47823bd836ab5a8fb70..58074d6c93cf33b97f9716964d0d6cbe0b7956e9 100644 --- a/crates/audio/src/assets.rs +++ b/crates/audio/src/assets.rs @@ -4,8 +4,8 @@ use anyhow::Result; use collections::HashMap; use gpui::{App, AssetSource, Global}; use rodio::{ - source::{Buffered, SamplesConverter}, Decoder, Source, + source::{Buffered, SamplesConverter}, }; type Sound = Buffered>>, f32>>; diff --git a/crates/auto_update/src/auto_update.rs b/crates/auto_update/src/auto_update.rs index 11a699b0b63438fad45cf6d209f4d3cdf83ee5b9..77d2037288bc32f791d7e1aa6ef7d0e46d712a84 100644 --- a/crates/auto_update/src/auto_update.rs +++ b/crates/auto_update/src/auto_update.rs @@ -1,9 +1,9 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use client::{Client, TelemetrySettings}; -use db::kvp::KEY_VALUE_STORE; use db::RELEASE_CHANNEL; +use db::kvp::KEY_VALUE_STORE; use gpui::{ - actions, App, AppContext as _, AsyncApp, Context, Entity, Global, SemanticVersion, Task, Window, + App, AppContext as _, AsyncApp, Context, Entity, Global, SemanticVersion, Task, Window, actions, }; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use paths::remote_servers_dir; @@ -252,9 +252,11 @@ impl AutoUpdater { } pub fn start_polling(&self, cx: &mut Context) -> Task> { - cx.spawn(async move |this, cx| loop { - this.update(cx, |this, cx| this.poll(cx))?; - cx.background_executor().timer(POLL_INTERVAL).await; + cx.spawn(async move |this, cx| { + loop { + this.update(cx, |this, cx| this.poll(cx))?; + cx.background_executor().timer(POLL_INTERVAL).await; + } }) } diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rs index 61aebaf8eddcdf16c5ca556fd793ebd551c4f360..b0fd67add03dc4f429b4b800b864122c64d41302 100644 --- a/crates/auto_update_ui/src/auto_update_ui.rs +++ b/crates/auto_update_ui/src/auto_update_ui.rs @@ -1,16 +1,16 @@ use auto_update::AutoUpdater; use client::proto::UpdateNotification; use editor::{Editor, MultiBuffer}; -use gpui::{actions, prelude::*, App, Context, DismissEvent, Entity, SharedString, Window}; +use gpui::{App, Context, DismissEvent, Entity, SharedString, Window, actions, prelude::*}; use http_client::HttpClient; use markdown_preview::markdown_preview_view::{MarkdownPreviewMode, MarkdownPreviewView}; use release_channel::{AppVersion, ReleaseChannel}; use serde::Deserialize; use smol::io::AsyncReadExt; use util::ResultExt as _; -use workspace::notifications::simple_message_notification::MessageNotification; -use workspace::notifications::{show_app_notification, NotificationId}; use workspace::Workspace; +use workspace::notifications::simple_message_notification::MessageNotification; +use workspace::notifications::{NotificationId, show_app_notification}; actions!(auto_update, [ViewReleaseNotesLocally]); diff --git a/crates/bedrock/src/bedrock.rs b/crates/bedrock/src/bedrock.rs index fa17bc03834941af07853d3269cd8fc37645be6f..df6701e4741b5f8be49474fc05f93d138835061b 100644 --- a/crates/bedrock/src/bedrock.rs +++ b/crates/bedrock/src/bedrock.rs @@ -2,7 +2,7 @@ mod models; use std::pin::Pin; -use anyhow::{anyhow, Context, Error, Result}; +use anyhow::{Context, Error, Result, anyhow}; use aws_sdk_bedrockruntime as bedrock; pub use aws_sdk_bedrockruntime as bedrock_client; pub use aws_sdk_bedrockruntime::types::{ diff --git a/crates/breadcrumbs/src/breadcrumbs.rs b/crates/breadcrumbs/src/breadcrumbs.rs index 53c8ce73173a6976452cffa4b21de813ea4bfbdf..78a4d858cccaf989c2348fd49abecb29a3bed997 100644 --- a/crates/breadcrumbs/src/breadcrumbs.rs +++ b/crates/breadcrumbs/src/breadcrumbs.rs @@ -6,10 +6,10 @@ use gpui::{ use itertools::Itertools; use std::cmp; use theme::ActiveTheme; -use ui::{prelude::*, ButtonLike, ButtonStyle, Label, Tooltip}; +use ui::{ButtonLike, ButtonStyle, Label, Tooltip, prelude::*}; use workspace::{ - item::{BreadcrumbText, ItemEvent, ItemHandle}, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, + item::{BreadcrumbText, ItemEvent, ItemHandle}, }; pub struct Breadcrumbs { diff --git a/crates/buffer_diff/src/buffer_diff.rs b/crates/buffer_diff/src/buffer_diff.rs index f5a0b7d6a71497e6ba55a0fd786d1e45b0b65771..57873e9fba5592c756e57311b6493eb25d48a2d9 100644 --- a/crates/buffer_diff/src/buffer_diff.rs +++ b/crates/buffer_diff/src/buffer_diff.rs @@ -1296,7 +1296,7 @@ mod tests { use super::*; use gpui::TestAppContext; use pretty_assertions::{assert_eq, assert_ne}; - use rand::{rngs::StdRng, Rng as _}; + use rand::{Rng as _, rngs::StdRng}; use text::{Buffer, BufferId, Rope}; use unindent::Unindent as _; use util::test::marked_text_ranges; diff --git a/crates/call/src/call_impl/mod.rs b/crates/call/src/call_impl/mod.rs index 0db63b203c86c0050ea51114a1a3b091a15ca3cb..1017bd92be8fe517fb8b2a40bd9bfa3905e3a5b3 100644 --- a/crates/call/src/call_impl/mod.rs +++ b/crates/call/src/call_impl/mod.rs @@ -2,11 +2,11 @@ pub mod participant; pub mod room; use crate::call_settings::CallSettings; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use audio::Audio; -use client::{proto, ChannelId, Client, TypedEnvelope, User, UserStore, ZED_ALWAYS_ACTIVE}; +use client::{ChannelId, Client, TypedEnvelope, User, UserStore, ZED_ALWAYS_ACTIVE, proto}; use collections::HashSet; -use futures::{channel::oneshot, future::Shared, Future, FutureExt}; +use futures::{Future, FutureExt, channel::oneshot, future::Shared}; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Subscription, Task, WeakEntity, diff --git a/crates/call/src/call_impl/participant.rs b/crates/call/src/call_impl/participant.rs index e887aeb329bb0c60ae19c7191af7c420facbc357..19b59f48ad633b93c186be0c51b3441db62dc2db 100644 --- a/crates/call/src/call_impl/participant.rs +++ b/crates/call/src/call_impl/participant.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, Result}; -use client::{proto, ParticipantIndex, User}; +use anyhow::{Result, anyhow}; +use client::{ParticipantIndex, User, proto}; use collections::HashMap; use gpui::WeakEntity; use livekit_client::AudioStream; diff --git a/crates/call/src/call_impl/room.rs b/crates/call/src/call_impl/room.rs index 3ee7f492a76bc238011e4811b9a61a0f8bf2f719..0b9e951ae557d93bd08d7118febedabd5323c761 100644 --- a/crates/call/src/call_impl/room.rs +++ b/crates/call/src/call_impl/room.rs @@ -2,11 +2,11 @@ use crate::{ call_settings::CallSettings, participant::{LocalParticipant, ParticipantLocation, RemoteParticipant}, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use audio::{Audio, Sound}; use client::{ - proto::{self, PeerId}, ChannelId, Client, ParticipantIndex, TypedEnvelope, User, UserStore, + proto::{self, PeerId}, }; use collections::{BTreeMap, HashMap, HashSet}; use fs::Fs; @@ -20,7 +20,7 @@ use postage::{sink::Sink, stream::Stream, watch}; use project::Project; use settings::Settings as _; use std::{any::Any, future::Future, mem, sync::Arc, time::Duration}; -use util::{post_inc, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, post_inc}; pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); @@ -139,7 +139,7 @@ impl Room { pending_participants: Default::default(), pending_call_count: 0, client_subscriptions: vec![ - client.add_message_handler(cx.weak_entity(), Self::handle_room_updated) + client.add_message_handler(cx.weak_entity(), Self::handle_room_updated), ], _subscriptions: vec![ cx.on_release(Self::released), diff --git a/crates/channel/src/channel.rs b/crates/channel/src/channel.rs index 13b66c7dc3a7e157eee0ebe81ad3255db972fecc..63865c574ecc36da27e18f02ccb8c44138cef3ba 100644 --- a/crates/channel/src/channel.rs +++ b/crates/channel/src/channel.rs @@ -6,10 +6,10 @@ use client::{Client, UserStore}; use gpui::{App, Entity}; use std::sync::Arc; -pub use channel_buffer::{ChannelBuffer, ChannelBufferEvent, ACKNOWLEDGE_DEBOUNCE_INTERVAL}; +pub use channel_buffer::{ACKNOWLEDGE_DEBOUNCE_INTERVAL, ChannelBuffer, ChannelBufferEvent}; pub use channel_chat::{ - mentions_to_proto, ChannelChat, ChannelChatEvent, ChannelMessage, ChannelMessageId, - MessageParams, + ChannelChat, ChannelChatEvent, ChannelMessage, ChannelMessageId, MessageParams, + mentions_to_proto, }; pub use channel_store::{Channel, ChannelEvent, ChannelMembership, ChannelStore}; diff --git a/crates/channel/src/channel_buffer.rs b/crates/channel/src/channel_buffer.rs index 9cea4a4d48d71441a3acc6e8035643fcbe0ebb5e..50420bf2970a4f3c641b91ea0c4bb71d01ced55c 100644 --- a/crates/channel/src/channel_buffer.rs +++ b/crates/channel/src/channel_buffer.rs @@ -5,8 +5,8 @@ use collections::HashMap; use gpui::{App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Task}; use language::proto::serialize_version; use rpc::{ - proto::{self, PeerId}, AnyProtoClient, TypedEnvelope, + proto::{self, PeerId}, }; use std::{sync::Arc, time::Duration}; use text::BufferId; diff --git a/crates/channel/src/channel_chat.rs b/crates/channel/src/channel_chat.rs index bbf74af6970d6a780fb2f4b2585672a7f5f49d54..400f8ff35c14de8d62d7e578fbc609649becb018 100644 --- a/crates/channel/src/channel_chat.rs +++ b/crates/channel/src/channel_chat.rs @@ -1,9 +1,8 @@ use crate::{Channel, ChannelStore}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use client::{ - proto, + ChannelId, Client, Subscription, TypedEnvelope, UserId, proto, user::{User, UserStore}, - ChannelId, Client, Subscription, TypedEnvelope, UserId, }; use collections::HashSet; use futures::lock::Mutex; @@ -16,7 +15,7 @@ use std::{ }; use sum_tree::{Bias, SumTree}; use time::OffsetDateTime; -use util::{post_inc, ResultExt as _, TryFutureExt}; +use util::{ResultExt as _, TryFutureExt, post_inc}; pub struct ChannelChat { pub channel_id: ChannelId, @@ -339,7 +338,7 @@ impl ChannelChat { .item() .map_or(false, |message| message.id == message_id) { - Some(cursor.start().1 .0) + Some(cursor.start().1.0) } else { None }, @@ -595,7 +594,7 @@ impl ChannelChat { let mut old_cursor = self.messages.cursor::<(ChannelMessageId, Count)>(&()); let mut new_messages = old_cursor.slice(&first_message.id, Bias::Left, &()); - let start_ix = old_cursor.start().1 .0; + let start_ix = old_cursor.start().1.0; let removed_messages = old_cursor.slice(&last_message.id, Bias::Right, &()); let removed_count = removed_messages.summary().count; let new_count = messages.summary().count; @@ -613,7 +612,7 @@ impl ChannelChat { ); while let Some(message) = old_cursor.item() { - let message_ix = old_cursor.start().1 .0; + let message_ix = old_cursor.start().1.0; if nonces.contains(&message.nonce) { if ranges.last().map_or(false, |r| r.end == message_ix) { ranges.last_mut().unwrap().end += 1; diff --git a/crates/channel/src/channel_store.rs b/crates/channel/src/channel_store.rs index 945db550d412dcc33859679fecd6cde70857ce30..17fa43def50a378b15dea2211e508aa98d4816f5 100644 --- a/crates/channel/src/channel_store.rs +++ b/crates/channel/src/channel_store.rs @@ -1,23 +1,23 @@ mod channel_index; -use crate::{channel_buffer::ChannelBuffer, channel_chat::ChannelChat, ChannelMessage}; -use anyhow::{anyhow, Result}; +use crate::{ChannelMessage, channel_buffer::ChannelBuffer, channel_chat::ChannelChat}; +use anyhow::{Result, anyhow}; use channel_index::ChannelIndex; use client::{ChannelId, Client, ClientSettings, Subscription, User, UserId, UserStore}; -use collections::{hash_map, HashMap, HashSet}; -use futures::{channel::mpsc, future::Shared, Future, FutureExt, StreamExt}; +use collections::{HashMap, HashSet, hash_map}; +use futures::{Future, FutureExt, StreamExt, channel::mpsc, future::Shared}; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, SharedString, Task, WeakEntity, }; use language::Capability; use rpc::{ - proto::{self, ChannelRole, ChannelVisibility}, TypedEnvelope, + proto::{self, ChannelRole, ChannelVisibility}, }; use settings::Settings; use std::{mem, sync::Arc, time::Duration}; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); diff --git a/crates/channel/src/channel_store_tests.rs b/crates/channel/src/channel_store_tests.rs index 779849df246fc6f5aaa4e5f7188456ebf9b90663..b7bed8a1a9385472ee9b05f5519165ed4b6679dd 100644 --- a/crates/channel/src/channel_store_tests.rs +++ b/crates/channel/src/channel_store_tests.rs @@ -1,7 +1,7 @@ use crate::channel_chat::ChannelChatEvent; use super::*; -use client::{test::FakeServer, Client, UserStore}; +use client::{Client, UserStore, test::FakeServer}; use clock::FakeSystemClock; use gpui::{App, AppContext as _, Entity, SemanticVersion, TestAppContext}; use http_client::FakeHttpClient; diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 40534f318d96230ba5be5b3d1f220881f1f949ec..17a578bd6c7c8746e9f4eef0b0d084b7d24704c5 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -5,7 +5,7 @@ use anyhow::{Context as _, Result}; use clap::Parser; -use cli::{ipc::IpcOneShotServer, CliRequest, CliResponse, IpcHandshake}; +use cli::{CliRequest, CliResponse, IpcHandshake, ipc::IpcOneShotServer}; use collections::HashMap; use parking_lot::Mutex; use std::{ @@ -614,14 +614,14 @@ mod windows { use anyhow::Context; use release_channel::app_identifier; use windows::{ - core::HSTRING, Win32::{ - Foundation::{CloseHandle, GetLastError, ERROR_ALREADY_EXISTS, GENERIC_WRITE}, + Foundation::{CloseHandle, ERROR_ALREADY_EXISTS, GENERIC_WRITE, GetLastError}, Storage::FileSystem::{ - CreateFileW, WriteFile, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, OPEN_EXISTING, + CreateFileW, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, OPEN_EXISTING, WriteFile, }, System::Threading::CreateMutexW, }, + core::HSTRING, }; use crate::{Detect, InstalledApp}; @@ -728,14 +728,14 @@ mod windows { #[cfg(target_os = "macos")] mod mac_os { - use anyhow::{anyhow, Context as _, Result}; + use anyhow::{Context as _, Result, anyhow}; use core_foundation::{ array::{CFArray, CFIndex}, base::TCFType as _, string::kCFStringEncodingUTF8, - url::{CFURLCreateWithBytes, CFURL}, + url::{CFURL, CFURLCreateWithBytes}, }; - use core_services::{kLSLaunchDefaults, LSLaunchURLSpec, LSOpenFromURLSpec}; + use core_services::{LSLaunchURLSpec, LSOpenFromURLSpec, kLSLaunchDefaults}; use serde::Deserialize; use std::{ ffi::OsStr, diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 35051446e2b9b61b5ae76abce53c59eef7415351..196a38e31fd4f1e390ba32322acb7b02812cdd44 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -6,7 +6,7 @@ pub mod telemetry; pub mod user; pub mod zed_urls; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_recursion::async_recursion; use async_tungstenite::tungstenite::{ client::IntoClientRequest, @@ -17,10 +17,10 @@ use chrono::{DateTime, Utc}; use clock::SystemClock; use credentials_provider::CredentialsProvider; use futures::{ - channel::oneshot, future::BoxFuture, AsyncReadExt, FutureExt, SinkExt, Stream, StreamExt, - TryFutureExt as _, TryStreamExt, + AsyncReadExt, FutureExt, SinkExt, Stream, StreamExt, TryFutureExt as _, TryStreamExt, + channel::oneshot, future::BoxFuture, }; -use gpui::{actions, App, AppContext as _, AsyncApp, Entity, Global, Task, WeakEntity}; +use gpui::{App, AppContext as _, AsyncApp, Entity, Global, Task, WeakEntity, actions}; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use parking_lot::RwLock; use postage::watch; @@ -40,8 +40,8 @@ use std::{ marker::PhantomData, path::PathBuf, sync::{ - atomic::{AtomicU64, Ordering}, Arc, LazyLock, Weak, + atomic::{AtomicU64, Ordering}, }, time::{Duration, Instant}, }; diff --git a/crates/client/src/socks.rs b/crates/client/src/socks.rs index 45126697d4081a7c2901b406588600989e0b1a5d..722e06a2f74b513534984d7c17d719388198b95b 100644 --- a/crates/client/src/socks.rs +++ b/crates/client/src/socks.rs @@ -1,5 +1,5 @@ //! socks proxy -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use futures::io::{AsyncRead, AsyncWrite}; use http_client::Uri; use tokio_socks::{ diff --git a/crates/client/src/test.rs b/crates/client/src/test.rs index 2f23d43ae36acbfd565794a6dad3ba0c110b49d8..825c0f43b4de07fd61d11ec750a2fcf24791038b 100644 --- a/crates/client/src/test.rs +++ b/crates/client/src/test.rs @@ -1,12 +1,12 @@ use crate::{Client, Connection, Credentials, EstablishConnectionError, UserStore}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use chrono::Duration; -use futures::{stream::BoxStream, StreamExt}; +use futures::{StreamExt, stream::BoxStream}; use gpui::{AppContext as _, BackgroundExecutor, Entity, TestAppContext}; use parking_lot::Mutex; use rpc::{ - proto::{self, GetPrivateUserInfo, GetPrivateUserInfoResponse}, ConnectionId, Peer, Receipt, TypedEnvelope, + proto::{self, GetPrivateUserInfo, GetPrivateUserInfoResponse}, }; use std::sync::Arc; diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index de5141b10402ca3745db5d30ea62ea8df48e8e0f..b213354a1bbc2a53a56712a357dc38ec67f1ac12 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -1,9 +1,9 @@ -use super::{proto, Client, Status, TypedEnvelope}; -use anyhow::{anyhow, Context as _, Result}; +use super::{Client, Status, TypedEnvelope, proto}; +use anyhow::{Context as _, Result, anyhow}; use chrono::{DateTime, Utc}; -use collections::{hash_map::Entry, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map::Entry}; use feature_flags::FeatureFlagAppExt; -use futures::{channel::mpsc, Future, StreamExt}; +use futures::{Future, StreamExt, channel::mpsc}; use gpui::{ App, AsyncApp, Context, Entity, EventEmitter, SharedString, SharedUri, Task, WeakEntity, }; diff --git a/crates/collab/src/api.rs b/crates/collab/src/api.rs index 2b8b5ac6fb7429afca858762eba0e2d65eacbee1..fde0d64eaebbb48f77e37d45a1ea7e09acaf0298 100644 --- a/crates/collab/src/api.rs +++ b/crates/collab/src/api.rs @@ -6,12 +6,13 @@ pub mod ips_file; pub mod slack; use crate::{ - auth, + AppState, Error, Result, auth, db::{User, UserId}, - rpc, AppState, Error, Result, + rpc, }; use anyhow::anyhow; use axum::{ + Extension, Json, Router, body::Body, extract::{Path, Query}, headers::Header, @@ -19,7 +20,6 @@ use axum::{ middleware::{self, Next}, response::IntoResponse, routing::{get, post}, - Extension, Json, Router, }; use axum_extra::response::ErasedJson; use serde::{Deserialize, Serialize}; diff --git a/crates/collab/src/api/billing.rs b/crates/collab/src/api/billing.rs index 2561767a3f81ece6403d3d4b744be210eb67b0cc..4115c999a93b4a98f478b4c079672c01fdba6c99 100644 --- a/crates/collab/src/api/billing.rs +++ b/crates/collab/src/api/billing.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, bail, Context}; +use anyhow::{Context, anyhow, bail}; use axum::{ + Extension, Json, Router, extract::{self, Query}, routing::{get, post}, - Extension, Json, Router, }; use chrono::{DateTime, SecondsFormat, Utc}; use collections::HashSet; @@ -24,17 +24,16 @@ use crate::api::events::SnowflakeRow; use crate::db::billing_subscription::{StripeCancellationReason, StripeSubscriptionStatus}; use crate::llm::{DEFAULT_MAX_MONTHLY_SPEND, FREE_TIER_MONTHLY_SPENDING_LIMIT}; use crate::rpc::{ResultExt as _, Server}; +use crate::{AppState, Cents, Error, Result}; use crate::{db::UserId, llm::db::LlmDatabase}; use crate::{ db::{ - billing_customer, BillingSubscriptionId, CreateBillingCustomerParams, - CreateBillingSubscriptionParams, CreateProcessedStripeEventParams, - UpdateBillingCustomerParams, UpdateBillingPreferencesParams, - UpdateBillingSubscriptionParams, + BillingSubscriptionId, CreateBillingCustomerParams, CreateBillingSubscriptionParams, + CreateProcessedStripeEventParams, UpdateBillingCustomerParams, + UpdateBillingPreferencesParams, UpdateBillingSubscriptionParams, billing_customer, }, stripe_billing::StripeBilling, }; -use crate::{AppState, Cents, Error, Result}; pub fn router() -> Router { Router::new() diff --git a/crates/collab/src/api/contributors.rs b/crates/collab/src/api/contributors.rs index 51d0e060df022c16037478bbd6ea23b8dcb9a968..70b15901953f91d8d9211836233ed5fdf6ef80a5 100644 --- a/crates/collab/src/api/contributors.rs +++ b/crates/collab/src/api/contributors.rs @@ -2,9 +2,9 @@ use std::sync::{Arc, OnceLock}; use anyhow::anyhow; use axum::{ + Extension, Json, Router, extract::{self, Query}, routing::get, - Extension, Json, Router, }; use chrono::{NaiveDateTime, SecondsFormat}; use serde::{Deserialize, Serialize}; diff --git a/crates/collab/src/api/events.rs b/crates/collab/src/api/events.rs index c7792690f8244d7af31b60ff5885ac2dd6a65355..04515ae44dd9fb6c34307c75eb11fbbabed3be1f 100644 --- a/crates/collab/src/api/events.rs +++ b/crates/collab/src/api/events.rs @@ -1,14 +1,14 @@ use super::ips_file::IpsFile; use crate::api::CloudflareIpCountryHeader; -use crate::{api::slack, AppState, Error, Result}; +use crate::{AppState, Error, Result, api::slack}; use anyhow::anyhow; use aws_sdk_s3::primitives::ByteStream; use axum::{ + Extension, Router, TypedHeader, body::Bytes, headers::Header, http::{HeaderMap, HeaderName, StatusCode}, routing::post, - Extension, Router, TypedHeader, }; use chrono::Duration; use semantic_version::SemanticVersion; diff --git a/crates/collab/src/api/extensions.rs b/crates/collab/src/api/extensions.rs index 73aea4534067f4f6e557c98fac3b27d3260c5d3a..034c8dcd3a913fffbca107cf29889c205786b828 100644 --- a/crates/collab/src/api/extensions.rs +++ b/crates/collab/src/api/extensions.rs @@ -1,13 +1,13 @@ use crate::db::ExtensionVersionConstraints; -use crate::{db::NewExtensionVersion, AppState, Error, Result}; -use anyhow::{anyhow, Context as _}; +use crate::{AppState, Error, Result, db::NewExtensionVersion}; +use anyhow::{Context as _, anyhow}; use aws_sdk_s3::presigning::PresigningConfig; use axum::{ + Extension, Json, Router, extract::{Path, Query}, http::StatusCode, response::Redirect, routing::get, - Extension, Json, Router, }; use collections::{BTreeSet, HashMap}; use rpc::{ExtensionApiManifest, ExtensionProvides, GetExtensionsResponse}; @@ -16,7 +16,7 @@ use serde::Deserialize; use std::str::FromStr; use std::{sync::Arc, time::Duration}; use time::PrimitiveDateTime; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; pub fn router() -> Router { Router::new() diff --git a/crates/collab/src/auth.rs b/crates/collab/src/auth.rs index 0c5056476911bea912586a37b113d9bf1185ec54..ee411d855cf97557f04c865f55e94f698fa6fb4b 100644 --- a/crates/collab/src/auth.rs +++ b/crates/collab/src/auth.rs @@ -1,20 +1,20 @@ use crate::{ + AppState, Error, Result, db::{self, AccessTokenId, Database, UserId}, rpc::Principal, - AppState, Error, Result, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use axum::{ http::{self, Request, StatusCode}, middleware::Next, response::IntoResponse, }; use base64::prelude::*; -use prometheus::{exponential_buckets, register_histogram, Histogram}; +use prometheus::{Histogram, exponential_buckets, register_histogram}; pub use rpc::auth::random_token; use scrypt::{ - password_hash::{PasswordHash, PasswordVerifier}, Scrypt, + password_hash::{PasswordHash, PasswordVerifier}, }; use serde::{Deserialize, Serialize}; use sha2::Digest; @@ -232,7 +232,7 @@ mod test { use sea_orm::EntityTrait; use super::*; - use crate::db::{access_token, NewUserParams}; + use crate::db::{NewUserParams, access_token}; #[gpui::test] async fn test_verify_access_token(cx: &mut gpui::TestAppContext) { diff --git a/crates/collab/src/db.rs b/crates/collab/src/db.rs index fa90239d9c8492014feb713eed7c40fd3890b8a7..764eec401eb657e7a575115ae87a86070eeb9da8 100644 --- a/crates/collab/src/db.rs +++ b/crates/collab/src/db.rs @@ -4,24 +4,24 @@ mod tables; #[cfg(test)] pub mod tests; -use crate::{executor::Executor, Error, Result}; +use crate::{Error, Result, executor::Executor}; use anyhow::anyhow; use collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use dashmap::DashMap; use futures::StreamExt; use project_repository_statuses::StatusKind; -use rand::{prelude::StdRng, Rng, SeedableRng}; +use rand::{Rng, SeedableRng, prelude::StdRng}; use rpc::ExtensionProvides; use rpc::{ - proto::{self}, ConnectionId, ExtensionMetadata, + proto::{self}, }; use sea_orm::{ - entity::prelude::*, - sea_query::{Alias, Expr, OnConflict}, ActiveValue, Condition, ConnectionTrait, DatabaseConnection, DatabaseTransaction, DbErr, FromQueryResult, IntoActiveModel, IsolationLevel, JoinType, QueryOrder, QuerySelect, Statement, TransactionTrait, + entity::prelude::*, + sea_query::{Alias, Expr, OnConflict}, }; use semantic_version::SemanticVersion; use serde::{Deserialize, Serialize}; diff --git a/crates/collab/src/db/ids.rs b/crates/collab/src/db/ids.rs index 698b1c5693337e4090d6c111988b41d596a3d23a..2ba7ec10514d8b0bbf4b26eab0b9384b3911204e 100644 --- a/crates/collab/src/db/ids.rs +++ b/crates/collab/src/db/ids.rs @@ -1,6 +1,6 @@ use crate::Result; use rpc::proto; -use sea_orm::{entity::prelude::*, DbErr}; +use sea_orm::{DbErr, entity::prelude::*}; use serde::{Deserialize, Serialize}; #[macro_export] diff --git a/crates/collab/src/db/queries/channels.rs b/crates/collab/src/db/queries/channels.rs index da301090ca7b3e21922e201c2a9731fad23d2d85..a21f85d4f870c0b152cfb040310512d853481ff5 100644 --- a/crates/collab/src/db/queries/channels.rs +++ b/crates/collab/src/db/queries/channels.rs @@ -1,7 +1,7 @@ use super::*; use rpc::{ - proto::{channel_member::Kind, ChannelBufferVersion, VectorClockEntry}, ErrorCode, ErrorCodeExt, + proto::{ChannelBufferVersion, VectorClockEntry, channel_member::Kind}, }; use sea_orm::{DbBackend, TryGetableMany}; diff --git a/crates/collab/src/db/queries/messages.rs b/crates/collab/src/db/queries/messages.rs index e4f6e0f497f7b2380dd762c181858fcd8309f5eb..8e5c4ba85154396eac354b1d38d8ef131a9f69c3 100644 --- a/crates/collab/src/db/queries/messages.rs +++ b/crates/collab/src/db/queries/messages.rs @@ -480,7 +480,7 @@ impl Database { self.notification_kinds_by_id .iter() .find(|(_, kind)| **kind == notification_kind) - .map(|kind| kind.0 .0) + .map(|kind| kind.0.0) } /// Removes the channel message with the given ID. diff --git a/crates/collab/src/db/tables/channel_member.rs b/crates/collab/src/db/tables/channel_member.rs index 5498a008565e4db681ac588f49cf4a3332121b9a..a00a380d55941c3a26a8e08eab54019254afd698 100644 --- a/crates/collab/src/db/tables/channel_member.rs +++ b/crates/collab/src/db/tables/channel_member.rs @@ -1,4 +1,4 @@ -use crate::db::{channel_member, ChannelId, ChannelMemberId, ChannelRole, UserId}; +use crate::db::{ChannelId, ChannelMemberId, ChannelRole, UserId, channel_member}; use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] diff --git a/crates/collab/src/db/tests.rs b/crates/collab/src/db/tests.rs index 52370c0956855400862206be9abf7e7149948a5c..cb27e15d6b4a49d70447fc695abb12b279dcf723 100644 --- a/crates/collab/src/db/tests.rs +++ b/crates/collab/src/db/tests.rs @@ -20,8 +20,8 @@ use parking_lot::Mutex; use sea_orm::ConnectionTrait; use sqlx::migrate::MigrateDatabase; use std::sync::{ - atomic::{AtomicI32, AtomicU32, Ordering::SeqCst}, Arc, + atomic::{AtomicI32, AtomicU32, Ordering::SeqCst}, }; pub struct TestDb { diff --git a/crates/collab/src/db/tests/buffer_tests.rs b/crates/collab/src/db/tests/buffer_tests.rs index 63986b8efcdf68d97c86d8ed2db249252a207a57..13c440d437d7380690ce528043f09b8b4430f9d2 100644 --- a/crates/collab/src/db/tests/buffer_tests.rs +++ b/crates/collab/src/db/tests/buffer_tests.rs @@ -111,10 +111,11 @@ async fn test_channel_buffers(db: &Arc) { assert_eq!(buffer_b.text(), "hello, cruel world"); // Ensure that C fails to open the buffer - assert!(db - .join_channel_buffer(zed_id, c_id, ConnectionId { owner_id, id: 3 }) - .await - .is_err()); + assert!( + db.join_channel_buffer(zed_id, c_id, ConnectionId { owner_id, id: 3 }) + .await + .is_err() + ); // Ensure that both collaborators have shown up assert_eq!( diff --git a/crates/collab/src/db/tests/channel_tests.rs b/crates/collab/src/db/tests/channel_tests.rs index 387454a7845adaac79010cd16cc7364a216e49f1..a4ff43bb37711e39202f925c376903814cdfd9ed 100644 --- a/crates/collab/src/db/tests/channel_tests.rs +++ b/crates/collab/src/db/tests/channel_tests.rs @@ -1,13 +1,13 @@ use crate::{ db::{ - tests::{channel_tree, new_test_connection, new_test_user}, Channel, ChannelId, ChannelRole, Database, NewUserParams, RoomId, UserId, + tests::{channel_tree, new_test_connection, new_test_user}, }, test_both_dbs, }; use rpc::{ - proto::{self}, ConnectionId, + proto::{self}, }; use std::sync::Arc; @@ -142,10 +142,11 @@ async fn test_joining_channels(db: &Arc) { let room_id = RoomId::from_proto(joined_room.room.id); drop(joined_room); // cannot join a room without membership to its channel - assert!(db - .join_room(room_id, user_2, ConnectionId { owner_id, id: 1 },) - .await - .is_err()); + assert!( + db.join_room(room_id, user_2, ConnectionId { owner_id, id: 1 },) + .await + .is_err() + ); } test_both_dbs!( @@ -547,8 +548,8 @@ async fn test_user_is_channel_participant(db: &Arc) { db.set_channel_member_role(zed_channel, admin, guest, ChannelRole::Banned) .await .unwrap(); - assert!(db - .transaction(|tx| async move { + assert!( + db.transaction(|tx| async move { db.check_user_is_channel_participant( &db.get_channel_internal(public_channel_id, &tx) .await @@ -559,7 +560,8 @@ async fn test_user_is_channel_participant(db: &Arc) { .await }) .await - .is_err()); + .is_err() + ); let (mut members, _) = db .get_channel_participant_details(public_channel_id, "", 100, admin) @@ -640,8 +642,8 @@ async fn test_user_is_channel_participant(db: &Arc) { }) .await .unwrap(); - assert!(db - .transaction(|tx| async move { + assert!( + db.transaction(|tx| async move { db.check_user_is_channel_participant( &db.get_channel_internal(internal_channel_id, &tx) .await @@ -652,7 +654,8 @@ async fn test_user_is_channel_participant(db: &Arc) { .await }) .await - .is_err(),); + .is_err(), + ); db.transaction(|tx| async move { db.check_user_is_channel_participant( @@ -720,19 +723,21 @@ async fn test_guest_access(db: &Arc) { .await .unwrap(); - assert!(db - .join_channel_chat(zed_channel, guest_connection, guest) - .await - .is_err()); + assert!( + db.join_channel_chat(zed_channel, guest_connection, guest) + .await + .is_err() + ); db.join_channel(zed_channel, guest, guest_connection) .await .unwrap(); - assert!(db - .join_channel_chat(zed_channel, guest_connection, guest) - .await - .is_ok()) + assert!( + db.join_channel_chat(zed_channel, guest_connection, guest) + .await + .is_ok() + ) } #[track_caller] diff --git a/crates/collab/src/db/tests/embedding_tests.rs b/crates/collab/src/db/tests/embedding_tests.rs index fcafac625d0be89808bd94dd0f6968743e25205a..8659d4b4a1165ab9d3a2ed591fc9a6dfbd727c56 100644 --- a/crates/collab/src/db/tests/embedding_tests.rs +++ b/crates/collab/src/db/tests/embedding_tests.rs @@ -1,7 +1,7 @@ use super::TestDb; use crate::db::embedding; use collections::HashMap; -use sea_orm::{sea_query::Expr, ColumnTrait, EntityTrait, QueryFilter}; +use sea_orm::{ColumnTrait, EntityTrait, QueryFilter, sea_query::Expr}; use std::ops::Sub; use time::{Duration, OffsetDateTime, PrimitiveDateTime}; diff --git a/crates/collab/src/db/tests/extension_tests.rs b/crates/collab/src/db/tests/extension_tests.rs index 460d74ffc0588c8243962a1a2b5e9d4bf9006fe8..9396b405fd52c19255159453afccaff5447b4544 100644 --- a/crates/collab/src/db/tests/extension_tests.rs +++ b/crates/collab/src/db/tests/extension_tests.rs @@ -6,7 +6,7 @@ use rpc::ExtensionProvides; use super::Database; use crate::db::ExtensionVersionConstraints; use crate::{ - db::{queries::extensions::convert_time_to_chrono, ExtensionMetadata, NewExtensionVersion}, + db::{ExtensionMetadata, NewExtensionVersion, queries::extensions::convert_time_to_chrono}, test_both_dbs, }; @@ -162,10 +162,11 @@ async fn test_extensions(db: &Arc) { } // Record download returns false if the extension does not exist. - assert!(!db - .record_extension_download("no-such-extension", "0.0.2") - .await - .unwrap()); + assert!( + !db.record_extension_download("no-such-extension", "0.0.2") + .await + .unwrap() + ); // Extensions are returned in descending order of total downloads. let extensions = db.get_extensions(None, None, 1, 5).await.unwrap(); diff --git a/crates/collab/src/env.rs b/crates/collab/src/env.rs index aaefd43df5e3945c042bd76ca5fbabf280f96614..bf9290e8d794846d7d58e8ce1b5a46199472cb29 100644 --- a/crates/collab/src/env.rs +++ b/crates/collab/src/env.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use std::fs; use std::path::Path; diff --git a/crates/collab/src/llm.rs b/crates/collab/src/llm.rs index aa513c099fc5c05aea4feba3923dab4c8daf90a9..1665d2e54b974a38ab1e7bf789ae68f0faf3a86c 100644 --- a/crates/collab/src/llm.rs +++ b/crates/collab/src/llm.rs @@ -2,30 +2,30 @@ mod authorization; pub mod db; mod token; -use crate::api::events::SnowflakeRow; use crate::api::CloudflareIpCountryHeader; +use crate::api::events::SnowflakeRow; use crate::build_kinesis_client; use crate::rpc::MIN_ACCOUNT_AGE_FOR_LLM_USE; -use crate::{db::UserId, executor::Executor, Cents, Config, Error, Result}; -use anyhow::{anyhow, Context as _}; +use crate::{Cents, Config, Error, Result, db::UserId, executor::Executor}; +use anyhow::{Context as _, anyhow}; use authorization::authorize_access_to_language_model; use axum::routing::get; use axum::{ + Extension, Json, Router, TypedHeader, body::Body, http::{self, HeaderName, HeaderValue, Request, StatusCode}, middleware::{self, Next}, response::{IntoResponse, Response}, routing::post, - Extension, Json, Router, TypedHeader, }; use chrono::{DateTime, Duration, Utc}; use collections::HashMap; use db::TokenUsage; -use db::{usage_measure::UsageMeasure, ActiveUserCount, LlmDatabase}; +use db::{ActiveUserCount, LlmDatabase, usage_measure::UsageMeasure}; use futures::{Stream, StreamExt as _}; use reqwest_client::ReqwestClient; use rpc::{ - proto::Plan, LanguageModelProvider, PerformCompletionParams, EXPIRED_LLM_TOKEN_HEADER_NAME, + EXPIRED_LLM_TOKEN_HEADER_NAME, LanguageModelProvider, PerformCompletionParams, proto::Plan, }; use rpc::{ListModelsResponse, MAX_LLM_MONTHLY_SPEND_REACHED_HEADER_NAME}; use serde_json::json; diff --git a/crates/collab/src/llm/db.rs b/crates/collab/src/llm/db.rs index 4374214c1b52fec241cba673da003a63c8ee8748..6a46184171b4d2abede6d5b9b7c70606056e29e4 100644 --- a/crates/collab/src/llm/db.rs +++ b/crates/collab/src/llm/db.rs @@ -21,15 +21,15 @@ use std::sync::Arc; use anyhow::anyhow; pub use queries::usages::{ActiveUserCount, TokenUsage}; -use sea_orm::prelude::*; pub use sea_orm::ConnectOptions; +use sea_orm::prelude::*; use sea_orm::{ ActiveValue, DatabaseConnection, DatabaseTransaction, IsolationLevel, TransactionTrait, }; +use crate::Result; use crate::db::TransactionHandle; use crate::executor::Executor; -use crate::Result; /// The database for the LLM service. pub struct LlmDatabase { diff --git a/crates/collab/src/llm/db/ids.rs b/crates/collab/src/llm/db/ids.rs index 67f2a49380796c098dcdf3d0bdb0a804fcfc1b59..03cab6cee0b9e7a07f2d4d43aa7e556615e34494 100644 --- a/crates/collab/src/llm/db/ids.rs +++ b/crates/collab/src/llm/db/ids.rs @@ -1,4 +1,4 @@ -use sea_orm::{entity::prelude::*, DbErr}; +use sea_orm::{DbErr, entity::prelude::*}; use serde::{Deserialize, Serialize}; use crate::id_type; diff --git a/crates/collab/src/llm/db/queries/providers.rs b/crates/collab/src/llm/db/queries/providers.rs index 7e51061ceef2ee69f686dc3efd60211e0cb666c0..9c7dbdd1847ea1d087582ffd959497bc41757b75 100644 --- a/crates/collab/src/llm/db/queries/providers.rs +++ b/crates/collab/src/llm/db/queries/providers.rs @@ -1,5 +1,5 @@ use super::*; -use sea_orm::{sea_query::OnConflict, QueryOrder}; +use sea_orm::{QueryOrder, sea_query::OnConflict}; use std::str::FromStr; use strum::IntoEnumIterator as _; diff --git a/crates/collab/src/llm/db/tests/billing_tests.rs b/crates/collab/src/llm/db/tests/billing_tests.rs index b76121887c9499779c7bc4e9df9f4ea25a5f0ccb..3a95610bc24b08d2cbb08709fc62de89a2fa23f8 100644 --- a/crates/collab/src/llm/db/tests/billing_tests.rs +++ b/crates/collab/src/llm/db/tests/billing_tests.rs @@ -1,10 +1,11 @@ use crate::{ + Cents, db::UserId, llm::{ - db::{queries::providers::ModelParams, LlmDatabase, TokenUsage}, FREE_TIER_MONTHLY_SPENDING_LIMIT, + db::{LlmDatabase, TokenUsage, queries::providers::ModelParams}, }, - test_llm_db, Cents, + test_llm_db, }; use chrono::{DateTime, Utc}; use pretty_assertions::assert_eq; diff --git a/crates/collab/src/llm/db/tests/usage_tests.rs b/crates/collab/src/llm/db/tests/usage_tests.rs index 3213c26e82dc45952ba79dfb60111b4e1d468a83..7e3d1ab502bc182f16732b53fdbb657a051d2c34 100644 --- a/crates/collab/src/llm/db/tests/usage_tests.rs +++ b/crates/collab/src/llm/db/tests/usage_tests.rs @@ -1,11 +1,12 @@ use crate::llm::FREE_TIER_MONTHLY_SPENDING_LIMIT; use crate::{ + Cents, db::UserId, llm::db::{ - queries::{providers::ModelParams, usages::Usage}, LlmDatabase, TokenUsage, + queries::{providers::ModelParams, usages::Usage}, }, - test_llm_db, Cents, + test_llm_db, }; use chrono::{DateTime, Duration, Utc}; use pretty_assertions::assert_eq; diff --git a/crates/collab/src/llm/token.rs b/crates/collab/src/llm/token.rs index 068e5f333ea6cb8687e7c4d5f75e6d6a3b8adfd3..68005a2d4c1a3f447c0884796501e16ec1d5f094 100644 --- a/crates/collab/src/llm/token.rs +++ b/crates/collab/src/llm/token.rs @@ -1,8 +1,8 @@ +use crate::Cents; use crate::db::user; use crate::llm::{DEFAULT_MAX_MONTHLY_SPEND, FREE_TIER_MONTHLY_SPENDING_LIMIT}; -use crate::Cents; -use crate::{db::billing_preference, Config}; -use anyhow::{anyhow, Result}; +use crate::{Config, db::billing_preference}; +use anyhow::{Result, anyhow}; use chrono::{NaiveDateTime, Utc}; use jsonwebtoken::{DecodingKey, EncodingKey, Header, Validation}; use serde::{Deserialize, Serialize}; diff --git a/crates/collab/src/main.rs b/crates/collab/src/main.rs index d552bba68e0e60d8599d2a71c11a23e8a6673500..30dab40ccebdae22f6e090f05014c96099849737 100644 --- a/crates/collab/src/main.rs +++ b/crates/collab/src/main.rs @@ -1,22 +1,22 @@ use anyhow::anyhow; use axum::headers::HeaderMapExt; use axum::{ + Extension, Router, extract::MatchedPath, http::{Request, Response}, routing::get, - Extension, Router, }; -use collab::api::billing::sync_llm_usage_with_stripe_periodically; use collab::api::CloudflareIpCountryHeader; +use collab::api::billing::sync_llm_usage_with_stripe_periodically; use collab::llm::{db::LlmDatabase, log_usage_periodically}; use collab::migrations::run_database_migrations; use collab::user_backfiller::spawn_user_backfiller; -use collab::{api::billing::poll_stripe_events_periodically, llm::LlmState, ServiceMode}; use collab::{ - api::fetch_extensions_from_blob_store_periodically, db, env, executor::Executor, - rpc::ResultExt, AppState, Config, RateLimiter, Result, + AppState, Config, RateLimiter, Result, api::fetch_extensions_from_blob_store_periodically, db, + env, executor::Executor, rpc::ResultExt, }; +use collab::{ServiceMode, api::billing::poll_stripe_events_periodically, llm::LlmState}; use db::Database; use std::{ env::args, @@ -29,9 +29,9 @@ use std::{ use tokio::signal::unix::SignalKind; use tower_http::trace::TraceLayer; use tracing_subscriber::{ - filter::EnvFilter, fmt::format::JsonFields, util::SubscriberInitExt, Layer, + Layer, filter::EnvFilter, fmt::format::JsonFields, util::SubscriberInitExt, }; -use util::{maybe, ResultExt as _}; +use util::{ResultExt as _, maybe}; const VERSION: &str = env!("CARGO_PKG_VERSION"); const REVISION: Option<&'static str> = option_env!("GITHUB_SHA"); diff --git a/crates/collab/src/migrations.rs b/crates/collab/src/migrations.rs index 56200500cf602ce8d32e49b27418912679ffe048..a9285c756412f939ae05dd73bff4e2a974f43f09 100644 --- a/crates/collab/src/migrations.rs +++ b/crates/collab/src/migrations.rs @@ -1,11 +1,11 @@ use std::path::Path; use std::time::Duration; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use sea_orm::ConnectOptions; -use sqlx::migrate::{Migrate, Migration, MigrationSource}; use sqlx::Connection; +use sqlx::migrate::{Migrate, Migration, MigrationSource}; /// Runs the database migrations for the specified database. pub async fn run_database_migrations( diff --git a/crates/collab/src/rate_limiter.rs b/crates/collab/src/rate_limiter.rs index 21f8d0318f9dd05d22031f8dad3ae9cccbfbbe9c..889910f8ea2f51305650696dd9d834bd4cd86a00 100644 --- a/crates/collab/src/rate_limiter.rs +++ b/crates/collab/src/rate_limiter.rs @@ -1,4 +1,4 @@ -use crate::{db::UserId, executor::Executor, Database, Error, Result}; +use crate::{Database, Error, Result, db::UserId, executor::Executor}; use chrono::{DateTime, Duration, Utc}; use dashmap::{DashMap, DashSet}; use rpc::ErrorCodeExt; diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 429b744224cdb8997ccd35f7d9080f46dc5e168c..7f2c5c782d9196746f75b25dba305c6c1c8abd39 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -3,7 +3,7 @@ mod connection_pool; use crate::api::{CloudflareIpCountryHeader, SystemIdHeader}; use crate::llm::LlmTokenClaims; use crate::{ - auth, + AppState, Config, Error, RateLimit, Result, auth, db::{ self, BufferId, Capability, Channel, ChannelId, ChannelRole, ChannelsForUser, CreatedChannelMessage, Database, InviteMemberResult, MembershipUpdated, MessageId, @@ -11,47 +11,46 @@ use crate::{ RespondToChannelInvite, RoomId, ServerId, UpdatedChannelMessage, User, UserId, }, executor::Executor, - AppState, Config, Error, RateLimit, Result, }; -use anyhow::{anyhow, bail, Context as _}; +use anyhow::{Context as _, anyhow, bail}; use async_tungstenite::tungstenite::{ - protocol::CloseFrame as TungsteniteCloseFrame, Message as TungsteniteMessage, + Message as TungsteniteMessage, protocol::CloseFrame as TungsteniteCloseFrame, }; use axum::{ + Extension, Router, TypedHeader, body::Body, extract::{ - ws::{CloseFrame as AxumCloseFrame, Message as AxumMessage}, ConnectInfo, WebSocketUpgrade, + ws::{CloseFrame as AxumCloseFrame, Message as AxumMessage}, }, headers::{Header, HeaderName}, http::StatusCode, middleware, response::IntoResponse, routing::get, - Extension, Router, TypedHeader, }; use chrono::Utc; use collections::{HashMap, HashSet}; pub use connection_pool::{ConnectionPool, ZedVersion}; use core::fmt::{self, Debug, Formatter}; use http_client::HttpClient; -use open_ai::{OpenAiEmbeddingModel, OPEN_AI_API_URL}; +use open_ai::{OPEN_AI_API_URL, OpenAiEmbeddingModel}; use reqwest_client::ReqwestClient; use rpc::proto::split_repository_update; use sha2::Digest; use supermaven_api::{CreateExternalUserRequest, SupermavenAdminApi}; use futures::{ - channel::oneshot, future::BoxFuture, stream::FuturesUnordered, FutureExt, SinkExt, StreamExt, - TryStreamExt, + FutureExt, SinkExt, StreamExt, TryStreamExt, channel::oneshot, future::BoxFuture, + stream::FuturesUnordered, }; -use prometheus::{register_int_gauge, IntGauge}; +use prometheus::{IntGauge, register_int_gauge}; use rpc::{ + Connection, ConnectionId, ErrorCode, ErrorCodeExt, ErrorExt, Peer, Receipt, TypedEnvelope, proto::{ self, Ack, AnyTypedEnvelope, EntityMessage, EnvelopedMessage, LiveKitConnectionInfo, RequestMessage, ShareProject, UpdateChannelBufferCollaborators, }, - Connection, ConnectionId, ErrorCode, ErrorCodeExt, ErrorExt, Peer, Receipt, TypedEnvelope, }; use semantic_version::SemanticVersion; use serde::{Serialize, Serializer}; @@ -64,17 +63,18 @@ use std::{ ops::{Deref, DerefMut}, rc::Rc, sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, OnceLock, + atomic::{AtomicBool, Ordering::SeqCst}, }, time::{Duration, Instant}, }; use time::OffsetDateTime; -use tokio::sync::{watch, MutexGuard, Semaphore}; +use tokio::sync::{MutexGuard, Semaphore, watch}; use tower::ServiceBuilder; use tracing::{ + Instrument, field::{self}, - info_span, instrument, Instrument, + info_span, instrument, }; pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); @@ -1115,7 +1115,7 @@ pub async fn handle_websocket_request( .into_response(); } - let Some(version) = app_version_header.map(|header| ZedVersion(header.0 .0)) else { + let Some(version) = app_version_header.map(|header| ZedVersion(header.0.0)) else { return ( StatusCode::UPGRADE_REQUIRED, "no version header found".to_string(), diff --git a/crates/collab/src/rpc/connection_pool.rs b/crates/collab/src/rpc/connection_pool.rs index 6af90770dc615ce6befb1bce6edfc94813f00a30..e21d3d4f404b9644ac5e1eeca9dac5c7893d5ac5 100644 --- a/crates/collab/src/rpc/connection_pool.rs +++ b/crates/collab/src/rpc/connection_pool.rs @@ -1,5 +1,5 @@ use crate::db::{ChannelId, ChannelRole, UserId}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::{BTreeMap, HashMap, HashSet}; use rpc::ConnectionId; use semantic_version::SemanticVersion; @@ -159,12 +159,13 @@ impl ConnectionPool { #[cfg(test)] pub fn check_invariants(&self) { for (connection_id, connection) in &self.connections { - assert!(self - .connected_users - .get(&connection.user_id) - .unwrap() - .connection_ids - .contains(connection_id)); + assert!( + self.connected_users + .get(&connection.user_id) + .unwrap() + .connection_ids + .contains(connection_id) + ); } for (user_id, state) in &self.connected_users { diff --git a/crates/collab/src/seed.rs b/crates/collab/src/seed.rs index ce5d99bbe063a12dd0d2518015158961507ca56c..b9322a5d817fcc236b8551656158ac74458fcec0 100644 --- a/crates/collab/src/seed.rs +++ b/crates/collab/src/seed.rs @@ -3,7 +3,7 @@ use crate::db::{self, ChannelRole, NewUserParams}; use anyhow::Context as _; use chrono::{DateTime, Utc}; use db::Database; -use serde::{de::DeserializeOwned, Deserialize}; +use serde::{Deserialize, de::DeserializeOwned}; use std::{fs, path::Path}; use crate::Config; diff --git a/crates/collab/src/stripe_billing.rs b/crates/collab/src/stripe_billing.rs index 9f561ab1b2f10eabffaef2f9dfeda0b7080e2225..8ad5105c9b321f2f7002f291f05ccbb9e57ef0b7 100644 --- a/crates/collab/src/stripe_billing.rs +++ b/crates/collab/src/stripe_billing.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use crate::{llm, Cents, Result}; +use crate::{Cents, Result, llm}; use anyhow::Context as _; use chrono::{Datelike, Utc}; use collections::HashMap; diff --git a/crates/collab/src/tests.rs b/crates/collab/src/tests.rs index 8a57d07a45bdfa3ba312affffe0850d01a56f7d6..5a9af2a622b8db8c6dfb773bcd2ae2b9b35bb74c 100644 --- a/crates/collab/src/tests.rs +++ b/crates/collab/src/tests.rs @@ -20,9 +20,9 @@ mod randomized_test_helpers; mod remote_editing_collaboration_tests; mod test_server; -use language::{tree_sitter_rust, Language, LanguageConfig, LanguageMatcher}; +use language::{Language, LanguageConfig, LanguageMatcher, tree_sitter_rust}; pub use randomized_test_helpers::{ - run_randomized_test, save_randomized_test_plan, RandomizedTest, TestError, UserTestPlan, + RandomizedTest, TestError, UserTestPlan, run_randomized_test, save_randomized_test_plan, }; pub use test_server::{TestClient, TestServer}; diff --git a/crates/collab/src/tests/channel_buffer_tests.rs b/crates/collab/src/tests/channel_buffer_tests.rs index 6286670d3db13e5769ab82b3a37af56e1275c9a7..4ed2745aa5faab1264fc8edd38a525ca868b01b1 100644 --- a/crates/collab/src/tests/channel_buffer_tests.rs +++ b/crates/collab/src/tests/channel_buffer_tests.rs @@ -1,6 +1,6 @@ use crate::{ rpc::{CLEANUP_TIMEOUT, RECONNECT_TIMEOUT}, - tests::{test_server::open_channel_notes, TestServer}, + tests::{TestServer, test_server::open_channel_notes}, }; use call::ActiveCall; use channel::ACKNOWLEDGE_DEBOUNCE_INTERVAL; @@ -10,7 +10,7 @@ use collections::HashMap; use editor::{Anchor, Editor, ToOffset}; use futures::future; use gpui::{BackgroundExecutor, Context, Entity, TestAppContext, Window}; -use rpc::{proto::PeerId, RECEIVE_TIMEOUT}; +use rpc::{RECEIVE_TIMEOUT, proto::PeerId}; use serde_json::json; use std::ops::Range; diff --git a/crates/collab/src/tests/channel_guest_tests.rs b/crates/collab/src/tests/channel_guest_tests.rs index 0e8d856221f92d9d7a5bb524c696764468aa3d18..6f7a6228b21b2a22e6e16003af527105640e4da4 100644 --- a/crates/collab/src/tests/channel_guest_tests.rs +++ b/crates/collab/src/tests/channel_guest_tests.rs @@ -51,13 +51,15 @@ async fn test_channel_guests( Some(project_id), ); assert!(project_b.read_with(cx_b, |project, cx| project.is_read_only(cx))); - assert!(project_b - .update(cx_b, |project, cx| { - let worktree_id = project.worktrees(cx).next().unwrap().read(cx).id(); - project.create_entry((worktree_id, "b.txt"), false, cx) - }) - .await - .is_err()); + assert!( + project_b + .update(cx_b, |project, cx| { + let worktree_id = project.worktrees(cx).next().unwrap().read(cx).id(); + project.create_entry((worktree_id, "b.txt"), false, cx) + }) + .await + .is_err() + ); assert!(room_b.read_with(cx_b, |room, _| room.is_muted())); } @@ -110,10 +112,12 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test cx_b.update(|_window, cx_b| { assert!(room_b.read_with(cx_b, |room, _| !room.can_use_microphone())); }); - assert!(room_b - .update(cx_b, |room, cx| room.share_microphone(cx)) - .await - .is_err()); + assert!( + room_b + .update(cx_b, |room, cx| room.share_microphone(cx)) + .await + .is_err() + ); // B is promoted active_call_a @@ -161,10 +165,12 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test // project and buffers are no longer editable assert!(project_b.read_with(cx_b, |project, cx| project.is_read_only(cx))); assert!(editor_b.update(cx_b, |editor, cx| editor.read_only(cx))); - assert!(room_b - .update(cx_b, |room, cx| room.share_microphone(cx)) - .await - .is_err()); + assert!( + room_b + .update(cx_b, |room, cx| room.share_microphone(cx)) + .await + .is_err() + ); } #[gpui::test] diff --git a/crates/collab/src/tests/channel_tests.rs b/crates/collab/src/tests/channel_tests.rs index 43f616dc579301e531b257f9d4ef69abe1398ec5..fdfd9c502cbc58fc261367bb9dadeeb0cbb57821 100644 --- a/crates/collab/src/tests/channel_tests.rs +++ b/crates/collab/src/tests/channel_tests.rs @@ -1,7 +1,7 @@ use crate::{ db::{self, UserId}, rpc::RECONNECT_TIMEOUT, - tests::{room_participants, RoomParticipants, TestServer}, + tests::{RoomParticipants, TestServer, room_participants}, }; use call::ActiveCall; use channel::{ChannelMembership, ChannelStore}; @@ -9,8 +9,8 @@ use client::{ChannelId, User}; use futures::future::try_join_all; use gpui::{BackgroundExecutor, Entity, SharedString, TestAppContext}; use rpc::{ - proto::{self, ChannelRole}, RECEIVE_TIMEOUT, + proto::{self, ChannelRole}, }; use std::sync::Arc; @@ -348,10 +348,12 @@ async fn test_joining_channel_ancestor_member( let active_call_b = cx_b.read(ActiveCall::global); - assert!(active_call_b - .update(cx_b, |active_call, cx| active_call.join_channel(sub_id, cx)) - .await - .is_ok()); + assert!( + active_call_b + .update(cx_b, |active_call, cx| active_call.join_channel(sub_id, cx)) + .await + .is_ok() + ); } #[gpui::test] @@ -1203,10 +1205,12 @@ async fn test_guest_access( let active_call_b = cx_b.read(ActiveCall::global); // Non-members should not be allowed to join - assert!(active_call_b - .update(cx_b, |call, cx| call.join_channel(channel_a, cx)) - .await - .is_err()); + assert!( + active_call_b + .update(cx_b, |call, cx| call.join_channel(channel_a, cx)) + .await + .is_err() + ); // Make channels A and B public client_a @@ -1271,10 +1275,12 @@ async fn test_invite_access( let active_call_b = cx_b.read(ActiveCall::global); // should not be allowed to join - assert!(active_call_b - .update(cx_b, |call, cx| call.join_channel(channel_b_id, cx)) - .await - .is_err()); + assert!( + active_call_b + .update(cx_b, |call, cx| call.join_channel(channel_b_id, cx)) + .await + .is_err() + ); client_a .channel_store() diff --git a/crates/collab/src/tests/editor_tests.rs b/crates/collab/src/tests/editor_tests.rs index 8a595cc2e1f0e4003a954b6caec03bc3ed6baf9f..719b8643f2bded9d911746a7e038513f05a5771d 100644 --- a/crates/collab/src/tests/editor_tests.rs +++ b/crates/collab/src/tests/editor_tests.rs @@ -1,9 +1,10 @@ use crate::{ rpc::RECONNECT_TIMEOUT, - tests::{rust_lang, TestServer}, + tests::{TestServer, rust_lang}, }; use call::ActiveCall; use editor::{ + Editor, RowInfo, actions::{ ConfirmCodeAction, ConfirmCompletion, ConfirmRename, ContextMenuFirst, ExpandMacroRecursively, Redo, Rename, ToggleCodeActions, Undo, @@ -12,23 +13,22 @@ use editor::{ editor_test_context::{AssertionContextManager, EditorTestContext}, expand_macro_recursively, }, - Editor, RowInfo, }; use fs::Fs; use futures::StreamExt; use gpui::{TestAppContext, UpdateGlobal, VisualContext, VisualTestContext}; use indoc::indoc; use language::{ - language_settings::{AllLanguageSettings, InlayHintSettings}, FakeLspAdapter, + language_settings::{AllLanguageSettings, InlayHintSettings}, }; use project::{ + ProjectPath, SERVER_PROGRESS_THROTTLE_TIMEOUT, lsp_store::{ lsp_ext_command::{ExpandedMacro, LspExpandMacro}, rust_analyzer_ext::RUST_ANALYZER_NAME, }, project_settings::{InlineBlameSettings, ProjectSettings}, - ProjectPath, SERVER_PROGRESS_THROTTLE_TIMEOUT, }; use recent_projects::disconnected_overlay::DisconnectedOverlay; use rpc::RECEIVE_TIMEOUT; @@ -38,8 +38,8 @@ use std::{ ops::Range, path::{Path, PathBuf}, sync::{ - atomic::{self, AtomicBool, AtomicUsize}, Arc, + atomic::{self, AtomicBool, AtomicUsize}, }, }; use text::Point; diff --git a/crates/collab/src/tests/following_tests.rs b/crates/collab/src/tests/following_tests.rs index bc372d16fe73a38ec2ad209180108cf0b863684a..3c8204cd51c6e054bfd5768554d2447f15e4df0b 100644 --- a/crates/collab/src/tests/following_tests.rs +++ b/crates/collab/src/tests/following_tests.rs @@ -8,8 +8,8 @@ use collab_ui::{ }; use editor::{Editor, ExcerptRange, MultiBuffer}; use gpui::{ - point, AppContext as _, BackgroundExecutor, BorrowAppContext, Entity, SharedString, - TestAppContext, VisualTestContext, + AppContext as _, BackgroundExecutor, BorrowAppContext, Entity, SharedString, TestAppContext, + VisualTestContext, point, }; use language::Capability; use project::WorktreeSettings; @@ -17,7 +17,7 @@ use rpc::proto::PeerId; use serde_json::json; use settings::SettingsStore; use util::path; -use workspace::{item::ItemHandle as _, SplitDirection, Workspace}; +use workspace::{SplitDirection, Workspace, item::ItemHandle as _}; use super::TestClient; @@ -441,7 +441,7 @@ async fn test_basic_following( use crate::rpc::RECONNECT_TIMEOUT; use gpui::TestScreenCaptureSource; use workspace::{ - dock::{test::TestPanel, DockPosition}, + dock::{DockPosition, test::TestPanel}, item::test::TestItem, shared_screen::SharedScreen, }; diff --git a/crates/collab/src/tests/integration_tests.rs b/crates/collab/src/tests/integration_tests.rs index b0e374fcfa443da3a152b0a1b257e4541754c781..0c3ee91d6ce5aca917605bcfc9152a026d3aaa96 100644 --- a/crates/collab/src/tests/integration_tests.rs +++ b/crates/collab/src/tests/integration_tests.rs @@ -1,38 +1,39 @@ use crate::{ rpc::{CLEANUP_TIMEOUT, RECONNECT_TIMEOUT}, tests::{ - channel_id, following_tests::join_channel, room_participants, rust_lang, RoomParticipants, - TestClient, TestServer, + RoomParticipants, TestClient, TestServer, channel_id, following_tests::join_channel, + room_participants, rust_lang, }, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use assistant_context_editor::ContextStore; use assistant_slash_command::SlashCommandWorkingSet; -use buffer_diff::{assert_hunks, DiffHunkSecondaryStatus, DiffHunkStatus}; -use call::{room, ActiveCall, ParticipantLocation, Room}; -use client::{User, RECEIVE_TIMEOUT}; +use buffer_diff::{DiffHunkSecondaryStatus, DiffHunkStatus, assert_hunks}; +use call::{ActiveCall, ParticipantLocation, Room, room}; +use client::{RECEIVE_TIMEOUT, User}; use collections::{HashMap, HashSet}; use fs::{FakeFs, Fs as _, RemoveOptions}; -use futures::{channel::mpsc, StreamExt as _}; +use futures::{StreamExt as _, channel::mpsc}; use git::status::{FileStatus, StatusCode, TrackedStatus, UnmergedStatus, UnmergedStatusCode}; use gpui::{ - px, size, App, BackgroundExecutor, Entity, Modifiers, MouseButton, MouseDownEvent, - TestAppContext, UpdateGlobal, + App, BackgroundExecutor, Entity, Modifiers, MouseButton, MouseDownEvent, TestAppContext, + UpdateGlobal, px, size, }; use language::{ + Diagnostic, DiagnosticEntry, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, + LineEnding, OffsetRangeExt, Point, Rope, language_settings::{ AllLanguageSettings, Formatter, FormatterList, PrettierSettings, SelectedFormatter, }, - tree_sitter_rust, tree_sitter_typescript, Diagnostic, DiagnosticEntry, FakeLspAdapter, - Language, LanguageConfig, LanguageMatcher, LineEnding, OffsetRangeExt, Point, Rope, + tree_sitter_rust, tree_sitter_typescript, }; use lsp::{LanguageServerId, OneOf}; use parking_lot::Mutex; use pretty_assertions::assert_eq; use project::{ + DiagnosticSummary, HoverBlockKind, Project, ProjectPath, lsp_store::{FormatTrigger, LspFormatTarget}, search::{SearchQuery, SearchResult}, - DiagnosticSummary, HoverBlockKind, Project, ProjectPath, }; use prompt_store::PromptBuilder; use rand::prelude::*; @@ -44,8 +45,8 @@ use std::{ path::{Path, PathBuf}, rc::Rc, sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, Ordering::SeqCst}, }, time::Duration, }; @@ -6206,15 +6207,19 @@ async fn test_contact_requests( executor.run_until_parked(); assert_eq!(client_a.summarize_contacts(cx_a).current, &["user_b"]); assert_eq!(client_b.summarize_contacts(cx_b).current, &["user_a"]); - assert!(client_b - .summarize_contacts(cx_b) - .incoming_requests - .is_empty()); + assert!( + client_b + .summarize_contacts(cx_b) + .incoming_requests + .is_empty() + ); assert!(client_c.summarize_contacts(cx_c).current.is_empty()); - assert!(client_c - .summarize_contacts(cx_c) - .outgoing_requests - .is_empty()); + assert!( + client_c + .summarize_contacts(cx_c) + .outgoing_requests + .is_empty() + ); async fn disconnect_and_reconnect(client: &TestClient, cx: &mut TestAppContext) { client.disconnect(&cx.to_async()); diff --git a/crates/collab/src/tests/notification_tests.rs b/crates/collab/src/tests/notification_tests.rs index cdec32463260f8815fecd69af34165be83247818..4e64b5526bc3554d2ee15a3acf0fb79d9859166f 100644 --- a/crates/collab/src/tests/notification_tests.rs +++ b/crates/collab/src/tests/notification_tests.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use gpui::{BackgroundExecutor, TestAppContext}; use notifications::NotificationEvent; use parking_lot::Mutex; -use rpc::{proto, Notification}; +use rpc::{Notification, proto}; use crate::tests::TestServer; diff --git a/crates/collab/src/tests/random_channel_buffer_tests.rs b/crates/collab/src/tests/random_channel_buffer_tests.rs index 0eacc56ffbfff1a9c95c41054590c7e75a99c2bf..c283a9fcd1741ad62c15e4c514df0a81ffb42062 100644 --- a/crates/collab/src/tests/random_channel_buffer_tests.rs +++ b/crates/collab/src/tests/random_channel_buffer_tests.rs @@ -1,6 +1,6 @@ use crate::db::ChannelRole; -use super::{run_randomized_test, RandomizedTest, TestClient, TestError, TestServer, UserTestPlan}; +use super::{RandomizedTest, TestClient, TestError, TestServer, UserTestPlan, run_randomized_test}; use anyhow::Result; use async_trait::async_trait; use gpui::{BackgroundExecutor, SharedString, TestAppContext}; diff --git a/crates/collab/src/tests/random_project_collaboration_tests.rs b/crates/collab/src/tests/random_project_collaboration_tests.rs index e20b1d97628555841f1988188e7b315821220aaf..0eca664b505b375c82abbd1de91731ccc905c6da 100644 --- a/crates/collab/src/tests/random_project_collaboration_tests.rs +++ b/crates/collab/src/tests/random_project_collaboration_tests.rs @@ -1,6 +1,6 @@ use super::{RandomizedTest, TestClient, TestError, TestServer, UserTestPlan}; use crate::{db::UserId, tests::run_randomized_test}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use call::ActiveCall; use collections::{BTreeMap, HashMap}; @@ -9,12 +9,12 @@ use fs::{FakeFs, Fs as _}; use git::status::{FileStatus, StatusCode, TrackedStatus, UnmergedStatus, UnmergedStatusCode}; use gpui::{BackgroundExecutor, Entity, TestAppContext}; use language::{ - range_to_lsp, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, PointUtf16, + FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, PointUtf16, range_to_lsp, }; use lsp::FakeLanguageServer; use pretty_assertions::assert_eq; use project::{ - search::SearchQuery, search::SearchResult, Project, ProjectPath, DEFAULT_COMPLETION_CONTEXT, + DEFAULT_COMPLETION_CONTEXT, Project, ProjectPath, search::SearchQuery, search::SearchResult, }; use rand::{ distributions::{Alphanumeric, DistString}, @@ -27,7 +27,7 @@ use std::{ rc::Rc, sync::Arc, }; -use util::{path, ResultExt}; +use util::{ResultExt, path}; #[gpui::test( iterations = 100, @@ -784,10 +784,12 @@ impl RandomizedTest for ProjectCollaborationTest { let save = cx.spawn(|cx| async move { save.await .map_err(|err| anyhow!("save request failed: {:?}", err))?; - assert!(buffer - .read_with(&cx, |buffer, _| { buffer.saved_version().to_owned() }) - .expect("App should not be dropped") - .observed_all(&requested_version)); + assert!( + buffer + .read_with(&cx, |buffer, _| { buffer.saved_version().to_owned() }) + .expect("App should not be dropped") + .observed_all(&requested_version) + ); anyhow::Ok(()) }); if detach { diff --git a/crates/collab/src/tests/randomized_test_helpers.rs b/crates/collab/src/tests/randomized_test_helpers.rs index 773d31fc3b65fbaa5ad74b942b5833018019848f..cabf10cfbcec2e13a322ed742745b410ba760fd9 100644 --- a/crates/collab/src/tests/randomized_test_helpers.rs +++ b/crates/collab/src/tests/randomized_test_helpers.rs @@ -9,7 +9,7 @@ use gpui::{BackgroundExecutor, Task, TestAppContext}; use parking_lot::Mutex; use rand::prelude::*; use rpc::RECEIVE_TIMEOUT; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; use settings::SettingsStore; use std::sync::OnceLock; use std::{ @@ -17,8 +17,8 @@ use std::{ path::PathBuf, rc::Rc, sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, Ordering::SeqCst}, }, }; diff --git a/crates/collab/src/tests/remote_editing_collaboration_tests.rs b/crates/collab/src/tests/remote_editing_collaboration_tests.rs index f79e9efe88c1270760077059c9e4cc4783c2f8a4..03c7702dd888ac1c44f1883e480603da6c6e9191 100644 --- a/crates/collab/src/tests/remote_editing_collaboration_tests.rs +++ b/crates/collab/src/tests/remote_editing_collaboration_tests.rs @@ -10,17 +10,17 @@ use gpui::{ }; use http_client::BlockedHttpClient; use language::{ + FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageRegistry, language_settings::{ - language_settings, AllLanguageSettings, Formatter, FormatterList, PrettierSettings, - SelectedFormatter, + AllLanguageSettings, Formatter, FormatterList, PrettierSettings, SelectedFormatter, + language_settings, }, - tree_sitter_typescript, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, - LanguageRegistry, + tree_sitter_typescript, }; use node_runtime::NodeRuntime; use project::{ - lsp_store::{FormatTrigger, LspFormatTarget}, ProjectPath, + lsp_store::{FormatTrigger, LspFormatTarget}, }; use remote::SshRemoteClient; use remote_server::{HeadlessAppState, HeadlessProject}; diff --git a/crates/collab/src/tests/test_server.rs b/crates/collab/src/tests/test_server.rs index f139beaa0918f479f9bd096343d1ba91d04dbf6b..77fbf1f7f71285774ac94369642d520015c4b5d1 100644 --- a/crates/collab/src/tests/test_server.rs +++ b/crates/collab/src/tests/test_server.rs @@ -1,22 +1,22 @@ use crate::{ - db::{tests::TestDb, NewUserParams, UserId}, - executor::Executor, - rpc::{Principal, Server, ZedVersion, CLEANUP_TIMEOUT, RECONNECT_TIMEOUT}, AppState, Config, RateLimiter, + db::{NewUserParams, UserId, tests::TestDb}, + executor::Executor, + rpc::{CLEANUP_TIMEOUT, Principal, RECONNECT_TIMEOUT, Server, ZedVersion}, }; use anyhow::anyhow; use call::ActiveCall; use channel::{ChannelBuffer, ChannelStore}; use client::{ - self, proto::PeerId, ChannelId, Client, Connection, Credentials, EstablishConnectionError, - UserStore, + self, ChannelId, Client, Connection, Credentials, EstablishConnectionError, UserStore, + proto::PeerId, }; use clock::FakeSystemClock; use collab_ui::channel_view::ChannelView; use collections::{HashMap, HashSet}; use dap::DapRegistry; use fs::FakeFs; -use futures::{channel::oneshot, StreamExt as _}; +use futures::{StreamExt as _, channel::oneshot}; use git::GitHostingProviderRegistry; use gpui::{AppContext as _, BackgroundExecutor, Entity, Task, TestAppContext, VisualTestContext}; use http_client::FakeHttpClient; @@ -27,8 +27,8 @@ use parking_lot::Mutex; use project::{Project, WorktreeId}; use remote::SshRemoteClient; use rpc::{ - proto::{self, ChannelRole}, RECEIVE_TIMEOUT, + proto::{self, ChannelRole}, }; use semantic_version::SemanticVersion; use serde_json::json; @@ -40,8 +40,8 @@ use std::{ ops::{Deref, DerefMut}, path::Path, sync::{ - atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst}, }, }; use util::path; diff --git a/crates/collab/src/user_backfiller.rs b/crates/collab/src/user_backfiller.rs index dcabe8d2167786cf3c724b7080cfcc8f1b775591..274dc37bc0cc49e0cb4ecc990565225d5272f06f 100644 --- a/crates/collab/src/user_backfiller.rs +++ b/crates/collab/src/user_backfiller.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use chrono::{DateTime, Utc}; use util::ResultExt; diff --git a/crates/collab_ui/src/channel_view.rs b/crates/collab_ui/src/channel_view.rs index ca910e2f9b3d2e96c468682e6c91b3cbafc004be..554cfe113a426b943314a6bce0238fb95bd8ff39 100644 --- a/crates/collab_ui/src/channel_view.rs +++ b/crates/collab_ui/src/channel_view.rs @@ -2,17 +2,17 @@ use anyhow::Result; use call::ActiveCall; use channel::{Channel, ChannelBuffer, ChannelBufferEvent, ChannelStore}; use client::{ - proto::{self, PeerId}, ChannelId, Collaborator, ParticipantIndex, + proto::{self, PeerId}, }; use collections::HashMap; use editor::{ - display_map::ToDisplayPoint, scroll::Autoscroll, CollaborationHub, DisplayPoint, Editor, - EditorEvent, + CollaborationHub, DisplayPoint, Editor, EditorEvent, display_map::ToDisplayPoint, + scroll::Autoscroll, }; use gpui::{ - actions, AnyView, App, ClipboardItem, Context, Entity, EventEmitter, Focusable, Pixels, Point, - Render, Subscription, Task, VisualContext as _, WeakEntity, Window, + AnyView, App, ClipboardItem, Context, Entity, EventEmitter, Focusable, Pixels, Point, Render, + Subscription, Task, VisualContext as _, WeakEntity, Window, actions, }; use project::Project; use rpc::proto::ChannelVisibility; @@ -23,12 +23,12 @@ use std::{ use ui::prelude::*; use util::ResultExt; use workspace::item::TabContentParams; -use workspace::{item::Dedup, notifications::NotificationId}; use workspace::{ + ItemNavHistory, Pane, SaveIntent, Toast, ViewId, Workspace, WorkspaceId, item::{FollowableItem, Item, ItemEvent, ItemHandle}, searchable::SearchableItemHandle, - ItemNavHistory, Pane, SaveIntent, Toast, ViewId, Workspace, WorkspaceId, }; +use workspace::{item::Dedup, notifications::NotificationId}; actions!(collab, [CopyLink]); diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs index f3f85259b932ba53f0c3d4078bd9e19eb194f192..0eee89d1fec38ec0f6b81381db4beb208a4b2004 100644 --- a/crates/collab_ui/src/chat_panel.rs +++ b/crates/collab_ui/src/chat_panel.rs @@ -1,16 +1,16 @@ -use crate::{collab_panel, ChatPanelButton, ChatPanelSettings}; +use crate::{ChatPanelButton, ChatPanelSettings, collab_panel}; use anyhow::Result; -use call::{room, ActiveCall}; +use call::{ActiveCall, room}; use channel::{ChannelChat, ChannelChatEvent, ChannelMessage, ChannelMessageId, ChannelStore}; use client::{ChannelId, Client}; use collections::HashMap; use db::kvp::KEY_VALUE_STORE; -use editor::{actions, Editor}; +use editor::{Editor, actions}; use gpui::{ - actions, div, list, prelude::*, px, Action, App, AsyncWindowContext, ClipboardItem, Context, - CursorStyle, DismissEvent, ElementId, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, - HighlightStyle, ListOffset, ListScrollEvent, ListState, Render, Stateful, Subscription, Task, - WeakEntity, Window, + Action, App, AsyncWindowContext, ClipboardItem, Context, CursorStyle, DismissEvent, ElementId, + Entity, EventEmitter, FocusHandle, Focusable, FontWeight, HighlightStyle, ListOffset, + ListScrollEvent, ListState, Render, Stateful, Subscription, Task, WeakEntity, Window, actions, + div, list, prelude::*, px, }; use language::LanguageRegistry; use menu::Confirm; @@ -22,13 +22,13 @@ use settings::Settings; use std::{sync::Arc, time::Duration}; use time::{OffsetDateTime, UtcOffset}; use ui::{ - prelude::*, Avatar, Button, ContextMenu, IconButton, IconName, KeyBinding, Label, PopoverMenu, - Tab, TabBar, Tooltip, + Avatar, Button, ContextMenu, IconButton, IconName, KeyBinding, Label, PopoverMenu, Tab, TabBar, + Tooltip, prelude::*, }; use util::{ResultExt, TryFutureExt}; use workspace::{ - dock::{DockPosition, Panel, PanelEvent}, Workspace, + dock::{DockPosition, Panel, PanelEvent}, }; mod message_editor; diff --git a/crates/collab_ui/src/chat_panel/message_editor.rs b/crates/collab_ui/src/chat_panel/message_editor.rs index b74c1f0c7bee2952bc529b4bc04aaa4629491353..d5dafd819360e45bcdd63bf16fb9b7096e5126d5 100644 --- a/crates/collab_ui/src/chat_panel/message_editor.rs +++ b/crates/collab_ui/src/chat_panel/message_editor.rs @@ -9,10 +9,10 @@ use gpui::{ HighlightStyle, IntoElement, Render, Task, TextStyle, WeakEntity, Window, }; use language::{ - language_settings::SoftWrap, Anchor, Buffer, BufferSnapshot, CodeLabel, LanguageRegistry, - ToOffset, + Anchor, Buffer, BufferSnapshot, CodeLabel, LanguageRegistry, ToOffset, + language_settings::SoftWrap, }; -use project::{search::SearchQuery, Completion, CompletionSource}; +use project::{Completion, CompletionSource, search::SearchQuery}; use settings::Settings; use std::{ cell::RefCell, @@ -22,7 +22,7 @@ use std::{ time::Duration, }; use theme::ThemeSettings; -use ui::{prelude::*, TextSize}; +use ui::{TextSize, prelude::*}; use crate::panel_settings::MessageEditorSettings; diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index 382fd922b01d5c68ce68a46b48aa276175888459..b09d8edd8782dd77e4835122f4823f8a14099074 100644 --- a/crates/collab_ui/src/collab_panel.rs +++ b/crates/collab_ui/src/collab_panel.rs @@ -2,26 +2,26 @@ mod channel_modal; mod contact_finder; use self::channel_modal::ChannelModal; -use crate::{channel_view::ChannelView, chat_panel::ChatPanel, CollaborationPanelSettings}; +use crate::{CollaborationPanelSettings, channel_view::ChannelView, chat_panel::ChatPanel}; use call::ActiveCall; use channel::{Channel, ChannelEvent, ChannelStore}; use client::{ChannelId, Client, Contact, User, UserStore}; use contact_finder::ContactFinder; use db::kvp::KEY_VALUE_STORE; use editor::{Editor, EditorElement, EditorStyle}; -use fuzzy::{match_strings, StringMatchCandidate}; +use fuzzy::{StringMatchCandidate, match_strings}; use gpui::{ - actions, anchored, canvas, deferred, div, fill, list, point, prelude::*, px, AnyElement, App, - AsyncWindowContext, Bounds, ClickEvent, ClipboardItem, Context, DismissEvent, Div, Entity, - EventEmitter, FocusHandle, Focusable, FontStyle, InteractiveElement, IntoElement, ListOffset, - ListState, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, SharedString, - Styled, Subscription, Task, TextStyle, WeakEntity, Window, + AnyElement, App, AsyncWindowContext, Bounds, ClickEvent, ClipboardItem, Context, DismissEvent, + Div, Entity, EventEmitter, FocusHandle, Focusable, FontStyle, InteractiveElement, IntoElement, + ListOffset, ListState, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, + SharedString, Styled, Subscription, Task, TextStyle, WeakEntity, Window, actions, anchored, + canvas, deferred, div, fill, list, point, prelude::*, px, }; use menu::{Cancel, Confirm, SecondaryConfirm, SelectNext, SelectPrevious}; use project::{Fs, Project}; use rpc::{ - proto::{self, ChannelVisibility, PeerId}, ErrorCode, ErrorExt, + proto::{self, ChannelVisibility, PeerId}, }; use serde_derive::{Deserialize, Serialize}; use settings::Settings; @@ -29,15 +29,15 @@ use smallvec::SmallVec; use std::{mem, sync::Arc}; use theme::{ActiveTheme, ThemeSettings}; use ui::{ - prelude::*, tooltip_container, Avatar, AvatarAvailabilityIndicator, Button, Color, ContextMenu, - Facepile, Icon, IconButton, IconName, IconSize, Indicator, Label, ListHeader, ListItem, - Tooltip, + Avatar, AvatarAvailabilityIndicator, Button, Color, ContextMenu, Facepile, Icon, IconButton, + IconName, IconSize, Indicator, Label, ListHeader, ListItem, Tooltip, prelude::*, + tooltip_container, }; -use util::{maybe, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, maybe}; use workspace::{ + OpenChannelNotes, Workspace, dock::{DockPosition, Panel, PanelEvent}, notifications::{DetachAndPromptErr, NotifyResultExt, NotifyTaskExt}, - OpenChannelNotes, Workspace, }; actions!( @@ -2519,12 +2519,14 @@ impl CollabPanel { ] } else { let github_login = github_login.clone(); - vec![IconButton::new("remove_contact", IconName::Close) - .on_click(cx.listener(move |this, _, window, cx| { - this.remove_contact(user_id, &github_login, window, cx); - })) - .icon_color(color) - .tooltip(Tooltip::text("Cancel invite"))] + vec![ + IconButton::new("remove_contact", IconName::Close) + .on_click(cx.listener(move |this, _, window, cx| { + this.remove_contact(user_id, &github_login, window, cx); + })) + .icon_color(color) + .tooltip(Tooltip::text("Cancel invite")), + ] }; ListItem::new(github_login.clone()) diff --git a/crates/collab_ui/src/collab_panel/channel_modal.rs b/crates/collab_ui/src/collab_panel/channel_modal.rs index f2949305eccb4fc0fdc9496791fd9f88df39b4f5..1c22fc35c677075f47e97538832e5dbe508de367 100644 --- a/crates/collab_ui/src/collab_panel/channel_modal.rs +++ b/crates/collab_ui/src/collab_panel/channel_modal.rs @@ -1,18 +1,18 @@ use channel::{ChannelMembership, ChannelStore}; use client::{ - proto::{self, ChannelRole, ChannelVisibility}, ChannelId, User, UserId, UserStore, + proto::{self, ChannelRole, ChannelVisibility}, }; -use fuzzy::{match_strings, StringMatchCandidate}; +use fuzzy::{StringMatchCandidate, match_strings}; use gpui::{ - actions, anchored, deferred, div, App, ClipboardItem, Context, DismissEvent, Entity, - EventEmitter, Focusable, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, + App, ClipboardItem, Context, DismissEvent, Entity, EventEmitter, Focusable, ParentElement, + Render, Styled, Subscription, Task, WeakEntity, Window, actions, anchored, deferred, div, }; use picker::{Picker, PickerDelegate}; use std::sync::Arc; -use ui::{prelude::*, Avatar, CheckboxWithLabel, ContextMenu, ListItem, ListItemSpacing}; +use ui::{Avatar, CheckboxWithLabel, ContextMenu, ListItem, ListItemSpacing, prelude::*}; use util::TryFutureExt; -use workspace::{notifications::DetachAndPromptErr, ModalView}; +use workspace::{ModalView, notifications::DetachAndPromptErr}; actions!( channel_modal, diff --git a/crates/collab_ui/src/collab_panel/contact_finder.rs b/crates/collab_ui/src/collab_panel/contact_finder.rs index 325f749c09985512957c5e8353b6924c8e9bed07..3c23ccc017838e8b97ec334dd432840e516ed413 100644 --- a/crates/collab_ui/src/collab_panel/contact_finder.rs +++ b/crates/collab_ui/src/collab_panel/contact_finder.rs @@ -5,7 +5,7 @@ use gpui::{ }; use picker::{Picker, PickerDelegate}; use std::sync::Arc; -use ui::{prelude::*, Avatar, ListItem, ListItemSpacing}; +use ui::{Avatar, ListItem, ListItemSpacing, prelude::*}; use util::{ResultExt as _, TryFutureExt}; use workspace::ModalView; diff --git a/crates/collab_ui/src/collab_ui.rs b/crates/collab_ui/src/collab_ui.rs index dbc408741cda1dabcad10e634f4a982f83392e6f..f9a2fa492562a89f66459510b1c4aa99edf57080 100644 --- a/crates/collab_ui/src/collab_ui.rs +++ b/crates/collab_ui/src/collab_ui.rs @@ -9,8 +9,8 @@ use std::{rc::Rc, sync::Arc}; pub use collab_panel::CollabPanel; use gpui::{ - point, App, Pixels, PlatformDisplay, Size, WindowBackgroundAppearance, WindowBounds, - WindowDecorations, WindowKind, WindowOptions, + App, Pixels, PlatformDisplay, Size, WindowBackgroundAppearance, WindowBounds, + WindowDecorations, WindowKind, WindowOptions, point, }; use panel_settings::MessageEditorSettings; pub use panel_settings::{ diff --git a/crates/collab_ui/src/notification_panel.rs b/crates/collab_ui/src/notification_panel.rs index a45a0c09896a5826bcae3902400511015c050e56..58df3cead306cfc5e84d06336a34f47cb8c20f8a 100644 --- a/crates/collab_ui/src/notification_panel.rs +++ b/crates/collab_ui/src/notification_panel.rs @@ -1,4 +1,4 @@ -use crate::{chat_panel::ChatPanel, NotificationPanelSettings}; +use crate::{NotificationPanelSettings, chat_panel::ChatPanel}; use anyhow::Result; use channel::ChannelStore; use client::{ChannelId, Client, Notification, User, UserStore}; @@ -6,10 +6,10 @@ use collections::HashMap; use db::kvp::KEY_VALUE_STORE; use futures::StreamExt; use gpui::{ - actions, div, img, list, px, AnyElement, App, AsyncWindowContext, Context, CursorStyle, - DismissEvent, Element, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, - IntoElement, ListAlignment, ListScrollEvent, ListState, ParentElement, Render, - StatefulInteractiveElement, Styled, Task, WeakEntity, Window, + AnyElement, App, AsyncWindowContext, Context, CursorStyle, DismissEvent, Element, Entity, + EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, ListAlignment, + ListScrollEvent, ListState, ParentElement, Render, StatefulInteractiveElement, Styled, Task, + WeakEntity, Window, actions, div, img, list, px, }; use notifications::{NotificationEntry, NotificationEvent, NotificationStore}; use project::Fs; @@ -19,13 +19,13 @@ use settings::{Settings, SettingsStore}; use std::{sync::Arc, time::Duration}; use time::{OffsetDateTime, UtcOffset}; use ui::{ - h_flex, prelude::*, v_flex, Avatar, Button, Icon, IconButton, IconName, Label, Tab, Tooltip, + Avatar, Button, Icon, IconButton, IconName, Label, Tab, Tooltip, h_flex, prelude::*, v_flex, }; use util::{ResultExt, TryFutureExt}; use workspace::notifications::{Notification as WorkspaceNotification, NotificationId}; use workspace::{ - dock::{DockPosition, Panel, PanelEvent}, Workspace, + dock::{DockPosition, Panel, PanelEvent}, }; const LOADING_THRESHOLD: usize = 30; diff --git a/crates/collab_ui/src/notifications/collab_notification.rs b/crates/collab_ui/src/notifications/collab_notification.rs index 6b2c5dd0454e3080fb1bd683bf0cd5938d90bf18..9d5541d9c20ef49286bb1bd1f40a64874f8eaf13 100644 --- a/crates/collab_ui/src/notifications/collab_notification.rs +++ b/crates/collab_ui/src/notifications/collab_notification.rs @@ -1,4 +1,4 @@ -use gpui::{img, prelude::*, AnyElement, SharedUri}; +use gpui::{AnyElement, SharedUri, img, prelude::*}; use smallvec::SmallVec; use ui::prelude::*; diff --git a/crates/collab_ui/src/notifications/incoming_call_notification.rs b/crates/collab_ui/src/notifications/incoming_call_notification.rs index a3b40f0232b1020bf71144797f75172fc7e784da..0bf71ce61439f17135b7ef2ebc651a36d985e342 100644 --- a/crates/collab_ui/src/notifications/incoming_call_notification.rs +++ b/crates/collab_ui/src/notifications/incoming_call_notification.rs @@ -2,10 +2,10 @@ use crate::notification_window_options; use crate::notifications::collab_notification::CollabNotification; use call::{ActiveCall, IncomingCall}; use futures::StreamExt; -use gpui::{prelude::*, App, WindowHandle}; +use gpui::{App, WindowHandle, prelude::*}; use std::sync::{Arc, Weak}; -use ui::{prelude::*, Button, Label}; +use ui::{Button, Label, prelude::*}; use util::ResultExt; use workspace::AppState; diff --git a/crates/collab_ui/src/notifications/project_shared_notification.rs b/crates/collab_ui/src/notifications/project_shared_notification.rs index d5880dc4b966498620b4f1f8ecc6aee3d591642d..f80a5e561eace451df2835244c7033e3096ba62b 100644 --- a/crates/collab_ui/src/notifications/project_shared_notification.rs +++ b/crates/collab_ui/src/notifications/project_shared_notification.rs @@ -1,12 +1,12 @@ use crate::notification_window_options; use crate::notifications::collab_notification::CollabNotification; -use call::{room, ActiveCall}; +use call::{ActiveCall, room}; use client::User; use collections::HashMap; use gpui::{App, Size}; use std::sync::{Arc, Weak}; -use ui::{prelude::*, Button, Label}; +use ui::{Button, Label, prelude::*}; use util::ResultExt; use workspace::AppState; diff --git a/crates/command_palette/src/command_palette.rs b/crates/command_palette/src/command_palette.rs index 5f4997570bc3c98cb5caaacb268606d9379f30dd..7a2db51fb2b07b59417697c871ff77d5cc646433 100644 --- a/crates/command_palette/src/command_palette.rs +++ b/crates/command_palette/src/command_palette.rs @@ -17,10 +17,10 @@ use gpui::{ use picker::{Picker, PickerDelegate}; use postage::{sink::Sink, stream::Stream}; use settings::Settings; -use ui::{h_flex, prelude::*, v_flex, HighlightedLabel, KeyBinding, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, KeyBinding, ListItem, ListItemSpacing, h_flex, prelude::*, v_flex}; use util::ResultExt; use workspace::{ModalView, Workspace, WorkspaceSettings}; -use zed_actions::{command_palette::Toggle, OpenZedUrl}; +use zed_actions::{OpenZedUrl, command_palette::Toggle}; pub fn init(cx: &mut App) { client::init_settings(cx); diff --git a/crates/component/src/component.rs b/crates/component/src/component.rs index 5ecf564c0749cf8ae76218b4c3d73fd9528365cc..2ce6d9892f1c51ec09032a5f00147aef4a7bb402 100644 --- a/crates/component/src/component.rs +++ b/crates/component/src/component.rs @@ -3,7 +3,7 @@ use std::ops::{Deref, DerefMut}; use std::sync::LazyLock; use collections::HashMap; -use gpui::{div, prelude::*, px, AnyElement, App, IntoElement, RenderOnce, SharedString, Window}; +use gpui::{AnyElement, App, IntoElement, RenderOnce, SharedString, Window, div, prelude::*, px}; use linkme::distributed_slice; use parking_lot::RwLock; use theme::ActiveTheme; diff --git a/crates/component_preview/src/component_preview.rs b/crates/component_preview/src/component_preview.rs index 41a0d154c48fa3ad986422a7af77645032139c49..48afadd7d837862256dcb47ef7d5419d026ff072 100644 --- a/crates/component_preview/src/component_preview.rs +++ b/crates/component_preview/src/component_preview.rs @@ -6,10 +6,10 @@ use std::iter::Iterator; use std::sync::Arc; use client::UserStore; -use component::{components, ComponentId, ComponentMetadata}; +use component::{ComponentId, ComponentMetadata, components}; use gpui::{ - list, prelude::*, uniform_list, App, Entity, EventEmitter, FocusHandle, Focusable, Task, - WeakEntity, Window, + App, Entity, EventEmitter, FocusHandle, Focusable, Task, WeakEntity, Window, list, prelude::*, + uniform_list, }; use collections::HashMap; @@ -18,10 +18,10 @@ use gpui::{ListState, ScrollHandle, UniformListScrollHandle}; use languages::LanguageRegistry; use notifications::status_toast::{StatusToast, ToastIcon}; use project::Project; -use ui::{prelude::*, Divider, ListItem, ListSubHeader}; +use ui::{Divider, ListItem, ListSubHeader, prelude::*}; -use workspace::{item::ItemEvent, Item, Workspace, WorkspaceId}; use workspace::{AppState, ItemId, SerializableItem}; +use workspace::{Item, Workspace, WorkspaceId, item::ItemEvent}; pub fn init(app_state: Arc, cx: &mut App) { let app_state = app_state.clone(); diff --git a/crates/context_server/src/client.rs b/crates/context_server/src/client.rs index de035dac3db9d7a3808c60d3b8ac386fd71952c5..119279b26f54e89a4eb00d7152614e027a7944ff 100644 --- a/crates/context_server/src/client.rs +++ b/crates/context_server/src/client.rs @@ -1,18 +1,18 @@ -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use collections::HashMap; -use futures::{channel::oneshot, select, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, channel::oneshot, select}; use gpui::{AppContext as _, AsyncApp, BackgroundExecutor, Task}; use parking_lot::Mutex; use postage::barrier; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use serde_json::{value::RawValue, Value}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; +use serde_json::{Value, value::RawValue}; use smol::channel; use std::{ fmt, path::PathBuf, sync::{ - atomic::{AtomicI32, Ordering::SeqCst}, Arc, + atomic::{AtomicI32, Ordering::SeqCst}, }, time::{Duration, Instant}, }; diff --git a/crates/context_server/src/context_server.rs b/crates/context_server/src/context_server.rs index bbd0cc6a7c705f24e30ca0748b1f0db3ad9c1aac..27d285ba93e546620244d39872ac70e7772f23b0 100644 --- a/crates/context_server/src/context_server.rs +++ b/crates/context_server/src/context_server.rs @@ -9,7 +9,7 @@ pub mod types; use command_palette_hooks::CommandPaletteFilter; pub use context_server_settings::{ContextServerSettings, ServerCommand, ServerConfig}; -use gpui::{actions, App}; +use gpui::{App, actions}; pub use crate::context_server_tool::ContextServerTool; pub use crate::registry::ContextServerFactoryRegistry; diff --git a/crates/context_server/src/context_server_tool.rs b/crates/context_server/src/context_server_tool.rs index d932d516ce3f67db76643959cec99eed8888e728..31801ddfc715dd634a30076a05a72c1cebe3805c 100644 --- a/crates/context_server/src/context_server_tool.rs +++ b/crates/context_server/src/context_server_tool.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use anyhow::{anyhow, bail, Result}; +use anyhow::{Result, anyhow, bail}; use assistant_tool::{ActionLog, Tool, ToolSource}; use gpui::{App, Entity, Task}; use icons::IconName; diff --git a/crates/context_server/src/manager.rs b/crates/context_server/src/manager.rs index fdacb9308ed8cc0ac29581532fcbd19359013cc9..cb163a655a31435db2e1c91f46335b409de5373f 100644 --- a/crates/context_server/src/manager.rs +++ b/crates/context_server/src/manager.rs @@ -17,7 +17,7 @@ use std::path::Path; use std::sync::Arc; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use collections::HashMap; use command_palette_hooks::CommandPaletteFilter; use gpui::{AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity}; @@ -30,8 +30,9 @@ use util::ResultExt as _; use crate::{ContextServerSettings, ServerConfig}; use crate::{ + CONTEXT_SERVERS_NAMESPACE, ContextServerFactoryRegistry, client::{self, Client}, - types, ContextServerFactoryRegistry, CONTEXT_SERVERS_NAMESPACE, + types, }; pub struct ContextServer { diff --git a/crates/context_server_settings/src/context_server_settings.rs b/crates/context_server_settings/src/context_server_settings.rs index c98f504e5f776b5980bf449427a086d0de02f1a4..a8cfc125715770555bb443d5420f5ad46f51e658 100644 --- a/crates/context_server_settings/src/context_server_settings.rs +++ b/crates/context_server_settings/src/context_server_settings.rs @@ -2,9 +2,9 @@ use std::sync::Arc; use collections::HashMap; use gpui::App; +use schemars::JsonSchema; use schemars::r#gen::SchemaGenerator; use schemars::schema::{InstanceType, Schema, SchemaObject}; -use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs index e60204a382476125da27053e4f9354c2bd197941..ac7b4b4a9269d53df58d722e855195c103f4a72a 100644 --- a/crates/copilot/src/copilot.rs +++ b/crates/copilot/src/copilot.rs @@ -4,20 +4,20 @@ pub mod request; mod sign_in; use ::fs::Fs; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::{HashMap, HashSet}; use command_palette_hooks::CommandPaletteFilter; -use futures::{channel::oneshot, future::Shared, Future, FutureExt, TryFutureExt}; +use futures::{Future, FutureExt, TryFutureExt, channel::oneshot, future::Shared}; use gpui::{ - actions, App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Global, Task, - WeakEntity, + App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Global, Task, + WeakEntity, actions, }; use http_client::HttpClient; use language::language_settings::CopilotSettings; use language::{ - language_settings::{all_language_settings, language_settings, EditPredictionProvider}, - point_from_lsp, point_to_lsp, Anchor, Bias, Buffer, BufferSnapshot, Language, PointUtf16, - ToPointUtf16, + Anchor, Bias, Buffer, BufferSnapshot, Language, PointUtf16, ToPointUtf16, + language_settings::{EditPredictionProvider, all_language_settings, language_settings}, + point_from_lsp, point_to_lsp, }; use lsp::{LanguageServer, LanguageServerBinary, LanguageServerId, LanguageServerName}; use node_runtime::NodeRuntime; @@ -33,10 +33,10 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{fs::remove_matching, ResultExt}; +use util::{ResultExt, fs::remove_matching}; pub use crate::copilot_completion_provider::CopilotCompletionProvider; -pub use crate::sign_in::{initiate_sign_in, CopilotCodeVerification}; +pub use crate::sign_in::{CopilotCodeVerification, initiate_sign_in}; actions!( copilot, diff --git a/crates/copilot/src/copilot_chat.rs b/crates/copilot/src/copilot_chat.rs index 15a4cddf20fe6e9cd5247d99b06ec53acfdf17f7..e8274b196541a7214887988f437dc55e078e9414 100644 --- a/crates/copilot/src/copilot_chat.rs +++ b/crates/copilot/src/copilot_chat.rs @@ -2,12 +2,12 @@ use std::path::PathBuf; use std::sync::Arc; use std::sync::OnceLock; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use chrono::DateTime; use collections::HashSet; use fs::Fs; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, StreamExt}; -use gpui::{prelude::*, App, AsyncApp, Global}; +use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream}; +use gpui::{App, AsyncApp, Global, prelude::*}; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use paths::home_dir; use serde::{Deserialize, Serialize}; diff --git a/crates/copilot/src/copilot_completion_provider.rs b/crates/copilot/src/copilot_completion_provider.rs index aad74f4744ef1946d613ada2c780cc7ab4bc70e1..fdf76e2392a21e0f53ca829fe061f75e406ea958 100644 --- a/crates/copilot/src/copilot_completion_provider.rs +++ b/crates/copilot/src/copilot_completion_provider.rs @@ -2,7 +2,7 @@ use crate::{Completion, Copilot}; use anyhow::Result; use gpui::{App, Context, Entity, EntityId, Task}; use inline_completion::{Direction, EditPredictionProvider, InlineCompletion}; -use language::{language_settings::AllLanguageSettings, Buffer, OffsetRangeExt, ToOffset}; +use language::{Buffer, OffsetRangeExt, ToOffset, language_settings::AllLanguageSettings}; use project::Project; use settings::Settings; use std::{path::Path, time::Duration}; @@ -264,18 +264,18 @@ fn common_prefix, T2: Iterator>(a: T1, b: mod tests { use super::*; use editor::{ - test::editor_lsp_test_context::EditorLspTestContext, Editor, ExcerptRange, MultiBuffer, + Editor, ExcerptRange, MultiBuffer, test::editor_lsp_test_context::EditorLspTestContext, }; use fs::FakeFs; use futures::StreamExt; use gpui::{AppContext as _, BackgroundExecutor, TestAppContext, UpdateGlobal}; use indoc::indoc; use language::{ + Point, language_settings::{ AllLanguageSettings, AllLanguageSettingsContent, CompletionSettings, WordsCompletionMode, }, - Point, }; use project::Project; use serde_json::json; @@ -283,7 +283,7 @@ mod tests { use std::future::Future; use util::{ path, - test::{marked_text_ranges_by, TextRangeMarker}, + test::{TextRangeMarker, marked_text_ranges_by}, }; #[gpui::test(iterations = 10)] diff --git a/crates/copilot/src/sign_in.rs b/crates/copilot/src/sign_in.rs index 4afff98c4febae73f768befe3e91d892f8099666..70ca6b7d4747e6ea351d50c35022291613962cd5 100644 --- a/crates/copilot/src/sign_in.rs +++ b/crates/copilot/src/sign_in.rs @@ -1,11 +1,11 @@ -use crate::{request::PromptUserDeviceFlow, Copilot, Status}; +use crate::{Copilot, Status, request::PromptUserDeviceFlow}; use gpui::{ - div, percentage, svg, Animation, AnimationExt, App, ClipboardItem, Context, DismissEvent, - Element, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, - MouseDownEvent, ParentElement, Render, Styled, Subscription, Transformation, Window, + Animation, AnimationExt, App, ClipboardItem, Context, DismissEvent, Element, Entity, + EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, MouseDownEvent, + ParentElement, Render, Styled, Subscription, Transformation, Window, div, percentage, svg, }; use std::time::Duration; -use ui::{prelude::*, Button, Label, Vector, VectorName}; +use ui::{Button, Label, Vector, VectorName, prelude::*}; use util::ResultExt as _; use workspace::notifications::NotificationId; use workspace::{ModalView, Toast, Workspace}; diff --git a/crates/dap/src/adapters.rs b/crates/dap/src/adapters.rs index a1e0cc0b8f14bf7c517a4169a5438c3b36ddd550..8dfd4896d0a37f017dc73a3e01a480384a5b9e9f 100644 --- a/crates/dap/src/adapters.rs +++ b/crates/dap/src/adapters.rs @@ -1,11 +1,11 @@ use ::fs::Fs; -use anyhow::{anyhow, Context as _, Ok, Result}; +use anyhow::{Context as _, Ok, Result, anyhow}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; use futures::io::BufReader; use gpui::{AsyncApp, SharedString}; -pub use http_client::{github::latest_github_release, HttpClient}; +pub use http_client::{HttpClient, github::latest_github_release}; use language::LanguageToolchainStore; use node_runtime::NodeRuntime; use serde::{Deserialize, Serialize}; diff --git a/crates/dap/src/client.rs b/crates/dap/src/client.rs index aa058620da6c242d5fa7eb3b0e50fa28d7d5dfc3..c681b64e556e323975fbb97d6a88717d97691aba 100644 --- a/crates/dap/src/client.rs +++ b/crates/dap/src/client.rs @@ -2,12 +2,12 @@ use crate::{ adapters::{DebugAdapterBinary, DebugAdapterName}, transport::{IoKind, LogKind, TransportDelegate}, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use dap_types::{ messages::{Message, Response}, requests::Request, }; -use futures::{channel::oneshot, select, FutureExt as _}; +use futures::{FutureExt as _, channel::oneshot, select}; use gpui::{AppContext, AsyncApp, BackgroundExecutor}; use smol::channel::{Receiver, Sender}; use std::{ @@ -281,17 +281,17 @@ mod tests { use super::*; use crate::{client::DebugAdapterClient, debugger_settings::DebuggerSettings}; use dap_types::{ - messages::Events, - requests::{Initialize, Request, RunInTerminal}, Capabilities, InitializeRequestArguments, InitializeRequestArgumentsPathFormat, RunInTerminalRequestArguments, + messages::Events, + requests::{Initialize, Request, RunInTerminal}, }; use gpui::TestAppContext; use serde_json::json; use settings::{Settings, SettingsStore}; use std::sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }; pub fn init_test(cx: &mut gpui::TestAppContext) { diff --git a/crates/dap/src/proto_conversions.rs b/crates/dap/src/proto_conversions.rs index 097593b11cc4d789b2f2b8f933c9c475c9f6f12f..f110ccc6146843d2cf3cc31935e969565239e776 100644 --- a/crates/dap/src/proto_conversions.rs +++ b/crates/dap/src/proto_conversions.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use client::proto::{ self, DapChecksum, DapChecksumAlgorithm, DapEvaluateContext, DapModule, DapScope, DapScopePresentationHint, DapSource, DapSourcePresentationHint, DapStackFrame, DapVariable, diff --git a/crates/dap/src/transport.rs b/crates/dap/src/transport.rs index 7106f076dd922ebba7b88dc2ca210dbced3426be..727cc1c00d0a9fe3af7f51818bfec33385be7b21 100644 --- a/crates/dap/src/transport.rs +++ b/crates/dap/src/transport.rs @@ -1,14 +1,14 @@ -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use dap_types::{ - messages::{Message, Response}, ErrorResponse, + messages::{Message, Response}, }; -use futures::{channel::oneshot, select, AsyncRead, AsyncReadExt as _, AsyncWrite, FutureExt as _}; +use futures::{AsyncRead, AsyncReadExt as _, AsyncWrite, FutureExt as _, channel::oneshot, select}; use gpui::AsyncApp; use settings::Settings as _; use smallvec::SmallVec; use smol::{ - channel::{unbounded, Receiver, Sender}, + channel::{Receiver, Sender, unbounded}, io::{AsyncBufReadExt as _, AsyncWriteExt, BufReader}, lock::Mutex, net::{TcpListener, TcpStream}, diff --git a/crates/dap_adapters/src/dap_adapters.rs b/crates/dap_adapters/src/dap_adapters.rs index c9c0a58ed88790ada17d7c4c14b4e363087f2d7c..b337bfbf5ae65bb04184cb874d83f28b7042589f 100644 --- a/crates/dap_adapters/src/dap_adapters.rs +++ b/crates/dap_adapters/src/dap_adapters.rs @@ -7,14 +7,14 @@ mod python; use std::{net::Ipv4Addr, sync::Arc}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use dap::{ + DapRegistry, adapters::{ self, AdapterVersion, DapDelegate, DebugAdapter, DebugAdapterBinary, DebugAdapterName, GithubRepo, }, - DapRegistry, }; use gdb::GdbDebugAdapter; use go::GoDebugAdapter; @@ -22,7 +22,7 @@ use javascript::JsDebugAdapter; use lldb::LldbDebugAdapter; use php::PhpDebugAdapter; use python::PythonDebugAdapter; -use serde_json::{json, Value}; +use serde_json::{Value, json}; use task::{DebugAdapterConfig, TCPHost}; pub fn init(registry: Arc) { diff --git a/crates/dap_adapters/src/gdb.rs b/crates/dap_adapters/src/gdb.rs index f0fde352b16a14ad275f30cfccc9b824090da348..3187a00fa0664eb7b520b89c7b9098011aa96133 100644 --- a/crates/dap_adapters/src/gdb.rs +++ b/crates/dap_adapters/src/gdb.rs @@ -1,6 +1,6 @@ use std::ffi::OsStr; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use async_trait::async_trait; use gpui::AsyncApp; use task::{DebugAdapterConfig, DebugTaskDefinition}; diff --git a/crates/db/src/db.rs b/crates/db/src/db.rs index 0b1e5767a48dc236f7da107d6aa8002591bcd81c..5d8fec21f65f3456f6f21b26055e007ac71356b7 100644 --- a/crates/db/src/db.rs +++ b/crates/db/src/db.rs @@ -17,9 +17,9 @@ use sqlez::thread_safe_connection::ThreadSafeConnection; use sqlez_macros::sql; use std::future::Future; use std::path::Path; -use std::sync::{atomic::Ordering, LazyLock}; +use std::sync::{LazyLock, atomic::Ordering}; use std::{env, sync::atomic::AtomicBool}; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; const CONNECTION_INITIALIZE_QUERY: &str = sql!( PRAGMA foreign_keys=TRUE; diff --git a/crates/debugger_tools/src/dap_log.rs b/crates/debugger_tools/src/dap_log.rs index cae500abb7aa360784d164a2fadbac810111e9f6..80b34a851db4b4bf6e4af3e55272027ea680b953 100644 --- a/crates/debugger_tools/src/dap_log.rs +++ b/crates/debugger_tools/src/dap_log.rs @@ -5,17 +5,17 @@ use dap::{ }; use editor::{Editor, EditorEvent}; use futures::{ - channel::mpsc::{unbounded, UnboundedSender}, StreamExt, + channel::mpsc::{UnboundedSender, unbounded}, }; use gpui::{ - actions, div, App, AppContext, Context, Empty, Entity, EventEmitter, FocusHandle, Focusable, - IntoElement, ParentElement, Render, SharedString, Styled, Subscription, WeakEntity, Window, + App, AppContext, Context, Empty, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, + ParentElement, Render, SharedString, Styled, Subscription, WeakEntity, Window, actions, div, }; use project::{ + Project, debugger::{dap_store, session::Session}, search::SearchQuery, - Project, }; use settings::Settings as _; use std::{ @@ -25,10 +25,10 @@ use std::{ }; use util::maybe; use workspace::{ + ToolbarItemEvent, ToolbarItemView, Workspace, item::Item, searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle}, - ui::{h_flex, Button, Clickable, ContextMenu, Label, LabelCommon, PopoverMenu}, - ToolbarItemEvent, ToolbarItemView, Workspace, + ui::{Button, Clickable, ContextMenu, Label, LabelCommon, PopoverMenu, h_flex}, }; struct DapLogView { diff --git a/crates/debugger_ui/src/attach_modal.rs b/crates/debugger_ui/src/attach_modal.rs index ac2219b4c8381c271a1aa16da008caece190773a..de4e0059392b808142ac1bae6af153be109e30c6 100644 --- a/crates/debugger_ui/src/attach_modal.rs +++ b/crates/debugger_ui/src/attach_modal.rs @@ -7,7 +7,7 @@ use picker::{Picker, PickerDelegate}; use std::cell::LazyCell; use std::sync::Arc; use sysinfo::System; -use ui::{prelude::*, Context, Tooltip}; +use ui::{Context, Tooltip, prelude::*}; use ui::{ListItem, ListItemSpacing}; use util::debug_panic; use workspace::ModalView; diff --git a/crates/debugger_ui/src/debugger_panel.rs b/crates/debugger_ui/src/debugger_panel.rs index 0246603bce3bc1ac12e4265d7ec4c928bdc081a3..0e441f23762803dacd1aaaede59996c81804c31c 100644 --- a/crates/debugger_ui/src/debugger_panel.rs +++ b/crates/debugger_ui/src/debugger_panel.rs @@ -1,20 +1,20 @@ use crate::session::DebugSession; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use command_palette_hooks::CommandPaletteFilter; use dap::{ - client::SessionId, debugger_settings::DebuggerSettings, ContinuedEvent, LoadedSourceEvent, - ModuleEvent, OutputEvent, StoppedEvent, ThreadEvent, + ContinuedEvent, LoadedSourceEvent, ModuleEvent, OutputEvent, StoppedEvent, ThreadEvent, + client::SessionId, debugger_settings::DebuggerSettings, }; -use futures::{channel::mpsc, SinkExt as _}; +use futures::{SinkExt as _, channel::mpsc}; use gpui::{ - actions, Action, App, AsyncWindowContext, Context, Entity, EventEmitter, FocusHandle, - Focusable, Subscription, Task, WeakEntity, + Action, App, AsyncWindowContext, Context, Entity, EventEmitter, FocusHandle, Focusable, + Subscription, Task, WeakEntity, actions, }; use project::{ + Project, debugger::dap_store::{self, DapStore}, terminals::TerminalKind, - Project, }; use rpc::proto::{self}; use settings::Settings; @@ -24,9 +24,10 @@ use terminal_view::terminal_panel::TerminalPanel; use ui::prelude::*; use util::ResultExt; use workspace::{ + ClearAllBreakpoints, Continue, Disconnect, Pane, Pause, Restart, StepBack, StepInto, StepOut, + StepOver, Stop, ToggleIgnoreBreakpoints, Workspace, dock::{DockPosition, Panel, PanelEvent}, - pane, ClearAllBreakpoints, Continue, Disconnect, Pane, Pause, Restart, StepBack, StepInto, - StepOut, StepOver, Stop, ToggleIgnoreBreakpoints, Workspace, + pane, }; pub enum DebugPanelEvent { diff --git a/crates/debugger_ui/src/session.rs b/crates/debugger_ui/src/session.rs index 0c5f81b6794693014df41bb110c2161b28203a5f..fd9e76c9fee9bd529e89f63c84fd3ebb68289669 100644 --- a/crates/debugger_ui/src/session.rs +++ b/crates/debugger_ui/src/session.rs @@ -8,22 +8,22 @@ use std::time::Duration; use dap::client::SessionId; use failed::FailedState; use gpui::{ - percentage, Animation, AnimationExt, AnyElement, App, Entity, EventEmitter, FocusHandle, - Focusable, Subscription, Task, Transformation, WeakEntity, + Animation, AnimationExt, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, + Subscription, Task, Transformation, WeakEntity, percentage, }; use inert::{InertEvent, InertState}; +use project::Project; use project::debugger::{dap_store::DapStore, session::Session}; use project::worktree_store::WorktreeStore; -use project::Project; use rpc::proto::{self, PeerId}; use running::RunningState; use starting::{StartingEvent, StartingState}; use task::DebugTaskDefinition; -use ui::{prelude::*, Indicator}; +use ui::{Indicator, prelude::*}; use util::ResultExt; use workspace::{ - item::{self, Item}, FollowableItem, ViewId, Workspace, + item::{self, Item}, }; use crate::debugger_panel::DebugPanel; diff --git a/crates/debugger_ui/src/session/failed.rs b/crates/debugger_ui/src/session/failed.rs index ac3c96ad86c2412700fe78ec399fdf0c40754679..c94f2284910ee6a8789a548ae95c31121150044c 100644 --- a/crates/debugger_ui/src/session/failed.rs +++ b/crates/debugger_ui/src/session/failed.rs @@ -1,6 +1,6 @@ use gpui::{FocusHandle, Focusable}; use ui::{ - h_flex, Color, Context, IntoElement, Label, LabelCommon, ParentElement, Render, Styled, Window, + Color, Context, IntoElement, Label, LabelCommon, ParentElement, Render, Styled, Window, h_flex, }; pub(crate) struct FailedState { diff --git a/crates/debugger_ui/src/session/inert.rs b/crates/debugger_ui/src/session/inert.rs index 4c3861176f578735ede842c93992192c69b332aa..b614ecd82b3c595d658234cf745230c92edccff9 100644 --- a/crates/debugger_ui/src/session/inert.rs +++ b/crates/debugger_ui/src/session/inert.rs @@ -7,10 +7,10 @@ use settings::Settings as _; use task::{DebugTaskDefinition, LaunchConfig, TCPHost}; use theme::ThemeSettings; use ui::{ - div, h_flex, relative, v_flex, ActiveTheme as _, ButtonCommon, ButtonLike, Clickable, Context, - ContextMenu, Disableable, DropdownMenu, FluentBuilder, Icon, IconName, IconSize, - InteractiveElement, IntoElement, Label, LabelCommon, LabelSize, ParentElement, PopoverMenu, - PopoverMenuHandle, Render, SharedString, SplitButton, Styled, Window, + ActiveTheme as _, ButtonCommon, ButtonLike, Clickable, Context, ContextMenu, Disableable, + DropdownMenu, FluentBuilder, Icon, IconName, IconSize, InteractiveElement, IntoElement, Label, + LabelCommon, LabelSize, ParentElement, PopoverMenu, PopoverMenuHandle, Render, SharedString, + SplitButton, Styled, Window, div, h_flex, relative, v_flex, }; use workspace::Workspace; diff --git a/crates/debugger_ui/src/session/running.rs b/crates/debugger_ui/src/session/running.rs index 808cb509e0aca3fe95df4e553162b3248e530c13..28137b89fb1cf5e02b73d60a8c29cf064f715e23 100644 --- a/crates/debugger_ui/src/session/running.rs +++ b/crates/debugger_ui/src/session/running.rs @@ -6,7 +6,7 @@ pub mod variable_list; use super::{DebugPanelItemEvent, ThreadItem}; use console::Console; -use dap::{client::SessionId, debugger_settings::DebuggerSettings, Capabilities, Thread}; +use dap::{Capabilities, Thread, client::SessionId, debugger_settings::DebuggerSettings}; use gpui::{AppContext, Entity, EventEmitter, FocusHandle, Focusable, Subscription, WeakEntity}; use loaded_source_list::LoadedSourceList; use module_list::ModuleList; @@ -15,10 +15,10 @@ use rpc::proto::ViewId; use settings::Settings; use stack_frame_list::StackFrameList; use ui::{ - div, h_flex, v_flex, ActiveTheme, AnyElement, App, Button, ButtonCommon, Clickable, Context, - ContextMenu, Disableable, Divider, DropdownMenu, FluentBuilder, IconButton, IconName, IconSize, - Indicator, InteractiveElement, IntoElement, Label, ParentElement, Render, SharedString, - StatefulInteractiveElement, Styled, Tooltip, Window, + ActiveTheme, AnyElement, App, Button, ButtonCommon, Clickable, Context, ContextMenu, + Disableable, Divider, DropdownMenu, FluentBuilder, IconButton, IconName, IconSize, Indicator, + InteractiveElement, IntoElement, Label, ParentElement, Render, SharedString, + StatefulInteractiveElement, Styled, Tooltip, Window, div, h_flex, v_flex, }; use util::ResultExt; use variable_list::VariableList; diff --git a/crates/debugger_ui/src/session/running/console.rs b/crates/debugger_ui/src/session/running/console.rs index d8b452d471c6d6a5dcd48050e0e11407fd9d13e5..1f8b9582ff7658e5de82598981c31cae03d446d1 100644 --- a/crates/debugger_ui/src/session/running/console.rs +++ b/crates/debugger_ui/src/session/running/console.rs @@ -11,8 +11,8 @@ use gpui::{Context, Entity, Render, Subscription, Task, TextStyle, WeakEntity}; use language::{Buffer, CodeLabel}; use menu::Confirm; use project::{ - debugger::session::{CompletionsQuery, OutputToken, Session}, Completion, + debugger::session::{CompletionsQuery, OutputToken, Session}, }; use settings::Settings; use std::{cell::RefCell, rc::Rc, usize}; diff --git a/crates/debugger_ui/src/session/running/loaded_source_list.rs b/crates/debugger_ui/src/session/running/loaded_source_list.rs index 4de0e40e8287eac6e6fde86b9581cd5f8c15bfe0..0c4ad90a759a81a49679f060d3a3d050d4a5ec62 100644 --- a/crates/debugger_ui/src/session/running/loaded_source_list.rs +++ b/crates/debugger_ui/src/session/running/loaded_source_list.rs @@ -1,4 +1,4 @@ -use gpui::{list, AnyElement, Empty, Entity, FocusHandle, Focusable, ListState, Subscription}; +use gpui::{AnyElement, Empty, Entity, FocusHandle, Focusable, ListState, Subscription, list}; use project::debugger::session::{Session, SessionEvent}; use ui::prelude::*; use util::maybe; diff --git a/crates/debugger_ui/src/session/running/module_list.rs b/crates/debugger_ui/src/session/running/module_list.rs index 0b0c43b0d770b04094618abe484fd8f4ba6f95ee..230c92453c947525335889f37cd524b14a56b963 100644 --- a/crates/debugger_ui/src/session/running/module_list.rs +++ b/crates/debugger_ui/src/session/running/module_list.rs @@ -1,10 +1,10 @@ use anyhow::anyhow; use gpui::{ - list, AnyElement, Empty, Entity, FocusHandle, Focusable, ListState, Subscription, WeakEntity, + AnyElement, Empty, Entity, FocusHandle, Focusable, ListState, Subscription, WeakEntity, list, }; use project::{ - debugger::session::{Session, SessionEvent}, ProjectItem as _, ProjectPath, + debugger::session::{Session, SessionEvent}, }; use std::{path::Path, sync::Arc}; use ui::prelude::*; diff --git a/crates/debugger_ui/src/session/running/stack_frame_list.rs b/crates/debugger_ui/src/session/running/stack_frame_list.rs index df0ea9eaaab5358fa6bf3c016836c6cfa6d6d1d8..1b24c643e76084ebc0cdeb1a38c6744586b0ec6f 100644 --- a/crates/debugger_ui/src/session/running/stack_frame_list.rs +++ b/crates/debugger_ui/src/session/running/stack_frame_list.rs @@ -1,17 +1,17 @@ use std::path::Path; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use dap::StackFrameId; use gpui::{ - list, AnyElement, Entity, EventEmitter, FocusHandle, Focusable, ListState, Subscription, Task, - WeakEntity, + AnyElement, Entity, EventEmitter, FocusHandle, Focusable, ListState, Subscription, Task, + WeakEntity, list, }; use language::PointUtf16; use project::debugger::session::{Session, SessionEvent, StackFrame}; use project::{ProjectItem, ProjectPath}; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use util::ResultExt; use workspace::Workspace; diff --git a/crates/debugger_ui/src/session/running/variable_list.rs b/crates/debugger_ui/src/session/running/variable_list.rs index 8eb5dbaa701539e4f68357faa1345756d14e59cb..6921024d579fc66d6d5bc2cebacf91e8257d120c 100644 --- a/crates/debugger_ui/src/session/running/variable_list.rs +++ b/crates/debugger_ui/src/session/running/variable_list.rs @@ -2,14 +2,14 @@ use super::stack_frame_list::{StackFrameList, StackFrameListEvent}; use dap::{ScopePresentationHint, StackFrameId, VariablePresentationHintKind, VariableReference}; use editor::Editor; use gpui::{ - actions, anchored, deferred, uniform_list, AnyElement, ClickEvent, ClipboardItem, Context, - DismissEvent, Entity, FocusHandle, Focusable, Hsla, MouseButton, MouseDownEvent, Point, - Stateful, Subscription, TextStyleRefinement, UniformListScrollHandle, + AnyElement, ClickEvent, ClipboardItem, Context, DismissEvent, Entity, FocusHandle, Focusable, + Hsla, MouseButton, MouseDownEvent, Point, Stateful, Subscription, TextStyleRefinement, + UniformListScrollHandle, actions, anchored, deferred, uniform_list, }; use menu::{SelectFirst, SelectLast, SelectNext, SelectPrevious}; use project::debugger::session::{Session, SessionEvent}; use std::{collections::HashMap, ops::Range, sync::Arc}; -use ui::{prelude::*, ContextMenu, ListItem, Scrollbar, ScrollbarState}; +use ui::{ContextMenu, ListItem, Scrollbar, ScrollbarState, prelude::*}; use util::{debug_panic, maybe}; actions!(variable_list, [ExpandSelectedEntry, CollapseSelectedEntry]); diff --git a/crates/debugger_ui/src/session/starting.rs b/crates/debugger_ui/src/session/starting.rs index dfbb7bb9472cafa86f1e628a3e6f534d7a0a6a12..bdbeee6302dac03a633044d7f949273047403d32 100644 --- a/crates/debugger_ui/src/session/starting.rs +++ b/crates/debugger_ui/src/session/starting.rs @@ -4,11 +4,11 @@ use anyhow::Result; use dap::client::SessionId; use gpui::{ - percentage, Animation, AnimationExt, Entity, EventEmitter, FocusHandle, Focusable, Task, - Transformation, + Animation, AnimationExt, Entity, EventEmitter, FocusHandle, Focusable, Task, Transformation, + percentage, }; use project::debugger::session::Session; -use ui::{v_flex, Color, Context, Icon, IconName, IntoElement, ParentElement, Render, Styled}; +use ui::{Color, Context, Icon, IconName, IntoElement, ParentElement, Render, Styled, v_flex}; pub(crate) struct StartingState { focus_handle: FocusHandle, diff --git a/crates/debugger_ui/src/tests/attach_modal.rs b/crates/debugger_ui/src/tests/attach_modal.rs index 66f402706b231ed627c4b0f9a3b5cd1c1dcfcf7d..b4b6cb678281a3e9b575a51373268f9b0e6d43db 100644 --- a/crates/debugger_ui/src/tests/attach_modal.rs +++ b/crates/debugger_ui/src/tests/attach_modal.rs @@ -1,6 +1,6 @@ use crate::{attach_modal::Candidate, *}; use attach_modal::AttachModal; -use dap::{client::SessionId, FakeAdapter}; +use dap::{FakeAdapter, client::SessionId}; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; use menu::Confirm; use project::{FakeFs, Project}; diff --git a/crates/debugger_ui/src/tests/debugger_panel.rs b/crates/debugger_ui/src/tests/debugger_panel.rs index 72a082f1f17ceb212130d274010711eac4940d26..4ddff9701dcfecf0f251a0554a8a6fca96690040 100644 --- a/crates/debugger_ui/src/tests/debugger_panel.rs +++ b/crates/debugger_ui/src/tests/debugger_panel.rs @@ -1,35 +1,35 @@ use crate::*; use dap::{ + ErrorResponse, RunInTerminalRequestArguments, SourceBreakpoint, StartDebuggingRequestArguments, + StartDebuggingRequestArgumentsRequest, client::SessionId, requests::{ Continue, Disconnect, Launch, Next, RunInTerminal, SetBreakpoints, StackTrace, StartDebugging, StepBack, StepIn, StepOut, Threads, }, - ErrorResponse, RunInTerminalRequestArguments, SourceBreakpoint, StartDebuggingRequestArguments, - StartDebuggingRequestArgumentsRequest, }; use editor::{ - actions::{self}, Editor, EditorMode, MultiBuffer, + actions::{self}, }; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; use project::{ - debugger::session::{ThreadId, ThreadStatus}, FakeFs, Project, + debugger::session::{ThreadId, ThreadStatus}, }; use serde_json::json; use std::{ path::Path, sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }, }; use task::LaunchConfig; -use terminal_view::{terminal_panel::TerminalPanel, TerminalView}; +use terminal_view::{TerminalView, terminal_panel::TerminalPanel}; use tests::{active_debug_session_panel, init_test, init_test_workspace}; use util::path; -use workspace::{dock::Panel, Item}; +use workspace::{Item, dock::Panel}; #[gpui::test] async fn test_basic_show_debug_panel(executor: BackgroundExecutor, cx: &mut TestAppContext) { @@ -444,15 +444,17 @@ async fn test_handle_successful_run_in_terminal_reverse_request( let panel = terminal_panel.read(cx).pane().unwrap().read(cx); assert_eq!(1, panel.items_len()); - assert!(panel - .active_item() - .unwrap() - .downcast::() - .unwrap() - .read(cx) - .terminal() - .read(cx) - .debug_terminal()); + assert!( + panel + .active_item() + .unwrap() + .downcast::() + .unwrap() + .read(cx) + .terminal() + .read(cx) + .debug_terminal() + ); }) .unwrap(); @@ -772,15 +774,21 @@ async fn test_shutdown_children_when_parent_session_shutdown( // assert parent session and all children sessions are shutdown dap_store.update(cx, |dap_store, cx| { - assert!(dap_store - .session_by_id(parent_session.read(cx).session_id()) - .is_none()); - assert!(dap_store - .session_by_id(first_child_session.read(cx).session_id()) - .is_none()); - assert!(dap_store - .session_by_id(second_child_session.read(cx).session_id()) - .is_none()); + assert!( + dap_store + .session_by_id(parent_session.read(cx).session_id()) + .is_none() + ); + assert!( + dap_store + .session_by_id(first_child_session.read(cx).session_id()) + .is_none() + ); + assert!( + dap_store + .session_by_id(second_child_session.read(cx).session_id()) + .is_none() + ); }); } @@ -874,15 +882,21 @@ async fn test_shutdown_parent_session_if_all_children_are_shutdown( // assert parent session and second child session still exist dap_store.update(cx, |dap_store, cx| { - assert!(dap_store - .session_by_id(parent_session.read(cx).session_id()) - .is_some()); - assert!(dap_store - .session_by_id(first_child_session.read(cx).session_id()) - .is_none()); - assert!(dap_store - .session_by_id(second_child_session.read(cx).session_id()) - .is_some()); + assert!( + dap_store + .session_by_id(parent_session.read(cx).session_id()) + .is_some() + ); + assert!( + dap_store + .session_by_id(first_child_session.read(cx).session_id()) + .is_none() + ); + assert!( + dap_store + .session_by_id(second_child_session.read(cx).session_id()) + .is_some() + ); }); // shutdown first child session @@ -896,12 +910,16 @@ async fn test_shutdown_parent_session_if_all_children_are_shutdown( // assert parent session got shutdown by second child session // because it was the last child dap_store.update(cx, |dap_store, cx| { - assert!(dap_store - .session_by_id(parent_session.read(cx).session_id()) - .is_none()); - assert!(dap_store - .session_by_id(second_child_session.read(cx).session_id()) - .is_none()); + assert!( + dap_store + .session_by_id(parent_session.read(cx).session_id()) + .is_none() + ); + assert!( + dap_store + .session_by_id(second_child_session.read(cx).session_id()) + .is_none() + ); }); } diff --git a/crates/debugger_ui/src/tests/module_list.rs b/crates/debugger_ui/src/tests/module_list.rs index 91bc195f9f060aaaabe9068ab705a7dee23f7517..3aa200082968b38d0de69e896394a404628a3ff5 100644 --- a/crates/debugger_ui/src/tests/module_list.rs +++ b/crates/debugger_ui/src/tests/module_list.rs @@ -4,14 +4,14 @@ use crate::{ tests::{active_debug_session_panel, init_test, init_test_workspace}, }; use dap::{ - requests::{Modules, StackTrace, Threads}, StoppedEvent, + requests::{Modules, StackTrace, Threads}, }; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; use project::{FakeFs, Project}; use std::sync::{ - atomic::{AtomicBool, AtomicI32, Ordering}, Arc, + atomic::{AtomicBool, AtomicI32, Ordering}, }; use task::LaunchConfig; diff --git a/crates/debugger_ui/src/tests/stack_frame_list.rs b/crates/debugger_ui/src/tests/stack_frame_list.rs index 5f3d3d601bf42fe78630b294cbdc3fd49a4fbc8a..7fd67e96002a258995edeade8292af1d13227c96 100644 --- a/crates/debugger_ui/src/tests/stack_frame_list.rs +++ b/crates/debugger_ui/src/tests/stack_frame_list.rs @@ -4,8 +4,8 @@ use crate::{ tests::{active_debug_session_panel, init_test, init_test_workspace}, }; use dap::{ - requests::{StackTrace, Threads}, StackFrame, + requests::{StackTrace, Threads}, }; use editor::{Editor, ToPoint as _}; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; diff --git a/crates/debugger_ui/src/tests/variable_list.rs b/crates/debugger_ui/src/tests/variable_list.rs index 958470dd107a06124016cdf8316e3583c80ff7dc..ffaaff2003c4220ead453fc500e838902d138071 100644 --- a/crates/debugger_ui/src/tests/variable_list.rs +++ b/crates/debugger_ui/src/tests/variable_list.rs @@ -1,17 +1,17 @@ use std::sync::{ - atomic::{AtomicBool, Ordering}, Arc, + atomic::{AtomicBool, Ordering}, }; use crate::{ + DebugPanel, session::running::variable_list::{CollapseSelectedEntry, ExpandSelectedEntry}, tests::{active_debug_session_panel, init_test, init_test_workspace}, - DebugPanel, }; use collections::HashMap; use dap::{ - requests::{Initialize, Launch, Scopes, StackTrace, Variables}, Scope, StackFrame, Variable, + requests::{Initialize, Launch, Scopes, StackTrace, Variables}, }; use gpui::{BackgroundExecutor, TestAppContext, VisualTestContext}; use menu::{SelectFirst, SelectNext, SelectPrevious}; diff --git a/crates/deepseek/src/deepseek.rs b/crates/deepseek/src/deepseek.rs index 777cf696d8e047eef9685ff410ae396c10f4cff5..07f6a959e100c9bd544544bd23e08adf097a94e6 100644 --- a/crates/deepseek/src/deepseek.rs +++ b/crates/deepseek/src/deepseek.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use futures::{ + AsyncBufReadExt, AsyncReadExt, io::BufReader, stream::{BoxStream, StreamExt}, - AsyncBufReadExt, AsyncReadExt, }; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 090ceacdb849dc22a7cf98a9198694d62202cee2..fc8320dc19692161f67f0fe0832cc9da5d3da207 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -7,23 +7,22 @@ mod diagnostics_tests; use anyhow::Result; use collections::{BTreeSet, HashSet}; use editor::{ - diagnostic_block_renderer, + Editor, EditorEvent, ExcerptId, ExcerptRange, MultiBuffer, ToOffset, diagnostic_block_renderer, display_map::{BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock}, highlight_diagnostic_message, scroll::Autoscroll, - Editor, EditorEvent, ExcerptId, ExcerptRange, MultiBuffer, ToOffset, }; use gpui::{ - actions, div, svg, AnyElement, AnyView, App, AsyncApp, Context, Entity, EventEmitter, - FocusHandle, Focusable, Global, HighlightStyle, InteractiveElement, IntoElement, ParentElement, - Render, SharedString, Styled, StyledText, Subscription, Task, WeakEntity, Window, + AnyElement, AnyView, App, AsyncApp, Context, Entity, EventEmitter, FocusHandle, Focusable, + Global, HighlightStyle, InteractiveElement, IntoElement, ParentElement, Render, SharedString, + Styled, StyledText, Subscription, Task, WeakEntity, Window, actions, div, svg, }; use language::{ Bias, Buffer, BufferRow, BufferSnapshot, Diagnostic, DiagnosticEntry, DiagnosticSeverity, Point, Selection, SelectionGoal, ToTreeSitterPoint, }; use lsp::LanguageServerId; -use project::{project_settings::ProjectSettings, DiagnosticSummary, Project, ProjectPath}; +use project::{DiagnosticSummary, Project, ProjectPath, project_settings::ProjectSettings}; use settings::Settings; use std::{ any::{Any, TypeId}, @@ -36,12 +35,12 @@ use std::{ }; use theme::ActiveTheme; pub use toolbar_controls::ToolbarControls; -use ui::{h_flex, prelude::*, Icon, IconName, Label}; +use ui::{Icon, IconName, Label, h_flex, prelude::*}; use util::ResultExt; use workspace::{ + ItemNavHistory, ToolbarItemLocation, Workspace, item::{BreadcrumbText, Item, ItemEvent, ItemHandle, TabContentParams}, searchable::SearchableItemHandle, - ItemNavHistory, ToolbarItemLocation, Workspace, }; actions!(diagnostics, [Deploy, ToggleWarnings]); diff --git a/crates/diagnostics/src/diagnostics_tests.rs b/crates/diagnostics/src/diagnostics_tests.rs index e6c1132154acd99f14c0cabb3b477f57f62899b2..b25867674755106735ea36734fb62f44bdf1597f 100644 --- a/crates/diagnostics/src/diagnostics_tests.rs +++ b/crates/diagnostics/src/diagnostics_tests.rs @@ -1,16 +1,16 @@ use super::*; use collections::HashMap; use editor::{ - display_map::{Block, BlockContext, DisplayRow}, DisplayPoint, GutterDimensions, + display_map::{Block, BlockContext, DisplayRow}, }; -use gpui::{px, AvailableSpace, Stateful, TestAppContext, VisualTestContext}; +use gpui::{AvailableSpace, Stateful, TestAppContext, VisualTestContext, px}; use language::{ Diagnostic, DiagnosticEntry, DiagnosticSeverity, OffsetRangeExt, PointUtf16, Rope, Unclipped, }; use pretty_assertions::assert_eq; use project::FakeFs; -use rand::{rngs::StdRng, seq::IteratorRandom as _, Rng}; +use rand::{Rng, rngs::StdRng, seq::IteratorRandom as _}; use serde_json::json; use settings::SettingsStore; use std::{ @@ -18,7 +18,7 @@ use std::{ path::{Path, PathBuf}, }; use unindent::Unindent as _; -use util::{path, post_inc, RandomCharIter}; +use util::{RandomCharIter, path, post_inc}; #[ctor::ctor] fn init_logger() { diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs index ab77ae2f075eb86ef680b87227aa032803999683..781e20fb64d917bbd13961fe262c610a2d59fc78 100644 --- a/crates/diagnostics/src/items.rs +++ b/crates/diagnostics/src/items.rs @@ -6,8 +6,8 @@ use gpui::{ WeakEntity, Window, }; use language::Diagnostic; -use ui::{h_flex, prelude::*, Button, ButtonLike, Color, Icon, IconName, Label, Tooltip}; -use workspace::{item::ItemHandle, StatusItemView, ToolbarItemEvent, Workspace}; +use ui::{Button, ButtonLike, Color, Icon, IconName, Label, Tooltip, h_flex, prelude::*}; +use workspace::{StatusItemView, ToolbarItemEvent, Workspace, item::ItemHandle}; use crate::{Deploy, ProjectDiagnosticsEditor}; diff --git a/crates/diagnostics/src/toolbar_controls.rs b/crates/diagnostics/src/toolbar_controls.rs index 26e4ff20f8f4c194a6b79561df3b62f689610b48..69b0ca4f59a1267539cbfa8401e2784e898bf6c3 100644 --- a/crates/diagnostics/src/toolbar_controls.rs +++ b/crates/diagnostics/src/toolbar_controls.rs @@ -2,7 +2,7 @@ use crate::ProjectDiagnosticsEditor; use gpui::{Context, Entity, EventEmitter, ParentElement, Render, WeakEntity, Window}; use ui::prelude::*; use ui::{IconButton, IconButtonShape, IconName, Tooltip}; -use workspace::{item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView}; +use workspace::{ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, item::ItemHandle}; pub struct ToolbarControls { editor: Option>, diff --git a/crates/editor/src/clangd_ext.rs b/crates/editor/src/clangd_ext.rs index aee465a00840f42867d5eb2ee371643cfcd7d18f..6062e7bc77b1f3fdf642e3afb74e0c5c54e9a7d3 100644 --- a/crates/editor/src/clangd_ext.rs +++ b/crates/editor/src/clangd_ext.rs @@ -8,7 +8,7 @@ use workspace::{OpenOptions, OpenVisible}; use crate::lsp_ext::find_specific_language_server_in_selection; -use crate::{element::register_action, Editor, SwitchSourceHeader}; +use crate::{Editor, SwitchSourceHeader, element::register_action}; use project::lsp_store::clangd_ext::CLANGD_SERVER_NAME; diff --git a/crates/editor/src/code_context_menus.rs b/crates/editor/src/code_context_menus.rs index 0908ad48fbdd6c9f1b9bad0af1d967b6e865ad1c..cb49123a7bdec903a73845319101f433cc4ba6a2 100644 --- a/crates/editor/src/code_context_menus.rs +++ b/crates/editor/src/code_context_menus.rs @@ -1,34 +1,35 @@ use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - div, px, uniform_list, AnyElement, BackgroundExecutor, Entity, Focusable, FontWeight, - ListSizingBehavior, ScrollStrategy, SharedString, Size, StrikethroughStyle, StyledText, - UniformListScrollHandle, + AnyElement, BackgroundExecutor, Entity, Focusable, FontWeight, ListSizingBehavior, + ScrollStrategy, SharedString, Size, StrikethroughStyle, StyledText, UniformListScrollHandle, + div, px, uniform_list, }; use language::Buffer; use language::CodeLabel; use markdown::Markdown; use multi_buffer::{Anchor, ExcerptId}; use ordered_float::OrderedFloat; -use project::lsp_store::CompletionDocumentation; use project::CompletionSource; +use project::lsp_store::CompletionDocumentation; use project::{CodeAction, Completion, TaskSourceKind}; use std::{ cell::RefCell, - cmp::{min, Reverse}, + cmp::{Reverse, min}, iter, ops::Range, rc::Rc, }; use task::ResolvedTask; -use ui::{prelude::*, Color, IntoElement, ListItem, Pixels, Popover, Styled}; +use ui::{Color, IntoElement, ListItem, Pixels, Popover, Styled, prelude::*}; use util::ResultExt; use crate::hover_popover::{hover_markdown_style, open_markdown_url}; use crate::{ + CodeActionProvider, CompletionId, CompletionProvider, DisplayRow, Editor, EditorStyle, + ResolvedTasks, actions::{ConfirmCodeAction, ConfirmCompletion}, - split_words, styled_runs_for_code_label, CodeActionProvider, CompletionId, CompletionProvider, - DisplayRow, Editor, EditorStyle, ResolvedTasks, + split_words, styled_runs_for_code_label, }; pub const MENU_GAP: Pixels = px(4.); diff --git a/crates/editor/src/commit_tooltip.rs b/crates/editor/src/commit_tooltip.rs index a450ef5ac87dd247e94865173c04bfd29ddc73aa..ccd3151fa9d502da0d2f8b970f96ed0ac7db04c9 100644 --- a/crates/editor/src/commit_tooltip.rs +++ b/crates/editor/src/commit_tooltip.rs @@ -1,6 +1,6 @@ use futures::Future; -use git::blame::BlameEntry; use git::PullRequest; +use git::blame::BlameEntry; use gpui::{ App, Asset, ClipboardItem, Element, Entity, MouseButton, ParentElement, Render, ScrollHandle, StatefulInteractiveElement, @@ -11,7 +11,7 @@ use std::hash::Hash; use theme::ThemeSettings; use time::{OffsetDateTime, UtcOffset}; use time_format::format_local_timestamp; -use ui::{prelude::*, tooltip_container, Avatar, Divider, IconButtonShape}; +use ui::{Avatar, Divider, IconButtonShape, prelude::*, tooltip_container}; use url::Url; use crate::git::blame::GitRemote; diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index bde8378ba802575650fe1c3aeb764c4b79ecec99..f2135762e26866bb8204ba4d6e0ea77b7ecc709b 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -27,7 +27,7 @@ mod tab_map; mod wrap_map; use crate::{ - hover_links::InlayHighlight, movement::TextLayoutDetails, EditorStyle, InlayId, RowExt, + EditorStyle, InlayId, RowExt, hover_links::InlayHighlight, movement::TextLayoutDetails, }; pub use block_map::{ Block, BlockChunks as DisplayChunks, BlockContext, BlockId, BlockMap, BlockPlacement, @@ -45,8 +45,8 @@ use inlay_map::{InlayMap, InlaySnapshot}; pub use inlay_map::{InlayOffset, InlayPoint}; pub use invisibles::{is_invisible, replacement}; use language::{ - language_settings::language_settings, ChunkRenderer, OffsetUtf16, Point, - Subscription as BufferSubscription, + ChunkRenderer, OffsetUtf16, Point, Subscription as BufferSubscription, + language_settings::language_settings, }; use lsp::DiagnosticSeverity; use multi_buffer::{ @@ -66,7 +66,7 @@ use std::{ use sum_tree::{Bias, TreeMap}; use tab_map::{TabMap, TabSnapshot}; use text::{BufferId, LineIndent}; -use ui::{px, SharedString}; +use ui::{SharedString, px}; use unicode_segmentation::UnicodeSegmentation; use wrap_map::{WrapMap, WrapSnapshot}; @@ -1295,7 +1295,7 @@ impl Add for DisplayPoint { type Output = Self; fn add(self, other: Self) -> Self::Output { - DisplayPoint(BlockPoint(self.0 .0 + other.0 .0)) + DisplayPoint(BlockPoint(self.0.0 + other.0.0)) } } @@ -1303,7 +1303,7 @@ impl Sub for DisplayPoint { type Output = Self; fn sub(self, other: Self) -> Self::Output { - DisplayPoint(BlockPoint(self.0 .0 - other.0 .0)) + DisplayPoint(BlockPoint(self.0.0 - other.0.0)) } } @@ -1417,18 +1417,19 @@ pub mod tests { movement, test::{marked_display_snapshot, test_font}, }; + use Bias::*; use block_map::BlockPlacement; use gpui::{ - div, font, observe, px, App, AppContext as _, BorrowAppContext, Element, Hsla, Rgba, + App, AppContext as _, BorrowAppContext, Element, Hsla, Rgba, div, font, observe, px, }; use language::{ - language_settings::{AllLanguageSettings, AllLanguageSettingsContent}, Buffer, Diagnostic, DiagnosticEntry, DiagnosticSet, Language, LanguageConfig, LanguageMatcher, + language_settings::{AllLanguageSettings, AllLanguageSettingsContent}, }; use lsp::LanguageServerId; use project::Project; - use rand::{prelude::*, Rng}; + use rand::{Rng, prelude::*}; use settings::SettingsStore; use smol::stream::StreamExt; use std::{env, sync::Arc}; @@ -1436,7 +1437,6 @@ pub mod tests { use theme::{LoadThemes, SyntaxTheme}; use unindent::Unindent as _; use util::test::{marked_text_ranges, sample_text}; - use Bias::*; #[gpui::test(iterations = 100)] async fn test_random_display_map(cx: &mut gpui::TestAppContext, mut rng: StdRng) { diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index 04c5bf051656a1899a512ab605adcdae8030558b..88849c96832cba85e5b2bd78717236049fa63bd3 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -1,6 +1,6 @@ use super::{ - wrap_map::{self, WrapEdit, WrapPoint, WrapSnapshot}, Highlights, + wrap_map::{self, WrapEdit, WrapPoint, WrapSnapshot}, }; use crate::{EditorStyle, GutterDimensions}; use collections::{Bound, HashMap, HashSet}; @@ -17,8 +17,8 @@ use std::{ fmt::Debug, ops::{Deref, DerefMut, Range, RangeBounds, RangeInclusive}, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{AtomicUsize, Ordering::SeqCst}, }, }; use sum_tree::{Bias, SumTree, Summary, TreeMap}; @@ -1282,8 +1282,8 @@ impl BlockSnapshot { let mut cursor = self.transforms.cursor::<(BlockRow, WrapRow)>(&()); cursor.seek(&BlockRow(rows.start), Bias::Right, &()); - let transform_output_start = cursor.start().0 .0; - let transform_input_start = cursor.start().1 .0; + let transform_output_start = cursor.start().0.0; + let transform_input_start = cursor.start().1.0; let mut input_start = transform_input_start; let mut input_end = transform_input_start; @@ -1441,7 +1441,7 @@ impl BlockSnapshot { let wrap_start_row = input_start.0 + overshoot; let wrap_end_row = cmp::min( input_start.0 + (range.end.0 - output_start.0), - cursor.end(&()).1 .0, + cursor.end(&()).1.0, ); let summary = self .wrap_snapshot @@ -1532,7 +1532,7 @@ impl BlockSnapshot { let max_input_row = WrapRow(self.transforms.summary().input_rows); let mut search_left = - (bias == Bias::Left && cursor.start().1 .0 > 0) || cursor.end(&()).1 == max_input_row; + (bias == Bias::Left && cursor.start().1.0 > 0) || cursor.end(&()).1 == max_input_row; let mut reversed = false; loop { @@ -1591,7 +1591,7 @@ impl BlockSnapshot { cursor.seek(&WrapRow(wrap_point.row()), Bias::Right, &()); if let Some(transform) = cursor.item() { if transform.block.is_some() { - BlockPoint::new(cursor.start().1 .0, 0) + BlockPoint::new(cursor.start().1.0, 0) } else { let (input_start_row, output_start_row) = cursor.start(); let input_start = Point::new(input_start_row.0, 0); @@ -1611,20 +1611,20 @@ impl BlockSnapshot { match transform.block.as_ref() { Some(block) => { if block.place_below() { - let wrap_row = cursor.start().1 .0 - 1; + let wrap_row = cursor.start().1.0 - 1; WrapPoint::new(wrap_row, self.wrap_snapshot.line_len(wrap_row)) } else if block.place_above() { - WrapPoint::new(cursor.start().1 .0, 0) + WrapPoint::new(cursor.start().1.0, 0) } else if bias == Bias::Left { - WrapPoint::new(cursor.start().1 .0, 0) + WrapPoint::new(cursor.start().1.0, 0) } else { - let wrap_row = cursor.end(&()).1 .0 - 1; + let wrap_row = cursor.end(&()).1.0 - 1; WrapPoint::new(wrap_row, self.wrap_snapshot.line_len(wrap_row)) } } None => { - let overshoot = block_point.row - cursor.start().0 .0; - let wrap_row = cursor.start().1 .0 + overshoot; + let overshoot = block_point.row - cursor.start().0.0; + let wrap_row = cursor.start().1.0 + overshoot; WrapPoint::new(wrap_row, block_point.column) } } @@ -1656,11 +1656,11 @@ impl BlockChunks<'_> { .item() .map_or(false, |transform| transform.block.is_none()) { - let start_input_row = self.transforms.start().1 .0; - let start_output_row = self.transforms.start().0 .0; + let start_input_row = self.transforms.start().1.0; + let start_output_row = self.transforms.start().0.0; if start_output_row < self.max_output_row { let end_input_row = cmp::min( - self.transforms.end(&()).1 .0, + self.transforms.end(&()).1.0, start_input_row + (self.max_output_row - start_output_row), ); self.input_chunks.seek(start_input_row..end_input_row); @@ -1683,8 +1683,8 @@ impl<'a> Iterator for BlockChunks<'a> { let transform = self.transforms.item()?; if transform.block.is_some() { - let block_start = self.transforms.start().0 .0; - let mut block_end = self.transforms.end(&()).0 .0; + let block_start = self.transforms.start().0.0; + let mut block_end = self.transforms.end(&()).0.0; self.advance(); if self.transforms.item().is_none() { block_end -= 1; @@ -1719,7 +1719,7 @@ impl<'a> Iterator for BlockChunks<'a> { } } - let transform_end = self.transforms.end(&()).0 .0; + let transform_end = self.transforms.end(&()).0.0; let (prefix_rows, prefix_bytes) = offset_for_row(self.input_chunk.text, transform_end - self.output_row); self.output_row += prefix_rows; @@ -1758,7 +1758,7 @@ impl Iterator for BlockRows<'_> { self.started = true; } - if self.output_row.0 >= self.transforms.end(&()).0 .0 { + if self.output_row.0 >= self.transforms.end(&()).0.0 { self.transforms.next(&()); while let Some(transform) = self.transforms.item() { if transform @@ -1778,7 +1778,7 @@ impl Iterator for BlockRows<'_> { .as_ref() .map_or(true, |block| block.is_replacement()) { - self.input_rows.seek(self.transforms.start().1 .0); + self.input_rows.seek(self.transforms.start().1.0); } } @@ -1913,7 +1913,7 @@ mod tests { display_map::{fold_map::FoldMap, inlay_map::InlayMap, tab_map::TabMap, wrap_map::WrapMap}, test::test_font, }; - use gpui::{div, font, px, App, AppContext as _, Element}; + use gpui::{App, AppContext as _, Element, div, font, px}; use itertools::Itertools; use language::{Buffer, Capability}; use multi_buffer::{ExcerptRange, MultiBuffer}; diff --git a/crates/editor/src/display_map/crease_map.rs b/crates/editor/src/display_map/crease_map.rs index af11a30ea097e49f9807c170528eda4bc54e2ef5..ddc354d3e862248091174efa5b98d74ac511b5d6 100644 --- a/crates/editor/src/display_map/crease_map.rs +++ b/crates/editor/src/display_map/crease_map.rs @@ -389,7 +389,7 @@ impl SeekTarget<'_, ItemSummary, ItemSummary> for Anchor { #[cfg(test)] mod test { use super::*; - use gpui::{div, App}; + use gpui::{App, div}; use multi_buffer::MultiBuffer; #[gpui::test] @@ -419,24 +419,32 @@ mod test { // Verify creases are inserted let crease_snapshot = crease_map.snapshot(); - assert!(crease_snapshot - .query_row(MultiBufferRow(1), &snapshot) - .is_some()); - assert!(crease_snapshot - .query_row(MultiBufferRow(3), &snapshot) - .is_some()); + assert!( + crease_snapshot + .query_row(MultiBufferRow(1), &snapshot) + .is_some() + ); + assert!( + crease_snapshot + .query_row(MultiBufferRow(3), &snapshot) + .is_some() + ); // Remove creases crease_map.remove(crease_ids, &snapshot); // Verify creases are removed let crease_snapshot = crease_map.snapshot(); - assert!(crease_snapshot - .query_row(MultiBufferRow(1), &snapshot) - .is_none()); - assert!(crease_snapshot - .query_row(MultiBufferRow(3), &snapshot) - .is_none()); + assert!( + crease_snapshot + .query_row(MultiBufferRow(1), &snapshot) + .is_none() + ); + assert!( + crease_snapshot + .query_row(MultiBufferRow(3), &snapshot) + .is_none() + ); } #[gpui::test] diff --git a/crates/editor/src/display_map/fold_map.rs b/crates/editor/src/display_map/fold_map.rs index 8461b1973c0ddf48bbce56a4cd8146441e21a101..b82c15f344a7178e339235389cc1b8487a29ceb4 100644 --- a/crates/editor/src/display_map/fold_map.rs +++ b/crates/editor/src/display_map/fold_map.rs @@ -1,6 +1,6 @@ use super::{ - inlay_map::{InlayBufferRows, InlayChunks, InlayEdit, InlayOffset, InlayPoint, InlaySnapshot}, Highlights, + inlay_map::{InlayBufferRows, InlayChunks, InlayEdit, InlayOffset, InlayPoint, InlaySnapshot}, }; use gpui::{AnyElement, App, ElementId}; use language::{Chunk, ChunkRenderer, Edit, Point, TextSummary}; @@ -97,8 +97,8 @@ impl FoldPoint { pub fn to_inlay_point(self, snapshot: &FoldSnapshot) -> InlayPoint { let mut cursor = snapshot.transforms.cursor::<(FoldPoint, InlayPoint)>(&()); cursor.seek(&self, Bias::Right, &()); - let overshoot = self.0 - cursor.start().0 .0; - InlayPoint(cursor.start().1 .0 + overshoot) + let overshoot = self.0 - cursor.start().0.0; + InlayPoint(cursor.start().1.0 + overshoot) } pub fn to_offset(self, snapshot: &FoldSnapshot) -> FoldOffset { @@ -527,7 +527,7 @@ impl FoldMap { edit.old.start = old_transforms.start().0; } let old_start = - old_transforms.start().1 .0 + (edit.old.start - old_transforms.start().0).0; + old_transforms.start().1.0 + (edit.old.start - old_transforms.start().0).0; old_transforms.seek_forward(&edit.old.end, Bias::Right, &()); if old_transforms.item().map_or(false, |t| t.is_fold()) { @@ -535,14 +535,14 @@ impl FoldMap { edit.old.end = old_transforms.start().0; } let old_end = - old_transforms.start().1 .0 + (edit.old.end - old_transforms.start().0).0; + old_transforms.start().1.0 + (edit.old.end - old_transforms.start().0).0; new_transforms.seek(&edit.new.start, Bias::Left, &()); if new_transforms.item().map_or(false, |t| t.is_fold()) { edit.new.start = new_transforms.start().0; } let new_start = - new_transforms.start().1 .0 + (edit.new.start - new_transforms.start().0).0; + new_transforms.start().1.0 + (edit.new.start - new_transforms.start().0).0; new_transforms.seek_forward(&edit.new.end, Bias::Right, &()); if new_transforms.item().map_or(false, |t| t.is_fold()) { @@ -550,7 +550,7 @@ impl FoldMap { edit.new.end = new_transforms.start().0; } let new_end = - new_transforms.start().1 .0 + (edit.new.end - new_transforms.start().0).0; + new_transforms.start().1.0 + (edit.new.end - new_transforms.start().0).0; fold_edits.push(FoldEdit { old: FoldOffset(old_start)..FoldOffset(old_end), @@ -600,8 +600,8 @@ impl FoldSnapshot { let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&()); cursor.seek(&range.start, Bias::Right, &()); if let Some(transform) = cursor.item() { - let start_in_transform = range.start.0 - cursor.start().0 .0; - let end_in_transform = cmp::min(range.end, cursor.end(&()).0).0 - cursor.start().0 .0; + let start_in_transform = range.start.0 - cursor.start().0.0; + let end_in_transform = cmp::min(range.end, cursor.end(&()).0).0 - cursor.start().0.0; if let Some(placeholder) = transform.placeholder.as_ref() { summary = TextSummary::from( &placeholder.text @@ -610,10 +610,10 @@ impl FoldSnapshot { } else { let inlay_start = self .inlay_snapshot - .to_offset(InlayPoint(cursor.start().1 .0 + start_in_transform)); + .to_offset(InlayPoint(cursor.start().1.0 + start_in_transform)); let inlay_end = self .inlay_snapshot - .to_offset(InlayPoint(cursor.start().1 .0 + end_in_transform)); + .to_offset(InlayPoint(cursor.start().1.0 + end_in_transform)); summary = self .inlay_snapshot .text_summary_for_range(inlay_start..inlay_end); @@ -626,7 +626,7 @@ impl FoldSnapshot { .summary::<_, TransformSummary>(&range.end, Bias::Right, &()) .output; if let Some(transform) = cursor.item() { - let end_in_transform = range.end.0 - cursor.start().0 .0; + let end_in_transform = range.end.0 - cursor.start().0.0; if let Some(placeholder) = transform.placeholder.as_ref() { summary += TextSummary::from(&placeholder.text[..end_in_transform.column as usize]); @@ -634,7 +634,7 @@ impl FoldSnapshot { let inlay_start = self.inlay_snapshot.to_offset(cursor.start().1); let inlay_end = self .inlay_snapshot - .to_offset(InlayPoint(cursor.start().1 .0 + end_in_transform)); + .to_offset(InlayPoint(cursor.start().1.0 + end_in_transform)); summary += self .inlay_snapshot .text_summary_for_range(inlay_start..inlay_end); @@ -655,10 +655,10 @@ impl FoldSnapshot { cursor.end(&()).1 } } else { - let overshoot = point.0 - cursor.start().0 .0; + let overshoot = point.0 - cursor.start().0.0; FoldPoint(cmp::min( - cursor.start().1 .0 + overshoot, - cursor.end(&()).1 .0, + cursor.start().1.0 + overshoot, + cursor.end(&()).1.0, )) } } @@ -686,8 +686,8 @@ impl FoldSnapshot { let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&()); cursor.seek(&fold_point, Bias::Left, &()); - let overshoot = fold_point.0 - cursor.start().0 .0; - let inlay_point = InlayPoint(cursor.start().1 .0 + overshoot); + let overshoot = fold_point.0 - cursor.start().0.0; + let inlay_point = InlayPoint(cursor.start().1.0 + overshoot); let input_rows = self.inlay_snapshot.row_infos(inlay_point.row()); FoldRows { @@ -769,7 +769,7 @@ impl FoldSnapshot { transform_cursor.seek(&range.start, Bias::Right, &()); let inlay_start = { - let overshoot = range.start.0 - transform_cursor.start().0 .0; + let overshoot = range.start.0 - transform_cursor.start().0.0; transform_cursor.start().1 + InlayOffset(overshoot) }; @@ -781,7 +781,7 @@ impl FoldSnapshot { { inlay_start } else if range.end < transform_end.0 { - let overshoot = range.end.0 - transform_cursor.start().0 .0; + let overshoot = range.end.0 - transform_cursor.start().0.0; transform_cursor.start().1 + InlayOffset(overshoot) } else { transform_end.1 @@ -823,18 +823,18 @@ impl FoldSnapshot { let mut cursor = self.transforms.cursor::<(FoldPoint, InlayPoint)>(&()); cursor.seek(&point, Bias::Right, &()); if let Some(transform) = cursor.item() { - let transform_start = cursor.start().0 .0; + let transform_start = cursor.start().0.0; if transform.placeholder.is_some() { if point.0 == transform_start || matches!(bias, Bias::Left) { FoldPoint(transform_start) } else { - FoldPoint(cursor.end(&()).0 .0) + FoldPoint(cursor.end(&()).0.0) } } else { let overshoot = InlayPoint(point.0 - transform_start); let inlay_point = cursor.start().1 + overshoot; let clipped_inlay_point = self.inlay_snapshot.clip_point(inlay_point, bias); - FoldPoint(cursor.start().0 .0 + (clipped_inlay_point - cursor.start().1).0) + FoldPoint(cursor.start().0.0 + (clipped_inlay_point - cursor.start().1).0) } } else { FoldPoint(self.transforms.summary().output.lines) @@ -1148,8 +1148,8 @@ impl FoldRows<'_> { pub(crate) fn seek(&mut self, row: u32) { let fold_point = FoldPoint::new(row, 0); self.cursor.seek(&fold_point, Bias::Left, &()); - let overshoot = fold_point.0 - self.cursor.start().0 .0; - let inlay_point = InlayPoint(self.cursor.start().1 .0 + overshoot); + let overshoot = fold_point.0 - self.cursor.start().0.0; + let inlay_point = InlayPoint(self.cursor.start().1.0 + overshoot); self.input_rows.seek(inlay_point.row()); self.fold_point = fold_point; } @@ -1170,7 +1170,7 @@ impl Iterator for FoldRows<'_> { if self.cursor.item().is_some() { if traversed_fold { - self.input_rows.seek(self.cursor.start().1 .0.row); + self.input_rows.seek(self.cursor.start().1.0.row); self.input_rows.next(); } *self.fold_point.row_mut() += 1; @@ -1195,7 +1195,7 @@ impl FoldChunks<'_> { self.transform_cursor.seek(&range.start, Bias::Right, &()); let inlay_start = { - let overshoot = range.start.0 - self.transform_cursor.start().0 .0; + let overshoot = range.start.0 - self.transform_cursor.start().0.0; self.transform_cursor.start().1 + InlayOffset(overshoot) }; @@ -1208,7 +1208,7 @@ impl FoldChunks<'_> { { inlay_start } else if range.end < transform_end.0 { - let overshoot = range.end.0 - self.transform_cursor.start().0 .0; + let overshoot = range.end.0 - self.transform_cursor.start().0.0; self.transform_cursor.start().1 + InlayOffset(overshoot) } else { transform_end.1 @@ -1260,7 +1260,7 @@ impl<'a> Iterator for FoldChunks<'a> { let transform_start = self.transform_cursor.start(); let transform_end = self.transform_cursor.end(&()); let inlay_end = if self.max_output_offset < transform_end.0 { - let overshoot = self.max_output_offset.0 - transform_start.0 .0; + let overshoot = self.max_output_offset.0 - transform_start.0.0; transform_start.1 + InlayOffset(overshoot) } else { transform_end.1 @@ -1309,9 +1309,9 @@ impl FoldOffset { .cursor::<(FoldOffset, TransformSummary)>(&()); cursor.seek(&self, Bias::Right, &()); let overshoot = if cursor.item().map_or(true, |t| t.is_fold()) { - Point::new(0, (self.0 - cursor.start().0 .0) as u32) + Point::new(0, (self.0 - cursor.start().0.0) as u32) } else { - let inlay_offset = cursor.start().1.input.len + self.0 - cursor.start().0 .0; + let inlay_offset = cursor.start().1.input.len + self.0 - cursor.start().0.0; let inlay_point = snapshot.inlay_snapshot.to_point(InlayOffset(inlay_offset)); inlay_point.0 - cursor.start().1.input.lines }; @@ -1322,8 +1322,8 @@ impl FoldOffset { pub fn to_inlay_offset(self, snapshot: &FoldSnapshot) -> InlayOffset { let mut cursor = snapshot.transforms.cursor::<(FoldOffset, InlayOffset)>(&()); cursor.seek(&self, Bias::Right, &()); - let overshoot = self.0 - cursor.start().0 .0; - InlayOffset(cursor.start().1 .0 + overshoot) + let overshoot = self.0 - cursor.start().0.0; + InlayOffset(cursor.start().1.0 + overshoot) } } @@ -1384,15 +1384,15 @@ pub type FoldEdit = Edit; #[cfg(test)] mod tests { use super::*; - use crate::{display_map::inlay_map::InlayMap, MultiBuffer, ToPoint}; + use crate::{MultiBuffer, ToPoint, display_map::inlay_map::InlayMap}; + use Bias::{Left, Right}; use collections::HashSet; use rand::prelude::*; use settings::SettingsStore; use std::{env, mem}; use text::Patch; - use util::test::sample_text; use util::RandomCharIter; - use Bias::{Left, Right}; + use util::test::sample_text; #[gpui::test] fn test_basic_folds(cx: &mut gpui::App) { diff --git a/crates/editor/src/display_map/inlay_map.rs b/crates/editor/src/display_map/inlay_map.rs index 899f8741f1f3b517e3a76f94828a0f2d78e041e6..925b7a6d4b4e9dd7fb8bce9e45639cdf07e0a636 100644 --- a/crates/editor/src/display_map/inlay_map.rs +++ b/crates/editor/src/display_map/inlay_map.rs @@ -11,7 +11,7 @@ use std::{ use sum_tree::{Bias, Cursor, SumTree}; use text::{Patch, Rope}; -use super::{custom_highlights::CustomHighlightsChunks, Highlights}; +use super::{Highlights, custom_highlights::CustomHighlightsChunks}; /// Decides where the [`Inlay`]s should be displayed. /// @@ -254,7 +254,7 @@ impl<'a> Iterator for InlayChunks<'a> { chunk .text .len() - .min(self.transforms.end(&()).0 .0 - self.output_offset.0), + .min(self.transforms.end(&()).0.0 - self.output_offset.0), ); chunk.text = suffix; @@ -352,7 +352,7 @@ impl InlayBufferRows<'_> { } else { match self.transforms.item() { Some(Transform::Isomorphic(_)) => { - buffer_point += inlay_point.0 - self.transforms.start().0 .0; + buffer_point += inlay_point.0 - self.transforms.start().0.0; buffer_point.row } _ => cmp::min(buffer_point.row + 1, self.max_buffer_row.0), @@ -664,18 +664,18 @@ impl InlaySnapshot { .transforms .cursor::<(InlayOffset, (InlayPoint, usize))>(&()); cursor.seek(&offset, Bias::Right, &()); - let overshoot = offset.0 - cursor.start().0 .0; + let overshoot = offset.0 - cursor.start().0.0; match cursor.item() { Some(Transform::Isomorphic(_)) => { - let buffer_offset_start = cursor.start().1 .1; + let buffer_offset_start = cursor.start().1.1; let buffer_offset_end = buffer_offset_start + overshoot; let buffer_start = self.buffer.offset_to_point(buffer_offset_start); let buffer_end = self.buffer.offset_to_point(buffer_offset_end); - InlayPoint(cursor.start().1 .0 .0 + (buffer_end - buffer_start)) + InlayPoint(cursor.start().1.0.0 + (buffer_end - buffer_start)) } Some(Transform::Inlay(inlay)) => { let overshoot = inlay.text.offset_to_point(overshoot); - InlayPoint(cursor.start().1 .0 .0 + overshoot) + InlayPoint(cursor.start().1.0.0 + overshoot) } None => self.max_point(), } @@ -694,18 +694,18 @@ impl InlaySnapshot { .transforms .cursor::<(InlayPoint, (InlayOffset, Point))>(&()); cursor.seek(&point, Bias::Right, &()); - let overshoot = point.0 - cursor.start().0 .0; + let overshoot = point.0 - cursor.start().0.0; match cursor.item() { Some(Transform::Isomorphic(_)) => { - let buffer_point_start = cursor.start().1 .1; + let buffer_point_start = cursor.start().1.1; let buffer_point_end = buffer_point_start + overshoot; let buffer_offset_start = self.buffer.point_to_offset(buffer_point_start); let buffer_offset_end = self.buffer.point_to_offset(buffer_point_end); - InlayOffset(cursor.start().1 .0 .0 + (buffer_offset_end - buffer_offset_start)) + InlayOffset(cursor.start().1.0.0 + (buffer_offset_end - buffer_offset_start)) } Some(Transform::Inlay(inlay)) => { let overshoot = inlay.text.point_to_offset(overshoot); - InlayOffset(cursor.start().1 .0 .0 + overshoot) + InlayOffset(cursor.start().1.0.0 + overshoot) } None => self.len(), } @@ -715,7 +715,7 @@ impl InlaySnapshot { cursor.seek(&point, Bias::Right, &()); match cursor.item() { Some(Transform::Isomorphic(_)) => { - let overshoot = point.0 - cursor.start().0 .0; + let overshoot = point.0 - cursor.start().0.0; cursor.start().1 + overshoot } Some(Transform::Inlay(_)) => cursor.start().1, @@ -752,7 +752,7 @@ impl InlaySnapshot { return cursor.end(&()).1; } else { let overshoot = offset - cursor.start().0; - return InlayOffset(cursor.start().1 .0 + overshoot); + return InlayOffset(cursor.start().1.0 + overshoot); } } Some(Transform::Inlay(inlay)) => { @@ -785,7 +785,7 @@ impl InlaySnapshot { return cursor.end(&()).1; } else { let overshoot = point - cursor.start().0; - return InlayPoint(cursor.start().1 .0 + overshoot); + return InlayPoint(cursor.start().1.0 + overshoot); } } Some(Transform::Inlay(inlay)) => { @@ -838,11 +838,11 @@ impl InlaySnapshot { return point; } } else { - let overshoot = point.0 - cursor.start().0 .0; + let overshoot = point.0 - cursor.start().0.0; let buffer_point = cursor.start().1 + overshoot; let clipped_buffer_point = self.buffer.clip_point(buffer_point, bias); let clipped_overshoot = clipped_buffer_point - cursor.start().1; - let clipped_point = InlayPoint(cursor.start().0 .0 + clipped_overshoot); + let clipped_point = InlayPoint(cursor.start().0.0 + clipped_overshoot); if clipped_point == point { return clipped_point; } else { @@ -903,19 +903,19 @@ impl InlaySnapshot { let mut cursor = self.transforms.cursor::<(InlayOffset, usize)>(&()); cursor.seek(&range.start, Bias::Right, &()); - let overshoot = range.start.0 - cursor.start().0 .0; + let overshoot = range.start.0 - cursor.start().0.0; match cursor.item() { Some(Transform::Isomorphic(_)) => { let buffer_start = cursor.start().1; let suffix_start = buffer_start + overshoot; let suffix_end = - buffer_start + (cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0 .0); + buffer_start + (cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0.0); summary = self.buffer.text_summary_for_range(suffix_start..suffix_end); cursor.next(&()); } Some(Transform::Inlay(inlay)) => { let suffix_start = overshoot; - let suffix_end = cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0 .0; + let suffix_end = cmp::min(cursor.end(&()).0, range.end).0 - cursor.start().0.0; summary = inlay.text.cursor(suffix_start).summary(suffix_end); cursor.next(&()); } @@ -927,7 +927,7 @@ impl InlaySnapshot { .summary::<_, TransformSummary>(&range.end, Bias::Right, &()) .output; - let overshoot = range.end.0 - cursor.start().0 .0; + let overshoot = range.end.0 - cursor.start().0.0; match cursor.item() { Some(Transform::Isomorphic(_)) => { let prefix_start = cursor.start().1; @@ -959,7 +959,7 @@ impl InlaySnapshot { } else { match cursor.item() { Some(Transform::Isomorphic(_)) => { - buffer_point += inlay_point.0 - cursor.start().0 .0; + buffer_point += inlay_point.0 - cursor.start().0.0; MultiBufferRow(buffer_point.row) } _ => cmp::min(MultiBufferRow(buffer_point.row + 1), max_buffer_row), @@ -1066,9 +1066,9 @@ fn push_isomorphic(sum_tree: &mut SumTree, summary: TextSummary) { mod tests { use super::*; use crate::{ + InlayId, MultiBuffer, display_map::{InlayHighlights, TextHighlights}, hover_links::InlayHighlight, - InlayId, MultiBuffer, }; use gpui::{App, HighlightStyle}; use project::{InlayHint, InlayHintLabel, ResolveState}; diff --git a/crates/editor/src/display_map/tab_map.rs b/crates/editor/src/display_map/tab_map.rs index e4832ff7f897d26842a61fa177a8f3f0423f0e10..ae8697e634c3f416867a40af78c2a09cde731e88 100644 --- a/crates/editor/src/display_map/tab_map.rs +++ b/crates/editor/src/display_map/tab_map.rs @@ -1,6 +1,6 @@ use super::{ - fold_map::{self, FoldChunks, FoldEdit, FoldPoint, FoldSnapshot}, Highlights, + fold_map::{self, FoldChunks, FoldEdit, FoldPoint, FoldSnapshot}, }; use language::{Chunk, Point}; use multi_buffer::MultiBufferSnapshot; @@ -602,10 +602,10 @@ impl<'a> Iterator for TabChunks<'a> { mod tests { use super::*; use crate::{ - display_map::{fold_map::FoldMap, inlay_map::InlayMap}, MultiBuffer, + display_map::{fold_map::FoldMap, inlay_map::InlayMap}, }; - use rand::{prelude::StdRng, Rng}; + use rand::{Rng, prelude::StdRng}; #[gpui::test] fn test_expand_tabs(cx: &mut gpui::App) { diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs index 858275c4a79ea163de8dbd07ee2eeb0a23581fc6..342cf835378124194c36c63bc79fc51193f55f48 100644 --- a/crates/editor/src/display_map/wrap_map.rs +++ b/crates/editor/src/display_map/wrap_map.rs @@ -1,7 +1,7 @@ use super::{ + Highlights, fold_map::FoldRows, tab_map::{self, TabEdit, TabPoint, TabSnapshot}, - Highlights, }; use gpui::{App, AppContext as _, Context, Entity, Font, LineWrapper, Pixels, Task}; use language::{Chunk, Point}; @@ -593,9 +593,9 @@ impl WrapSnapshot { let output_end = WrapPoint::new(rows.end, 0); let mut transforms = self.transforms.cursor::<(WrapPoint, TabPoint)>(&()); transforms.seek(&output_start, Bias::Right, &()); - let mut input_start = TabPoint(transforms.start().1 .0); + let mut input_start = TabPoint(transforms.start().1.0); if transforms.item().map_or(false, |t| t.is_isomorphic()) { - input_start.0 += output_start.0 - transforms.start().0 .0; + input_start.0 += output_start.0 - transforms.start().0.0; } let input_end = self .to_tab_point(output_end) @@ -647,11 +647,11 @@ impl WrapSnapshot { let mut cursor = self.transforms.cursor::<(WrapPoint, TabPoint)>(&()); cursor.seek(&start, Bias::Right, &()); if let Some(transform) = cursor.item() { - let start_in_transform = start.0 - cursor.start().0 .0; - let end_in_transform = cmp::min(end, cursor.end(&()).0).0 - cursor.start().0 .0; + let start_in_transform = start.0 - cursor.start().0.0; + let end_in_transform = cmp::min(end, cursor.end(&()).0).0 - cursor.start().0.0; if transform.is_isomorphic() { - let tab_start = TabPoint(cursor.start().1 .0 + start_in_transform); - let tab_end = TabPoint(cursor.start().1 .0 + end_in_transform); + let tab_start = TabPoint(cursor.start().1.0 + start_in_transform); + let tab_end = TabPoint(cursor.start().1.0 + end_in_transform); summary += &self.tab_snapshot.text_summary_for_range(tab_start..tab_end); } else { debug_assert_eq!(start_in_transform.row, end_in_transform.row); @@ -674,7 +674,7 @@ impl WrapSnapshot { .output; if let Some(transform) = cursor.item() { - let end_in_transform = end.0 - cursor.start().0 .0; + let end_in_transform = end.0 - cursor.start().0.0; if transform.is_isomorphic() { let char_start = cursor.start().1; let char_end = TabPoint(char_start.0 + end_in_transform); @@ -736,9 +736,9 @@ impl WrapSnapshot { pub fn to_tab_point(&self, point: WrapPoint) -> TabPoint { let mut cursor = self.transforms.cursor::<(WrapPoint, TabPoint)>(&()); cursor.seek(&point, Bias::Right, &()); - let mut tab_point = cursor.start().1 .0; + let mut tab_point = cursor.start().1.0; if cursor.item().map_or(false, |t| t.is_isomorphic()) { - tab_point += point.0 - cursor.start().0 .0; + tab_point += point.0 - cursor.start().0.0; } TabPoint(tab_point) } @@ -754,7 +754,7 @@ impl WrapSnapshot { pub fn tab_point_to_wrap_point(&self, point: TabPoint) -> WrapPoint { let mut cursor = self.transforms.cursor::<(TabPoint, WrapPoint)>(&()); cursor.seek(&point, Bias::Right, &()); - WrapPoint(cursor.start().1 .0 + (point.0 - cursor.start().0 .0)) + WrapPoint(cursor.start().1.0 + (point.0 - cursor.start().0.0)) } pub fn clip_point(&self, mut point: WrapPoint, bias: Bias) -> WrapPoint { @@ -877,9 +877,9 @@ impl WrapChunks<'_> { let output_start = WrapPoint::new(rows.start, 0); let output_end = WrapPoint::new(rows.end, 0); self.transforms.seek(&output_start, Bias::Right, &()); - let mut input_start = TabPoint(self.transforms.start().1 .0); + let mut input_start = TabPoint(self.transforms.start().1.0); if self.transforms.item().map_or(false, |t| t.is_isomorphic()) { - input_start.0 += output_start.0 - self.transforms.start().0 .0; + input_start.0 += output_start.0 - self.transforms.start().0.0; } let input_end = self .snapshot @@ -1169,9 +1169,9 @@ fn consolidate_wrap_edits(edits: Vec) -> Vec { mod tests { use super::*; use crate::{ + MultiBuffer, display_map::{fold_map::FoldMap, inlay_map::InlayMap, tab_map::TabMap}, test::test_font, - MultiBuffer, }; use gpui::{px, test::observe}; use rand::prelude::*; diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index e5be44d553c2016070a9c5d93694e83dc2e6f0fa..1a1fe6926c3c847dfa272deeb010d81dfb5b875f 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -51,7 +51,7 @@ pub mod test; pub(crate) use actions::*; pub use actions::{AcceptEditPrediction, OpenExcerpts, OpenExcerptsSplit}; use aho_corasick::AhoCorasick; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use blink_manager::BlinkManager; use buffer_diff::DiffHunkStatus; use client::{Collaborator, ParticipantIndex}; @@ -66,14 +66,14 @@ pub use editor_settings::{ ShowScrollbar, }; pub use editor_settings_controls::*; -use element::{layout_line, AcceptEditPredictionBinding, LineWithInvisibles, PositionMap}; +use element::{AcceptEditPredictionBinding, LineWithInvisibles, PositionMap, layout_line}; pub use element::{ CursorLayout, EditorElement, HighlightedRange, HighlightedRangeLine, PointForPosition, }; use feature_flags::{Debugger, FeatureFlagAppExt}; use futures::{ - future::{self, join, Shared}, FutureExt, + future::{self, Shared, join}, }; use fuzzy::StringMatchCandidate; @@ -84,18 +84,18 @@ use code_context_menus::{ }; use git::blame::GitBlame; use gpui::{ - div, impl_actions, point, prelude::*, pulsating_between, px, relative, size, Action, Animation, - AnimationExt, AnyElement, App, AppContext, AsyncWindowContext, AvailableSpace, Background, - Bounds, ClickEvent, ClipboardEntry, ClipboardItem, Context, DispatchPhase, Edges, Entity, - EntityInputHandler, EventEmitter, FocusHandle, FocusOutEvent, Focusable, FontId, FontWeight, - Global, HighlightStyle, Hsla, KeyContext, Modifiers, MouseButton, MouseDownEvent, PaintQuad, - ParentElement, Pixels, Render, SharedString, Size, Stateful, Styled, StyledText, Subscription, - Task, TextStyle, TextStyleRefinement, UTF16Selection, UnderlineStyle, UniformListScrollHandle, - WeakEntity, WeakFocusHandle, Window, + Action, Animation, AnimationExt, AnyElement, App, AppContext, AsyncWindowContext, + AvailableSpace, Background, Bounds, ClickEvent, ClipboardEntry, ClipboardItem, Context, + DispatchPhase, Edges, Entity, EntityInputHandler, EventEmitter, FocusHandle, FocusOutEvent, + Focusable, FontId, FontWeight, Global, HighlightStyle, Hsla, KeyContext, Modifiers, + MouseButton, MouseDownEvent, PaintQuad, ParentElement, Pixels, Render, SharedString, Size, + Stateful, Styled, StyledText, Subscription, Task, TextStyle, TextStyleRefinement, + UTF16Selection, UnderlineStyle, UniformListScrollHandle, WeakEntity, WeakFocusHandle, Window, + div, impl_actions, point, prelude::*, pulsating_between, px, relative, size, }; use highlight_matching_bracket::refresh_matching_bracket_highlights; -use hover_links::{find_file, HoverLink, HoveredLinkState, InlayHighlight}; -use hover_popover::{hide_hover, HoverState}; +use hover_links::{HoverLink, HoveredLinkState, InlayHighlight, find_file}; +use hover_popover::{HoverState, hide_hover}; use indent_guides::ActiveIndentGuidesState; use inlay_hint_cache::{InlayHintCache, InlaySplice, InvalidationStrategy}; pub use inline_completion::Direction; @@ -103,24 +103,25 @@ use inline_completion::{EditPredictionProvider, InlineCompletionProviderHandle}; pub use items::MAX_TAB_TITLE_LEN; use itertools::Itertools; use language::{ + AutoindentMode, BracketMatch, BracketPair, Buffer, Capability, CharKind, CodeLabel, + CursorShape, Diagnostic, DiffOptions, EditPredictionsMode, EditPreview, HighlightedText, + IndentKind, IndentSize, Language, OffsetRangeExt, Point, Selection, SelectionGoal, TextObject, + TransactionId, TreeSitterOptions, WordsQuery, language_settings::{ - self, all_language_settings, language_settings, InlayHintSettings, RewrapBehavior, - WordsCompletionMode, + self, InlayHintSettings, RewrapBehavior, WordsCompletionMode, all_language_settings, + language_settings, }, - point_from_lsp, text_diff_with_options, AutoindentMode, BracketMatch, BracketPair, Buffer, - Capability, CharKind, CodeLabel, CursorShape, Diagnostic, DiffOptions, EditPredictionsMode, - EditPreview, HighlightedText, IndentKind, IndentSize, Language, OffsetRangeExt, Point, - Selection, SelectionGoal, TextObject, TransactionId, TreeSitterOptions, WordsQuery, + point_from_lsp, text_diff_with_options, }; -use language::{point_to_lsp, BufferRow, CharClassifier, Runnable, RunnableRange}; +use language::{BufferRow, CharClassifier, Runnable, RunnableRange, point_to_lsp}; use linked_editing_ranges::refresh_linked_ranges; use mouse_context_menu::MouseContextMenu; use persistence::DB; use project::{ + ProjectPath, debugger::breakpoint_store::{ BreakpointEditAction, BreakpointState, BreakpointStore, BreakpointStoreEvent, }, - ProjectPath, }; pub use proposed_changes_editor::{ @@ -148,21 +149,21 @@ use multi_buffer::{ }; use parking_lot::Mutex; use project::{ - debugger::breakpoint_store::Breakpoint, - lsp_store::{CompletionDocumentation, FormatTrigger, LspFormatTarget, OpenLspBufferHandle}, - project_settings::{GitGutterSetting, ProjectSettings}, CodeAction, Completion, CompletionIntent, CompletionSource, DocumentHighlight, InlayHint, Location, LocationLink, PrepareRenameResponse, Project, ProjectItem, ProjectTransaction, TaskSourceKind, + debugger::breakpoint_store::Breakpoint, + lsp_store::{CompletionDocumentation, FormatTrigger, LspFormatTarget, OpenLspBufferHandle}, + project_settings::{GitGutterSetting, ProjectSettings}, }; use rand::prelude::*; -use rpc::{proto::*, ErrorExt}; +use rpc::{ErrorExt, proto::*}; use scroll::{Autoscroll, OngoingScroll, ScrollAnchor, ScrollManager, ScrollbarAutoHide}; use selections_collection::{ - resolve_selections, MutableSelectionsCollection, SelectionsCollection, + MutableSelectionsCollection, SelectionsCollection, resolve_selections, }; use serde::{Deserialize, Serialize}; -use settings::{update_settings_file, Settings, SettingsLocation, SettingsStore}; +use settings::{Settings, SettingsLocation, SettingsStore, update_settings_file}; use smallvec::SmallVec; use snippet::Snippet; use std::sync::Arc; @@ -182,21 +183,21 @@ pub use sum_tree::Bias; use sum_tree::TreeMap; use text::{BufferId, OffsetUtf16, Rope}; use theme::{ - observe_buffer_font_size_adjustment, ActiveTheme, PlayerColor, StatusColors, SyntaxTheme, - ThemeColors, ThemeSettings, + ActiveTheme, PlayerColor, StatusColors, SyntaxTheme, ThemeColors, ThemeSettings, + observe_buffer_font_size_adjustment, }; use ui::{ - h_flex, prelude::*, ButtonSize, ButtonStyle, Disclosure, IconButton, IconButtonShape, IconName, - IconSize, Key, Tooltip, + ButtonSize, ButtonStyle, Disclosure, IconButton, IconButtonShape, IconName, IconSize, Key, + Tooltip, h_flex, prelude::*, }; -use util::{maybe, post_inc, RangeExt, ResultExt, TryFutureExt}; +use util::{RangeExt, ResultExt, TryFutureExt, maybe, post_inc}; use workspace::{ + Item as WorkspaceItem, ItemId, ItemNavHistory, OpenInTerminal, OpenTerminal, + RestoreOnStartupBehavior, SERIALIZATION_THROTTLE_TIME, SplitDirection, TabBarSettings, Toast, + ViewId, Workspace, WorkspaceId, WorkspaceSettings, item::{ItemHandle, PreviewTabsSettings}, notifications::{DetachAndPromptErr, NotificationId, NotifyTaskExt}, searchable::SearchEvent, - Item as WorkspaceItem, ItemId, ItemNavHistory, OpenInTerminal, OpenTerminal, - RestoreOnStartupBehavior, SplitDirection, TabBarSettings, Toast, ViewId, Workspace, - WorkspaceId, WorkspaceSettings, SERIALIZATION_THROTTLE_TIME, }; use crate::hover_links::{find_url, find_url_from_range}; @@ -271,11 +272,7 @@ pub enum Navigated { impl Navigated { pub fn from_bool(yes: bool) -> Navigated { - if yes { - Navigated::Yes - } else { - Navigated::No - } + if yes { Navigated::Yes } else { Navigated::No } } } @@ -1969,12 +1966,12 @@ impl Editor { pub fn set_custom_context_menu( &mut self, f: impl 'static - + Fn( - &mut Self, - DisplayPoint, - &mut Window, - &mut Context, - ) -> Option>, + + Fn( + &mut Self, + DisplayPoint, + &mut Window, + &mut Context, + ) -> Option>, ) { self.custom_context_menu = Some(Box::new(f)) } @@ -12474,11 +12471,7 @@ impl Editor { best_in_bracket_range = in_bracket_range; best_destination = Some( if close.contains(&selection.start) && close.contains(&selection.end) { - if inside { - open.end - } else { - open.start - } + if inside { open.end } else { open.start } } else if inside { *close.start() } else { diff --git a/crates/editor/src/editor_settings_controls.rs b/crates/editor/src/editor_settings_controls.rs index 9e22c6439317317edee25301418aeaa14e4feca6..54bb865520568ef2f5d0291c19a061a5c87d3568 100644 --- a/crates/editor/src/editor_settings_controls.rs +++ b/crates/editor/src/editor_settings_controls.rs @@ -5,8 +5,8 @@ use project::project_settings::{InlineBlameSettings, ProjectSettings}; use settings::{EditableSettingControl, Settings}; use theme::{FontFamilyCache, ThemeSettings}; use ui::{ - prelude::*, CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, - SettingsGroup, + CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, SettingsGroup, + prelude::*, }; use crate::EditorSettings; diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index c5199c700368f1e164d91d1cb8724b0c0ec06134..6dac9e26a4b1fde170da61e83acee9e5bb4db776 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -1,30 +1,30 @@ use super::*; use crate::{ + JoinLines, scroll::scroll_amount::ScrollAmount, test::{ assert_text_with_selections, build_editor, - editor_lsp_test_context::{git_commit_lang, EditorLspTestContext}, + editor_lsp_test_context::{EditorLspTestContext, git_commit_lang}, editor_test_context::EditorTestContext, select_ranges, }, - JoinLines, }; use buffer_diff::{BufferDiff, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind}; use futures::StreamExt; use gpui::{ - div, BackgroundExecutor, SemanticVersion, TestAppContext, UpdateGlobal, VisualTestContext, - WindowBounds, WindowOptions, + BackgroundExecutor, SemanticVersion, TestAppContext, UpdateGlobal, VisualTestContext, + WindowBounds, WindowOptions, div, }; use indoc::indoc; use language::{ - language_settings::{ - AllLanguageSettings, AllLanguageSettingsContent, CompletionSettings, - LanguageSettingsContent, PrettierSettings, - }, BracketPairConfig, Capability::ReadWrite, FakeLspAdapter, LanguageConfig, LanguageConfigOverride, LanguageMatcher, LanguageName, Override, Point, + language_settings::{ + AllLanguageSettings, AllLanguageSettingsContent, CompletionSettings, + LanguageSettingsContent, PrettierSettings, + }, }; use language_settings::{Formatter, FormatterList, IndentGuideSettings}; use lsp::CompletionParams; @@ -32,9 +32,9 @@ use multi_buffer::{IndentGuide, PathKey}; use parking_lot::Mutex; use pretty_assertions::{assert_eq, assert_ne}; use project::{ + FakeFs, debugger::breakpoint_store::{BreakpointState, SourceBreakpoint}, project_settings::{LspSettings, ProjectSettings}, - FakeFs, }; use serde_json::{self, json}; use std::{cell::RefCell, future::Future, rc::Rc, sync::atomic::AtomicBool, time::Instant}; @@ -47,12 +47,12 @@ use text::ToPoint as _; use unindent::Unindent; use util::{ assert_set_eq, path, - test::{marked_text_ranges, marked_text_ranges_by, sample_text, TextRangeMarker}, + test::{TextRangeMarker, marked_text_ranges, marked_text_ranges_by, sample_text}, uri, }; use workspace::{ - item::{FollowEvent, FollowableItem, Item, ItemHandle}, CloseAllItems, CloseInactiveItems, NavigationEntry, ViewId, + item::{FollowEvent, FollowableItem, Item, ItemHandle}, }; #[gpui::test] diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 30e9775b5700fc6c900e9836fabf43f1616b8da8..ede1df1e1e29b32dc837a90ba243649920976234 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1,6 +1,15 @@ use crate::{ + BlockId, COLUMNAR_SELECTION_MODIFIERS, CURSORS_VISIBLE_FOR, ChunkReplacement, + ContextMenuPlacement, CursorShape, CustomBlockId, DisplayDiffHunk, DisplayPoint, DisplayRow, + DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode, Editor, EditorMode, + EditorSettings, EditorSnapshot, EditorStyle, FILE_HEADER_HEIGHT, FocusedBlock, + GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, + HoveredCursor, InlayHintRefreshReason, InlineCompletion, JumpData, LineDown, LineHighlight, + LineUp, MAX_LINE_LEN, MIN_LINE_NUMBER_DIGITS, MULTI_BUFFER_EXCERPT_HEADER_HEIGHT, OpenExcerpts, + PageDown, PageUp, Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection, + SoftWrap, StickyHeaderExcerpt, ToPoint, ToggleFold, code_context_menus::{CodeActionsMenu, MENU_ASIDE_MAX_WIDTH, MENU_ASIDE_MIN_WIDTH, MENU_GAP}, - commit_tooltip::{blame_entry_relative_timestamp, CommitTooltip, ParsedCommitMessage}, + commit_tooltip::{CommitTooltip, ParsedCommitMessage, blame_entry_relative_timestamp}, display_map::{ Block, BlockContext, BlockStyle, DisplaySnapshot, HighlightedChunk, ToDisplayPoint, }, @@ -10,46 +19,37 @@ use crate::{ }, git::blame::GitBlame, hover_popover::{ - self, hover_at, HOVER_POPOVER_GAP, MIN_POPOVER_CHARACTER_WIDTH, MIN_POPOVER_LINE_HEIGHT, + self, HOVER_POPOVER_GAP, MIN_POPOVER_CHARACTER_WIDTH, MIN_POPOVER_LINE_HEIGHT, hover_at, }, inlay_hint_settings, items::BufferSearchHighlights, mouse_context_menu::{self, MenuPosition, MouseContextMenu}, scroll::scroll_amount::ScrollAmount, - BlockId, ChunkReplacement, ContextMenuPlacement, CursorShape, CustomBlockId, DisplayDiffHunk, - DisplayPoint, DisplayRow, DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode, - Editor, EditorMode, EditorSettings, EditorSnapshot, EditorStyle, FocusedBlock, - GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor, InlayHintRefreshReason, - InlineCompletion, JumpData, LineDown, LineHighlight, LineUp, OpenExcerpts, PageDown, PageUp, - Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection, SoftWrap, - StickyHeaderExcerpt, ToPoint, ToggleFold, COLUMNAR_SELECTION_MODIFIERS, CURSORS_VISIBLE_FOR, - FILE_HEADER_HEIGHT, GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, MAX_LINE_LEN, MIN_LINE_NUMBER_DIGITS, - MULTI_BUFFER_EXCERPT_HEADER_HEIGHT, }; use buffer_diff::{DiffHunkStatus, DiffHunkStatusKind}; use client::ParticipantIndex; use collections::{BTreeMap, HashMap, HashSet}; use feature_flags::{Debugger, FeatureFlagAppExt}; use file_icons::FileIcons; -use git::{blame::BlameEntry, status::FileStatus, Oid}; +use git::{Oid, blame::BlameEntry, status::FileStatus}; use gpui::{ - anchored, deferred, div, fill, linear_color_stop, linear_gradient, outline, point, px, quad, - relative, size, solid_background, transparent_black, Action, Along, AnyElement, App, - AvailableSpace, Axis as ScrollbarAxis, BorderStyle, Bounds, ClickEvent, ClipboardItem, - ContentMask, Context, Corner, Corners, CursorStyle, DispatchPhase, Edges, Element, - ElementInputHandler, Entity, Focusable as _, FontId, GlobalElementId, Hitbox, Hsla, - InteractiveElement, IntoElement, Keystroke, Length, ModifiersChangedEvent, MouseButton, + Action, Along, AnyElement, App, AvailableSpace, Axis as ScrollbarAxis, BorderStyle, Bounds, + ClickEvent, ClipboardItem, ContentMask, Context, Corner, Corners, CursorStyle, DispatchPhase, + Edges, Element, ElementInputHandler, Entity, Focusable as _, FontId, GlobalElementId, Hitbox, + Hsla, InteractiveElement, IntoElement, Keystroke, Length, ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, ParentElement, Pixels, ScrollDelta, ScrollWheelEvent, ShapedLine, SharedString, Size, StatefulInteractiveElement, Style, Styled, - Subscription, TextRun, TextStyleRefinement, Window, + Subscription, TextRun, TextStyleRefinement, Window, anchored, deferred, div, fill, + linear_color_stop, linear_gradient, outline, point, px, quad, relative, size, solid_background, + transparent_black, }; use itertools::Itertools; use language::{ + ChunkRendererContext, language_settings::{ IndentGuideBackgroundColoring, IndentGuideColoring, IndentGuideSettings, ShowWhitespaceSetting, }, - ChunkRendererContext, }; use lsp::DiagnosticSeverity; use multi_buffer::{ @@ -61,7 +61,7 @@ use project::{ project_settings::{self, GitGutterSetting, GitHunkStyleSetting, ProjectSettings}, }; use settings::Settings; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use std::{ any::TypeId, borrow::Cow, @@ -76,9 +76,9 @@ use std::{ use sum_tree::Bias; use text::BufferId; use theme::{ActiveTheme, Appearance, BufferLineHeight, PlayerColor}; -use ui::{h_flex, prelude::*, ButtonLike, ContextMenu, KeyBinding, Tooltip, POPOVER_Y_PADDING}; +use ui::{ButtonLike, ContextMenu, KeyBinding, POPOVER_Y_PADDING, Tooltip, h_flex, prelude::*}; use unicode_segmentation::UnicodeSegmentation; -use util::{debug_panic, RangeExt, ResultExt}; +use util::{RangeExt, ResultExt, debug_panic}; use workspace::{item::Item, notifications::NotifyTaskExt}; const INLINE_BLAME_PADDING_EM_WIDTHS: f32 = 7.; @@ -8490,9 +8490,9 @@ fn compute_auto_height_layout( mod tests { use super::*; use crate::{ + Editor, MultiBuffer, display_map::{BlockPlacement, BlockProperties}, editor_tests::{init_test, update_test_language_settings}, - Editor, MultiBuffer, }; use gpui::{TestAppContext, VisualTestContext}; use language::language_settings; diff --git a/crates/editor/src/git/blame.rs b/crates/editor/src/git/blame.rs index 6a87cdec7144fddc308a7b2d40f06886d86bed52..7b1b1692bd2860578ee6afd3caf4ab76d4c369ce 100644 --- a/crates/editor/src/git/blame.rs +++ b/crates/editor/src/git/blame.rs @@ -1,8 +1,9 @@ use anyhow::Result; use collections::HashMap; use git::{ + GitHostingProvider, GitHostingProviderRegistry, Oid, blame::{Blame, BlameEntry}, - parse_git_remote_url, GitHostingProvider, GitHostingProviderRegistry, Oid, + parse_git_remote_url, }; use gpui::{App, AppContext as _, Context, Entity, Subscription, Task}; use http_client::HttpClient; @@ -529,7 +530,7 @@ mod tests { use std::{cmp, env, ops::Range, path::Path}; use text::BufferId; use unindent::Unindent as _; - use util::{path, RandomCharIter}; + use util::{RandomCharIter, path}; // macro_rules! assert_blame_rows { // ($blame:expr, $rows:expr, $expected:expr, $cx:expr) => { diff --git a/crates/editor/src/hover_links.rs b/crates/editor/src/hover_links.rs index 004c7863b8c99aabb40efb2c478dee868281b503..fbab3fd8ff3b1567dc7995640f0eecfde1af93e6 100644 --- a/crates/editor/src/hover_links.rs +++ b/crates/editor/src/hover_links.rs @@ -1,11 +1,11 @@ use crate::{ + Anchor, Editor, EditorSettings, EditorSnapshot, FindAllReferences, GoToDefinition, + GoToTypeDefinition, GotoDefinitionKind, InlayId, Navigated, PointForPosition, SelectPhase, editor_settings::{GoToDefinitionFallback, MultiCursorModifier}, hover_popover::{self, InlayHover}, scroll::ScrollAmount, - Anchor, Editor, EditorSettings, EditorSnapshot, FindAllReferences, GoToDefinition, - GoToTypeDefinition, GotoDefinitionKind, InlayId, Navigated, PointForPosition, SelectPhase, }; -use gpui::{px, App, AsyncWindowContext, Context, Entity, Modifiers, Task, Window}; +use gpui::{App, AsyncWindowContext, Context, Entity, Modifiers, Task, Window, px}; use language::{Bias, ToOffset}; use linkify::{LinkFinder, LinkKind}; use lsp::LanguageServerId; @@ -16,7 +16,7 @@ use project::{ use settings::Settings; use std::ops::Range; use theme::ActiveTheme as _; -use util::{maybe, ResultExt, TryFutureExt as _}; +use util::{ResultExt, TryFutureExt as _, maybe}; #[derive(Debug)] pub struct HoveredLinkState { @@ -920,11 +920,11 @@ fn surrounding_filename( mod tests { use super::*; use crate::{ + DisplayPoint, display_map::ToDisplayPoint, editor_tests::init_test, inlay_hint_cache::tests::{cached_hint_labels, visible_hint_labels}, test::editor_lsp_test_context::EditorLspTestContext, - DisplayPoint, }; use futures::StreamExt; use gpui::Modifiers; @@ -1633,12 +1633,14 @@ mod tests { cx.simulate_mouse_move(screen_coord, None, Modifiers::secondary_key()); // No highlight cx.update_editor(|editor, window, cx| { - assert!(editor - .snapshot(window, cx) - .text_highlight_ranges::() - .unwrap_or_default() - .1 - .is_empty()); + assert!( + editor + .snapshot(window, cx) + .text_highlight_ranges::() + .unwrap_or_default() + .1 + .is_empty() + ); }); // Moving the mouse over a file that does exist should highlight it. @@ -1838,12 +1840,14 @@ mod tests { // No highlight cx.update_editor(|editor, window, cx| { - assert!(editor - .snapshot(window, cx) - .text_highlight_ranges::() - .unwrap_or_default() - .1 - .is_empty()); + assert!( + editor + .snapshot(window, cx) + .text_highlight_ranges::() + .unwrap_or_default() + .1 + .is_empty() + ); }); // Does not open the directory diff --git a/crates/editor/src/hover_popover.rs b/crates/editor/src/hover_popover.rs index e15b0681e754a0991e179860ab5ab45f906e7604..1d322118b62057f61bbd8f59dbf7a8caa2261e23 100644 --- a/crates/editor/src/hover_popover.rs +++ b/crates/editor/src/hover_popover.rs @@ -1,15 +1,15 @@ use crate::{ - display_map::{invisibles::is_invisible, InlayOffset, ToDisplayPoint}, - hover_links::{InlayHighlight, RangeInEditor}, - scroll::{Autoscroll, ScrollAmount}, Anchor, AnchorRangeExt, DisplayPoint, DisplayRow, Editor, EditorSettings, EditorSnapshot, Hover, + display_map::{InlayOffset, ToDisplayPoint, invisibles::is_invisible}, + hover_links::{InlayHighlight, RangeInEditor}, + scroll::{Autoscroll, ScrollAmount}, }; use gpui::{ - div, px, AnyElement, AsyncWindowContext, Context, Entity, Focusable as _, FontWeight, Hsla, + AnyElement, AsyncWindowContext, Context, Entity, Focusable as _, FontWeight, Hsla, InteractiveElement, IntoElement, MouseButton, ParentElement, Pixels, ScrollHandle, Size, Stateful, StatefulInteractiveElement, StyleRefinement, Styled, Task, TextStyleRefinement, - Window, + Window, div, px, }; use itertools::Itertools; use language::{DiagnosticEntry, Language, LanguageRegistry}; @@ -22,7 +22,7 @@ use std::{borrow::Cow, cell::RefCell}; use std::{ops::Range, sync::Arc, time::Duration}; use std::{path::PathBuf, rc::Rc}; use theme::ThemeSettings; -use ui::{prelude::*, theme_is_transparent, Scrollbar, ScrollbarState}; +use ui::{Scrollbar, ScrollbarState, prelude::*, theme_is_transparent}; use url::Url; use util::TryFutureExt; use workspace::{OpenOptions, OpenVisible, Workspace}; @@ -918,17 +918,17 @@ impl DiagnosticPopover { mod tests { use super::*; use crate::{ + InlayId, PointForPosition, actions::ConfirmCompletion, editor_tests::{handle_completion_request, init_test}, hover_links::update_inlay_link_and_hover_points, inlay_hint_cache::tests::{cached_hint_labels, visible_hint_labels}, test::editor_lsp_test_context::EditorLspTestContext, - InlayId, PointForPosition, }; use collections::BTreeSet; use gpui::App; use indoc::indoc; - use language::{language_settings::InlayHintSettings, Diagnostic, DiagnosticSet}; + use language::{Diagnostic, DiagnosticSet, language_settings::InlayHintSettings}; use lsp::LanguageServerId; use markdown::parser::MarkdownEvent; use smol::stream::StreamExt; diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rs index 750e5c682fdf5a7ef2a5befb4f055052b665d0c2..d0a31335911158711e5c3523870b1891f6c3ad05 100644 --- a/crates/editor/src/inlay_hint_cache.rs +++ b/crates/editor/src/inlay_hint_cache.rs @@ -14,22 +14,22 @@ use std::{ }; use crate::{ - display_map::Inlay, Anchor, Editor, ExcerptId, InlayId, MultiBuffer, MultiBufferSnapshot, + Anchor, Editor, ExcerptId, InlayId, MultiBuffer, MultiBufferSnapshot, display_map::Inlay, }; use anyhow::Context as _; use clock::Global; use futures::future; use gpui::{AppContext as _, AsyncApp, Context, Entity, Task, Window}; -use language::{language_settings::InlayHintKind, Buffer, BufferSnapshot}; +use language::{Buffer, BufferSnapshot, language_settings::InlayHintKind}; use parking_lot::RwLock; use project::{InlayHint, ResolveState}; -use collections::{hash_map, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map}; use language::language_settings::InlayHintSettings; use smol::lock::Semaphore; use sum_tree::Bias; use text::{BufferId, ToOffset, ToPoint}; -use util::{post_inc, ResultExt}; +use util::{ResultExt, post_inc}; pub struct InlayHintCache { hints: HashMap>>, @@ -1292,11 +1292,11 @@ fn apply_hint_update( pub mod tests { use crate::editor_tests::update_test_language_settings; use crate::scroll::ScrollAmount; - use crate::{scroll::Autoscroll, test::editor_lsp_test_context::rust_lang, ExcerptRange}; + use crate::{ExcerptRange, scroll::Autoscroll, test::editor_lsp_test_context::rust_lang}; use futures::StreamExt; use gpui::{AppContext as _, Context, SemanticVersion, TestAppContext, WindowHandle}; use itertools::Itertools as _; - use language::{language_settings::AllLanguageSettingsContent, Capability, FakeLspAdapter}; + use language::{Capability, FakeLspAdapter, language_settings::AllLanguageSettingsContent}; use language::{Language, LanguageConfig, LanguageMatcher}; use lsp::FakeLanguageServer; use parking_lot::Mutex; diff --git a/crates/editor/src/inline_completion_tests.rs b/crates/editor/src/inline_completion_tests.rs index 10736adda6a8d9d90c52bcae5629d12c951d2fe9..05d15302d1f537a55c5ca018f402f8567cef5202 100644 --- a/crates/editor/src/inline_completion_tests.rs +++ b/crates/editor/src/inline_completion_tests.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Entity}; +use gpui::{Entity, prelude::*}; use indoc::indoc; use inline_completion::EditPredictionProvider; use multi_buffer::{Anchor, MultiBufferSnapshot, ToPoint}; @@ -7,7 +7,7 @@ use std::ops::Range; use text::{Point, ToOffset}; use crate::{ - editor_tests::init_test, test::editor_test_context::EditorTestContext, InlineCompletion, + InlineCompletion, editor_tests::init_test, test::editor_test_context::EditorTestContext, }; #[gpui::test] diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index b89b0df975e048cd32b9e029cecc09209704f72f..bc70a6db92d3ab1d80162b8acf7e08a144eed733 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -1,30 +1,30 @@ use crate::{ - editor_settings::SeedQuerySetting, - persistence::{SerializedEditor, DB}, - scroll::ScrollAnchor, Anchor, Autoscroll, Editor, EditorEvent, EditorSettings, ExcerptId, ExcerptRange, FormatTarget, MultiBuffer, MultiBufferSnapshot, NavigationData, SearchWithinRange, ToPoint as _, + editor_settings::SeedQuerySetting, + persistence::{DB, SerializedEditor}, + scroll::ScrollAnchor, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use clock::Global; use collections::{HashMap, HashSet}; use file_icons::FileIcons; use futures::future::try_join_all; use git::status::GitSummary; use gpui::{ - point, AnyElement, App, AsyncWindowContext, Context, Entity, EntityId, EventEmitter, - IntoElement, ParentElement, Pixels, SharedString, Styled, Task, WeakEntity, Window, + AnyElement, App, AsyncWindowContext, Context, Entity, EntityId, EventEmitter, IntoElement, + ParentElement, Pixels, SharedString, Styled, Task, WeakEntity, Window, point, }; use language::{ - proto::serialize_anchor as serialize_text_anchor, Bias, Buffer, CharKind, DiskState, Point, - SelectionGoal, + Bias, Buffer, CharKind, DiskState, Point, SelectionGoal, + proto::serialize_anchor as serialize_text_anchor, }; use lsp::DiagnosticSeverity; use project::{ - lsp_store::FormatTrigger, project_settings::ProjectSettings, search::SearchQuery, Project, - ProjectEntryId, ProjectItem as _, ProjectPath, + Project, ProjectEntryId, ProjectItem as _, ProjectPath, lsp_store::FormatTrigger, + project_settings::ProjectSettings, search::SearchQuery, }; -use rpc::proto::{self, update_view, PeerId}; +use rpc::proto::{self, PeerId, update_view}; use settings::Settings; use std::{ any::TypeId, @@ -38,21 +38,21 @@ use std::{ }; use text::{BufferId, Selection}; use theme::{Theme, ThemeSettings}; -use ui::{prelude::*, IconDecorationKind}; -use util::{paths::PathExt, ResultExt, TryFutureExt}; +use ui::{IconDecorationKind, prelude::*}; +use util::{ResultExt, TryFutureExt, paths::PathExt}; use workspace::{ - item::{BreadcrumbText, FollowEvent, ProjectItemKind}, - searchable::SearchOptions, - OpenVisible, Pane, WorkspaceSettings, + ItemId, ItemNavHistory, ToolbarItemLocation, ViewId, Workspace, WorkspaceId, + item::{FollowableItem, Item, ItemEvent, ProjectItem}, + searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle}, }; use workspace::{ - item::{Dedup, ItemSettings, SerializableItem, TabContentParams}, OpenOptions, + item::{Dedup, ItemSettings, SerializableItem, TabContentParams}, }; use workspace::{ - item::{FollowableItem, Item, ItemEvent, ProjectItem}, - searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle}, - ItemId, ItemNavHistory, ToolbarItemLocation, ViewId, Workspace, WorkspaceId, + OpenVisible, Pane, WorkspaceSettings, + item::{BreadcrumbText, FollowEvent, ProjectItemKind}, + searchable::SearchOptions, }; pub const MAX_TAB_TITLE_LEN: usize = 24; diff --git a/crates/editor/src/jsx_tag_auto_close.rs b/crates/editor/src/jsx_tag_auto_close.rs index 9e932b5b8991b52e373b4b2c90093a15408f2a8d..3278d5dc7e4b33d90103aac343e9dfd0692dbe01 100644 --- a/crates/editor/src/jsx_tag_auto_close.rs +++ b/crates/editor/src/jsx_tag_auto_close.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use gpui::{Context, Entity, Window}; use multi_buffer::{MultiBuffer, ToOffset}; diff --git a/crates/editor/src/mouse_context_menu.rs b/crates/editor/src/mouse_context_menu.rs index 3148e030844b9a427a9c97d0215bdf49c8315500..3c282d8253c4f220bfbbb130e52dd88175beccb5 100644 --- a/crates/editor/src/mouse_context_menu.rs +++ b/crates/editor/src/mouse_context_menu.rs @@ -1,10 +1,10 @@ -use crate::actions::FormatSelections; use crate::CopyAndTrim; +use crate::actions::FormatSelections; use crate::{ - actions::Format, selections_collection::SelectionsCollection, Copy, CopyPermalinkToLine, Cut, - DisplayPoint, DisplaySnapshot, Editor, EditorMode, FindAllReferences, GoToDeclaration, - GoToDefinition, GoToImplementation, GoToTypeDefinition, Paste, Rename, RevealInFileManager, - SelectMode, ToDisplayPoint, ToggleCodeActions, + Copy, CopyPermalinkToLine, Cut, DisplayPoint, DisplaySnapshot, Editor, EditorMode, + FindAllReferences, GoToDeclaration, GoToDefinition, GoToImplementation, GoToTypeDefinition, + Paste, Rename, RevealInFileManager, SelectMode, ToDisplayPoint, ToggleCodeActions, + actions::Format, selections_collection::SelectionsCollection, }; use gpui::prelude::FluentBuilder; use gpui::{Context, DismissEvent, Entity, Focusable as _, Pixels, Point, Subscription, Window}; diff --git a/crates/editor/src/movement.rs b/crates/editor/src/movement.rs index d5feb27718cae950b4ba5263cefeb208da05d6bf..bcb42350f743437974c6e651ed5ef27ee07bc9f0 100644 --- a/crates/editor/src/movement.rs +++ b/crates/editor/src/movement.rs @@ -2,7 +2,7 @@ //! in editor given a given motion (e.g. it handles converting a "move left" command into coordinates in editor). It is exposed mostly for use by vim crate. use super::{Bias, DisplayPoint, DisplaySnapshot, SelectionGoal, ToDisplayPoint}; -use crate::{scroll::ScrollAnchor, CharKind, DisplayRow, EditorStyle, ToOffset, ToPoint}; +use crate::{CharKind, DisplayRow, EditorStyle, ToOffset, ToPoint, scroll::ScrollAnchor}; use gpui::{Pixels, WindowTextSystem}; use language::Point; use multi_buffer::{MultiBufferRow, MultiBufferSnapshot}; @@ -766,11 +766,11 @@ pub fn split_display_range_by_lines( mod tests { use super::*; use crate::{ + Buffer, DisplayMap, DisplayRow, ExcerptRange, FoldPlaceholder, InlayId, MultiBuffer, display_map::Inlay, test::{editor_test_context::EditorTestContext, marked_display_snapshot}, - Buffer, DisplayMap, DisplayRow, ExcerptRange, FoldPlaceholder, InlayId, MultiBuffer, }; - use gpui::{font, px, AppContext as _}; + use gpui::{AppContext as _, font, px}; use language::Capability; use project::Project; use settings::SettingsStore; diff --git a/crates/editor/src/proposed_changes_editor.rs b/crates/editor/src/proposed_changes_editor.rs index bb6ac55bdf6ea8404ea4e502da0b75cf795592b8..1ce61805acce6a976ac88d53db5d1f9423db4f31 100644 --- a/crates/editor/src/proposed_changes_editor.rs +++ b/crates/editor/src/proposed_changes_editor.rs @@ -9,10 +9,10 @@ use project::Project; use smol::stream::StreamExt; use std::{any::TypeId, ops::Range, rc::Rc, time::Duration}; use text::ToOffset; -use ui::{prelude::*, ButtonLike, KeyBinding}; +use ui::{ButtonLike, KeyBinding, prelude::*}; use workspace::{ - searchable::SearchableItemHandle, Item, ItemHandle as _, ToolbarItemEvent, ToolbarItemLocation, - ToolbarItemView, Workspace, + Item, ItemHandle as _, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + searchable::SearchableItemHandle, }; pub struct ProposedChangesEditor { diff --git a/crates/editor/src/rust_analyzer_ext.rs b/crates/editor/src/rust_analyzer_ext.rs index 86483051cfe9de715d908ee553993e779c555c2d..412a59b8407d47448341510c0b4b2cb83ee30a51 100644 --- a/crates/editor/src/rust_analyzer_ext.rs +++ b/crates/editor/src/rust_analyzer_ext.rs @@ -2,7 +2,7 @@ use std::{fs, path::Path}; use anyhow::Context as _; use gpui::{App, AppContext as _, Context, Entity, Window}; -use language::{proto::serialize_anchor, Capability, Language}; +use language::{Capability, Language, proto::serialize_anchor}; use multi_buffer::MultiBuffer; use project::lsp_store::{ lsp_ext_command::{DocsUrls, ExpandMacro, ExpandedMacro}, @@ -12,8 +12,8 @@ use rpc::proto; use text::ToPointUtf16; use crate::{ - element::register_action, lsp_ext::find_specific_language_server_in_selection, Editor, - ExpandMacroRecursively, OpenDocs, + Editor, ExpandMacroRecursively, OpenDocs, element::register_action, + lsp_ext::find_specific_language_server_in_selection, }; fn is_rust_language(language: &Language) -> bool { diff --git a/crates/editor/src/scroll.rs b/crates/editor/src/scroll.rs index 81c1e1a665c9927533e89fca14a9a410703c9727..a7c209bdffcb3f75bfd1b7773e81ca1f27f36fd3 100644 --- a/crates/editor/src/scroll.rs +++ b/crates/editor/src/scroll.rs @@ -4,15 +4,15 @@ pub(crate) mod scroll_amount; use crate::editor_settings::ScrollBeyondLastLine; use crate::{ + Anchor, DisplayPoint, DisplayRow, Editor, EditorEvent, EditorMode, EditorSettings, + InlayHintRefreshReason, MultiBufferSnapshot, RowExt, ToPoint, display_map::{DisplaySnapshot, ToDisplayPoint}, hover_popover::hide_hover, persistence::DB, - Anchor, DisplayPoint, DisplayRow, Editor, EditorEvent, EditorMode, EditorSettings, - InlayHintRefreshReason, MultiBufferSnapshot, RowExt, ToPoint, }; pub use autoscroll::{Autoscroll, AutoscrollStrategy}; use core::fmt::Debug; -use gpui::{point, px, App, Axis, Context, Global, Pixels, Task, Window}; +use gpui::{App, Axis, Context, Global, Pixels, Task, Window, point, px}; use language::{Bias, Point}; pub use scroll_amount::ScrollAmount; use settings::Settings; diff --git a/crates/editor/src/scroll/actions.rs b/crates/editor/src/scroll/actions.rs index 652670dd50030bb7bdf8347d9cdcdc0de46b4716..72827b2fee48c424a632018b5f66015cd058ed79 100644 --- a/crates/editor/src/scroll/actions.rs +++ b/crates/editor/src/scroll/actions.rs @@ -1,8 +1,8 @@ use super::Axis; use crate::{ - display_map::DisplayRow, Autoscroll, Editor, EditorMode, NextScreen, - NextScrollCursorCenterTopBottom, ScrollCursorBottom, ScrollCursorCenter, - ScrollCursorCenterTopBottom, ScrollCursorTop, SCROLL_CENTER_TOP_BOTTOM_DEBOUNCE_TIMEOUT, + Autoscroll, Editor, EditorMode, NextScreen, NextScrollCursorCenterTopBottom, + SCROLL_CENTER_TOP_BOTTOM_DEBOUNCE_TIMEOUT, ScrollCursorBottom, ScrollCursorCenter, + ScrollCursorCenterTopBottom, ScrollCursorTop, display_map::DisplayRow, }; use gpui::{Context, Point, Window}; diff --git a/crates/editor/src/scroll/autoscroll.rs b/crates/editor/src/scroll/autoscroll.rs index eae2706a38331b50c6a0617e36f8e37037079c73..7c022e62a4e18427fd88b98766a1617a96b6ceff 100644 --- a/crates/editor/src/scroll/autoscroll.rs +++ b/crates/editor/src/scroll/autoscroll.rs @@ -1,7 +1,7 @@ use crate::{ - display_map::ToDisplayPoint, DisplayRow, Editor, EditorMode, LineWithInvisibles, RowExt, + DisplayRow, Editor, EditorMode, LineWithInvisibles, RowExt, display_map::ToDisplayPoint, }; -use gpui::{px, Bounds, Context, Pixels, Window}; +use gpui::{Bounds, Context, Pixels, Window, px}; use language::Point; use multi_buffer::Anchor; use std::{cmp, f32}; diff --git a/crates/editor/src/scroll/scroll_amount.rs b/crates/editor/src/scroll/scroll_amount.rs index ee80b3d86f7aa97821c98e9832776ddc95774306..0c0319b8212d43d3f5ab2f0bc9681cef3eba2137 100644 --- a/crates/editor/src/scroll/scroll_amount.rs +++ b/crates/editor/src/scroll/scroll_amount.rs @@ -1,5 +1,5 @@ use serde::Deserialize; -use ui::{px, Pixels}; +use ui::{Pixels, px}; #[derive(Debug)] pub enum ScrollDirection { diff --git a/crates/editor/src/selections_collection.rs b/crates/editor/src/selections_collection.rs index 9a2d800b3a86ec030ccba50e7cafae8456d88e94..32dcd4412af38b68a3db506146dcaa0ce451d512 100644 --- a/crates/editor/src/selections_collection.rs +++ b/crates/editor/src/selections_collection.rs @@ -12,10 +12,10 @@ use language::{Bias, Point, Selection, SelectionGoal, TextDimension}; use util::post_inc; use crate::{ - display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, - movement::TextLayoutDetails, Anchor, DisplayPoint, DisplayRow, ExcerptId, MultiBuffer, MultiBufferSnapshot, SelectMode, ToOffset, ToPoint, + display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, + movement::TextLayoutDetails, }; #[derive(Debug, Clone)] diff --git a/crates/editor/src/signature_help.rs b/crates/editor/src/signature_help.rs index 51e85582e3444eed2d5cea92969824d2ee234042..949f90b0b9761611895e71862aaff657f07458ff 100644 --- a/crates/editor/src/signature_help.rs +++ b/crates/editor/src/signature_help.rs @@ -1,8 +1,8 @@ use crate::actions::ShowSignatureHelp; use crate::{Editor, EditorSettings, ToggleAutoSignatureHelp}; use gpui::{ - combine_highlights, App, Context, HighlightStyle, MouseButton, Size, StyledText, Task, - TextStyle, Window, + App, Context, HighlightStyle, MouseButton, Size, StyledText, Task, TextStyle, Window, + combine_highlights, }; use language::BufferSnapshot; use multi_buffer::{Anchor, ToOffset}; @@ -11,8 +11,8 @@ use std::ops::Range; use text::Rope; use theme::ThemeSettings; use ui::{ - div, relative, ActiveTheme, AnyElement, InteractiveElement, IntoElement, ParentElement, Pixels, - SharedString, StatefulInteractiveElement, Styled, StyledExt, + ActiveTheme, AnyElement, InteractiveElement, IntoElement, ParentElement, Pixels, SharedString, + StatefulInteractiveElement, Styled, StyledExt, div, relative, }; // Language-specific settings may define quotes as "brackets", so filter them out separately. diff --git a/crates/editor/src/test.rs b/crates/editor/src/test.rs index f853aba877146a87e215f46478d11a6869d33dd4..fb38d6e1049e7b59a02ac16add2ab24ded322211 100644 --- a/crates/editor/src/test.rs +++ b/crates/editor/src/test.rs @@ -4,12 +4,12 @@ pub mod editor_test_context; use std::sync::LazyLock; use crate::{ - display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, DisplayPoint, Editor, EditorMode, FoldPlaceholder, MultiBuffer, + display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, }; use gpui::{ - font, AppContext as _, Context, Entity, Font, FontFeatures, FontStyle, FontWeight, Pixels, - Window, + AppContext as _, Context, Entity, Font, FontFeatures, FontStyle, FontWeight, Pixels, Window, + font, }; use project::Project; use util::test::{marked_text_offsets, marked_text_ranges}; diff --git a/crates/editor/src/test/editor_lsp_test_context.rs b/crates/editor/src/test/editor_lsp_test_context.rs index 7031139ca6b5fe56f1159d64074e05abf014bc6f..1f625b45103c5a4473c592ccb0a81d22a181ab63 100644 --- a/crates/editor/src/test/editor_lsp_test_context.rs +++ b/crates/editor/src/test/editor_lsp_test_context.rs @@ -14,7 +14,7 @@ use futures::Future; use gpui::{Context, Entity, Focusable as _, VisualTestContext, Window}; use indoc::indoc; use language::{ - point_to_lsp, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageQueries, + FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, LanguageQueries, point_to_lsp, }; use lsp::{notification, request}; use multi_buffer::ToPointUtf16; diff --git a/crates/editor/src/test/editor_test_context.rs b/crates/editor/src/test/editor_test_context.rs index 565bac336fbf9443551f09116a242d2cbaa3ddc7..2a2712bf305da78685d3877cb06e05027906fac4 100644 --- a/crates/editor/src/test/editor_test_context.rs +++ b/crates/editor/src/test/editor_test_context.rs @@ -1,14 +1,14 @@ use crate::{ - display_map::ToDisplayPoint, AnchorRangeExt, Autoscroll, DisplayPoint, Editor, MultiBuffer, - RowExt, + AnchorRangeExt, Autoscroll, DisplayPoint, Editor, MultiBuffer, RowExt, + display_map::ToDisplayPoint, }; use buffer_diff::DiffHunkStatusKind; use collections::BTreeMap; use futures::Future; use gpui::{ - prelude::*, AnyWindowHandle, App, Context, Entity, Focusable as _, Keystroke, Pixels, Point, - VisualTestContext, Window, WindowHandle, + AnyWindowHandle, App, Context, Entity, Focusable as _, Keystroke, Pixels, Point, + VisualTestContext, Window, WindowHandle, prelude::*, }; use itertools::Itertools; use language::{Buffer, BufferSnapshot, LanguageRegistry}; @@ -20,8 +20,8 @@ use std::{ ops::{Deref, DerefMut, Range}, path::Path, sync::{ - atomic::{AtomicUsize, Ordering}, Arc, + atomic::{AtomicUsize, Ordering}, }, }; use util::{ diff --git a/crates/evals/src/eval.rs b/crates/evals/src/eval.rs index 2c8f05c86d9342d41e09b41facec8cad8f766ec2..05b4eae33f97f49cefb36a6e62573863a1b790dd 100644 --- a/crates/evals/src/eval.rs +++ b/crates/evals/src/eval.rs @@ -18,19 +18,19 @@ use semantic_index::{ }; use serde::{Deserialize, Serialize}; use settings::SettingsStore; +use smol::Timer; use smol::channel::bounded; use smol::io::AsyncReadExt; -use smol::Timer; use std::ops::RangeInclusive; use std::path::PathBuf; use std::time::Duration; use std::{ fs, path::Path, - process::{exit, Stdio}, + process::{Stdio, exit}, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{AtomicUsize, Ordering::SeqCst}, }, }; diff --git a/crates/extension/src/extension.rs b/crates/extension/src/extension.rs index 95c20491944dfb0ca67baac2d9f293a49c8479e2..1955c9f3d0f4824df13fad0d1169afed3eb0a09f 100644 --- a/crates/extension/src/extension.rs +++ b/crates/extension/src/extension.rs @@ -8,7 +8,7 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; use ::lsp::LanguageServerName; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_trait::async_trait; use fs::normalize_path; use gpui::{App, Task}; diff --git a/crates/extension/src/extension_builder.rs b/crates/extension/src/extension_builder.rs index 48e224d8b5f1a1d8494843cbb2db5f33fb074595..f2c8a6a65aab0d29634a8377ca9da3a61e6d8185 100644 --- a/crates/extension/src/extension_builder.rs +++ b/crates/extension/src/extension_builder.rs @@ -1,12 +1,12 @@ use crate::{ - parse_wasm_extension_version, ExtensionLibraryKind, ExtensionManifest, GrammarManifestEntry, + ExtensionLibraryKind, ExtensionManifest, GrammarManifestEntry, parse_wasm_extension_version, }; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use convert_case::{Case, Casing as _}; -use futures::io::BufReader; use futures::AsyncReadExt; +use futures::io::BufReader; use http_client::{self, AsyncBody, HttpClient}; use serde::Deserialize; use std::{ diff --git a/crates/extension/src/extension_manifest.rs b/crates/extension/src/extension_manifest.rs index e93767246e916707670b437f3f673242b6be84b3..799b30861f6fac7d9106ec3e65da51dbe84da3a1 100644 --- a/crates/extension/src/extension_manifest.rs +++ b/crates/extension/src/extension_manifest.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use collections::{BTreeMap, HashMap}; use fs::Fs; use language::LanguageName; @@ -347,9 +347,11 @@ mod tests { assert!(manifest.allow_exec("cargo", &["test"]).is_ok()); assert!(manifest.allow_exec("cargo", &["test", "--all"]).is_ok()); - assert!(manifest - .allow_exec("cargo", &["test", "--all", "--no-fail-fast"]) - .is_ok()); + assert!( + manifest + .allow_exec("cargo", &["test", "--all", "--no-fail-fast"]) + .is_ok() + ); assert!(manifest.allow_exec("cargo", &["build"]).is_err()); // wrong first arg } @@ -365,12 +367,16 @@ mod tests { assert!(manifest.allow_exec("docker", &["run", "nginx"]).is_ok()); assert!(manifest.allow_exec("docker", &["run"]).is_err()); - assert!(manifest - .allow_exec("docker", &["run", "ubuntu", "bash"]) - .is_ok()); - assert!(manifest - .allow_exec("docker", &["run", "alpine", "sh", "-c", "echo hello"]) - .is_ok()); + assert!( + manifest + .allow_exec("docker", &["run", "ubuntu", "bash"]) + .is_ok() + ); + assert!( + manifest + .allow_exec("docker", &["run", "alpine", "sh", "-c", "echo hello"]) + .is_ok() + ); assert!(manifest.allow_exec("docker", &["ps"]).is_err()); // wrong first arg } } diff --git a/crates/extension_api/src/extension_api.rs b/crates/extension_api/src/extension_api.rs index 80eb1f447cd6c932f268386508e371d3117e66bd..e7a012439fc8051beef38fe2d2c379b8ad174c20 100644 --- a/crates/extension_api/src/extension_api.rs +++ b/crates/extension_api/src/extension_api.rs @@ -15,21 +15,21 @@ pub use serde_json; // We explicitly enumerate the symbols we want to re-export, as there are some // that we may want to shadow to provide a cleaner Rust API. pub use wit::{ - download_file, make_file_executable, + CodeLabel, CodeLabelSpan, CodeLabelSpanLiteral, Command, DownloadedFileType, EnvVars, + KeyValueStore, LanguageServerInstallationStatus, Project, Range, Worktree, download_file, + make_file_executable, zed::extension::github::{ - github_release_by_tag_name, latest_github_release, GithubRelease, GithubReleaseAsset, - GithubReleaseOptions, + GithubRelease, GithubReleaseAsset, GithubReleaseOptions, github_release_by_tag_name, + latest_github_release, }, zed::extension::nodejs::{ node_binary_path, npm_install_package, npm_package_installed_version, npm_package_latest_version, }, - zed::extension::platform::{current_platform, Architecture, Os}, + zed::extension::platform::{Architecture, Os, current_platform}, zed::extension::slash_command::{ SlashCommand, SlashCommandArgumentCompletion, SlashCommandOutput, SlashCommandOutputSection, }, - CodeLabel, CodeLabelSpan, CodeLabelSpanLiteral, Command, DownloadedFileType, EnvVars, - KeyValueStore, LanguageServerInstallationStatus, Project, Range, Worktree, }; // Undocumented WIT re-exports. @@ -210,7 +210,7 @@ fn extension() -> &'static mut dyn Extension { static mut EXTENSION: Option> = None; #[cfg(target_arch = "wasm32")] -#[link_section = "zed:api-version"] +#[unsafe(link_section = "zed:api-version")] #[doc(hidden)] pub static ZED_API_VERSION: [u8; 6] = *include_bytes!(concat!(env!("OUT_DIR"), "/version_bytes")); diff --git a/crates/extension_api/src/http_client.rs b/crates/extension_api/src/http_client.rs index 9953ba42b3f4da9b63f2e00614a55d8b0d7188df..9e30da8db4856635460c7636f0698fef34266797 100644 --- a/crates/extension_api/src/http_client.rs +++ b/crates/extension_api/src/http_client.rs @@ -1,7 +1,7 @@ //! An HTTP client. pub use crate::wit::zed::extension::http_client::{ - fetch, fetch_stream, HttpMethod, HttpRequest, HttpResponse, HttpResponseStream, RedirectPolicy, + HttpMethod, HttpRequest, HttpResponse, HttpResponseStream, RedirectPolicy, fetch, fetch_stream, }; impl HttpRequest { diff --git a/crates/extension_api/src/settings.rs b/crates/extension_api/src/settings.rs index aea4db1a726f4f8b52a9c1a2ff7f15b71942eed7..a133a8027a4361c1f92e3fdecc73664497b4e6d6 100644 --- a/crates/extension_api/src/settings.rs +++ b/crates/extension_api/src/settings.rs @@ -3,7 +3,7 @@ #[path = "../wit/since_v0.2.0/settings.rs"] mod types; -use crate::{wit, Project, Result, SettingsLocation, Worktree}; +use crate::{Project, Result, SettingsLocation, Worktree, wit}; use serde_json; pub use types::*; diff --git a/crates/extension_cli/src/main.rs b/crates/extension_cli/src/main.rs index c753138007fd330fe165412626cfed41b795e852..5c2ba8569b1d75780e0fc8af8c62fcf607349a22 100644 --- a/crates/extension_cli/src/main.rs +++ b/crates/extension_cli/src/main.rs @@ -5,11 +5,11 @@ use std::path::{Path, PathBuf}; use std::process::Command; use std::sync::Arc; -use ::fs::{copy_recursive, CopyOptions, Fs, RealFs}; -use anyhow::{anyhow, bail, Context, Result}; +use ::fs::{CopyOptions, Fs, RealFs, copy_recursive}; +use anyhow::{Context, Result, anyhow, bail}; use clap::Parser; -use extension::extension_builder::{CompileExtensionOptions, ExtensionBuilder}; use extension::ExtensionManifest; +use extension::extension_builder::{CompileExtensionOptions, ExtensionBuilder}; use language::LanguageConfig; use reqwest_client::ReqwestClient; use rpc::ExtensionProvides; diff --git a/crates/extension_host/src/extension_host.rs b/crates/extension_host/src/extension_host.rs index 3334944858d94cf55071c11fffe1172fef5b1fb2..3be714fc955ab1bfc15f7db05578a8a2121d2503 100644 --- a/crates/extension_host/src/extension_host.rs +++ b/crates/extension_host/src/extension_host.rs @@ -5,14 +5,14 @@ pub mod wasm_host; #[cfg(test)] mod extension_store_test; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use client::ExtensionProvides; -use client::{proto, telemetry::Telemetry, Client, ExtensionMetadata, GetExtensionsResponse}; -use collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet}; -use extension::extension_builder::{CompileExtensionOptions, ExtensionBuilder}; +use client::{Client, ExtensionMetadata, GetExtensionsResponse, proto, telemetry::Telemetry}; +use collections::{BTreeMap, BTreeSet, HashMap, HashSet, btree_map}; pub use extension::ExtensionManifest; +use extension::extension_builder::{CompileExtensionOptions, ExtensionBuilder}; use extension::{ ExtensionContextServerProxy, ExtensionEvents, ExtensionGrammarProxy, ExtensionHostProxy, ExtensionIndexedDocsProviderProxy, ExtensionLanguageProxy, ExtensionLanguageServerProxy, @@ -20,21 +20,22 @@ use extension::{ }; use fs::{Fs, RemoveOptions}; use futures::{ + AsyncReadExt as _, Future, FutureExt as _, StreamExt as _, channel::{ - mpsc::{unbounded, UnboundedSender}, + mpsc::{UnboundedSender, unbounded}, oneshot, }, io::BufReader, - select_biased, AsyncReadExt as _, Future, FutureExt as _, StreamExt as _, + select_biased, }; use gpui::{ - actions, App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task, - WeakEntity, + App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task, WeakEntity, + actions, }; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use language::{ - LanguageConfig, LanguageMatcher, LanguageName, LanguageQueries, LoadedLanguage, Rope, - QUERY_FILENAME_PREFIXES, + LanguageConfig, LanguageMatcher, LanguageName, LanguageQueries, LoadedLanguage, + QUERY_FILENAME_PREFIXES, Rope, }; use node_runtime::NodeRuntime; use project::ContextProviderWithTasks; @@ -54,8 +55,8 @@ use std::{ use url::Url; use util::ResultExt; use wasm_host::{ - wit::{is_supported_wasm_api_version, wasm_api_version_range}, WasmExtension, WasmHost, + wit::{is_supported_wasm_api_version, wasm_api_version_range}, }; pub use extension::{ diff --git a/crates/extension_host/src/extension_store_test.rs b/crates/extension_host/src/extension_store_test.rs index def82110f2a0d7aaaf3fc59b40bb927c1bfa036e..2acc01cb03a27c8640fa32f0d82753ba44670603 100644 --- a/crates/extension_host/src/extension_store_test.rs +++ b/crates/extension_host/src/extension_store_test.rs @@ -1,20 +1,20 @@ use crate::{ Event, ExtensionIndex, ExtensionIndexEntry, ExtensionIndexLanguageEntry, ExtensionIndexThemeEntry, ExtensionManifest, ExtensionSettings, ExtensionStore, - GrammarManifestEntry, SchemaVersion, RELOAD_DEBOUNCE_DURATION, + GrammarManifestEntry, RELOAD_DEBOUNCE_DURATION, SchemaVersion, }; use async_compression::futures::bufread::GzipEncoder; use collections::BTreeMap; use extension::ExtensionHostProxy; use fs::{FakeFs, Fs, RealFs}; -use futures::{io::BufReader, AsyncReadExt, StreamExt}; +use futures::{AsyncReadExt, StreamExt, io::BufReader}; use gpui::{AppContext as _, SemanticVersion, SharedString, TestAppContext}; use http_client::{FakeHttpClient, Response}; use language::{BinaryStatus, LanguageMatcher, LanguageRegistry}; use lsp::LanguageServerName; use node_runtime::NodeRuntime; use parking_lot::Mutex; -use project::{Project, DEFAULT_COMPLETION_CONTEXT}; +use project::{DEFAULT_COMPLETION_CONTEXT, Project}; use release_channel::AppVersion; use reqwest_client::ReqwestClient; use serde_json::json; diff --git a/crates/extension_host/src/headless_host.rs b/crates/extension_host/src/headless_host.rs index 3aaf610b85e11f9065d4fbb9c3d4331835275b0e..076f03e204a0489e27c24c6b3d4d150fb3a2a9ca 100644 --- a/crates/extension_host/src/headless_host.rs +++ b/crates/extension_host/src/headless_host.rs @@ -1,7 +1,7 @@ use std::{path::PathBuf, sync::Arc}; -use anyhow::{anyhow, Context as _, Result}; -use client::{proto, TypedEnvelope}; +use anyhow::{Context as _, Result, anyhow}; +use client::{TypedEnvelope, proto}; use collections::{HashMap, HashSet}; use extension::{ Extension, ExtensionHostProxy, ExtensionLanguageProxy, ExtensionLanguageServerProxy, diff --git a/crates/extension_host/src/wasm_host.rs b/crates/extension_host/src/wasm_host.rs index a01662f63f72e322eaa2c25f6543bb3ec959f936..1308b8e421a5c74eae76dfd6c787d08c82a4ba42 100644 --- a/crates/extension_host/src/wasm_host.rs +++ b/crates/extension_host/src/wasm_host.rs @@ -1,21 +1,21 @@ pub mod wit; use crate::ExtensionManifest; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use async_trait::async_trait; use extension::{ CodeLabel, Command, Completion, ExtensionHostProxy, KeyValueStoreDelegate, ProjectDelegate, SlashCommand, SlashCommandArgumentCompletion, SlashCommandOutput, Symbol, WorktreeDelegate, }; -use fs::{normalize_path, Fs}; +use fs::{Fs, normalize_path}; use futures::future::LocalBoxFuture; use futures::{ + Future, FutureExt, StreamExt as _, channel::{ mpsc::{self, UnboundedSender}, oneshot, }, future::BoxFuture, - Future, FutureExt, StreamExt as _, }; use gpui::{App, AsyncApp, BackgroundExecutor, Task}; use http_client::HttpClient; @@ -29,8 +29,8 @@ use std::{ sync::{Arc, OnceLock}, }; use wasmtime::{ - component::{Component, ResourceTable}, Engine, Store, + component::{Component, ResourceTable}, }; use wasmtime_wasi::{self as wasi, WasiView}; use wit::Extension; diff --git a/crates/extension_host/src/wasm_host/wit.rs b/crates/extension_host/src/wasm_host/wit.rs index 93fb911ac08b153fc355923a908bb2bdb5c407f9..612d99cd8b89ee88bd263db54c76044c1f3e6028 100644 --- a/crates/extension_host/src/wasm_host/wit.rs +++ b/crates/extension_host/src/wasm_host/wit.rs @@ -11,23 +11,23 @@ use lsp::LanguageServerName; use release_channel::ReleaseChannel; use since_v0_4_0 as latest; -use super::{wasm_engine, WasmState}; -use anyhow::{anyhow, Context as _, Result}; +use super::{WasmState, wasm_engine}; +use anyhow::{Context as _, Result, anyhow}; use semantic_version::SemanticVersion; use std::{ops::RangeInclusive, sync::Arc}; use wasmtime::{ - component::{Component, Linker, Resource}, Store, + component::{Component, Linker, Resource}, }; #[cfg(test)] pub use latest::CodeLabelSpanLiteral; pub use latest::{ + CodeLabel, CodeLabelSpan, Command, ExtensionProject, Range, SlashCommand, zed::extension::lsp::{ Completion, CompletionKind, CompletionLabelDetails, InsertTextFormat, Symbol, SymbolKind, }, zed::extension::slash_command::{SlashCommandArgumentCompletion, SlashCommandOutput}, - CodeLabel, CodeLabelSpan, Command, ExtensionProject, Range, SlashCommand, }; pub use since_v0_0_4::LanguageServerConfig; diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs b/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs index 5210726a566ab04cce3742c96f4c9d1c0a45b4c3..b5532005f5411b8abf39bcae9f0f0ea51ede4a20 100644 --- a/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs +++ b/crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs @@ -1,6 +1,6 @@ use super::latest; -use crate::wasm_host::wit::since_v0_0_4; use crate::wasm_host::WasmState; +use crate::wasm_host::wit::since_v0_0_4; use anyhow::Result; use extension::{ExtensionLanguageServerProxy, WorktreeDelegate}; use language::BinaryStatus; diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs b/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs index 95c6ed0037bed89e4adc212b6cc88df2b5841b1a..8962122261eb9d7aa8d4b7571f9c616e72328732 100644 --- a/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs +++ b/crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs @@ -1,14 +1,14 @@ -use crate::wasm_host::{wit::ToWasmtimeResult, WasmState}; +use crate::wasm_host::{WasmState, wit::ToWasmtimeResult}; use ::http_client::{AsyncBody, HttpRequestExt}; use ::settings::{Settings, WorktreeId}; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use extension::{ExtensionLanguageServerProxy, KeyValueStoreDelegate, WorktreeDelegate}; -use futures::{io::BufReader, FutureExt as _}; -use futures::{lock::Mutex, AsyncReadExt}; +use futures::{AsyncReadExt, lock::Mutex}; +use futures::{FutureExt as _, io::BufReader}; use language::LanguageName; -use language::{language_settings::AllLanguageSettings, BinaryStatus}; +use language::{BinaryStatus, language_settings::AllLanguageSettings}; use project::project_settings::ProjectSettings; use semantic_version::SemanticVersion; use std::{ diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs b/crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs index 4e246dea1647674279729f80b1fec641a66cad38..13181aace3c68800a0342cfab681d0181e78c3e2 100644 --- a/crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs +++ b/crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs @@ -1,9 +1,9 @@ use crate::wasm_host::wit::since_v0_4_0::slash_command::SlashCommandOutputSection; use crate::wasm_host::wit::{CompletionKind, CompletionLabelDetails, InsertTextFormat, SymbolKind}; -use crate::wasm_host::{wit::ToWasmtimeResult, WasmState}; +use crate::wasm_host::{WasmState, wit::ToWasmtimeResult}; use ::http_client::{AsyncBody, HttpRequestExt}; use ::settings::{Settings, WorktreeId}; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; @@ -11,9 +11,9 @@ use context_server_settings::ContextServerSettings; use extension::{ ExtensionLanguageServerProxy, KeyValueStoreDelegate, ProjectDelegate, WorktreeDelegate, }; -use futures::{io::BufReader, FutureExt as _}; -use futures::{lock::Mutex, AsyncReadExt}; -use language::{language_settings::AllLanguageSettings, BinaryStatus, LanguageName}; +use futures::{AsyncReadExt, lock::Mutex}; +use futures::{FutureExt as _, io::BufReader}; +use language::{BinaryStatus, LanguageName, language_settings::AllLanguageSettings}; use project::project_settings::ProjectSettings; use semantic_version::SemanticVersion; use std::{ diff --git a/crates/extensions_ui/src/components/extension_card.rs b/crates/extensions_ui/src/components/extension_card.rs index 4e6ab6a623f4240e95b658aa975a4979b494875a..75223df96fb8a16b8aedd59c9b3a931397ce7c50 100644 --- a/crates/extensions_ui/src/components/extension_card.rs +++ b/crates/extensions_ui/src/components/extension_card.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, AnyElement}; +use gpui::{AnyElement, prelude::*}; use smallvec::SmallVec; use ui::prelude::*; diff --git a/crates/extensions_ui/src/components/feature_upsell.rs b/crates/extensions_ui/src/components/feature_upsell.rs index be650ff6e06fae1c5cd61df50e8a436a658297c3..d2d86937ff624f077fbc25f95cce893d9bc69531 100644 --- a/crates/extensions_ui/src/components/feature_upsell.rs +++ b/crates/extensions_ui/src/components/feature_upsell.rs @@ -1,6 +1,6 @@ use gpui::{AnyElement, Div, StyleRefinement}; use smallvec::SmallVec; -use ui::{prelude::*, ButtonLike}; +use ui::{ButtonLike, prelude::*}; #[derive(IntoElement)] pub struct FeatureUpsell { diff --git a/crates/extensions_ui/src/extension_suggest.rs b/crates/extensions_ui/src/extension_suggest.rs index 32e61de6eff396f7c1dc63a3823ebc87c7e7b455..85296ab8001004b2c96be12012b8b8cf59831d80 100644 --- a/crates/extensions_ui/src/extension_suggest.rs +++ b/crates/extensions_ui/src/extension_suggest.rs @@ -9,7 +9,7 @@ use gpui::{AppContext as _, Context, Entity, SharedString, Window}; use language::Buffer; use ui::prelude::*; use workspace::notifications::simple_message_notification::MessageNotification; -use workspace::{notifications::NotificationId, Workspace}; +use workspace::{Workspace, notifications::NotificationId}; const SUGGESTIONS_BY_EXTENSION_ID: &[(&str, &[&str])] = &[ ("astro", &["astro"]), diff --git a/crates/extensions_ui/src/extension_version_selector.rs b/crates/extensions_ui/src/extension_version_selector.rs index 8e9b85c86073bcf04548e3a8ffa7fdb8a9d03711..3cb3f0e4243c7a0f1c732df6194bfe27e060f08a 100644 --- a/crates/extensions_ui/src/extension_version_selector.rs +++ b/crates/extensions_ui/src/extension_version_selector.rs @@ -4,13 +4,13 @@ use std::sync::Arc; use client::ExtensionMetadata; use extension_host::{ExtensionSettings, ExtensionStore}; use fs::Fs; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; -use gpui::{prelude::*, App, DismissEvent, Entity, EventEmitter, Focusable, Task, WeakEntity}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; +use gpui::{App, DismissEvent, Entity, EventEmitter, Focusable, Task, WeakEntity, prelude::*}; use picker::{Picker, PickerDelegate}; use release_channel::ReleaseChannel; use semantic_version::SemanticVersion; use settings::update_settings_file; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::ModalView; diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs index ffe55529951827a3b1952e0aaaca7574246e80a3..92570f72c9ad5a5a73ffe97036666a5b144ea7d6 100644 --- a/crates/extensions_ui/src/extensions_ui.rs +++ b/crates/extensions_ui/src/extensions_ui.rs @@ -10,11 +10,11 @@ use client::{ExtensionMetadata, ExtensionProvides}; use collections::{BTreeMap, BTreeSet}; use editor::{Editor, EditorElement, EditorStyle}; use extension_host::{ExtensionManifest, ExtensionOperation, ExtensionStore}; -use fuzzy::{match_strings, StringMatchCandidate}; +use fuzzy::{StringMatchCandidate, match_strings}; use gpui::{ - actions, point, uniform_list, Action, App, ClipboardItem, Context, Entity, EventEmitter, - Flatten, Focusable, InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, - TextStyle, UniformListScrollHandle, WeakEntity, Window, + Action, App, ClipboardItem, Context, Entity, EventEmitter, Flatten, Focusable, + InteractiveElement, KeyContext, ParentElement, Render, Styled, Task, TextStyle, + UniformListScrollHandle, WeakEntity, Window, actions, point, uniform_list, }; use num_format::{Locale, ToFormattedString}; use project::DirectoryLister; @@ -23,13 +23,13 @@ use settings::Settings; use strum::IntoEnumIterator as _; use theme::ThemeSettings; use ui::{ - prelude::*, CheckboxWithLabel, ContextMenu, PopoverMenu, ScrollableHandle, Scrollbar, - ScrollbarState, ToggleButton, Tooltip, + CheckboxWithLabel, ContextMenu, PopoverMenu, ScrollableHandle, Scrollbar, ScrollbarState, + ToggleButton, Tooltip, prelude::*, }; use vim_mode_setting::VimModeSetting; use workspace::{ - item::{Item, ItemEvent}, Workspace, WorkspaceId, + item::{Item, ItemEvent}, }; use zed_actions::ExtensionCategoryFilter; diff --git a/crates/feature_flags/src/feature_flags.rs b/crates/feature_flags/src/feature_flags.rs index 8981f0809581ea3de3814d50ad452a360c9b8413..effb3cda31004425a402e4d741e0d4d64b0c18cd 100644 --- a/crates/feature_flags/src/feature_flags.rs +++ b/crates/feature_flags/src/feature_flags.rs @@ -1,5 +1,5 @@ use futures::channel::oneshot; -use futures::{select_biased, FutureExt}; +use futures::{FutureExt, select_biased}; use gpui::{App, Context, Global, Subscription, Task, Window}; use std::cell::RefCell; use std::rc::Rc; diff --git a/crates/feedback/src/feedback.rs b/crates/feedback/src/feedback.rs index 69f98f86115ea301d3225b985bd0d176a3fbcfd5..23811c2bfae63d69b686e4dd028e23b269443572 100644 --- a/crates/feedback/src/feedback.rs +++ b/crates/feedback/src/feedback.rs @@ -1,4 +1,4 @@ -use gpui::{actions, App, ClipboardItem, PromptLevel}; +use gpui::{App, ClipboardItem, PromptLevel, actions}; use system_specs::SystemSpecs; use util::ResultExt; use workspace::Workspace; diff --git a/crates/feedback/src/feedback_modal.rs b/crates/feedback/src/feedback_modal.rs index 45d656c174b6b12194bbdb16486d8db26e5c95db..beb879efe718e9709fc5d0e9aad8d2b96ff27066 100644 --- a/crates/feedback/src/feedback_modal.rs +++ b/crates/feedback/src/feedback_modal.rs @@ -1,5 +1,5 @@ use gpui::{App, Context, DismissEvent, EventEmitter, FocusHandle, Focusable, Render, Window}; -use ui::{prelude::*, IconPosition}; +use ui::{IconPosition, prelude::*}; use workspace::{ModalView, Workspace}; use zed_actions::feedback::GiveFeedback; diff --git a/crates/file_finder/src/file_finder.rs b/crates/file_finder/src/file_finder.rs index a796de6f3b260f06fcff60e4a7a2fb88c0d50e73..b2a27047bb5057ec8a08bfe3c9d3009f09b42b98 100644 --- a/crates/file_finder/src/file_finder.rs +++ b/crates/file_finder/src/file_finder.rs @@ -16,9 +16,9 @@ use file_finder_settings::{FileFinderSettings, FileFinderWidth}; use file_icons::FileIcons; use fuzzy::{CharBag, PathMatch, PathMatchCandidate}; use gpui::{ - actions, Action, AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, - Focusable, KeyContext, Modifiers, ModifiersChangedEvent, ParentElement, Render, Styled, Task, - WeakEntity, Window, + Action, AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, + KeyContext, Modifiers, ModifiersChangedEvent, ParentElement, Render, Styled, Task, WeakEntity, + Window, actions, }; use new_path_prompt::NewPathPrompt; use open_path_prompt::OpenPathPrompt; @@ -31,19 +31,19 @@ use std::{ ops::Range, path::{Component, Path, PathBuf}, sync::{ - atomic::{self, AtomicBool}, Arc, + atomic::{self, AtomicBool}, }, }; use text::Point; use ui::{ - prelude::*, ContextMenu, HighlightedLabel, ListItem, ListItemSpacing, PopoverMenu, - PopoverMenuHandle, + ContextMenu, HighlightedLabel, ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, + prelude::*, }; -use util::{maybe, paths::PathWithPosition, post_inc, ResultExt}; +use util::{ResultExt, maybe, paths::PathWithPosition, post_inc}; use workspace::{ - item::PreviewTabsSettings, notifications::NotifyResultExt, pane, ModalView, OpenOptions, - OpenVisible, SplitDirection, Workspace, + ModalView, OpenOptions, OpenVisible, SplitDirection, Workspace, item::PreviewTabsSettings, + notifications::NotifyResultExt, pane, }; actions!(file_finder, [SelectPrevious, ToggleMenu]); diff --git a/crates/file_finder/src/file_finder_tests.rs b/crates/file_finder/src/file_finder_tests.rs index 65058c6b24e706d38211d457220981609641fd01..d37e3d9cb70dde7e3a521ee781c63b17406261df 100644 --- a/crates/file_finder/src/file_finder_tests.rs +++ b/crates/file_finder/src/file_finder_tests.rs @@ -4,7 +4,7 @@ use super::*; use editor::Editor; use gpui::{Entity, TestAppContext, VisualTestContext}; use menu::{Confirm, SelectNext, SelectPrevious}; -use project::{RemoveOptions, FS_WATCH_LATENCY}; +use project::{FS_WATCH_LATENCY, RemoveOptions}; use serde_json::json; use util::path; use workspace::{AppState, OpenOptions, ToggleFileFinder, Workspace}; diff --git a/crates/file_finder/src/new_path_prompt.rs b/crates/file_finder/src/new_path_prompt.rs index cf6789a3e6e6444db500ba76b52dd5b1f6658a5a..87075ebb0c422e8fca67ca78eaf759fb50fb8e15 100644 --- a/crates/file_finder/src/new_path_prompt.rs +++ b/crates/file_finder/src/new_path_prompt.rs @@ -6,12 +6,12 @@ use project::{Entry, PathMatchCandidateSet, Project, ProjectPath, WorktreeId}; use std::{ path::{Path, PathBuf}, sync::{ - atomic::{self, AtomicBool}, Arc, + atomic::{self, AtomicBool}, }, }; -use ui::{highlight_ranges, prelude::*, LabelLike, ListItemSpacing}; use ui::{Context, ListItem, Window}; +use ui::{LabelLike, ListItemSpacing, highlight_ranges, prelude::*}; use util::ResultExt; use workspace::Workspace; diff --git a/crates/file_finder/src/open_path_prompt.rs b/crates/file_finder/src/open_path_prompt.rs index aeb774176d7a300b04ebdd6b326f21866d3aa10e..2d18d60d2df930e0254f92b2aa0e7162b618cc31 100644 --- a/crates/file_finder/src/open_path_prompt.rs +++ b/crates/file_finder/src/open_path_prompt.rs @@ -3,14 +3,14 @@ use fuzzy::{StringMatch, StringMatchCandidate}; use picker::{Picker, PickerDelegate}; use project::DirectoryLister; use std::{ - path::{Path, PathBuf, MAIN_SEPARATOR_STR}, + path::{MAIN_SEPARATOR_STR, Path, PathBuf}, sync::{ - atomic::{self, AtomicBool}, Arc, + atomic::{self, AtomicBool}, }, }; -use ui::{prelude::*, HighlightedLabel, ListItemSpacing}; use ui::{Context, ListItem, Window}; +use ui::{HighlightedLabel, ListItemSpacing, prelude::*}; use util::{maybe, paths::compare_paths}; use workspace::Workspace; diff --git a/crates/fs/src/fake_git_repo.rs b/crates/fs/src/fake_git_repo.rs index 6d1a19faf2db691db5e426010e024ab08a3efa42..eaed99f7e00be8827e6943ffc6f46242335a6ff3 100644 --- a/crates/fs/src/fake_git_repo.rs +++ b/crates/fs/src/fake_git_repo.rs @@ -1,5 +1,5 @@ use crate::FakeFs; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{HashMap, HashSet}; use futures::future::{self, BoxFuture}; use git::{ diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs index d30228a4eab0d037a5e300d85b571646c58fc1ef..5c75c3cacbe198330fddbf34b441483e645d6cdb 100644 --- a/crates/fs/src/fs.rs +++ b/crates/fs/src/fs.rs @@ -4,7 +4,7 @@ mod mac_watcher; #[cfg(not(target_os = "macos"))] pub mod fs_watcher; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; #[cfg(any(target_os = "linux", target_os = "freebsd"))] use ashpd::desktop::trash; use gpui::App; @@ -21,7 +21,7 @@ use std::os::fd::{AsFd, AsRawFd}; use std::os::unix::fs::{FileTypeExt, MetadataExt}; use async_tar::Archive; -use futures::{future::BoxFuture, AsyncRead, Stream, StreamExt}; +use futures::{AsyncRead, Stream, StreamExt, future::BoxFuture}; use git::repository::{GitRepository, RealGitRepository}; use rope::Rope; use serde::{Deserialize, Serialize}; @@ -39,7 +39,7 @@ use text::LineEnding; #[cfg(any(test, feature = "test-support"))] mod fake_git_repo; #[cfg(any(test, feature = "test-support"))] -use collections::{btree_map, BTreeMap}; +use collections::{BTreeMap, btree_map}; #[cfg(any(test, feature = "test-support"))] use fake_git_repo::FakeGitRepositoryState; #[cfg(any(test, feature = "test-support"))] @@ -466,8 +466,8 @@ impl Fs for RealFs { async fn trash_file(&self, path: &Path, _options: RemoveOptions) -> Result<()> { use util::paths::SanitizedPath; use windows::{ - core::HSTRING, Storage::{StorageDeleteOption, StorageFile}, + core::HSTRING, }; // todo(windows) // When new version of `windows-rs` release, make this operation `async` @@ -492,8 +492,8 @@ impl Fs for RealFs { async fn trash_dir(&self, path: &Path, _options: RemoveOptions) -> Result<()> { use util::paths::SanitizedPath; use windows::{ - core::HSTRING, Storage::{StorageDeleteOption, StorageFolder}, + core::HSTRING, }; // todo(windows) @@ -710,7 +710,7 @@ impl Fs for RealFs { Arc, ) { use parking_lot::Mutex; - use util::{paths::SanitizedPath, ResultExt as _}; + use util::{ResultExt as _, paths::SanitizedPath}; let (tx, rx) = smol::channel::unbounded(); let pending_paths: Arc>> = Default::default(); @@ -2300,7 +2300,7 @@ async fn file_id(path: impl AsRef) -> Result { use windows::Win32::{ Foundation::HANDLE, Storage::FileSystem::{ - GetFileInformationByHandle, BY_HANDLE_FILE_INFORMATION, FILE_FLAG_BACKUP_SEMANTICS, + BY_HANDLE_FILE_INFORMATION, FILE_FLAG_BACKUP_SEMANTICS, GetFileInformationByHandle, }, }; diff --git a/crates/fs/src/fs_watcher.rs b/crates/fs/src/fs_watcher.rs index b0e6a94b819b1879472e8bb5aedfa7bf5842f351..4b03c87157147a60988139a2fdd857adc83431f9 100644 --- a/crates/fs/src/fs_watcher.rs +++ b/crates/fs/src/fs_watcher.rs @@ -1,7 +1,7 @@ use notify::EventKind; use parking_lot::Mutex; use std::sync::{Arc, OnceLock}; -use util::{paths::SanitizedPath, ResultExt}; +use util::{ResultExt, paths::SanitizedPath}; use crate::{PathEvent, PathEventKind, Watcher}; diff --git a/crates/fsevent/src/fsevent.rs b/crates/fsevent/src/fsevent.rs index 99cafb42c2bd4bc676dc204293a981699ca84951..81ca0a4114253fc38b5d120d1c37dfc9233f7fd1 100644 --- a/crates/fsevent/src/fsevent.rs +++ b/crates/fsevent/src/fsevent.rs @@ -5,7 +5,7 @@ use fsevent_sys::{self as fs, core_foundation as cf}; use parking_lot::Mutex; use std::{ convert::AsRef, - ffi::{c_void, CStr, OsStr}, + ffi::{CStr, OsStr, c_void}, os::unix::ffi::OsStrExt, path::{Path, PathBuf}, ptr, slice, diff --git a/crates/fuzzy/src/fuzzy.rs b/crates/fuzzy/src/fuzzy.rs index b9595df61f2e46432c53705fee9360683039bac5..2d8c318c9feee9f8ce89a2ac037389f0929e9b02 100644 --- a/crates/fuzzy/src/fuzzy.rs +++ b/crates/fuzzy/src/fuzzy.rs @@ -5,6 +5,6 @@ mod strings; pub use char_bag::CharBag; pub use paths::{ - match_fixed_path_set, match_path_sets, PathMatch, PathMatchCandidate, PathMatchCandidateSet, + PathMatch, PathMatchCandidate, PathMatchCandidateSet, match_fixed_path_set, match_path_sets, }; -pub use strings::{match_strings, StringMatch, StringMatchCandidate}; +pub use strings::{StringMatch, StringMatchCandidate, match_strings}; diff --git a/crates/fuzzy/src/paths.rs b/crates/fuzzy/src/paths.rs index cb3d131b380ac9a7a9299984c3be66df8b596a61..79628240eb74addfaab27892e73d05e15be09e1d 100644 --- a/crates/fuzzy/src/paths.rs +++ b/crates/fuzzy/src/paths.rs @@ -4,14 +4,14 @@ use std::{ cmp::{self, Ordering}, path::Path, sync::{ - atomic::{self, AtomicBool}, Arc, + atomic::{self, AtomicBool}, }, }; use crate::{ - matcher::{MatchCandidate, Matcher}, CharBag, + matcher::{MatchCandidate, Matcher}, }; #[derive(Clone, Debug)] diff --git a/crates/fuzzy/src/strings.rs b/crates/fuzzy/src/strings.rs index bb5db63fd2faa481737aed0132accf35b9cb0ee9..2180a9b7b66044cb4d9c62f80274f71c73661f63 100644 --- a/crates/fuzzy/src/strings.rs +++ b/crates/fuzzy/src/strings.rs @@ -1,6 +1,6 @@ use crate::{ - matcher::{MatchCandidate, Matcher}, CharBag, + matcher::{MatchCandidate, Matcher}, }; use gpui::BackgroundExecutor; use std::{ diff --git a/crates/git/src/blame.rs b/crates/git/src/blame.rs index 8bdf92aa72100a39bbeb88c6d45b2e4572f66991..e207576c88ff579e7324999610b3d2143632564f 100644 --- a/crates/git/src/blame.rs +++ b/crates/git/src/blame.rs @@ -1,15 +1,15 @@ -use crate::commit::get_messages; use crate::Oid; -use anyhow::{anyhow, Context as _, Result}; +use crate::commit::get_messages; +use anyhow::{Context as _, Result, anyhow}; use collections::{HashMap, HashSet}; use futures::AsyncWriteExt; use serde::{Deserialize, Serialize}; use std::process::Stdio; use std::{ops::Range, path::Path}; use text::Rope; -use time::macros::format_description; use time::OffsetDateTime; use time::UtcOffset; +use time::macros::format_description; pub use git2 as libgit; @@ -301,8 +301,8 @@ fn parse_git_blame(output: &str) -> Result> { mod tests { use std::path::PathBuf; - use super::parse_git_blame; use super::BlameEntry; + use super::parse_git_blame; fn read_test_data(filename: &str) -> String { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); diff --git a/crates/git/src/commit.rs b/crates/git/src/commit.rs index 0c2feb9af24d06c00d4498095a5df9a01fed7f13..74ed6854f68dfb01dc9421afc19a826d764435f4 100644 --- a/crates/git/src/commit.rs +++ b/crates/git/src/commit.rs @@ -1,5 +1,5 @@ use crate::Oid; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use std::path::Path; diff --git a/crates/git/src/git.rs b/crates/git/src/git.rs index aeb075c1fe263fdfd98d0f2890a70c29ab641d2a..615d807c3806f27a3473acb2b6b58f1c898365c0 100644 --- a/crates/git/src/git.rs +++ b/crates/git/src/git.rs @@ -7,7 +7,7 @@ pub mod status; pub use crate::hosting_provider::*; pub use crate::remote::*; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; pub use git2 as libgit; use gpui::action_with_deprecated_aliases; use gpui::actions; diff --git a/crates/git/src/repository.rs b/crates/git/src/repository.rs index 5e508b023b5c76c61db4c53e3d01bd034c06a925..0af0e4933643675a3c5f99c99c0da2d1a6404ef0 100644 --- a/crates/git/src/repository.rs +++ b/crates/git/src/repository.rs @@ -1,9 +1,9 @@ use crate::status::GitStatus; use crate::{Oid, SHORT_SHA_LENGTH}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use futures::future::BoxFuture; -use futures::{select_biased, AsyncWriteExt, FutureExt as _}; +use futures::{AsyncWriteExt, FutureExt as _, select_biased}; use git2::BranchType; use gpui::{AsyncApp, BackgroundExecutor, SharedString}; use parking_lot::Mutex; @@ -23,8 +23,8 @@ use std::{ }; use sum_tree::MapSeekTarget; use thiserror::Error; -use util::command::{new_smol_command, new_std_command}; use util::ResultExt; +use util::command::{new_smol_command, new_std_command}; use uuid::Uuid; pub use askpass::{AskPassDelegate, AskPassResult, AskPassSession}; @@ -1843,16 +1843,19 @@ mod tests { .unwrap(); let checkpoint2 = repo.checkpoint().await.unwrap(); - assert!(!repo - .compare_checkpoints(checkpoint1, checkpoint2.clone()) - .await - .unwrap()); + assert!( + !repo + .compare_checkpoints(checkpoint1, checkpoint2.clone()) + .await + .unwrap() + ); let checkpoint3 = repo.checkpoint().await.unwrap(); - assert!(repo - .compare_checkpoints(checkpoint2, checkpoint3) - .await - .unwrap()); + assert!( + repo.compare_checkpoints(checkpoint2, checkpoint3) + .await + .unwrap() + ); } #[test] diff --git a/crates/git/src/status.rs b/crates/git/src/status.rs index 528bcec01fcb685e29a53ff7371c46ee87901474..872a1a373b527470604428f2c756262f6fd008c4 100644 --- a/crates/git/src/status.rs +++ b/crates/git/src/status.rs @@ -1,5 +1,5 @@ use crate::repository::RepoPath; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use serde::{Deserialize, Serialize}; use std::{path::Path, str::FromStr, sync::Arc}; use util::ResultExt; diff --git a/crates/git_hosting_providers/src/git_hosting_providers.rs b/crates/git_hosting_providers/src/git_hosting_providers.rs index 441136aa1f11ecbaefa38a5007158b30f26176ef..11ac890eab3e03cee598c745df827009883bfc45 100644 --- a/crates/git_hosting_providers/src/git_hosting_providers.rs +++ b/crates/git_hosting_providers/src/git_hosting_providers.rs @@ -3,9 +3,9 @@ mod settings; use std::sync::Arc; -use anyhow::{anyhow, Result}; -use git::repository::GitRepository; +use anyhow::{Result, anyhow}; use git::GitHostingProviderRegistry; +use git::repository::GitRepository; use gpui::App; use url::Url; use util::maybe; diff --git a/crates/git_hosting_providers/src/providers/chromium.rs b/crates/git_hosting_providers/src/providers/chromium.rs index b651144b666b008e7102af2e4900219ea7538c94..735c836730dc5d1ad1f33c587f64e502bc1cb9a2 100644 --- a/crates/git_hosting_providers/src/providers/chromium.rs +++ b/crates/git_hosting_providers/src/providers/chromium.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use std::sync::{Arc, LazyLock}; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use async_trait::async_trait; use futures::AsyncReadExt; use git::{ diff --git a/crates/git_hosting_providers/src/providers/codeberg.rs b/crates/git_hosting_providers/src/providers/codeberg.rs index 0e01331278a6f265df9b1041fe0bc6dc40f341ab..2953280781a8f4e4b7fd244fda600a6ed8c89359 100644 --- a/crates/git_hosting_providers/src/providers/codeberg.rs +++ b/crates/git_hosting_providers/src/providers/codeberg.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use std::sync::Arc; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use async_trait::async_trait; use futures::AsyncReadExt; use gpui::SharedString; diff --git a/crates/git_hosting_providers/src/providers/github.rs b/crates/git_hosting_providers/src/providers/github.rs index 160cbc8f6c4ac8f7df73b7e6a1282eed6174f624..a5ffac762ac45662bb80e4d17bfb690723ae0339 100644 --- a/crates/git_hosting_providers/src/providers/github.rs +++ b/crates/git_hosting_providers/src/providers/github.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use std::sync::{Arc, LazyLock}; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use async_trait::async_trait; use futures::AsyncReadExt; use gpui::SharedString; diff --git a/crates/git_hosting_providers/src/providers/gitlab.rs b/crates/git_hosting_providers/src/providers/gitlab.rs index e4b296b92a6c10ff3f4468744148a1786405cf61..969a2ff1d5951400a38946531c1da4527462169a 100644 --- a/crates/git_hosting_providers/src/providers/gitlab.rs +++ b/crates/git_hosting_providers/src/providers/gitlab.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use url::Url; use git::{ diff --git a/crates/git_ui/src/askpass_modal.rs b/crates/git_ui/src/askpass_modal.rs index 6a3700018dfc1bd8bdce5319e56bcd88aeca1ced..149833ad3535bb69ba35e199ece5166e194745a9 100644 --- a/crates/git_ui/src/askpass_modal.rs +++ b/crates/git_ui/src/askpass_modal.rs @@ -2,9 +2,9 @@ use editor::Editor; use futures::channel::oneshot; use gpui::{AppContext, DismissEvent, Entity, EventEmitter, Focusable, Styled}; use ui::{ - div, h_flex, v_flex, ActiveTheme, App, Context, DynamicSpacing, Headline, HeadlineSize, Icon, - IconName, IconSize, InteractiveElement, IntoElement, ParentElement, Render, SharedString, - StyledExt, StyledTypography, Window, + ActiveTheme, App, Context, DynamicSpacing, Headline, HeadlineSize, Icon, IconName, IconSize, + InteractiveElement, IntoElement, ParentElement, Render, SharedString, StyledExt, + StyledTypography, Window, div, h_flex, v_flex, }; use workspace::ModalView; diff --git a/crates/git_ui/src/branch_picker.rs b/crates/git_ui/src/branch_picker.rs index 9ba55f9ed9d6c6dd92d1fe67d67f43023bbfa1dc..4e380d74c69e59a58d088d5231a8266f8cfb0556 100644 --- a/crates/git_ui/src/branch_picker.rs +++ b/crates/git_ui/src/branch_picker.rs @@ -1,18 +1,18 @@ -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use fuzzy::StringMatchCandidate; use git::repository::Branch; use gpui::{ - rems, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - InteractiveElement, IntoElement, Modifiers, ModifiersChangedEvent, ParentElement, Render, - SharedString, Styled, Subscription, Task, Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + IntoElement, Modifiers, ModifiersChangedEvent, ParentElement, Render, SharedString, Styled, + Subscription, Task, Window, rems, }; use picker::{Picker, PickerDelegate, PickerEditorPosition}; use project::git_store::Repository; use std::sync::Arc; use time::OffsetDateTime; use time_format::format_local_timestamp; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::notifications::DetachAndPromptErr; use workspace::{ModalView, Workspace}; diff --git a/crates/git_ui/src/commit_modal.rs b/crates/git_ui/src/commit_modal.rs index 9a5b7dfc294685059d36165b8e4777351664895d..77be9606129884413627f1dc31407ddbab81c4cf 100644 --- a/crates/git_ui/src/commit_modal.rs +++ b/crates/git_ui/src/commit_modal.rs @@ -1,15 +1,15 @@ use crate::branch_picker::{self, BranchList}; -use crate::git_panel::{commit_message_editor, GitPanel}; +use crate::git_panel::{GitPanel, commit_message_editor}; use git::{Commit, GenerateCommitMessage}; use panel::{panel_button, panel_editor_style, panel_filled_button}; -use ui::{prelude::*, KeybindingHint, PopoverMenu, PopoverMenuHandle, Tooltip}; +use ui::{KeybindingHint, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; use editor::{Editor, EditorElement}; use gpui::*; use util::ResultExt; use workspace::{ - dock::{Dock, PanelHandle}, ModalView, Workspace, + dock::{Dock, PanelHandle}, }; // nate: It is a pain to get editors to size correctly and not overflow. diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index bf01d22cfae98463b3ebc699eb45d1c35d5b1ff4..f087897bcb36bc0c08ebd1a89dd1e86eb5c7d257 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -4,11 +4,11 @@ use crate::git_panel_settings::StatusStyle; use crate::project_diff::Diff; use crate::remote_output::{self, RemoteAction, SuccessMessage}; +use crate::{ProjectDiff, picker_prompt, project_diff}; use crate::{branch_picker, render_remote_button}; use crate::{ git_panel_settings::GitPanelSettings, git_status_icon, repository_selector::RepositorySelector, }; -use crate::{picker_prompt, project_diff, ProjectDiff}; use anyhow::Result; use askpass::AskPassDelegate; use assistant_settings::AssistantSettings; @@ -16,8 +16,8 @@ use db::kvp::KEY_VALUE_STORE; use editor::commit_tooltip::CommitTooltip; use editor::{ - scroll::ScrollbarAutoHide, Editor, EditorElement, EditorMode, EditorSettings, MultiBuffer, - ShowScrollbar, + Editor, EditorElement, EditorMode, EditorSettings, MultiBuffer, ShowScrollbar, + scroll::ScrollbarAutoHide, }; use futures::StreamExt as _; use git::repository::{ @@ -25,14 +25,14 @@ use git::repository::{ ResetMode, Upstream, UpstreamTracking, UpstreamTrackingStatus, }; use git::status::StageStatus; -use git::{repository::RepoPath, status::FileStatus, Commit, ToggleStaged}; +use git::{Commit, ToggleStaged, repository::RepoPath, status::FileStatus}; use git::{ExpandCommitEditor, RestoreTrackedFiles, StageAll, TrashUntrackedFiles, UnstageAll}; use gpui::{ - actions, anchored, deferred, percentage, uniform_list, Action, Animation, AnimationExt as _, - Axis, ClickEvent, Corner, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, Modifiers, ModifiersChangedEvent, - MouseButton, MouseDownEvent, Point, PromptLevel, ScrollStrategy, Subscription, Task, - Transformation, UniformListScrollHandle, WeakEntity, + Action, Animation, AnimationExt as _, Axis, ClickEvent, Corner, DismissEvent, Entity, + EventEmitter, FocusHandle, Focusable, KeyContext, ListHorizontalSizingBehavior, + ListSizingBehavior, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, Point, + PromptLevel, ScrollStrategy, Subscription, Task, Transformation, UniformListScrollHandle, + WeakEntity, actions, anchored, deferred, percentage, uniform_list, }; use itertools::Itertools; use language::{Buffer, File}; @@ -42,12 +42,12 @@ use language_model::{ use menu::{Confirm, SecondaryConfirm, SelectFirst, SelectLast, SelectNext, SelectPrevious}; use multi_buffer::ExcerptInfo; use panel::{ - panel_button, panel_editor_container, panel_editor_style, panel_filled_button, - panel_icon_button, PanelHeader, + PanelHeader, panel_button, panel_editor_container, panel_editor_style, panel_filled_button, + panel_icon_button, }; use project::{ - git_store::{GitEvent, Repository}, Fs, Project, ProjectPath, + git_store::{GitEvent, Repository}, }; use serde::{Deserialize, Serialize}; use settings::{Settings as _, SettingsStore}; @@ -59,17 +59,17 @@ use std::{collections::HashSet, sync::Arc, time::Duration, usize}; use strum::{IntoEnumIterator, VariantNames}; use time::OffsetDateTime; use ui::{ - prelude::*, Checkbox, ContextMenu, ElevationIndex, PopoverMenu, Scrollbar, ScrollbarState, - Tooltip, + Checkbox, ContextMenu, ElevationIndex, PopoverMenu, Scrollbar, ScrollbarState, Tooltip, + prelude::*, }; -use util::{maybe, post_inc, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, maybe, post_inc}; use workspace::AppState; use notifications::status_toast::{StatusToast, ToastIcon}; use workspace::{ + Workspace, dock::{DockPosition, Panel, PanelEvent}, notifications::DetachAndPromptErr, - Workspace, }; actions!( @@ -4244,182 +4244,186 @@ impl ComponentPreview for PanelRepoFooter { .gap_6() .w_full() .flex_none() - .children(vec![example_group_with_title( - "Action Button States", - vec![ - single_example( - "No Branch", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(1).clone(), - None, - )) - .into_any_element(), - ) - .grow(), - single_example( - "Remote status unknown", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(2).clone(), - Some(branch(unknown_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "No Remote Upstream", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(3).clone(), - Some(branch(no_remote_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Not Ahead or Behind", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(4).clone(), - Some(branch(not_ahead_or_behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Behind remote", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(5).clone(), - Some(branch(behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Ahead of remote", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(6).clone(), - Some(branch(ahead_of_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Ahead and behind remote", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - active_repository(7).clone(), - Some(branch(ahead_and_behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - ], - ) - .grow() - .vertical()]) - .children(vec![example_group_with_title( - "Labels", - vec![ - single_example( - "Short Branch & Repo", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed"), - Some(custom("main", behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Long Branch", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed"), - Some(custom( - "redesign-and-update-git-ui-list-entry-style", - behind_upstream, - )), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Long Repo", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed-industries-community-examples"), - Some(custom("gpui", ahead_of_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Long Repo & Branch", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed-industries-community-examples"), - Some(custom( - "redesign-and-update-git-ui-list-entry-style", - behind_upstream, - )), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Uppercase Repo", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("LICENSES"), - Some(custom("main", ahead_of_upstream)), - )) - .into_any_element(), - ) - .grow(), - single_example( - "Uppercase Branch", - div() - .w(example_width) - .overflow_hidden() - .child(PanelRepoFooter::new_preview( - SharedString::from("zed"), - Some(custom("update-README", behind_upstream)), - )) - .into_any_element(), - ) - .grow(), - ], - ) - .grow() - .vertical()]) + .children(vec![ + example_group_with_title( + "Action Button States", + vec![ + single_example( + "No Branch", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(1).clone(), + None, + )) + .into_any_element(), + ) + .grow(), + single_example( + "Remote status unknown", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(2).clone(), + Some(branch(unknown_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "No Remote Upstream", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(3).clone(), + Some(branch(no_remote_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Not Ahead or Behind", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(4).clone(), + Some(branch(not_ahead_or_behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Behind remote", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(5).clone(), + Some(branch(behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Ahead of remote", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(6).clone(), + Some(branch(ahead_of_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Ahead and behind remote", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + active_repository(7).clone(), + Some(branch(ahead_and_behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + ], + ) + .grow() + .vertical(), + ]) + .children(vec![ + example_group_with_title( + "Labels", + vec![ + single_example( + "Short Branch & Repo", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed"), + Some(custom("main", behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Long Branch", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed"), + Some(custom( + "redesign-and-update-git-ui-list-entry-style", + behind_upstream, + )), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Long Repo", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed-industries-community-examples"), + Some(custom("gpui", ahead_of_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Long Repo & Branch", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed-industries-community-examples"), + Some(custom( + "redesign-and-update-git-ui-list-entry-style", + behind_upstream, + )), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Uppercase Repo", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("LICENSES"), + Some(custom("main", ahead_of_upstream)), + )) + .into_any_element(), + ) + .grow(), + single_example( + "Uppercase Branch", + div() + .w(example_width) + .overflow_hidden() + .child(PanelRepoFooter::new_preview( + SharedString::from("zed"), + Some(custom("update-README", behind_upstream)), + )) + .into_any_element(), + ) + .grow(), + ], + ) + .grow() + .vertical(), + ]) .into_any_element() } } diff --git a/crates/git_ui/src/git_ui.rs b/crates/git_ui/src/git_ui.rs index ab10791405cec7ef985d9f21f877834f72e62b2d..63e397d335e087a5532f816ce70ccffe428951f7 100644 --- a/crates/git_ui/src/git_ui.rs +++ b/crates/git_ui/src/git_ui.rs @@ -8,7 +8,7 @@ use git::{ status::{FileStatus, StatusCode, UnmergedStatus, UnmergedStatusCode}, }; use git_panel_settings::GitPanelSettings; -use gpui::{actions, App, FocusHandle}; +use gpui::{App, FocusHandle, actions}; use onboarding::GitOnboardingModal; use project_diff::ProjectDiff; use ui::prelude::*; @@ -165,9 +165,9 @@ fn render_remote_button( mod remote_button { use gpui::{Action, AnyView, ClickEvent, Corner, FocusHandle}; use ui::{ - div, h_flex, rems, App, ButtonCommon, Clickable, ContextMenu, ElementId, FluentBuilder, - Icon, IconName, IconSize, IntoElement, Label, LabelCommon, LabelSize, LineHeightStyle, - ParentElement, PopoverMenu, SharedString, SplitButton, Styled, Tooltip, Window, + App, ButtonCommon, Clickable, ContextMenu, ElementId, FluentBuilder, Icon, IconName, + IconSize, IntoElement, Label, LabelCommon, LabelSize, LineHeightStyle, ParentElement, + PopoverMenu, SharedString, SplitButton, Styled, Tooltip, Window, div, h_flex, rems, }; pub fn render_fetch_button( diff --git a/crates/git_ui/src/onboarding.rs b/crates/git_ui/src/onboarding.rs index c51de8f5ef02e977079955236d7acd7ae35715a9..d721b21a2aca2d70f8177ca8df87b9025feebfb3 100644 --- a/crates/git_ui/src/onboarding.rs +++ b/crates/git_ui/src/onboarding.rs @@ -1,8 +1,8 @@ use gpui::{ - svg, ClickEvent, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, MouseDownEvent, - Render, + ClickEvent, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, MouseDownEvent, Render, + svg, }; -use ui::{prelude::*, TintColor}; +use ui::{TintColor, prelude::*}; use workspace::{ModalView, Workspace}; use crate::git_panel::GitPanel; diff --git a/crates/git_ui/src/picker_prompt.rs b/crates/git_ui/src/picker_prompt.rs index ea67268668095eb51fef748599646afb539b49b6..ec530bf5d3bf7e1ae9df8fb92c1a2b1f42cd3232 100644 --- a/crates/git_ui/src/picker_prompt.rs +++ b/crates/git_ui/src/picker_prompt.rs @@ -3,13 +3,13 @@ use fuzzy::{StringMatch, StringMatchCandidate}; use core::cmp; use gpui::{ - rems, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - InteractiveElement, IntoElement, ParentElement, Render, SharedString, Styled, Subscription, - Task, WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + IntoElement, ParentElement, Render, SharedString, Styled, Subscription, Task, WeakEntity, + Window, rems, }; use picker::{Picker, PickerDelegate}; use std::sync::Arc; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace}; diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index 815dfbdfb6d26b2a5465208a729f8ab3e5cd8146..010154f8ef3a9ccac0d674726708a7921b43e7a3 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -6,35 +6,35 @@ use anyhow::Result; use buffer_diff::{BufferDiff, DiffHunkSecondaryStatus}; use collections::HashSet; use editor::{ + Editor, EditorEvent, actions::{GoToHunk, GoToPreviousHunk}, scroll::Autoscroll, - Editor, EditorEvent, }; use futures::StreamExt; use git::{ + Commit, StageAll, StageAndNext, ToggleStaged, UnstageAll, UnstageAndNext, repository::{Branch, Upstream, UpstreamTracking, UpstreamTrackingStatus}, status::FileStatus, - Commit, StageAll, StageAndNext, ToggleStaged, UnstageAll, UnstageAndNext, }; use gpui::{ - actions, Action, AnyElement, AnyView, App, AppContext as _, AsyncWindowContext, Entity, - EventEmitter, FocusHandle, Focusable, Render, Subscription, Task, WeakEntity, + Action, AnyElement, AnyView, App, AppContext as _, AsyncWindowContext, Entity, EventEmitter, + FocusHandle, Focusable, Render, Subscription, Task, WeakEntity, actions, }; use language::{Anchor, Buffer, Capability, OffsetRangeExt}; use multi_buffer::{MultiBuffer, PathKey}; use project::{ - git_store::{GitEvent, GitStore}, Project, ProjectPath, + git_store::{GitEvent, GitStore}, }; use std::any::{Any, TypeId}; use theme::ActiveTheme; -use ui::{prelude::*, vertical_divider, KeyBinding, Tooltip}; +use ui::{KeyBinding, Tooltip, prelude::*, vertical_divider}; use util::ResultExt as _; use workspace::{ - item::{BreadcrumbText, Item, ItemEvent, ItemHandle, TabContentParams}, - searchable::SearchableItemHandle, CloseActiveItem, ItemNavHistory, SerializableItem, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + item::{BreadcrumbText, Item, ItemEvent, ItemHandle, TabContentParams}, + searchable::SearchableItemHandle, }; actions!(git, [Diff, Add]); @@ -1249,41 +1249,43 @@ mod preview { v_flex() .gap_6() - .children(vec![example_group(vec![ - single_example( - "No Repo", - div() - .w(width) - .h(height) - .child(no_repo_state) - .into_any_element(), - ), - single_example( - "No Changes", - div() - .w(width) - .h(height) - .child(no_changes_state) - .into_any_element(), - ), - single_example( - "Unknown Upstream", - div() - .w(width) - .h(height) - .child(unknown_upstream_state) - .into_any_element(), - ), - single_example( - "Ahead of Remote", - div() - .w(width) - .h(height) - .child(ahead_of_upstream_state) - .into_any_element(), - ), + .children(vec![ + example_group(vec![ + single_example( + "No Repo", + div() + .w(width) + .h(height) + .child(no_repo_state) + .into_any_element(), + ), + single_example( + "No Changes", + div() + .w(width) + .h(height) + .child(no_changes_state) + .into_any_element(), + ), + single_example( + "Unknown Upstream", + div() + .w(width) + .h(height) + .child(unknown_upstream_state) + .into_any_element(), + ), + single_example( + "Ahead of Remote", + div() + .w(width) + .h(height) + .child(ahead_of_upstream_state) + .into_any_element(), + ), + ]) + .vertical(), ]) - .vertical()]) .into_any_element() } } @@ -1293,7 +1295,7 @@ mod preview { #[cfg(test)] mod tests { use db::indoc; - use editor::test::editor_test_context::{assert_state_with_diff, EditorTestContext}; + use editor::test::editor_test_context::{EditorTestContext, assert_state_with_diff}; use gpui::TestAppContext; use project::FakeFs; use serde_json::json; diff --git a/crates/git_ui/src/repository_selector.rs b/crates/git_ui/src/repository_selector.rs index 1608b6dad8eed6a7103b281860b8e94cc97371ca..322e623e60ecbce91c86eab95fb740e7621eb1b0 100644 --- a/crates/git_ui/src/repository_selector.rs +++ b/crates/git_ui/src/repository_selector.rs @@ -3,9 +3,9 @@ use gpui::{ }; use itertools::Itertools; use picker::{Picker, PickerDelegate}; -use project::{git_store::Repository, Project}; +use project::{Project, git_store::Repository}; use std::sync::Arc; -use ui::{prelude::*, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*}; use workspace::{ModalView, Workspace}; pub fn register(workspace: &mut Workspace) { diff --git a/crates/go_to_line/src/cursor_position.rs b/crates/go_to_line/src/cursor_position.rs index 6910926de8b49b15fb9c9ff4c0b41e34eb6321ea..0314126a8072468bf181ae8b6e46429b15f56aca 100644 --- a/crates/go_to_line/src/cursor_position.rs +++ b/crates/go_to_line/src/cursor_position.rs @@ -6,11 +6,11 @@ use settings::{Settings, SettingsSources}; use std::{fmt::Write, num::NonZeroU32, time::Duration}; use text::{Point, Selection}; use ui::{ - div, Button, ButtonCommon, Clickable, Context, FluentBuilder, IntoElement, LabelSize, - ParentElement, Render, Tooltip, Window, + Button, ButtonCommon, Clickable, Context, FluentBuilder, IntoElement, LabelSize, ParentElement, + Render, Tooltip, Window, div, }; use util::paths::FILE_ROW_COLUMN_DELIMITER; -use workspace::{item::ItemHandle, StatusItemView, Workspace}; +use workspace::{StatusItemView, Workspace, item::ItemHandle}; #[derive(Copy, Clone, Debug, Default, PartialOrd, PartialEq)] pub(crate) struct SelectionStats { diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rs index 8a6294ab8886c4be91e5b71af8ee022c348ae377..83aaf5d86194bed825040821506809785e0576d4 100644 --- a/crates/go_to_line/src/go_to_line.rs +++ b/crates/go_to_line/src/go_to_line.rs @@ -2,11 +2,11 @@ pub mod cursor_position; use cursor_position::{LineIndicatorFormat, UserCaretPosition}; use editor::{ - actions::Tab, scroll::Autoscroll, Anchor, Editor, MultiBufferSnapshot, ToOffset, ToPoint, + Anchor, Editor, MultiBufferSnapshot, ToOffset, ToPoint, actions::Tab, scroll::Autoscroll, }; use gpui::{ - div, prelude::*, App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Render, - SharedString, Styled, Subscription, + App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Render, SharedString, Styled, + Subscription, div, prelude::*, }; use language::Buffer; use settings::Settings; diff --git a/crates/google_ai/src/google_ai.rs b/crates/google_ai/src/google_ai.rs index 05f8d4345c7fd5b5cb3715c70edee4c5a6e3cbbe..8d4f97dcc4b7017f9c2578030223d62f4142c75a 100644 --- a/crates/google_ai/src/google_ai.rs +++ b/crates/google_ai/src/google_ai.rs @@ -1,7 +1,7 @@ mod supported_countries; -use anyhow::{anyhow, bail, Result}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, Stream, StreamExt}; +use anyhow::{Result, anyhow, bail}; +use futures::{AsyncBufReadExt, AsyncReadExt, Stream, StreamExt, io::BufReader, stream::BoxStream}; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; diff --git a/crates/gpui/examples/animation.rs b/crates/gpui/examples/animation.rs index 6e7db7b7bfa09fe6321b9ee1a0144aa8c79421e8..6bfe75dd0a51fa5807efc6cd579751460aa8b187 100644 --- a/crates/gpui/examples/animation.rs +++ b/crates/gpui/examples/animation.rs @@ -2,9 +2,9 @@ use std::time::Duration; use anyhow::Result; use gpui::{ - black, bounce, div, ease_in_out, percentage, prelude::*, px, rgb, size, svg, Animation, - AnimationExt as _, App, Application, AssetSource, Bounds, Context, SharedString, - Transformation, Window, WindowBounds, WindowOptions, + Animation, AnimationExt as _, App, Application, AssetSource, Bounds, Context, SharedString, + Transformation, Window, WindowBounds, WindowOptions, black, bounce, div, ease_in_out, + percentage, prelude::*, px, rgb, size, svg, }; struct Assets {} diff --git a/crates/gpui/examples/data_table.rs b/crates/gpui/examples/data_table.rs index 1341915ce00abd358d5fb7655914209c0dedf566..3f3286680b72ab82fa506ab2e9052e477294a26f 100644 --- a/crates/gpui/examples/data_table.rs +++ b/crates/gpui/examples/data_table.rs @@ -5,9 +5,9 @@ use std::{ }; use gpui::{ - canvas, div, point, prelude::*, px, rgb, size, uniform_list, App, Application, Bounds, Context, - MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, Render, SharedString, - UniformListScrollHandle, Window, WindowBounds, WindowOptions, + App, Application, Bounds, Context, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, + Render, SharedString, UniformListScrollHandle, Window, WindowBounds, WindowOptions, canvas, + div, point, prelude::*, px, rgb, size, uniform_list, }; const TOTAL_ITEMS: usize = 10000; diff --git a/crates/gpui/examples/gif_viewer.rs b/crates/gpui/examples/gif_viewer.rs index 79e618fa558a8585c458d24024d6518a77f5126f..3206a2fb7a3faa1f01378aedcf3e1ac9d9febf96 100644 --- a/crates/gpui/examples/gif_viewer.rs +++ b/crates/gpui/examples/gif_viewer.rs @@ -1,4 +1,4 @@ -use gpui::{div, img, prelude::*, App, Application, Context, Render, Window, WindowOptions}; +use gpui::{App, Application, Context, Render, Window, WindowOptions, div, img, prelude::*}; use std::path::PathBuf; struct GifViewer { diff --git a/crates/gpui/examples/gradient.rs b/crates/gpui/examples/gradient.rs index ec4cdf9bfcdf97f8e0bc3287b94bc3e5a5e198d9..4a84d2319d1d0b3d432d35dd2b66e168d733cffd 100644 --- a/crates/gpui/examples/gradient.rs +++ b/crates/gpui/examples/gradient.rs @@ -1,6 +1,6 @@ use gpui::{ - canvas, div, linear_color_stop, linear_gradient, point, prelude::*, px, size, App, Application, - Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, + App, Application, Bounds, ColorSpace, Context, Half, Render, Window, WindowOptions, canvas, + div, linear_color_stop, linear_gradient, point, prelude::*, px, size, }; struct GradientViewer { diff --git a/crates/gpui/examples/hello_world.rs b/crates/gpui/examples/hello_world.rs index ca77eae70cf2aa4d68fb3c088fd62e6bdcb660a4..70110934741e583a6a56f338d8a010c5758f6f01 100644 --- a/crates/gpui/examples/hello_world.rs +++ b/crates/gpui/examples/hello_world.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, rgb, size, App, Application, Bounds, Context, SharedString, Window, - WindowBounds, WindowOptions, + App, Application, Bounds, Context, SharedString, Window, WindowBounds, WindowOptions, div, + prelude::*, px, rgb, size, }; struct HelloWorld { diff --git a/crates/gpui/examples/image/image.rs b/crates/gpui/examples/image/image.rs index 0aa17ccede95b5ede7b372cce21d7f6e6a578d81..bd1708e8c453656b2b7047b428f3dc63409eddec 100644 --- a/crates/gpui/examples/image/image.rs +++ b/crates/gpui/examples/image/image.rs @@ -4,9 +4,9 @@ use std::sync::Arc; use anyhow::Result; use gpui::{ - actions, div, img, prelude::*, px, rgb, size, App, AppContext, Application, AssetSource, - Bounds, Context, ImageSource, KeyBinding, Menu, MenuItem, Point, SharedString, SharedUri, - TitlebarOptions, Window, WindowBounds, WindowOptions, + App, AppContext, Application, AssetSource, Bounds, Context, ImageSource, KeyBinding, Menu, + MenuItem, Point, SharedString, SharedUri, TitlebarOptions, Window, WindowBounds, WindowOptions, + actions, div, img, prelude::*, px, rgb, size, }; use reqwest_client::ReqwestClient; diff --git a/crates/gpui/examples/image_loading.rs b/crates/gpui/examples/image_loading.rs index 0ca27c07b444abdb5d46e640c710cf60fcb3c942..8c86eaa0e4b5106b9c320d3193d26b2b65ea41e3 100644 --- a/crates/gpui/examples/image_loading.rs +++ b/crates/gpui/examples/image_loading.rs @@ -2,10 +2,10 @@ use std::{path::Path, sync::Arc, time::Duration}; use anyhow::anyhow; use gpui::{ - black, div, img, prelude::*, pulsating_between, px, red, size, Animation, AnimationExt, App, - Application, Asset, AssetLogger, AssetSource, Bounds, Context, Hsla, ImageAssetLoader, - ImageCacheError, ImgResourceLoader, Length, Pixels, RenderImage, Resource, SharedString, - Window, WindowBounds, WindowOptions, LOADING_DELAY, + Animation, AnimationExt, App, Application, Asset, AssetLogger, AssetSource, Bounds, Context, + Hsla, ImageAssetLoader, ImageCacheError, ImgResourceLoader, LOADING_DELAY, Length, Pixels, + RenderImage, Resource, SharedString, Window, WindowBounds, WindowOptions, black, div, img, + prelude::*, pulsating_between, px, red, size, }; struct Assets {} diff --git a/crates/gpui/examples/input.rs b/crates/gpui/examples/input.rs index af2ec8500351d094b81a6294081b8ae8c6ef3597..7b280d7caede7e4334eda77020ac8b1ddeed0512 100644 --- a/crates/gpui/examples/input.rs +++ b/crates/gpui/examples/input.rs @@ -1,12 +1,12 @@ use std::ops::Range; use gpui::{ - actions, black, div, fill, hsla, opaque_grey, point, prelude::*, px, relative, rgb, rgba, size, - white, yellow, App, Application, Bounds, ClipboardItem, Context, CursorStyle, ElementId, - ElementInputHandler, Entity, EntityInputHandler, FocusHandle, Focusable, GlobalElementId, - KeyBinding, Keystroke, LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, - PaintQuad, Pixels, Point, ShapedLine, SharedString, Style, TextRun, UTF16Selection, - UnderlineStyle, Window, WindowBounds, WindowOptions, + App, Application, Bounds, ClipboardItem, Context, CursorStyle, ElementId, ElementInputHandler, + Entity, EntityInputHandler, FocusHandle, Focusable, GlobalElementId, KeyBinding, Keystroke, + LayoutId, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad, Pixels, Point, + ShapedLine, SharedString, Style, TextRun, UTF16Selection, UnderlineStyle, Window, WindowBounds, + WindowOptions, actions, black, div, fill, hsla, opaque_grey, point, prelude::*, px, relative, + rgb, rgba, size, white, yellow, }; use unicode_segmentation::*; diff --git a/crates/gpui/examples/on_window_close_quit.rs b/crates/gpui/examples/on_window_close_quit.rs index 9aaaeb6b77ae6f0f3213cfb016cc84d7bf05d0e7..8fe24001445d94b1629bf766294d850d0918a5e8 100644 --- a/crates/gpui/examples/on_window_close_quit.rs +++ b/crates/gpui/examples/on_window_close_quit.rs @@ -1,6 +1,6 @@ use gpui::{ - actions, div, prelude::*, px, rgb, size, App, Application, Bounds, Context, FocusHandle, - KeyBinding, Window, WindowBounds, WindowOptions, + App, Application, Bounds, Context, FocusHandle, KeyBinding, Window, WindowBounds, + WindowOptions, actions, div, prelude::*, px, rgb, size, }; actions!(example, [CloseWindow]); diff --git a/crates/gpui/examples/opacity.rs b/crates/gpui/examples/opacity.rs index 796ae08c5f0a722f8725712978d7098b17cd6fa0..68e2a3fbd044cc57f9b6e8da774f498f3167aab2 100644 --- a/crates/gpui/examples/opacity.rs +++ b/crates/gpui/examples/opacity.rs @@ -2,8 +2,9 @@ use std::{fs, path::PathBuf, time::Duration}; use anyhow::Result; use gpui::{ - div, hsla, img, point, prelude::*, px, rgb, size, svg, App, Application, AssetSource, Bounds, - BoxShadow, ClickEvent, Context, SharedString, Task, Timer, Window, WindowBounds, WindowOptions, + App, Application, AssetSource, Bounds, BoxShadow, ClickEvent, Context, SharedString, Task, + Timer, Window, WindowBounds, WindowOptions, div, hsla, img, point, prelude::*, px, rgb, size, + svg, }; struct Assets { @@ -50,23 +51,25 @@ impl HelloWorld { self.opacity = 0.0; cx.notify(); - self._task = Some(cx.spawn_in(window, async move |view, cx| loop { - Timer::after(Duration::from_secs_f32(0.05)).await; - let mut stop = false; - let _ = cx.update(|_, cx| { - view.update(cx, |view, cx| { - if view.opacity >= 1.0 { - stop = true; - return; - } + self._task = Some(cx.spawn_in(window, async move |view, cx| { + loop { + Timer::after(Duration::from_secs_f32(0.05)).await; + let mut stop = false; + let _ = cx.update(|_, cx| { + view.update(cx, |view, cx| { + if view.opacity >= 1.0 { + stop = true; + return; + } - view.opacity += 0.1; - cx.notify(); - }) - }); + view.opacity += 0.1; + cx.notify(); + }) + }); - if stop { - break; + if stop { + break; + } } })); } diff --git a/crates/gpui/examples/ownership_post.rs b/crates/gpui/examples/ownership_post.rs index cd1316ed9d2ee84f9f1cdbe32be224349be77301..e690de54a88609c6a725b359962f165f6c0b5574 100644 --- a/crates/gpui/examples/ownership_post.rs +++ b/crates/gpui/examples/ownership_post.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, App, Application, Context, Entity, EventEmitter}; +use gpui::{App, Application, Context, Entity, EventEmitter, prelude::*}; struct Counter { count: usize, diff --git a/crates/gpui/examples/painting.rs b/crates/gpui/examples/painting.rs index 7c1a6a367d1335f58ed1ba4f09f3385ecb452980..bca9256bc5ca4e1ab8f129dfe4148606c081f569 100644 --- a/crates/gpui/examples/painting.rs +++ b/crates/gpui/examples/painting.rs @@ -1,7 +1,7 @@ use gpui::{ - canvas, div, linear_color_stop, linear_gradient, point, prelude::*, px, rgb, size, Application, - Background, Bounds, ColorSpace, Context, MouseDownEvent, Path, PathBuilder, PathStyle, Pixels, - Point, Render, StrokeOptions, Window, WindowOptions, + Application, Background, Bounds, ColorSpace, Context, MouseDownEvent, Path, PathBuilder, + PathStyle, Pixels, Point, Render, StrokeOptions, Window, WindowOptions, canvas, div, + linear_color_stop, linear_gradient, point, prelude::*, px, rgb, size, }; struct PaintingViewer { diff --git a/crates/gpui/examples/pattern.rs b/crates/gpui/examples/pattern.rs index 9b19af02be205e7441c9332362d1fcc1a6a84b21..8be6642fdaf032aef9105f8925986544d8606b7c 100644 --- a/crates/gpui/examples/pattern.rs +++ b/crates/gpui/examples/pattern.rs @@ -1,6 +1,6 @@ use gpui::{ - div, linear_color_stop, linear_gradient, pattern_slash, prelude::*, px, rgb, size, App, - AppContext, Application, Bounds, Context, Window, WindowBounds, WindowOptions, + App, AppContext, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, + linear_color_stop, linear_gradient, pattern_slash, prelude::*, px, rgb, size, }; struct PatternExample; diff --git a/crates/gpui/examples/set_menus.rs b/crates/gpui/examples/set_menus.rs index 2de8e872504d1d7968da2cfbabceee68a5d5c07c..2b302f78f273449b9afeac8cb272a1a8148aaf56 100644 --- a/crates/gpui/examples/set_menus.rs +++ b/crates/gpui/examples/set_menus.rs @@ -1,5 +1,5 @@ use gpui::{ - actions, div, prelude::*, rgb, App, Application, Context, Menu, MenuItem, Window, WindowOptions, + App, Application, Context, Menu, MenuItem, Window, WindowOptions, actions, div, prelude::*, rgb, }; struct SetMenus; diff --git a/crates/gpui/examples/shadow.rs b/crates/gpui/examples/shadow.rs index cfb8e6b4f1f5c5b365f058402650a1a975d39720..4fa44ca6230de773af685ec4ee3f181e3b090de0 100644 --- a/crates/gpui/examples/shadow.rs +++ b/crates/gpui/examples/shadow.rs @@ -1,6 +1,6 @@ use gpui::{ - div, hsla, point, prelude::*, px, relative, rgb, size, App, Application, Bounds, BoxShadow, - Context, Div, SharedString, Window, WindowBounds, WindowOptions, + App, Application, Bounds, BoxShadow, Context, Div, SharedString, Window, WindowBounds, + WindowOptions, div, hsla, point, prelude::*, px, relative, rgb, size, }; use smallvec::smallvec; diff --git a/crates/gpui/examples/svg/svg.rs b/crates/gpui/examples/svg/svg.rs index 62ce04e1ce94f632f121bc85a2bf531870ccb4bf..5d938998e8799f873ff8490ba8dfd8118fbf6ae3 100644 --- a/crates/gpui/examples/svg/svg.rs +++ b/crates/gpui/examples/svg/svg.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; use anyhow::Result; use gpui::{ - div, prelude::*, px, rgb, size, svg, App, Application, AssetSource, Bounds, Context, - SharedString, Window, WindowBounds, WindowOptions, + App, Application, AssetSource, Bounds, Context, SharedString, Window, WindowBounds, + WindowOptions, div, prelude::*, px, rgb, size, svg, }; struct Assets { diff --git a/crates/gpui/examples/text_layout.rs b/crates/gpui/examples/text_layout.rs index 993a718528712bd058d1f4731152bc33db041e26..c4cbcd4e5edc142dde58a1dd5d9b61a1daee0c3a 100644 --- a/crates/gpui/examples/text_layout.rs +++ b/crates/gpui/examples/text_layout.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, size, App, Application, Bounds, Context, Window, WindowBounds, - WindowOptions, + App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, + size, }; struct HelloWorld {} diff --git a/crates/gpui/examples/text_wrapper.rs b/crates/gpui/examples/text_wrapper.rs index 6753fc4ae99051794bf6f67f11c9c9d71a51d6a2..dfc2456bc636331c30842da51d0490dfa19adf82 100644 --- a/crates/gpui/examples/text_wrapper.rs +++ b/crates/gpui/examples/text_wrapper.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, size, App, Application, Bounds, Context, TextOverflow, Window, - WindowBounds, WindowOptions, + App, Application, Bounds, Context, TextOverflow, Window, WindowBounds, WindowOptions, div, + prelude::*, px, size, }; struct HelloWorld {} diff --git a/crates/gpui/examples/uniform_list.rs b/crates/gpui/examples/uniform_list.rs index 00a98182c3b7d7f9188c8e94a8c43071a3572d08..221de44bd928d9d4557fc7c7b8b69f5664094ce9 100644 --- a/crates/gpui/examples/uniform_list.rs +++ b/crates/gpui/examples/uniform_list.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, rgb, size, uniform_list, App, Application, Bounds, Context, Window, - WindowBounds, WindowOptions, + App, Application, Bounds, Context, Window, WindowBounds, WindowOptions, div, prelude::*, px, + rgb, size, uniform_list, }; struct UniformListExample {} diff --git a/crates/gpui/examples/window.rs b/crates/gpui/examples/window.rs index c3aa34436296fd4d219b2683597f67389353524b..a513118f01b39bddac13abf3f5e9629ba32f48a4 100644 --- a/crates/gpui/examples/window.rs +++ b/crates/gpui/examples/window.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, rgb, size, App, Application, Bounds, Context, SharedString, Timer, Window, - WindowBounds, WindowKind, WindowOptions, + App, Application, Bounds, Context, SharedString, Timer, Window, WindowBounds, WindowKind, + WindowOptions, div, prelude::*, px, rgb, size, }; struct SubWindow { diff --git a/crates/gpui/examples/window_positioning.rs b/crates/gpui/examples/window_positioning.rs index 95cd787e275d0e602d772539296edad3bc9c38fe..0f0bb8ac288d7117867df9b12a104e4272903378 100644 --- a/crates/gpui/examples/window_positioning.rs +++ b/crates/gpui/examples/window_positioning.rs @@ -1,7 +1,7 @@ use gpui::{ - div, point, prelude::*, px, rgb, App, Application, Bounds, Context, DisplayId, Hsla, Pixels, - SharedString, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowKind, - WindowOptions, + App, Application, Bounds, Context, DisplayId, Hsla, Pixels, SharedString, Size, Window, + WindowBackgroundAppearance, WindowBounds, WindowKind, WindowOptions, div, point, prelude::*, + px, rgb, }; struct WindowContent { diff --git a/crates/gpui/examples/window_shadow.rs b/crates/gpui/examples/window_shadow.rs index 0d787680f3c947c1914d7025d48c96518a36f1d2..3c9849ebdd70fa9e1d2a0c891597107f22af2881 100644 --- a/crates/gpui/examples/window_shadow.rs +++ b/crates/gpui/examples/window_shadow.rs @@ -1,8 +1,8 @@ use gpui::{ - black, canvas, div, green, point, prelude::*, px, rgb, size, transparent_black, white, App, - Application, Bounds, Context, CursorStyle, Decorations, Hsla, MouseButton, Pixels, Point, + App, Application, Bounds, Context, CursorStyle, Decorations, Hsla, MouseButton, Pixels, Point, ResizeEdge, Size, Window, WindowBackgroundAppearance, WindowBounds, WindowDecorations, - WindowOptions, + WindowOptions, black, canvas, div, green, point, prelude::*, px, rgb, size, transparent_black, + white, }; struct WindowShadow {} diff --git a/crates/gpui/src/action.rs b/crates/gpui/src/action.rs index be7ec6d96a456ae90377b2da098c3ec05f61496d..783b7d47e418f3e6df32b1f0247fa7816341778b 100644 --- a/crates/gpui/src/action.rs +++ b/crates/gpui/src/action.rs @@ -1,7 +1,7 @@ use crate::SharedString; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; -pub use no_action::{is_no_action, NoAction}; +pub use no_action::{NoAction, is_no_action}; use serde_json::json; use std::{ any::{Any, TypeId}, diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index 380692a88625c8761bb989f8a354e3c09e418fe2..95d16c0dfecbc9a1e03518522a9ed8f3499b6a7f 100644 --- a/crates/gpui/src/app.rs +++ b/crates/gpui/src/app.rs @@ -1,21 +1,21 @@ use std::{ - any::{type_name, TypeId}, + any::{TypeId, type_name}, cell::{Ref, RefCell, RefMut}, marker::PhantomData, mem, ops::{Deref, DerefMut}, path::{Path, PathBuf}, rc::{Rc, Weak}, - sync::{atomic::Ordering::SeqCst, Arc}, + sync::{Arc, atomic::Ordering::SeqCst}, time::Duration, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use derive_more::{Deref, DerefMut}; use futures::{ + Future, FutureExt, channel::oneshot, future::{LocalBoxFuture, Shared}, - Future, FutureExt, }; use parking_lot::RwLock; use slotmap::SlotMap; @@ -30,14 +30,14 @@ pub use test_context::*; use util::ResultExt; use crate::{ - current_platform, hash, init_app_menus, Action, ActionBuildError, ActionRegistry, Any, AnyView, - AnyWindowHandle, AppContext, Asset, AssetSource, BackgroundExecutor, Bounds, ClipboardItem, - DispatchPhase, DisplayId, EventEmitter, FocusHandle, FocusMap, ForegroundExecutor, Global, - KeyBinding, Keymap, Keystroke, LayoutId, Menu, MenuItem, OwnedMenu, PathPromptOptions, Pixels, - Platform, PlatformDisplay, Point, PromptBuilder, PromptHandle, PromptLevel, Render, - RenderablePromptHandle, Reservation, ScreenCaptureSource, SharedString, SubscriberSet, - Subscription, SvgRenderer, Task, TextSystem, Window, WindowAppearance, WindowHandle, WindowId, - WindowInvalidator, + Action, ActionBuildError, ActionRegistry, Any, AnyView, AnyWindowHandle, AppContext, Asset, + AssetSource, BackgroundExecutor, Bounds, ClipboardItem, DispatchPhase, DisplayId, EventEmitter, + FocusHandle, FocusMap, ForegroundExecutor, Global, KeyBinding, Keymap, Keystroke, LayoutId, + Menu, MenuItem, OwnedMenu, PathPromptOptions, Pixels, Platform, PlatformDisplay, Point, + PromptBuilder, PromptHandle, PromptLevel, Render, RenderablePromptHandle, Reservation, + ScreenCaptureSource, SharedString, SubscriberSet, Subscription, SvgRenderer, Task, TextSystem, + Window, WindowAppearance, WindowHandle, WindowId, WindowInvalidator, current_platform, hash, + init_app_menus, }; mod async_context; @@ -1513,15 +1513,15 @@ impl App { pub fn set_prompt_builder( &mut self, renderer: impl Fn( - PromptLevel, - &str, - Option<&str>, - &[&str], - PromptHandle, - &mut Window, - &mut App, - ) -> RenderablePromptHandle - + 'static, + PromptLevel, + &str, + Option<&str>, + &[&str], + PromptHandle, + &mut Window, + &mut App, + ) -> RenderablePromptHandle + + 'static, ) { self.prompt_builder = Some(PromptBuilder::Custom(Box::new(renderer))) } diff --git a/crates/gpui/src/app/async_context.rs b/crates/gpui/src/app/async_context.rs index 2a0f7e47c9a43425135a34748a1eff7557686c18..c20a5b90660b756f244220e46b08753658cc37de 100644 --- a/crates/gpui/src/app/async_context.rs +++ b/crates/gpui/src/app/async_context.rs @@ -3,7 +3,7 @@ use crate::{ Entity, Focusable, ForegroundExecutor, Global, PromptLevel, Render, Reservation, Result, Task, VisualContext, Window, WindowHandle, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use derive_more::{Deref, DerefMut}; use futures::channel::oneshot; use std::{future::Future, rc::Weak}; diff --git a/crates/gpui/src/app/entity_map.rs b/crates/gpui/src/app/entity_map.rs index 9959ddcc051f7facc6efe3ad3f48e360a5c14802..ebcf95dbbb1d53cc96819d46cd04c21b530279bf 100644 --- a/crates/gpui/src/app/entity_map.rs +++ b/crates/gpui/src/app/entity_map.rs @@ -1,11 +1,11 @@ -use crate::{seal::Sealed, App, AppContext, VisualContext, Window}; -use anyhow::{anyhow, Result}; +use crate::{App, AppContext, VisualContext, Window, seal::Sealed}; +use anyhow::{Result, anyhow}; use collections::FxHashSet; use derive_more::{Deref, DerefMut}; use parking_lot::{RwLock, RwLockUpgradableReadGuard}; use slotmap::{KeyData, SecondaryMap, SlotMap}; use std::{ - any::{type_name, Any, TypeId}, + any::{Any, TypeId, type_name}, cell::RefCell, cmp::Ordering, fmt::{self, Display}, @@ -14,8 +14,8 @@ use std::{ mem, num::NonZeroU64, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicUsize, Ordering::SeqCst}, }, thread::panicking, }; diff --git a/crates/gpui/src/app/test_context.rs b/crates/gpui/src/app/test_context.rs index e84a056ff947ad625cc2a5bdc791e3af114bcbff..e639da7654fcb5ee8f577739b95e6c6dab6921b5 100644 --- a/crates/gpui/src/app/test_context.rs +++ b/crates/gpui/src/app/test_context.rs @@ -8,7 +8,7 @@ use crate::{ WindowHandle, WindowOptions, }; use anyhow::{anyhow, bail}; -use futures::{channel::oneshot, Stream, StreamExt}; +use futures::{Stream, StreamExt, channel::oneshot}; use std::{cell::RefCell, future::Future, ops::Deref, rc::Rc, sync::Arc, time::Duration}; /// A TestAppContext is provided to tests created with `#[gpui::test]`, it provides diff --git a/crates/gpui/src/assets.rs b/crates/gpui/src/assets.rs index 99696481f3b057cd9b21109cddb1f380428b2854..70a07c11e9239c048f9eaede8cae31a79acf779c 100644 --- a/crates/gpui/src/assets.rs +++ b/crates/gpui/src/assets.rs @@ -1,4 +1,4 @@ -use crate::{size, DevicePixels, Result, SharedString, Size}; +use crate::{DevicePixels, Result, SharedString, Size, size}; use smallvec::SmallVec; use image::{Delay, Frame}; diff --git a/crates/gpui/src/color.rs b/crates/gpui/src/color.rs index 891c42c5c202fd9ad2992e7504e170ab60921b34..c40fcd2828a22486f28f8c196303fbfed1556026 100644 --- a/crates/gpui/src/color.rs +++ b/crates/gpui/src/color.rs @@ -1,4 +1,4 @@ -use anyhow::{bail, Context}; +use anyhow::{Context, bail}; use serde::de::{self, Deserialize, Deserializer, Visitor}; use std::{ fmt::{self, Display, Formatter}, diff --git a/crates/gpui/src/element.rs b/crates/gpui/src/element.rs index 6af0474ad50ac8a84f961202b9c70fb9906ec90b..26c8c7a849faa105b12eb8d9741a0a5df8d90df3 100644 --- a/crates/gpui/src/element.rs +++ b/crates/gpui/src/element.rs @@ -32,8 +32,8 @@ //! your own custom layout algorithm or rendering a code editor. use crate::{ - util::FluentBuilder, App, ArenaBox, AvailableSpace, Bounds, Context, DispatchNodeId, ElementId, - FocusHandle, LayoutId, Pixels, Point, Size, Style, Window, ELEMENT_ARENA, + App, ArenaBox, AvailableSpace, Bounds, Context, DispatchNodeId, ELEMENT_ARENA, ElementId, + FocusHandle, LayoutId, Pixels, Point, Size, Style, Window, util::FluentBuilder, }; use derive_more::{Deref, DerefMut}; pub(crate) use smallvec::SmallVec; diff --git a/crates/gpui/src/elements/anchored.rs b/crates/gpui/src/elements/anchored.rs index b6ab196f83d79fd122c507b5cbca0384fa2e0f42..2e33f138b9b9dff30f7daffc26f6cb75dc07d812 100644 --- a/crates/gpui/src/elements/anchored.rs +++ b/crates/gpui/src/elements/anchored.rs @@ -2,8 +2,8 @@ use smallvec::SmallVec; use taffy::style::{Display, Position}; use crate::{ - point, AnyElement, App, Axis, Bounds, Corner, Edges, Element, GlobalElementId, IntoElement, - LayoutId, ParentElement, Pixels, Point, Size, Style, Window, + AnyElement, App, Axis, Bounds, Corner, Edges, Element, GlobalElementId, IntoElement, LayoutId, + ParentElement, Pixels, Point, Size, Style, Window, point, }; /// The state that the anchored element element uses to track its children. diff --git a/crates/gpui/src/elements/common.rs b/crates/gpui/src/elements/common.rs index 42d6882cd50663f296a90e337ef73a42a813334c..5ac0d3a022ef7197a43a969dc5283eaacbdfbe94 100644 --- a/crates/gpui/src/elements/common.rs +++ b/crates/gpui/src/elements/common.rs @@ -1,4 +1,4 @@ -use crate::{rgb, Hsla, Rgba, WindowAppearance}; +use crate::{Hsla, Rgba, WindowAppearance, rgb}; /// The appearance of the base GPUI colors, used to style GPUI elements /// diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rs index 0ef76732fbd1b238db54b3bcf284965bdc9861f3..3b3dd4cbdc5e66ba038332735761b25ef7c64f29 100644 --- a/crates/gpui/src/elements/div.rs +++ b/crates/gpui/src/elements/div.rs @@ -16,12 +16,12 @@ //! constructed by combining these two systems into an all-in-one element. use crate::{ - point, px, size, Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, Bounds, ClickEvent, - DispatchPhase, Element, ElementId, Entity, FocusHandle, Global, GlobalElementId, Hitbox, - HitboxId, IntoElement, IsZero, KeyContext, KeyDownEvent, KeyUpEvent, LayoutId, - ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, - ParentElement, Pixels, Point, Render, ScrollWheelEvent, SharedString, Size, Style, - StyleRefinement, Styled, Task, TooltipId, Visibility, Window, + Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, Bounds, ClickEvent, DispatchPhase, + Element, ElementId, Entity, FocusHandle, Global, GlobalElementId, Hitbox, HitboxId, + IntoElement, IsZero, KeyContext, KeyDownEvent, KeyUpEvent, LayoutId, ModifiersChangedEvent, + MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Point, + Render, ScrollWheelEvent, SharedString, Size, Style, StyleRefinement, Styled, Task, TooltipId, + Visibility, Window, point, px, size, }; use collections::HashMap; use refineable::Refineable; diff --git a/crates/gpui/src/elements/img.rs b/crates/gpui/src/elements/img.rs index 276d9ac938501e2819dcd863ea0f1e0e487cf7b2..19309cd038842987f34472ec9407da965ec06f94 100644 --- a/crates/gpui/src/elements/img.rs +++ b/crates/gpui/src/elements/img.rs @@ -1,16 +1,16 @@ use crate::{ - px, swap_rgba_pa_to_bgra, AbsoluteLength, AnyElement, App, Asset, AssetLogger, Bounds, - DefiniteLength, Element, ElementId, GlobalElementId, Hitbox, Image, InteractiveElement, - Interactivity, IntoElement, LayoutId, Length, ObjectFit, Pixels, RenderImage, Resource, - SharedString, SharedUri, StyleRefinement, Styled, SvgSize, Task, Window, - SMOOTH_SVG_SCALE_FACTOR, + AbsoluteLength, AnyElement, App, Asset, AssetLogger, Bounds, DefiniteLength, Element, + ElementId, GlobalElementId, Hitbox, Image, InteractiveElement, Interactivity, IntoElement, + LayoutId, Length, ObjectFit, Pixels, RenderImage, Resource, SMOOTH_SVG_SCALE_FACTOR, + SharedString, SharedUri, StyleRefinement, Styled, SvgSize, Task, Window, px, + swap_rgba_pa_to_bgra, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use futures::{AsyncReadExt, Future}; use image::{ - codecs::{gif::GifDecoder, webp::WebPDecoder}, AnimationDecoder, DynamicImage, Frame, ImageBuffer, ImageError, ImageFormat, Rgba, + codecs::{gif::GifDecoder, webp::WebPDecoder}, }; use smallvec::SmallVec; use std::{ diff --git a/crates/gpui/src/elements/list.rs b/crates/gpui/src/elements/list.rs index 5f4b9d8b0d2aa6860e83a69fcee874a6cfdbedea..af522b0c7f5cda79e25b317e021a8cfab95f6b28 100644 --- a/crates/gpui/src/elements/list.rs +++ b/crates/gpui/src/elements/list.rs @@ -8,9 +8,9 @@ //! If all of your elements are the same height, see [`UniformList`] for a simpler API use crate::{ - point, px, size, AnyElement, App, AvailableSpace, Bounds, ContentMask, DispatchPhase, Edges, - Element, EntityId, FocusHandle, GlobalElementId, Hitbox, IntoElement, Pixels, Point, - ScrollWheelEvent, Size, Style, StyleRefinement, Styled, Window, + AnyElement, App, AvailableSpace, Bounds, ContentMask, DispatchPhase, Edges, Element, EntityId, + FocusHandle, GlobalElementId, Hitbox, IntoElement, Pixels, Point, ScrollWheelEvent, Size, + Style, StyleRefinement, Styled, Window, point, px, size, }; use collections::VecDeque; use refineable::Refineable as _; @@ -349,7 +349,7 @@ impl ListState { let mut cursor = state.items.cursor::<(Count, Height)>(&()); cursor.seek(&Count(scroll_top.item_ix), Bias::Right, &()); - let scroll_top = cursor.start().1 .0 + scroll_top.offset_in_item; + let scroll_top = cursor.start().1.0 + scroll_top.offset_in_item; cursor.seek_forward(&Count(ix), Bias::Right, &()); if let Some(&ListItem::Measured { size, .. }) = cursor.item() { @@ -1067,8 +1067,8 @@ mod test { #[gpui::test] fn test_reset_after_paint_before_scroll(cx: &mut TestAppContext) { use crate::{ - div, list, point, px, size, AppContext, Context, Element, IntoElement, ListState, - Render, Styled, Window, + AppContext, Context, Element, IntoElement, ListState, Render, Styled, Window, div, + list, point, px, size, }; let cx = cx.add_empty_window(); diff --git a/crates/gpui/src/elements/svg.rs b/crates/gpui/src/elements/svg.rs index c5997bb3405e0ccdff0fa2ba2d10beca7356f3d2..abb75156bdf5385c0eaf89040cb08397fe2509a9 100644 --- a/crates/gpui/src/elements/svg.rs +++ b/crates/gpui/src/elements/svg.rs @@ -1,7 +1,7 @@ use crate::{ - geometry::Negate as _, point, px, radians, size, App, Bounds, Element, GlobalElementId, Hitbox, - InteractiveElement, Interactivity, IntoElement, LayoutId, Pixels, Point, Radians, SharedString, - Size, StyleRefinement, Styled, TransformationMatrix, Window, + App, Bounds, Element, GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement, + LayoutId, Pixels, Point, Radians, SharedString, Size, StyleRefinement, Styled, + TransformationMatrix, Window, geometry::Negate as _, point, px, radians, size, }; use util::ResultExt; diff --git a/crates/gpui/src/elements/text.rs b/crates/gpui/src/elements/text.rs index 45a092edf0d65916f6b1f0196604c1300e62ed63..cd6cf033dbd6915bc41b837b20299492640863b2 100644 --- a/crates/gpui/src/elements/text.rs +++ b/crates/gpui/src/elements/text.rs @@ -1,9 +1,8 @@ use crate::{ - register_tooltip_mouse_handlers, set_tooltip_on_window, ActiveTooltip, AnyView, App, Bounds, - DispatchPhase, Element, ElementId, GlobalElementId, HighlightStyle, Hitbox, IntoElement, - LayoutId, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, SharedString, Size, - TextOverflow, TextRun, TextStyle, TooltipId, WhiteSpace, Window, WrappedLine, - WrappedLineLayout, + ActiveTooltip, AnyView, App, Bounds, DispatchPhase, Element, ElementId, GlobalElementId, + HighlightStyle, Hitbox, IntoElement, LayoutId, MouseDownEvent, MouseMoveEvent, MouseUpEvent, + Pixels, Point, SharedString, Size, TextOverflow, TextRun, TextStyle, TooltipId, WhiteSpace, + Window, WrappedLine, WrappedLineLayout, register_tooltip_mouse_handlers, set_tooltip_on_window, }; use anyhow::anyhow; use smallvec::SmallVec; diff --git a/crates/gpui/src/elements/uniform_list.rs b/crates/gpui/src/elements/uniform_list.rs index baf3d77c0e6a51a235e8f0f72f7c35a7a35fdeee..8de7abf0cfa97ef06bb2179c8fe641fdb3913194 100644 --- a/crates/gpui/src/elements/uniform_list.rs +++ b/crates/gpui/src/elements/uniform_list.rs @@ -5,10 +5,10 @@ //! elements with uniform height. use crate::{ - point, size, AnyElement, App, AvailableSpace, Bounds, ContentMask, Context, Element, ElementId, - Entity, GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement, IsZero, - LayoutId, ListSizingBehavior, Pixels, Render, ScrollHandle, Size, StyleRefinement, Styled, - Window, + AnyElement, App, AvailableSpace, Bounds, ContentMask, Context, Element, ElementId, Entity, + GlobalElementId, Hitbox, InteractiveElement, Interactivity, IntoElement, IsZero, LayoutId, + ListSizingBehavior, Pixels, Render, ScrollHandle, Size, StyleRefinement, Styled, Window, point, + size, }; use smallvec::SmallVec; use std::{cell::RefCell, cmp, ops::Range, rc::Rc}; diff --git a/crates/gpui/src/executor.rs b/crates/gpui/src/executor.rs index 388180fd9e5a9cd3ff954a9d8bd48f7045d06d37..affca7b1b4a56145b516a6deaecccbebafdde5d2 100644 --- a/crates/gpui/src/executor.rs +++ b/crates/gpui/src/executor.rs @@ -13,8 +13,8 @@ use std::{ pin::Pin, rc::Rc, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{AtomicUsize, Ordering::SeqCst}, }, task::{Context, Poll}, time::{Duration, Instant}, diff --git a/crates/gpui/src/gpui.rs b/crates/gpui/src/gpui.rs index 34b9f09d8ef7f360d470500ff6d19a421131a02f..4e6bda1977df4c621c7fa8b8fa3c9c3f3840a811 100644 --- a/crates/gpui/src/gpui.rs +++ b/crates/gpui/src/gpui.rs @@ -130,7 +130,7 @@ pub use elements::*; pub use executor::*; pub use geometry::*; pub use global::*; -pub use gpui_macros::{register_action, test, AppContext, IntoElement, Render, VisualContext}; +pub use gpui_macros::{AppContext, IntoElement, Render, VisualContext, register_action, test}; pub use http_client; pub use input::*; pub use interactive::*; diff --git a/crates/gpui/src/interactive.rs b/crates/gpui/src/interactive.rs index f1f6e60e7f4c834a5ea3c596c74f66e3a497fc58..c6eab26186a079f781d4d91d766d1130c8c4e86c 100644 --- a/crates/gpui/src/interactive.rs +++ b/crates/gpui/src/interactive.rs @@ -1,6 +1,6 @@ use crate::{ - point, seal::Sealed, Context, Empty, IntoElement, Keystroke, Modifiers, Pixels, Point, Render, - Window, + Context, Empty, IntoElement, Keystroke, Modifiers, Pixels, Point, Render, Window, point, + seal::Sealed, }; use smallvec::SmallVec; use std::{any::Any, fmt::Debug, ops::Deref, path::PathBuf}; @@ -481,8 +481,8 @@ impl PlatformInput { mod test { use crate::{ - self as gpui, div, AppContext as _, Context, FocusHandle, InteractiveElement, IntoElement, - KeyBinding, Keystroke, ParentElement, Render, TestAppContext, Window, + self as gpui, AppContext as _, Context, FocusHandle, InteractiveElement, IntoElement, + KeyBinding, Keystroke, ParentElement, Render, TestAppContext, Window, div, }; struct TestView { diff --git a/crates/gpui/src/keymap.rs b/crates/gpui/src/keymap.rs index 49bdb54cfb65277708968d83f1784b95ecdc1fd5..4f2b57fc52e71b0010e5297abc41daa2feebacff 100644 --- a/crates/gpui/src/keymap.rs +++ b/crates/gpui/src/keymap.rs @@ -4,7 +4,7 @@ mod context; pub use binding::*; pub use context::*; -use crate::{is_no_action, Action, Keystroke}; +use crate::{Action, Keystroke, is_no_action}; use collections::HashMap; use smallvec::SmallVec; use std::any::TypeId; @@ -219,7 +219,7 @@ impl Keymap { mod tests { use super::*; use crate as gpui; - use gpui::{actions, NoAction}; + use gpui::{NoAction, actions}; actions!( keymap_test, @@ -265,38 +265,46 @@ mod tests { keymap.add_bindings(bindings.clone()); // binding is only enabled in a specific context - assert!(keymap - .bindings_for_input( - &[Keystroke::parse("ctrl-a").unwrap()], - &[KeyContext::parse("barf").unwrap()], - ) - .0 - .is_empty()); - assert!(!keymap - .bindings_for_input( - &[Keystroke::parse("ctrl-a").unwrap()], - &[KeyContext::parse("editor").unwrap()], - ) - .0 - .is_empty()); + assert!( + keymap + .bindings_for_input( + &[Keystroke::parse("ctrl-a").unwrap()], + &[KeyContext::parse("barf").unwrap()], + ) + .0 + .is_empty() + ); + assert!( + !keymap + .bindings_for_input( + &[Keystroke::parse("ctrl-a").unwrap()], + &[KeyContext::parse("editor").unwrap()], + ) + .0 + .is_empty() + ); // binding is disabled in a more specific context - assert!(keymap - .bindings_for_input( - &[Keystroke::parse("ctrl-a").unwrap()], - &[KeyContext::parse("editor mode=full").unwrap()], - ) - .0 - .is_empty()); + assert!( + keymap + .bindings_for_input( + &[Keystroke::parse("ctrl-a").unwrap()], + &[KeyContext::parse("editor mode=full").unwrap()], + ) + .0 + .is_empty() + ); // binding is globally disabled - assert!(keymap - .bindings_for_input( - &[Keystroke::parse("ctrl-b").unwrap()], - &[KeyContext::parse("barf").unwrap()], - ) - .0 - .is_empty()); + assert!( + keymap + .bindings_for_input( + &[Keystroke::parse("ctrl-b").unwrap()], + &[KeyContext::parse("barf").unwrap()], + ) + .0 + .is_empty() + ); } #[test] diff --git a/crates/gpui/src/keymap/context.rs b/crates/gpui/src/keymap/context.rs index 3bee2de4114af78009ce4b8db35544b3d13d1ae1..1732145d4803bd0caf4853feaf8eb82dd1e5c10f 100644 --- a/crates/gpui/src/keymap/context.rs +++ b/crates/gpui/src/keymap/context.rs @@ -1,5 +1,5 @@ use crate::SharedString; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use std::fmt; /// A datastructure for resolving whether an action should be dispatched diff --git a/crates/gpui/src/path_builder.rs b/crates/gpui/src/path_builder.rs index 0fd8eb6fa5458315483db45dfb03bbc3a42d5800..982b8586764154c29cb7d14bdbae3d7d19bfc8c1 100644 --- a/crates/gpui/src/path_builder.rs +++ b/crates/gpui/src/path_builder.rs @@ -8,7 +8,7 @@ use lyon::tessellation::{ pub use lyon::math::Transform; pub use lyon::tessellation::{FillOptions, FillRule, StrokeOptions}; -use crate::{point, px, Path, Pixels, Point}; +use crate::{Path, Pixels, Point, point, px}; /// Style of the PathBuilder pub enum PathStyle { diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index d6c62dae8b75222188c3c84a7aadc62c0ad30726..fdd4974be36e5b5b6584d04048fbc9859488a3f1 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -27,13 +27,13 @@ mod test; mod windows; use crate::{ - point, Action, AnyWindowHandle, App, AsyncWindowContext, BackgroundExecutor, Bounds, - DevicePixels, DispatchEventResult, Font, FontId, FontMetrics, FontRun, ForegroundExecutor, - GlyphId, GpuSpecs, ImageSource, Keymap, LineLayout, Pixels, PlatformInput, Point, - RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, ScaledPixels, Scene, - SharedString, Size, SvgRenderer, SvgSize, Task, TaskLabel, Window, DEFAULT_WINDOW_SIZE, + Action, AnyWindowHandle, App, AsyncWindowContext, BackgroundExecutor, Bounds, + DEFAULT_WINDOW_SIZE, DevicePixels, DispatchEventResult, Font, FontId, FontMetrics, FontRun, + ForegroundExecutor, GlyphId, GpuSpecs, ImageSource, Keymap, LineLayout, Pixels, PlatformInput, + Point, RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, ScaledPixels, Scene, + SharedString, Size, SvgRenderer, SvgSize, Task, TaskLabel, Window, point, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_task::Runnable; use futures::channel::oneshot; use image::codecs::gif::GifDecoder; @@ -1307,11 +1307,7 @@ impl ClipboardItem { } } - if any_entries { - Some(answer) - } else { - None - } + if any_entries { Some(answer) } else { None } } /// If this item is one ClipboardEntry::String, returns its metadata. diff --git a/crates/gpui/src/platform/blade/blade_atlas.rs b/crates/gpui/src/platform/blade/blade_atlas.rs index 2783d57127e6c8d5e0b4bf6e2d5978ad1b8ff955..aaa6192dc36489208c2e4e390dba0013d1a6b12c 100644 --- a/crates/gpui/src/platform/blade/blade_atlas.rs +++ b/crates/gpui/src/platform/blade/blade_atlas.rs @@ -1,6 +1,6 @@ use crate::{ - platform::AtlasTextureList, AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, - DevicePixels, PlatformAtlas, Point, Size, + AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, DevicePixels, PlatformAtlas, + Point, Size, platform::AtlasTextureList, }; use anyhow::Result; use blade_graphics as gpu; diff --git a/crates/gpui/src/platform/linux/dispatcher.rs b/crates/gpui/src/platform/linux/dispatcher.rs index 85526340b02990310b35bbe9404c5bd796478860..94269ea62112001092fa2e3df51b11e200bc641b 100644 --- a/crates/gpui/src/platform/linux/dispatcher.rs +++ b/crates/gpui/src/platform/linux/dispatcher.rs @@ -1,9 +1,9 @@ use crate::{PlatformDispatcher, TaskLabel}; use async_task::Runnable; use calloop::{ + EventLoop, channel::{self, Sender}, timer::TimeoutAction, - EventLoop, }; use parking::{Parker, Unparker}; use parking_lot::Mutex; diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 8b36743f6f2bed7232a28d25a8752af0a4c8aa9f..cbf5861df291fe15c02c596926d4d88b1f76f35f 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -14,19 +14,19 @@ use std::{ time::Duration, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use async_task::Runnable; -use calloop::{channel::Channel, LoopSignal}; +use calloop::{LoopSignal, channel::Channel}; use futures::channel::oneshot; use util::ResultExt as _; #[cfg(any(feature = "wayland", feature = "x11"))] use xkbcommon::xkb::{self, Keycode, Keysym, State}; use crate::{ - px, Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId, + Action, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, DisplayId, ForegroundExecutor, Keymap, LinuxDispatcher, Menu, MenuItem, OwnedMenu, PathPromptOptions, Pixels, Platform, PlatformDisplay, PlatformTextSystem, PlatformWindow, Point, Result, - ScreenCaptureSource, Task, WindowAppearance, WindowParams, + ScreenCaptureSource, Task, WindowAppearance, WindowParams, px, }; #[cfg(any(feature = "wayland", feature = "x11"))] pub(crate) const SCROLL_LINES: f32 = 3.0; @@ -852,7 +852,7 @@ impl crate::Modifiers { #[cfg(test)] mod tests { use super::*; - use crate::{px, Point}; + use crate::{Point, px}; #[test] fn test_is_within_click_distance() { diff --git a/crates/gpui/src/platform/linux/text_system.rs b/crates/gpui/src/platform/linux/text_system.rs index 68ac89ce7c37d4804e829a93992d617723df19d3..1987954db589226379f0c22a04b4f85b102356c6 100644 --- a/crates/gpui/src/platform/linux/text_system.rs +++ b/crates/gpui/src/platform/linux/text_system.rs @@ -1,9 +1,9 @@ use crate::{ - point, size, Bounds, DevicePixels, Font, FontFeatures, FontId, FontMetrics, FontRun, FontStyle, - FontWeight, GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, RenderGlyphParams, - ShapedGlyph, SharedString, Size, SUBPIXEL_VARIANTS, + Bounds, DevicePixels, Font, FontFeatures, FontId, FontMetrics, FontRun, FontStyle, FontWeight, + GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, RenderGlyphParams, SUBPIXEL_VARIANTS, + ShapedGlyph, SharedString, Size, point, size, }; -use anyhow::{anyhow, Context as _, Ok, Result}; +use anyhow::{Context as _, Ok, Result, anyhow}; use collections::HashMap; use cosmic_text::{ Attrs, AttrsList, CacheKey, Family, Font as CosmicTextFont, FontSystem, ShapeBuffer, ShapeLine, diff --git a/crates/gpui/src/platform/linux/wayland/client.rs b/crates/gpui/src/platform/linux/wayland/client.rs index 075edac55c1ca66bed1463767b50846db6385bf6..6906dc123e212208b58ab0e04a4c39b945a28b54 100644 --- a/crates/gpui/src/platform/linux/wayland/client.rs +++ b/crates/gpui/src/platform/linux/wayland/client.rs @@ -8,8 +8,8 @@ use std::{ }; use calloop::{ - timer::{TimeoutAction, Timer}, EventLoop, LoopHandle, + timer::{TimeoutAction, Timer}, }; use calloop_wayland_source::WaylandSource; use collections::HashMap; @@ -21,7 +21,7 @@ use util::ResultExt; use wayland_backend::client::ObjectId; use wayland_backend::protocol::WEnum; use wayland_client::event_created_child; -use wayland_client::globals::{registry_queue_init, GlobalList, GlobalListContents}; +use wayland_client::globals::{GlobalList, GlobalListContents, registry_queue_init}; use wayland_client::protocol::wl_callback::{self, WlCallback}; use wayland_client::protocol::wl_data_device_manager::DndAction; use wayland_client::protocol::wl_data_offer::WlDataOffer; @@ -30,12 +30,11 @@ use wayland_client::protocol::{ wl_data_device, wl_data_device_manager, wl_data_offer, wl_data_source, wl_output, wl_region, }; use wayland_client::{ - delegate_noop, + Connection, Dispatch, Proxy, QueueHandle, delegate_noop, protocol::{ wl_buffer, wl_compositor, wl_keyboard, wl_pointer, wl_registry, wl_seat, wl_shm, wl_shm_pool, wl_surface, }, - Connection, Dispatch, Proxy, QueueHandle, }; use wayland_protocols::wp::cursor_shape::v1::client::{ wp_cursor_shape_device_v1, wp_cursor_shape_manager_v1, @@ -64,13 +63,13 @@ use wayland_protocols::xdg::decoration::zv1::client::{ use wayland_protocols::xdg::shell::client::{xdg_surface, xdg_toplevel, xdg_wm_base}; use wayland_protocols_plasma::blur::client::{org_kde_kwin_blur, org_kde_kwin_blur_manager}; use xkbcommon::xkb::ffi::XKB_KEYMAP_FORMAT_TEXT_V1; -use xkbcommon::xkb::{self, Keycode, KEYMAP_COMPILE_NO_FLAGS}; +use xkbcommon::xkb::{self, KEYMAP_COMPILE_NO_FLAGS, Keycode}; use super::display::WaylandDisplay; use super::window::{ImeInput, WaylandWindowStatePtr}; use crate::platform::linux::{ - get_xkb_compose_state, is_within_click_distance, open_uri_internal, read_fd, + LinuxClient, get_xkb_compose_state, is_within_click_distance, open_uri_internal, read_fd, reveal_path_internal, wayland::{ clipboard::{Clipboard, DataOffer, FILE_LIST_MIME_TYPE, TEXT_MIME_TYPE}, @@ -79,16 +78,14 @@ use crate::platform::linux::{ window::WaylandWindow, }, xdg_desktop_portal::{Event as XDPEvent, XDPEventSource}, - LinuxClient, }; -use crate::platform::{blade::BladeContext, PlatformWindow}; +use crate::platform::{PlatformWindow, blade::BladeContext}; use crate::{ - point, px, size, AnyWindowHandle, Bounds, CursorStyle, DevicePixels, DisplayId, FileDropEvent, - ForegroundExecutor, KeyDownEvent, KeyUpEvent, Keystroke, LinuxCommon, Modifiers, + AnyWindowHandle, Bounds, CursorStyle, DOUBLE_CLICK_INTERVAL, DevicePixels, DisplayId, + FileDropEvent, ForegroundExecutor, KeyDownEvent, KeyUpEvent, Keystroke, LinuxCommon, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseExitEvent, MouseMoveEvent, - MouseUpEvent, NavigationDirection, Pixels, PlatformDisplay, PlatformInput, Point, ScaledPixels, - ScrollDelta, ScrollWheelEvent, Size, TouchPhase, WindowParams, DOUBLE_CLICK_INTERVAL, - SCROLL_LINES, + MouseUpEvent, NavigationDirection, Pixels, PlatformDisplay, PlatformInput, Point, SCROLL_LINES, + ScaledPixels, ScrollDelta, ScrollWheelEvent, Size, TouchPhase, WindowParams, point, px, size, }; /// Used to convert evdev scancode to xkb scancode diff --git a/crates/gpui/src/platform/linux/wayland/clipboard.rs b/crates/gpui/src/platform/linux/wayland/clipboard.rs index 0eed91a561d9fee42eef3e97dc3011462ec4c81a..7b7c59c83d4fa9e1f1bdc165d3ac02ae28640564 100644 --- a/crates/gpui/src/platform/linux/wayland/clipboard.rs +++ b/crates/gpui/src/platform/linux/wayland/clipboard.rs @@ -7,12 +7,12 @@ use std::{ use calloop::{LoopHandle, PostAction}; use filedescriptor::Pipe; use strum::IntoEnumIterator; -use wayland_client::{protocol::wl_data_offer::WlDataOffer, Connection}; +use wayland_client::{Connection, protocol::wl_data_offer::WlDataOffer}; use wayland_protocols::wp::primary_selection::zv1::client::zwp_primary_selection_offer_v1::ZwpPrimarySelectionOfferV1; use crate::{ - hash, platform::linux::platform::read_fd, ClipboardEntry, ClipboardItem, Image, ImageFormat, - WaylandClientStatePtr, + ClipboardEntry, ClipboardItem, Image, ImageFormat, WaylandClientStatePtr, hash, + platform::linux::platform::read_fd, }; pub(crate) const TEXT_MIME_TYPE: &str = "text/plain;charset=utf-8"; diff --git a/crates/gpui/src/platform/linux/wayland/cursor.rs b/crates/gpui/src/platform/linux/wayland/cursor.rs index 09aa414debcffb8b275e893ff3caad9352b811b8..756447ecd21a666a556d0db92e2aad199644ea23 100644 --- a/crates/gpui/src/platform/linux/wayland/cursor.rs +++ b/crates/gpui/src/platform/linux/wayland/cursor.rs @@ -1,9 +1,9 @@ use crate::Globals; use util::ResultExt; +use wayland_client::Connection; use wayland_client::protocol::wl_surface::WlSurface; use wayland_client::protocol::{wl_pointer::WlPointer, wl_shm::WlShm}; -use wayland_client::Connection; use wayland_cursor::{CursorImageBuffer, CursorTheme}; pub(crate) struct Cursor { diff --git a/crates/gpui/src/platform/linux/wayland/window.rs b/crates/gpui/src/platform/linux/wayland/window.rs index 17dcee6b3a37107051be12ea220ee9253f5399fb..4178bea4a35c4c128cb3bb021cf7acc1d3929eec 100644 --- a/crates/gpui/src/platform/linux/wayland/window.rs +++ b/crates/gpui/src/platform/linux/wayland/window.rs @@ -13,7 +13,7 @@ use futures::channel::oneshot::Receiver; use raw_window_handle as rwh; use wayland_backend::client::ObjectId; use wayland_client::WEnum; -use wayland_client::{protocol::wl_surface, Proxy}; +use wayland_client::{Proxy, protocol::wl_surface}; use wayland_protocols::wp::fractional_scale::v1::client::wp_fractional_scale_v1; use wayland_protocols::wp::viewporter::client::wp_viewport; use wayland_protocols::xdg::decoration::zv1::client::zxdg_toplevel_decoration_v1; @@ -22,16 +22,17 @@ use wayland_protocols::xdg::shell::client::xdg_toplevel::{self}; use wayland_protocols_plasma::blur::client::org_kde_kwin_blur; use crate::platform::{ + PlatformAtlas, PlatformInputHandler, PlatformWindow, blade::{BladeContext, BladeRenderer, BladeSurfaceConfig}, linux::wayland::{display::WaylandDisplay, serial::SerialKind}, - PlatformAtlas, PlatformInputHandler, PlatformWindow, }; use crate::scene::Scene; use crate::{ - px, size, AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels, + AnyWindowHandle, Bounds, Decorations, Globals, GpuSpecs, Modifiers, Output, Pixels, PlatformDisplay, PlatformInput, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Size, Tiling, WaylandClientStatePtr, WindowAppearance, - WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams, + WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowParams, px, + size, }; #[derive(Default)] diff --git a/crates/gpui/src/platform/linux/x11/client.rs b/crates/gpui/src/platform/linux/x11/client.rs index 49528431486be227dffb5e31008d945320b78087..45c37221abcc708f811aa9ffc7821983753d9a23 100644 --- a/crates/gpui/src/platform/linux/x11/client.rs +++ b/crates/gpui/src/platform/linux/x11/client.rs @@ -9,8 +9,8 @@ use std::{ }; use calloop::{ - generic::{FdWrapper, Generic}, EventLoop, LoopHandle, RegistrationToken, + generic::{FdWrapper, Generic}, }; use anyhow::Context as _; @@ -30,38 +30,37 @@ use x11rb::{ AtomEnum, ChangeWindowAttributesAux, ClientMessageData, ClientMessageEvent, ConnectionExt as _, EventMask, KeyPressEvent, }, - protocol::{randr, render, xinput, xkb, xproto, Event}, + protocol::{Event, randr, render, xinput, xkb, xproto}, resource_manager::Database, wrapper::ConnectionExt as _, xcb_ffi::XCBConnection, }; -use xim::{x11rb::X11rbClient, AttributeName, Client, InputStyle}; +use xim::{AttributeName, Client, InputStyle, x11rb::X11rbClient}; use xkbc::x11::ffi::{XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION}; use xkbcommon::xkb::{self as xkbc, LayoutIndex, ModMask, STATE_LAYOUT_EFFECTIVE}; use super::{ - button_or_scroll_from_event_detail, get_valuator_axis_index, modifiers_from_state, - pressed_button_from_mask, ButtonOrScroll, ScrollDirection, + ButtonOrScroll, ScrollDirection, button_or_scroll_from_event_detail, get_valuator_axis_index, + modifiers_from_state, pressed_button_from_mask, }; use super::{X11Display, X11WindowStatePtr, XcbAtoms}; use super::{XimCallbackEvent, XimHandler}; use crate::platform::{ + LinuxCommon, PlatformWindow, blade::BladeContext, linux::{ - get_xkb_compose_state, is_within_click_distance, open_uri_internal, + LinuxClient, get_xkb_compose_state, is_within_click_distance, open_uri_internal, platform::{DOUBLE_CLICK_INTERVAL, SCROLL_LINES}, reveal_path_internal, xdg_desktop_portal::{Event as XDPEvent, XDPEventSource}, - LinuxClient, }, - LinuxCommon, PlatformWindow, }; use crate::{ - modifiers_from_xinput_info, point, px, AnyWindowHandle, Bounds, ClipboardItem, CursorStyle, - DisplayId, FileDropEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, Pixels, - Platform, PlatformDisplay, PlatformInput, Point, RequestFrameOptions, ScaledPixels, - ScrollDelta, Size, TouchPhase, WindowParams, X11Window, + AnyWindowHandle, Bounds, ClipboardItem, CursorStyle, DisplayId, FileDropEvent, Keystroke, + Modifiers, ModifiersChangedEvent, MouseButton, Pixels, Platform, PlatformDisplay, + PlatformInput, Point, RequestFrameOptions, ScaledPixels, ScrollDelta, Size, TouchPhase, + WindowParams, X11Window, modifiers_from_xinput_info, point, px, }; /// Value for DeviceId parameters which selects all devices. diff --git a/crates/gpui/src/platform/linux/x11/display.rs b/crates/gpui/src/platform/linux/x11/display.rs index 4983e2f5a395f95c61412c0fdc90e31bcead710e..d1c2bef0d7d0130099da93bf53e5328d11524de4 100644 --- a/crates/gpui/src/platform/linux/x11/display.rs +++ b/crates/gpui/src/platform/linux/x11/display.rs @@ -2,7 +2,7 @@ use anyhow::Result; use uuid::Uuid; use x11rb::{connection::Connection as _, xcb_ffi::XCBConnection}; -use crate::{px, Bounds, DisplayId, Pixels, PlatformDisplay, Size}; +use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, Size, px}; #[derive(Debug)] pub(crate) struct X11Display { diff --git a/crates/gpui/src/platform/linux/x11/window.rs b/crates/gpui/src/platform/linux/x11/window.rs index 38ed0d88585beed45256b58501f5f265c13b34e9..7a4cd1c35a8698e5036fcd29fba919e6d78233bc 100644 --- a/crates/gpui/src/platform/linux/x11/window.rs +++ b/crates/gpui/src/platform/linux/x11/window.rs @@ -1,17 +1,17 @@ -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use crate::platform::blade::{BladeContext, BladeRenderer, BladeSurfaceConfig}; use crate::{ - px, size, AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GpuSpecs, - Modifiers, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, - PlatformWindow, Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size, - Tiling, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations, - WindowKind, WindowParams, X11ClientStatePtr, + AnyWindowHandle, Bounds, Decorations, DevicePixels, ForegroundExecutor, GpuSpecs, Modifiers, + Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, + Point, PromptLevel, RequestFrameOptions, ResizeEdge, ScaledPixels, Scene, Size, Tiling, + WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowDecorations, WindowKind, + WindowParams, X11ClientStatePtr, px, size, }; use blade_graphics as gpu; use raw_window_handle as rwh; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use x11rb::{ connection::Connection, cookie::{Cookie, VoidCookie}, @@ -31,7 +31,7 @@ use std::{ sync::Arc, }; -use super::{X11Display, XINPUT_ALL_DEVICES, XINPUT_ALL_DEVICE_GROUPS}; +use super::{X11Display, XINPUT_ALL_DEVICE_GROUPS, XINPUT_ALL_DEVICES}; x11rb::atom_manager! { pub XcbAtoms: AtomsCookie { XA_ATOM, diff --git a/crates/gpui/src/platform/linux/x11/xim_handler.rs b/crates/gpui/src/platform/linux/x11/xim_handler.rs index e1ccfd4cd977b400d5b4b26216cb0d59e3d70f4d..82b7c96312b3b0bdc95b42fd8acbd7b93acbfb06 100644 --- a/crates/gpui/src/platform/linux/x11/xim_handler.rs +++ b/crates/gpui/src/platform/linux/x11/xim_handler.rs @@ -1,6 +1,6 @@ use std::default::Default; -use x11rb::protocol::{xproto, Event}; +use x11rb::protocol::{Event, xproto}; use xim::{AHashMap, AttributeName, Client, ClientError, ClientHandler, InputStyle}; pub enum XimCallbackEvent { diff --git a/crates/gpui/src/platform/mac.rs b/crates/gpui/src/platform/mac.rs index 441c6562c8b9bf81cae5467fa74c7dbcbb4bf4f8..75041b8cc179f7812e5009eba44e509bb22e62f4 100644 --- a/crates/gpui/src/platform/mac.rs +++ b/crates/gpui/src/platform/mac.rs @@ -30,7 +30,7 @@ mod platform; mod window; mod window_appearance; -use crate::{px, size, DevicePixels, Pixels, Size}; +use crate::{DevicePixels, Pixels, Size, px, size}; use cocoa::{ base::{id, nil}, foundation::{NSAutoreleasePool, NSNotFound, NSRect, NSSize, NSString, NSUInteger}, @@ -38,7 +38,7 @@ use cocoa::{ use objc::runtime::{BOOL, NO, YES}; use std::{ - ffi::{c_char, CStr}, + ffi::{CStr, c_char}, ops::Range, }; @@ -60,11 +60,7 @@ trait BoolExt { impl BoolExt for bool { fn to_objc(self) -> BOOL { - if self { - YES - } else { - NO - } + if self { YES } else { NO } } } diff --git a/crates/gpui/src/platform/mac/dispatcher.rs b/crates/gpui/src/platform/mac/dispatcher.rs index 13b2742d234e1e7a8616380ce1ba48b0a86bbc2b..137295fb916e893c193962a3076b83ee5dce1436 100644 --- a/crates/gpui/src/platform/mac/dispatcher.rs +++ b/crates/gpui/src/platform/mac/dispatcher.rs @@ -13,7 +13,7 @@ use parking::{Parker, Unparker}; use parking_lot::Mutex; use std::{ ffi::c_void, - ptr::{addr_of, NonNull}, + ptr::{NonNull, addr_of}, sync::Arc, time::Duration, }; diff --git a/crates/gpui/src/platform/mac/display.rs b/crates/gpui/src/platform/mac/display.rs index 7e8b38312c6d67a7ab8b098ce9186419a99db9f4..4ee27027d5fbff973b9ef2c27b5d55739c8a711a 100644 --- a/crates/gpui/src/platform/mac/display.rs +++ b/crates/gpui/src/platform/mac/display.rs @@ -1,4 +1,4 @@ -use crate::{px, size, Bounds, DisplayId, Pixels, PlatformDisplay}; +use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, px, size}; use anyhow::Result; use cocoa::{ appkit::NSScreen, diff --git a/crates/gpui/src/platform/mac/display_link.rs b/crates/gpui/src/platform/mac/display_link.rs index 03bae5018112deb0dc8409cf678aa5ffd8c14dab..28563871dfde492393cece6c4e6eb04337c11221 100644 --- a/crates/gpui/src/platform/mac/display_link.rs +++ b/crates/gpui/src/platform/mac/display_link.rs @@ -103,7 +103,7 @@ mod sys { use anyhow::Result; use core_graphics::display::CGDirectDisplayID; - use foreign_types::{foreign_type, ForeignType}; + use foreign_types::{ForeignType, foreign_type}; use std::{ ffi::c_void, fmt::{self, Debug, Formatter}, diff --git a/crates/gpui/src/platform/mac/events.rs b/crates/gpui/src/platform/mac/events.rs index f91551427531cba967690107c4e7590acd03bde2..34805c5bb28b1323ae3db5119f8e8104aa567968 100644 --- a/crates/gpui/src/platform/mac/events.rs +++ b/crates/gpui/src/platform/mac/events.rs @@ -1,15 +1,16 @@ use crate::{ - platform::mac::{ - kTISPropertyUnicodeKeyLayoutData, LMGetKbdType, NSStringExt, - TISCopyCurrentKeyboardLayoutInputSource, TISGetInputSourceProperty, UCKeyTranslate, - }, - point, px, KeyDownEvent, KeyUpEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, + KeyDownEvent, KeyUpEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseExitEvent, MouseMoveEvent, MouseUpEvent, NavigationDirection, Pixels, PlatformInput, ScrollDelta, ScrollWheelEvent, TouchPhase, + platform::mac::{ + LMGetKbdType, NSStringExt, TISCopyCurrentKeyboardLayoutInputSource, + TISGetInputSourceProperty, UCKeyTranslate, kTISPropertyUnicodeKeyLayoutData, + }, + point, px, }; use cocoa::{ appkit::{NSEvent, NSEventModifierFlags, NSEventPhase, NSEventType}, - base::{id, YES}, + base::{YES, id}, }; use core_foundation::data::{CFDataGetBytePtr, CFDataRef}; use core_graphics::event::CGKeyCode; diff --git a/crates/gpui/src/platform/mac/metal_atlas.rs b/crates/gpui/src/platform/mac/metal_atlas.rs index 4662761a7d32a26b5b22111f8eb00cc71d2c90c6..e3c7d147bc2579e1ca889b2f99539d9828eab80e 100644 --- a/crates/gpui/src/platform/mac/metal_atlas.rs +++ b/crates/gpui/src/platform/mac/metal_atlas.rs @@ -1,8 +1,8 @@ use crate::{ - platform::AtlasTextureList, AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, - DevicePixels, PlatformAtlas, Point, Size, + AtlasKey, AtlasTextureId, AtlasTextureKind, AtlasTile, Bounds, DevicePixels, PlatformAtlas, + Point, Size, platform::AtlasTextureList, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::FxHashMap; use derive_more::{Deref, DerefMut}; use etagere::BucketedAtlasAllocator; diff --git a/crates/gpui/src/platform/mac/metal_renderer.rs b/crates/gpui/src/platform/mac/metal_renderer.rs index 0ed718292dfc5c21c926c1a28ed999803b2c9ab8..832ffab5c3ea73a4b70b51268f173bdcc39499ef 100644 --- a/crates/gpui/src/platform/mac/metal_renderer.rs +++ b/crates/gpui/src/platform/mac/metal_renderer.rs @@ -1,10 +1,10 @@ use super::metal_atlas::MetalAtlas; use crate::{ - point, size, AtlasTextureId, AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, - DevicePixels, MonochromeSprite, PaintSurface, Path, PathId, PathVertex, PolychromeSprite, - PrimitiveBatch, Quad, ScaledPixels, Scene, Shadow, Size, Surface, Underline, + AtlasTextureId, AtlasTextureKind, AtlasTile, Background, Bounds, ContentMask, DevicePixels, + MonochromeSprite, PaintSurface, Path, PathId, PathVertex, PolychromeSprite, PrimitiveBatch, + Quad, ScaledPixels, Scene, Shadow, Size, Surface, Underline, point, size, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use block::ConcreteBlock; use cocoa::{ base::{NO, YES}, diff --git a/crates/gpui/src/platform/mac/open_type.rs b/crates/gpui/src/platform/mac/open_type.rs index 51529beb9cad7d8702707c3ca194530f97776806..2ae5e8f87ab78a70e423a4645c96e69f098828a6 100644 --- a/crates/gpui/src/platform/mac/open_type.rs +++ b/crates/gpui/src/platform/mac/open_type.rs @@ -4,13 +4,12 @@ use crate::{FontFallbacks, FontFeatures}; use cocoa::appkit::CGFloat; use core_foundation::{ array::{ - kCFTypeArrayCallBacks, CFArray, CFArrayAppendArray, CFArrayAppendValue, - CFArrayCreateMutable, CFArrayGetCount, CFArrayGetValueAtIndex, CFArrayRef, - CFMutableArrayRef, + CFArray, CFArrayAppendArray, CFArrayAppendValue, CFArrayCreateMutable, CFArrayGetCount, + CFArrayGetValueAtIndex, CFArrayRef, CFMutableArrayRef, kCFTypeArrayCallBacks, }, - base::{kCFAllocatorDefault, CFRelease, TCFType}, + base::{CFRelease, TCFType, kCFAllocatorDefault}, dictionary::{ - kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks, CFDictionaryCreate, + CFDictionaryCreate, kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks, }, number::CFNumber, string::{CFString, CFStringRef}, @@ -18,12 +17,11 @@ use core_foundation::{ use core_foundation_sys::locale::CFLocaleCopyPreferredLanguages; use core_graphics::{display::CFDictionary, geometry::CGAffineTransform}; use core_text::{ - font::{cascade_list_for_languages, CTFont, CTFontRef}, + font::{CTFont, CTFontRef, cascade_list_for_languages}, font_descriptor::{ - kCTFontCascadeListAttribute, kCTFontFeatureSettingsAttribute, CTFontDescriptor, - CTFontDescriptorCopyAttributes, CTFontDescriptorCreateCopyWithFeature, + CTFontDescriptor, CTFontDescriptorCopyAttributes, CTFontDescriptorCreateCopyWithFeature, CTFontDescriptorCreateWithAttributes, CTFontDescriptorCreateWithNameAndSize, - CTFontDescriptorRef, + CTFontDescriptorRef, kCTFontCascadeListAttribute, kCTFontFeatureSettingsAttribute, }, }; use font_kit::font::Font as FontKitFont; diff --git a/crates/gpui/src/platform/mac/platform.rs b/crates/gpui/src/platform/mac/platform.rs index cd9a22eb77eca709517ad694d7b7790b9417e48b..c830522cbe2cd87354ad66504478a3fac437234d 100644 --- a/crates/gpui/src/platform/mac/platform.rs +++ b/crates/gpui/src/platform/mac/platform.rs @@ -1,16 +1,17 @@ use super::{ + BoolExt, attributed_string::{NSAttributedString, NSMutableAttributedString}, events::key_to_native, - renderer, screen_capture, BoolExt, + renderer, screen_capture, }; use crate::{ - hash, Action, AnyWindowHandle, BackgroundExecutor, ClipboardEntry, ClipboardItem, - ClipboardString, CursorStyle, ForegroundExecutor, Image, ImageFormat, Keymap, MacDispatcher, - MacDisplay, MacWindow, Menu, MenuItem, PathPromptOptions, Platform, PlatformDisplay, - PlatformTextSystem, PlatformWindow, Result, ScreenCaptureSource, SemanticVersion, Task, - WindowAppearance, WindowParams, + Action, AnyWindowHandle, BackgroundExecutor, ClipboardEntry, ClipboardItem, ClipboardString, + CursorStyle, ForegroundExecutor, Image, ImageFormat, Keymap, MacDispatcher, MacDisplay, + MacWindow, Menu, MenuItem, PathPromptOptions, Platform, PlatformDisplay, PlatformTextSystem, + PlatformWindow, Result, ScreenCaptureSource, SemanticVersion, Task, WindowAppearance, + WindowParams, hash, }; -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use block::ConcreteBlock; use cocoa::{ appkit::{ @@ -19,7 +20,7 @@ use cocoa::{ NSPasteboardTypePNG, NSPasteboardTypeRTF, NSPasteboardTypeRTFD, NSPasteboardTypeString, NSPasteboardTypeTIFF, NSSavePanel, NSWindow, }, - base::{id, nil, selector, BOOL, NO, YES}, + base::{BOOL, NO, YES, id, nil, selector}, foundation::{ NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSProcessInfo, NSRange, NSString, NSUInteger, NSURL, @@ -47,7 +48,7 @@ use ptr::null_mut; use std::{ cell::Cell, convert::TryInto, - ffi::{c_void, CStr, OsStr}, + ffi::{CStr, OsStr, c_void}, os::{raw::c_char, unix::ffi::OsStrExt}, path::{Path, PathBuf}, process::Command, diff --git a/crates/gpui/src/platform/mac/screen_capture.rs b/crates/gpui/src/platform/mac/screen_capture.rs index c248cebeb8d57dcc7028adfa3a64db4694ac92f7..900e9d2181dac554c9ecd9920616e562fa6236b6 100644 --- a/crates/gpui/src/platform/mac/screen_capture.rs +++ b/crates/gpui/src/platform/mac/screen_capture.rs @@ -1,11 +1,12 @@ use crate::{ + Pixels, Size, platform::{ScreenCaptureFrame, ScreenCaptureSource, ScreenCaptureStream}, - px, size, Pixels, Size, + px, size, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use block::ConcreteBlock; use cocoa::{ - base::{id, nil, YES}, + base::{YES, id, nil}, foundation::NSArray, }; use core_foundation::base::TCFType; diff --git a/crates/gpui/src/platform/mac/text_system.rs b/crates/gpui/src/platform/mac/text_system.rs index cfaa53315836742e1dc9d7aeb6d50730fa7f26ef..abc6cf46c4032105526a5a34dbc29ccc8381b935 100644 --- a/crates/gpui/src/platform/mac/text_system.rs +++ b/crates/gpui/src/platform/mac/text_system.rs @@ -1,8 +1,8 @@ use crate::{ - point, px, size, swap_rgba_pa_to_bgra, Bounds, DevicePixels, Font, FontFallbacks, FontFeatures, - FontId, FontMetrics, FontRun, FontStyle, FontWeight, GlyphId, LineLayout, Pixels, - PlatformTextSystem, Point, RenderGlyphParams, Result, ShapedGlyph, ShapedRun, SharedString, - Size, SUBPIXEL_VARIANTS, + Bounds, DevicePixels, Font, FontFallbacks, FontFeatures, FontId, FontMetrics, FontRun, + FontStyle, FontWeight, GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, + RenderGlyphParams, Result, SUBPIXEL_VARIANTS, ShapedGlyph, ShapedRun, SharedString, Size, + point, px, size, swap_rgba_pa_to_bgra, }; use anyhow::anyhow; use cocoa::appkit::CGFloat; @@ -14,7 +14,7 @@ use core_foundation::{ string::CFString, }; use core_graphics::{ - base::{kCGImageAlphaPremultipliedLast, CGGlyph}, + base::{CGGlyph, kCGImageAlphaPremultipliedLast}, color_space::CGColorSpace, context::CGContext, display::CGPoint, @@ -639,7 +639,7 @@ mod lenient_font_attributes { string::{CFString, CFStringRef}, }; use core_text::font_descriptor::{ - kCTFontFamilyNameAttribute, CTFontDescriptor, CTFontDescriptorCopyAttribute, + CTFontDescriptor, CTFontDescriptorCopyAttribute, kCTFontFamilyNameAttribute, }; pub fn family_name(descriptor: &CTFontDescriptor) -> Option { @@ -674,7 +674,7 @@ mod lenient_font_attributes { #[cfg(test)] mod tests { - use crate::{font, px, FontRun, GlyphId, MacTextSystem, PlatformTextSystem}; + use crate::{FontRun, GlyphId, MacTextSystem, PlatformTextSystem, font, px}; #[test] fn test_layout_line_bom_char() { @@ -697,7 +697,7 @@ mod tests { assert_eq!(layout.runs.len(), 1); assert_eq!(layout.runs[0].glyphs.len(), 2); assert_eq!(layout.runs[0].glyphs[0].id, GlyphId(68u32)); // a - // There's no glyph for \u{feff} + // There's no glyph for \u{feff} assert_eq!(layout.runs[0].glyphs[1].id, GlyphId(69u32)); // b } } diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index 8adf25f9f7f8ee7896f01176f4f286810af71808..e655e067f8885e569ce4fbfc770ef4b6c73039ac 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -1,11 +1,11 @@ -use super::{ns_string, renderer, MacDisplay, NSRange, NSStringExt}; +use super::{MacDisplay, NSRange, NSStringExt, ns_string, renderer}; use crate::{ - platform::PlatformInputHandler, point, px, size, AnyWindowHandle, Bounds, DisplayLink, - ExternalPaths, FileDropEvent, ForegroundExecutor, KeyDownEvent, Keystroke, Modifiers, - ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, - PlatformAtlas, PlatformDisplay, PlatformInput, PlatformWindow, Point, PromptLevel, - RequestFrameOptions, ScaledPixels, Size, Timer, WindowAppearance, WindowBackgroundAppearance, - WindowBounds, WindowKind, WindowParams, + AnyWindowHandle, Bounds, DisplayLink, ExternalPaths, FileDropEvent, ForegroundExecutor, + KeyDownEvent, Keystroke, Modifiers, ModifiersChangedEvent, MouseButton, MouseDownEvent, + MouseMoveEvent, MouseUpEvent, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, + PlatformWindow, Point, PromptLevel, RequestFrameOptions, ScaledPixels, Size, Timer, + WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowKind, WindowParams, + platform::PlatformInputHandler, point, px, size, }; use block::ConcreteBlock; use cocoa::{ @@ -28,7 +28,7 @@ use objc::{ class, declare::ClassDecl, msg_send, - runtime::{Class, Object, Protocol, Sel, BOOL, NO, YES}, + runtime::{BOOL, Class, NO, Object, Protocol, Sel, YES}, sel, sel_impl, }; use parking_lot::Mutex; @@ -36,7 +36,7 @@ use raw_window_handle as rwh; use smallvec::SmallVec; use std::{ cell::Cell, - ffi::{c_void, CStr}, + ffi::{CStr, c_void}, mem, ops::Range, path::PathBuf, @@ -1198,11 +1198,7 @@ fn get_scale_factor(native_window: id) -> f32 { // (if it is off-screen), though we'd expect to see viewDidChangeBackingProperties before // it was rendered for real. // Regardless, attempt to avoid the issue here. - if factor == 0.0 { - 2. - } else { - factor - } + if factor == 0.0 { 2. } else { factor } } unsafe fn get_window_state(object: &Object) -> Arc> { diff --git a/crates/gpui/src/platform/test/display.rs b/crates/gpui/src/platform/test/display.rs index 7a8f075c017f5e89dd4e67a6eb642de30ecac788..c4adb014aa523668677e1ba40b5499485a8932b5 100644 --- a/crates/gpui/src/platform/test/display.rs +++ b/crates/gpui/src/platform/test/display.rs @@ -1,4 +1,4 @@ -use crate::{px, Bounds, DisplayId, Pixels, PlatformDisplay, Point}; +use crate::{Bounds, DisplayId, Pixels, PlatformDisplay, Point, px}; use anyhow::{Ok, Result}; #[derive(Debug)] diff --git a/crates/gpui/src/platform/test/platform.rs b/crates/gpui/src/platform/test/platform.rs index cb29783c84ec3b6420a3c836d0df482f2cb8fdbb..e66465d2d2af90b8173ccc9943a76466dbec5d6d 100644 --- a/crates/gpui/src/platform/test/platform.rs +++ b/crates/gpui/src/platform/test/platform.rs @@ -1,7 +1,7 @@ use crate::{ - px, size, AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor, - Keymap, Platform, PlatformDisplay, PlatformTextSystem, ScreenCaptureFrame, ScreenCaptureSource, - ScreenCaptureStream, Task, TestDisplay, TestWindow, WindowAppearance, WindowParams, + AnyWindowHandle, BackgroundExecutor, ClipboardItem, CursorStyle, ForegroundExecutor, Keymap, + Platform, PlatformDisplay, PlatformTextSystem, ScreenCaptureFrame, ScreenCaptureSource, + ScreenCaptureStream, Task, TestDisplay, TestWindow, WindowAppearance, WindowParams, px, size, }; use anyhow::Result; use collections::VecDeque; @@ -16,7 +16,7 @@ use std::{ #[cfg(target_os = "windows")] use windows::Win32::{ Graphics::Imaging::{CLSID_WICImagingFactory, IWICImagingFactory}, - System::Com::{CoCreateInstance, CLSCTX_INPROC_SERVER}, + System::Com::{CLSCTX_INPROC_SERVER, CoCreateInstance}, }; /// TestPlatform implements the Platform trait for use in tests. diff --git a/crates/gpui/src/platform/windows/clipboard.rs b/crates/gpui/src/platform/windows/clipboard.rs index 5de057152f0b4f6d47262b447572cbd22986e584..19b5c6cacdfadb61ffa25eef12e75a06c495700c 100644 --- a/crates/gpui/src/platform/windows/clipboard.rs +++ b/crates/gpui/src/platform/windows/clipboard.rs @@ -12,7 +12,7 @@ use windows::Win32::{ GetClipboardData, GetClipboardFormatNameW, IsClipboardFormatAvailable, OpenClipboard, RegisterClipboardFormatW, SetClipboardData, }, - Memory::{GlobalAlloc, GlobalLock, GlobalUnlock, GMEM_MOVEABLE}, + Memory::{GMEM_MOVEABLE, GlobalAlloc, GlobalLock, GlobalUnlock}, Ole::{CF_HDROP, CF_UNICODETEXT}, }, UI::Shell::{DragQueryFileW, HDROP}, @@ -20,7 +20,7 @@ use windows::Win32::{ use windows_core::PCWSTR; use crate::{ - hash, ClipboardEntry, ClipboardItem, ClipboardString, Image, ImageFormat, SmartGlobal, + ClipboardEntry, ClipboardItem, ClipboardString, Image, ImageFormat, SmartGlobal, hash, }; // https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-dragqueryfilew diff --git a/crates/gpui/src/platform/windows/direct_write.rs b/crates/gpui/src/platform/windows/direct_write.rs index f323bc589265c5bc96656aa1d67ef1b0a3a50803..2e9a8af01ddfe49d45856134307f4c5625b30db9 100644 --- a/crates/gpui/src/platform/windows/direct_write.rs +++ b/crates/gpui/src/platform/windows/direct_write.rs @@ -1,13 +1,12 @@ use std::{borrow::Cow, sync::Arc}; use ::util::ResultExt; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use itertools::Itertools; use parking_lot::{RwLock, RwLockUpgradableReadGuard}; use smallvec::SmallVec; use windows::{ - core::*, Win32::{ Foundation::*, Globalization::GetUserDefaultLocaleName, @@ -21,6 +20,7 @@ use windows::{ System::SystemServices::LOCALE_NAME_MAX_LENGTH, UI::WindowsAndMessaging::*, }, + core::*, }; use windows_numerics::Vector2; diff --git a/crates/gpui/src/platform/windows/dispatcher.rs b/crates/gpui/src/platform/windows/dispatcher.rs index 6ce63612bbce04403f6fe7ec14541e94c0ea55f1..d88aadcf716506466fbcf0933c725efd58fac124 100644 --- a/crates/gpui/src/platform/windows/dispatcher.rs +++ b/crates/gpui/src/platform/windows/dispatcher.rs @@ -1,5 +1,5 @@ use std::{ - thread::{current, ThreadId}, + thread::{ThreadId, current}, time::Duration, }; diff --git a/crates/gpui/src/platform/windows/display.rs b/crates/gpui/src/platform/windows/display.rs index 25631672c4ceba1398d04b229761e145064af3db..34e00c86b9dd45907f3ccdea18d891dbf9fe1830 100644 --- a/crates/gpui/src/platform/windows/display.rs +++ b/crates/gpui/src/platform/windows/display.rs @@ -4,7 +4,6 @@ use std::rc::Rc; use util::ResultExt; use uuid::Uuid; use windows::{ - core::*, Win32::{ Foundation::*, Graphics::Gdi::*, @@ -13,9 +12,10 @@ use windows::{ WindowsAndMessaging::USER_DEFAULT_SCREEN_DPI, }, }, + core::*, }; -use crate::{logical_point, point, size, Bounds, DevicePixels, DisplayId, Pixels, PlatformDisplay}; +use crate::{Bounds, DevicePixels, DisplayId, Pixels, PlatformDisplay, logical_point, point, size}; #[derive(Debug, Clone, Copy)] pub(crate) struct WindowsDisplay { diff --git a/crates/gpui/src/platform/windows/events.rs b/crates/gpui/src/platform/windows/events.rs index 24c766c891c86edcaf0a72da4305e44bdbd263f6..e12991c4ef428b511f027b5331ef2d6dedbfd4c9 100644 --- a/crates/gpui/src/platform/windows/events.rs +++ b/crates/gpui/src/platform/windows/events.rs @@ -3,7 +3,6 @@ use std::rc::Rc; use ::util::ResultExt; use anyhow::Context as _; use windows::{ - core::PCWSTR, Win32::{ Foundation::*, Graphics::Gdi::*, @@ -15,6 +14,7 @@ use windows::{ WindowsAndMessaging::*, }, }, + core::PCWSTR, }; use crate::*; @@ -232,11 +232,7 @@ fn handle_close_msg(state_ptr: Rc) -> Option { drop(lock); let should_close = callback(); state_ptr.state.borrow_mut().callbacks.should_close = Some(callback); - if should_close { - None - } else { - Some(0) - } + if should_close { None } else { Some(0) } } else { None } diff --git a/crates/gpui/src/platform/windows/platform.rs b/crates/gpui/src/platform/windows/platform.rs index 46446504251247e1be9ecc6d7c8247448827c8ae..e991bc93c63ad5bd3bbaa51bc1df249f94122cc9 100644 --- a/crates/gpui/src/platform/windows/platform.rs +++ b/crates/gpui/src/platform/windows/platform.rs @@ -6,15 +6,18 @@ use std::{ sync::Arc, }; -use ::util::{paths::SanitizedPath, ResultExt}; -use anyhow::{anyhow, Context as _, Result}; +use ::util::{ResultExt, paths::SanitizedPath}; +use anyhow::{Context as _, Result, anyhow}; use async_task::Runnable; use futures::channel::oneshot::{self, Receiver}; use itertools::Itertools; use parking_lot::RwLock; use smallvec::SmallVec; use windows::{ - core::*, + UI::{ + StartScreen::{JumpList, JumpListItem}, + ViewManagement::UISettings, + }, Win32::{ Foundation::*, Graphics::{ @@ -25,10 +28,7 @@ use windows::{ System::{Com::*, LibraryLoader::*, Ole::*, SystemInformation::*, Threading::*}, UI::{Input::KeyboardAndMouse::*, Shell::*, WindowsAndMessaging::*}, }, - UI::{ - StartScreen::{JumpList, JumpListItem}, - ViewManagement::UISettings, - }, + core::*, }; use crate::{platform::blade::BladeContext, *}; @@ -826,7 +826,7 @@ fn should_auto_hide_scrollbars() -> Result { #[cfg(test)] mod tests { - use crate::{read_from_clipboard, write_to_clipboard, ClipboardItem}; + use crate::{ClipboardItem, read_from_clipboard, write_to_clipboard}; #[test] fn test_clipboard() { diff --git a/crates/gpui/src/platform/windows/system_settings.rs b/crates/gpui/src/platform/windows/system_settings.rs index 8bbc83fe43b713216c559fc7c72d444d180963d4..d8e3513b3c33da556a9258810cf86d8da9fe43a3 100644 --- a/crates/gpui/src/platform/windows/system_settings.rs +++ b/crates/gpui/src/platform/windows/system_settings.rs @@ -2,10 +2,10 @@ use std::ffi::{c_uint, c_void}; use ::util::ResultExt; use windows::Win32::UI::{ - Shell::{SHAppBarMessage, ABM_GETSTATE, ABM_GETTASKBARPOS, ABS_AUTOHIDE, APPBARDATA}, + Shell::{ABM_GETSTATE, ABM_GETTASKBARPOS, ABS_AUTOHIDE, APPBARDATA, SHAppBarMessage}, WindowsAndMessaging::{ - SystemParametersInfoW, SPI_GETWHEELSCROLLCHARS, SPI_GETWHEELSCROLLLINES, - SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS, + SPI_GETWHEELSCROLLCHARS, SPI_GETWHEELSCROLLLINES, SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS, + SystemParametersInfoW, }, }; diff --git a/crates/gpui/src/platform/windows/util.rs b/crates/gpui/src/platform/windows/util.rs index 6c3ef5e5ac08ab6772937348159e110a8e3a6237..aefde5e881cdecc509e8ddd6d8e7759f9783fdca 100644 --- a/crates/gpui/src/platform/windows/util.rs +++ b/crates/gpui/src/platform/windows/util.rs @@ -2,13 +2,13 @@ use std::sync::OnceLock; use ::util::ResultExt; use windows::{ - core::BOOL, - Wdk::System::SystemServices::RtlGetVersion, - Win32::{Foundation::*, Graphics::Dwm::*, UI::WindowsAndMessaging::*}, UI::{ Color, ViewManagement::{UIColorType, UISettings}, }, + Wdk::System::SystemServices::RtlGetVersion, + Win32::{Foundation::*, Graphics::Dwm::*, UI::WindowsAndMessaging::*}, + core::BOOL, }; use crate::*; diff --git a/crates/gpui/src/platform/windows/window.rs b/crates/gpui/src/platform/windows/window.rs index 65980a284c8ac8fcfb6f42f572855f3b0540a93c..c5d49d036b5e44cea4f308b44cb73aaadb5fc2f2 100644 --- a/crates/gpui/src/platform/windows/window.rs +++ b/crates/gpui/src/platform/windows/window.rs @@ -17,13 +17,13 @@ use futures::channel::oneshot::{self, Receiver}; use raw_window_handle as rwh; use smallvec::SmallVec; use windows::{ - core::*, Win32::{ Foundation::*, Graphics::Gdi::*, System::{Com::*, LibraryLoader::*, Ole::*, SystemServices::*}, UI::{Controls::*, HiDpi::*, Input::KeyboardAndMouse::*, Shell::*, WindowsAndMessaging::*}, }, + core::*, }; use crate::platform::blade::{BladeContext, BladeRenderer}; @@ -1326,7 +1326,7 @@ mod windows_renderer { #[cfg(test)] mod tests { use super::ClickState; - use crate::{point, DevicePixels, MouseButton}; + use crate::{DevicePixels, MouseButton, point}; use std::time::Duration; #[test] diff --git a/crates/gpui/src/prelude.rs b/crates/gpui/src/prelude.rs index 0cb57d534c4f67fb89591dda5f26a17eecd60d28..270f0a9341181e35669db16b9bddfb3aa6afd519 100644 --- a/crates/gpui/src/prelude.rs +++ b/crates/gpui/src/prelude.rs @@ -3,7 +3,7 @@ //! application to avoid having to import each trait individually. pub use crate::{ - util::FluentBuilder, AppContext as _, BorrowAppContext, Context, Element, FocusableElement, - InteractiveElement, IntoElement, ParentElement, Refineable, Render, RenderOnce, - StatefulInteractiveElement, Styled, StyledImage, VisualContext, + AppContext as _, BorrowAppContext, Context, Element, FocusableElement, InteractiveElement, + IntoElement, ParentElement, Refineable, Render, RenderOnce, StatefulInteractiveElement, Styled, + StyledImage, VisualContext, util::FluentBuilder, }; diff --git a/crates/gpui/src/scene.rs b/crates/gpui/src/scene.rs index 6271d6e88bdc463897109cd6bd4dcf00b8f76c7b..fc527bf620a0b62750721ea05d3562f20bbbb373 100644 --- a/crates/gpui/src/scene.rs +++ b/crates/gpui/src/scene.rs @@ -2,8 +2,8 @@ #![cfg_attr(windows, allow(dead_code))] use crate::{ - bounds_tree::BoundsTree, point, AtlasTextureId, AtlasTile, Background, Bounds, ContentMask, - Corners, Edges, Hsla, Pixels, Point, Radians, ScaledPixels, Size, + AtlasTextureId, AtlasTile, Background, Bounds, ContentMask, Corners, Edges, Hsla, Pixels, + Point, Radians, ScaledPixels, Size, bounds_tree::BoundsTree, point, }; use std::{fmt::Debug, iter::Peekable, ops::Range, slice}; diff --git a/crates/gpui/src/style.rs b/crates/gpui/src/style.rs index 5dbfa32a30836deab01ad6100196531eba0a53da..188576b46540d62f945b4b02344521dbb0f1d95f 100644 --- a/crates/gpui/src/style.rs +++ b/crates/gpui/src/style.rs @@ -5,11 +5,11 @@ use std::{ }; use crate::{ - black, phi, point, quad, rems, size, AbsoluteLength, App, Background, BackgroundTag, - BorderStyle, Bounds, ContentMask, Corners, CornersRefinement, CursorStyle, DefiniteLength, - DevicePixels, Edges, EdgesRefinement, Font, FontFallbacks, FontFeatures, FontStyle, FontWeight, - Hsla, Length, Pixels, Point, PointRefinement, Rgba, SharedString, Size, SizeRefinement, Styled, - TextRun, Window, + AbsoluteLength, App, Background, BackgroundTag, BorderStyle, Bounds, ContentMask, Corners, + CornersRefinement, CursorStyle, DefiniteLength, DevicePixels, Edges, EdgesRefinement, Font, + FontFallbacks, FontFeatures, FontStyle, FontWeight, Hsla, Length, Pixels, Point, + PointRefinement, Rgba, SharedString, Size, SizeRefinement, Styled, TextRun, Window, black, phi, + point, quad, rems, size, }; use collections::HashSet; use refineable::Refineable; diff --git a/crates/gpui/src/styled.rs b/crates/gpui/src/styled.rs index 96e77e8df91ae73a8fb9d93f9fe2f63d0f1b1358..569ab7757806de0512d63766cad262c24ebb1918 100644 --- a/crates/gpui/src/styled.rs +++ b/crates/gpui/src/styled.rs @@ -1,8 +1,8 @@ use crate::{ - self as gpui, px, relative, rems, AbsoluteLength, AlignItems, BorderStyle, CursorStyle, - DefiniteLength, Fill, FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla, - JustifyContent, Length, SharedString, StrikethroughStyle, StyleRefinement, TextOverflow, - UnderlineStyle, WhiteSpace, + self as gpui, AbsoluteLength, AlignItems, BorderStyle, CursorStyle, DefiniteLength, Fill, + FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla, JustifyContent, Length, + SharedString, StrikethroughStyle, StyleRefinement, TextOverflow, UnderlineStyle, WhiteSpace, + px, relative, rems, }; use crate::{TextAlign, TextStyleRefinement}; pub use gpui_macros::{ diff --git a/crates/gpui/src/taffy.rs b/crates/gpui/src/taffy.rs index 7b96a7f5754abe07d7bfac8d69577654c4544583..b8c71d9731a6bd0fa862edd771ddbd270ac4b9f0 100644 --- a/crates/gpui/src/taffy.rs +++ b/crates/gpui/src/taffy.rs @@ -5,10 +5,10 @@ use collections::{FxHashMap, FxHashSet}; use smallvec::SmallVec; use std::fmt::Debug; use taffy::{ + TaffyTree, TraversePartialTree as _, geometry::{Point as TaffyPoint, Rect as TaffyRect, Size as TaffySize}, style::AvailableSpace as TaffyAvailableSpace, tree::NodeId, - TaffyTree, TraversePartialTree as _, }; type NodeMeasureFn = Box< @@ -71,8 +71,13 @@ impl TaffyLayoutEngine { &mut self, style: Style, rem_size: Pixels, - measure: impl FnMut(Size>, Size, &mut Window, &mut App) -> Size - + 'static, + measure: impl FnMut( + Size>, + Size, + &mut Window, + &mut App, + ) -> Size + + 'static, ) -> LayoutId { let taffy_style = style.to_taffy(rem_size); diff --git a/crates/gpui/src/text_system.rs b/crates/gpui/src/text_system.rs index 2ab3a21f7d03915a99db3d41365bbb11495a2b91..216e14b6daef7a3f3459f84275374c33305c2d14 100644 --- a/crates/gpui/src/text_system.rs +++ b/crates/gpui/src/text_system.rs @@ -13,8 +13,8 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::{ - px, Bounds, DevicePixels, Hsla, Pixels, PlatformTextSystem, Point, Result, SharedString, Size, - StrikethroughStyle, UnderlineStyle, + Bounds, DevicePixels, Hsla, Pixels, PlatformTextSystem, Point, Result, SharedString, Size, + StrikethroughStyle, UnderlineStyle, px, }; use anyhow::anyhow; use collections::FxHashMap; @@ -22,7 +22,7 @@ use core::fmt; use derive_more::Deref; use itertools::Itertools; use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use std::{ borrow::Cow, cmp, diff --git a/crates/gpui/src/text_system/line.rs b/crates/gpui/src/text_system/line.rs index ca2a9e9a728469fc36a571f0b3992451c3ea0349..1ebec668c7024213f8e9cb5b2297cfcf33065377 100644 --- a/crates/gpui/src/text_system/line.rs +++ b/crates/gpui/src/text_system/line.rs @@ -1,7 +1,7 @@ use crate::{ - black, fill, point, px, size, App, Bounds, Half, Hsla, LineLayout, Pixels, Point, Result, - SharedString, StrikethroughStyle, TextAlign, UnderlineStyle, Window, WrapBoundary, - WrappedLineLayout, + App, Bounds, Half, Hsla, LineLayout, Pixels, Point, Result, SharedString, StrikethroughStyle, + TextAlign, UnderlineStyle, Window, WrapBoundary, WrappedLineLayout, black, fill, point, px, + size, }; use derive_more::{Deref, DerefMut}; use smallvec::SmallVec; diff --git a/crates/gpui/src/text_system/line_layout.rs b/crates/gpui/src/text_system/line_layout.rs index 200ea1be51c648a50d369a09612b6f43af47eca5..8a5d35628a4423166cbdccbb0a9955df75534883 100644 --- a/crates/gpui/src/text_system/line_layout.rs +++ b/crates/gpui/src/text_system/line_layout.rs @@ -1,4 +1,4 @@ -use crate::{point, px, FontId, GlyphId, Pixels, PlatformTextSystem, Point, SharedString, Size}; +use crate::{FontId, GlyphId, Pixels, PlatformTextSystem, Point, SharedString, Size, point, px}; use collections::FxHashMap; use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard}; use smallvec::SmallVec; diff --git a/crates/gpui/src/text_system/line_wrapper.rs b/crates/gpui/src/text_system/line_wrapper.rs index b7a783a728815698ecd3f80b173dea1540997309..d0bafe1d0325fa18d4a5dc49573812e9b73b1eb4 100644 --- a/crates/gpui/src/text_system/line_wrapper.rs +++ b/crates/gpui/src/text_system/line_wrapper.rs @@ -1,4 +1,4 @@ -use crate::{px, FontId, FontRun, Pixels, PlatformTextSystem, SharedString, TextRun}; +use crate::{FontId, FontRun, Pixels, PlatformTextSystem, SharedString, TextRun, px}; use collections::HashMap; use std::{iter, sync::Arc}; @@ -232,7 +232,7 @@ impl Boundary { mod tests { use super::*; use crate::{ - font, Font, FontFeatures, FontStyle, FontWeight, Hsla, TestAppContext, TestDispatcher, + Font, FontFeatures, FontStyle, FontWeight, Hsla, TestAppContext, TestDispatcher, font, }; #[cfg(target_os = "macos")] use crate::{TextRun, WindowTextSystem, WrapBoundary}; @@ -242,11 +242,11 @@ mod tests { let dispatcher = TestDispatcher::new(StdRng::seed_from_u64(0)); let cx = TestAppContext::new(dispatcher, None); cx.text_system() - .add_fonts(vec![std::fs::read( - "../../assets/fonts/plex-mono/ZedPlexMono-Regular.ttf", - ) - .unwrap() - .into()]) + .add_fonts(vec![ + std::fs::read("../../assets/fonts/plex-mono/ZedPlexMono-Regular.ttf") + .unwrap() + .into(), + ]) .unwrap(); let id = cx.text_system().font_id(&font("Zed Plex Mono")).unwrap(); LineWrapper::new(id, px(16.), cx.text_system().platform_text_system.clone()) diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index 10e6f9d90d8385b85ca97c9c409be6b994a5a18a..4d1115abc5f28aefa16a6e3c734205805891584c 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -1,27 +1,27 @@ use crate::{ - point, prelude::*, px, size, transparent_black, Action, AnyDrag, AnyElement, AnyTooltip, - AnyView, App, AppContext, Arena, Asset, AsyncWindowContext, AvailableSpace, Background, - BorderStyle, Bounds, BoxShadow, Context, Corners, CursorStyle, Decorations, DevicePixels, - DispatchActionListener, DispatchNodeId, DispatchTree, DisplayId, Edges, Effect, Entity, - EntityId, EventEmitter, FileDropEvent, FontId, Global, GlobalElementId, GlyphId, GpuSpecs, - Hsla, InputHandler, IsZero, KeyBinding, KeyContext, KeyDownEvent, KeyEvent, Keystroke, - KeystrokeEvent, LayoutId, LineLayoutIndex, Modifiers, ModifiersChangedEvent, MonochromeSprite, - MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent, Path, Pixels, PlatformAtlas, - PlatformDisplay, PlatformInput, PlatformInputHandler, PlatformWindow, Point, PolychromeSprite, - PromptLevel, Quad, Render, RenderGlyphParams, RenderImage, RenderImageParams, RenderSvgParams, - Replay, ResizeEdge, ScaledPixels, Scene, Shadow, SharedString, Size, StrikethroughStyle, Style, + Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, AppContext, Arena, Asset, + AsyncWindowContext, AvailableSpace, Background, BorderStyle, Bounds, BoxShadow, Context, + Corners, CursorStyle, Decorations, DevicePixels, DispatchActionListener, DispatchNodeId, + DispatchTree, DisplayId, Edges, Effect, Entity, EntityId, EventEmitter, FileDropEvent, FontId, + Global, GlobalElementId, GlyphId, GpuSpecs, Hsla, InputHandler, IsZero, KeyBinding, KeyContext, + KeyDownEvent, KeyEvent, Keystroke, KeystrokeEvent, LayoutId, LineLayoutIndex, Modifiers, + ModifiersChangedEvent, MonochromeSprite, MouseButton, MouseEvent, MouseMoveEvent, MouseUpEvent, + Path, Pixels, PlatformAtlas, PlatformDisplay, PlatformInput, PlatformInputHandler, + PlatformWindow, Point, PolychromeSprite, PromptLevel, Quad, Render, RenderGlyphParams, + RenderImage, RenderImageParams, RenderSvgParams, Replay, ResizeEdge, SMOOTH_SVG_SCALE_FACTOR, + SUBPIXEL_VARIANTS, ScaledPixels, Scene, Shadow, SharedString, Size, StrikethroughStyle, Style, SubscriberSet, Subscription, TaffyLayoutEngine, Task, TextStyle, TextStyleRefinement, TransformationMatrix, Underline, UnderlineStyle, WindowAppearance, WindowBackgroundAppearance, WindowBounds, WindowControls, WindowDecorations, WindowOptions, WindowParams, WindowTextSystem, - SMOOTH_SVG_SCALE_FACTOR, SUBPIXEL_VARIANTS, + point, prelude::*, px, size, transparent_black, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{FxHashMap, FxHashSet}; #[cfg(target_os = "macos")] use core_video::pixel_buffer::CVPixelBuffer; use derive_more::{Deref, DerefMut}; -use futures::channel::oneshot; use futures::FutureExt; +use futures::channel::oneshot; use parking_lot::RwLock; use raw_window_handle::{HandleError, HasWindowHandle}; use refineable::Refineable; @@ -39,13 +39,13 @@ use std::{ ops::{DerefMut, Range}, rc::Rc, sync::{ - atomic::{AtomicUsize, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicUsize, Ordering::SeqCst}, }, time::{Duration, Instant}, }; use util::post_inc; -use util::{measure, ResultExt}; +use util::{ResultExt, measure}; use uuid::Uuid; mod prompts; diff --git a/crates/gpui/src/window/prompts.rs b/crates/gpui/src/window/prompts.rs index 3c52afc1b0241cd4a553c962bce958f80bc973e6..f3307b3861a15382e8f35af1bc0fae5ba269bb23 100644 --- a/crates/gpui/src/window/prompts.rs +++ b/crates/gpui/src/window/prompts.rs @@ -3,9 +3,9 @@ use std::ops::Deref; use futures::channel::oneshot; use crate::{ - div, opaque_grey, white, AnyView, App, AppContext as _, Context, Entity, EventEmitter, - FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement, PromptLevel, Render, - StatefulInteractiveElement, Styled, + AnyView, App, AppContext as _, Context, Entity, EventEmitter, FocusHandle, Focusable, + InteractiveElement, IntoElement, ParentElement, PromptLevel, Render, + StatefulInteractiveElement, Styled, div, opaque_grey, white, }; use super::Window; diff --git a/crates/gpui_macros/src/derive_app_context.rs b/crates/gpui_macros/src/derive_app_context.rs index 37ef83e3b8a7700badda2b537078079fc195d06a..bca015b8dc5ab43c0a6873f03251d68e2d0b592b 100644 --- a/crates/gpui_macros/src/derive_app_context.rs +++ b/crates/gpui_macros/src/derive_app_context.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; use crate::get_simple_attribute_field; diff --git a/crates/gpui_macros/src/derive_into_element.rs b/crates/gpui_macros/src/derive_into_element.rs index 4e244e80538cf413c9fe4b139307d6aebbc1eefb..a73745856955c94a89fb2a2d54836c6f67fa2907 100644 --- a/crates/gpui_macros/src/derive_into_element.rs +++ b/crates/gpui_macros/src/derive_into_element.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; pub fn derive_into_element(input: TokenStream) -> TokenStream { let ast = parse_macro_input!(input as DeriveInput); diff --git a/crates/gpui_macros/src/derive_path_static_str.rs b/crates/gpui_macros/src/derive_path_static_str.rs index 25531fd2adf9d5c04a247da0b3f14f48523a1b0f..80ac813c4a70dc6415bf3c8329debcec107b90ed 100644 --- a/crates/gpui_macros/src/derive_path_static_str.rs +++ b/crates/gpui_macros/src/derive_path_static_str.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, Attribute, Data, DeriveInput, Lit, Meta, NestedMeta}; +use syn::{Attribute, Data, DeriveInput, Lit, Meta, NestedMeta, parse_macro_input}; pub fn derive_path_static_str(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); diff --git a/crates/gpui_macros/src/derive_render.rs b/crates/gpui_macros/src/derive_render.rs index 2be0177d327ea7584beed09dabadf8c067f6526f..3e0dcbc993d05a4a4359cd8e65c689c898741a1c 100644 --- a/crates/gpui_macros/src/derive_render.rs +++ b/crates/gpui_macros/src/derive_render.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; pub fn derive_render(input: TokenStream) -> TokenStream { let ast = parse_macro_input!(input as DeriveInput); diff --git a/crates/gpui_macros/src/derive_visual_context.rs b/crates/gpui_macros/src/derive_visual_context.rs index 97a0c7493b829355c0842d667e11a4af5d597e19..f2681bb29b92f31d31599ebb7201a42a482283d8 100644 --- a/crates/gpui_macros/src/derive_visual_context.rs +++ b/crates/gpui_macros/src/derive_visual_context.rs @@ -1,6 +1,6 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput}; +use syn::{DeriveInput, parse_macro_input}; use super::get_simple_attribute_field; diff --git a/crates/gpui_macros/src/styles.rs b/crates/gpui_macros/src/styles.rs index 20d36c1c915d7ffb1aa25f710a632817025dee08..b8a4d8ac2f7a599697a9d9a29f73133ba216a266 100644 --- a/crates/gpui_macros/src/styles.rs +++ b/crates/gpui_macros/src/styles.rs @@ -2,9 +2,9 @@ use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::{ - braced, + Token, Visibility, braced, parse::{Parse, ParseStream, Result}, - parse_macro_input, Token, Visibility, + parse_macro_input, }; #[derive(Debug)] diff --git a/crates/gpui_macros/src/test.rs b/crates/gpui_macros/src/test.rs index 5ee4662ff3f96b94470d7befc136860244886c91..62edca2489133f93f1b9c3f13c9827581af7baae 100644 --- a/crates/gpui_macros/src/test.rs +++ b/crates/gpui_macros/src/test.rs @@ -3,8 +3,8 @@ use proc_macro2::Ident; use quote::{format_ident, quote}; use std::mem; use syn::{ - parse_quote, spanned::Spanned, AttributeArgs, FnArg, ItemFn, Lit, Meta, MetaList, NestedMeta, - PathSegment, Type, + AttributeArgs, FnArg, ItemFn, Lit, Meta, MetaList, NestedMeta, PathSegment, Type, parse_quote, + spanned::Spanned, }; pub fn test(args: TokenStream, function: TokenStream) -> TokenStream { diff --git a/crates/html_to_markdown/src/structure/wikipedia.rs b/crates/html_to_markdown/src/structure/wikipedia.rs index fdbc6bc982a9b39f238f0b7ec730a0cb960db6c7..c8d399a6610dcbc7beea939dfae2eacb8b0512ad 100644 --- a/crates/html_to_markdown/src/structure/wikipedia.rs +++ b/crates/html_to_markdown/src/structure/wikipedia.rs @@ -1,6 +1,6 @@ +use crate::HandleTag; use crate::html_element::HtmlElement; use crate::markdown_writer::{HandlerOutcome, MarkdownWriter, StartTagOutcome}; -use crate::HandleTag; pub struct WikipediaChromeRemover; @@ -148,7 +148,7 @@ mod tests { use indoc::indoc; use pretty_assertions::assert_eq; - use crate::{convert_html_to_markdown, markdown, TagHandler}; + use crate::{TagHandler, convert_html_to_markdown, markdown}; use super::*; diff --git a/crates/http_client/src/github.rs b/crates/http_client/src/github.rs index 649daa9e319ab274afb3803fc1697c7475bc2a72..bace2f989fd6323ac662a28b8da0dc777697a7fc 100644 --- a/crates/http_client/src/github.rs +++ b/crates/http_client/src/github.rs @@ -1,5 +1,5 @@ use crate::HttpClient; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use futures::AsyncReadExt; use serde::Deserialize; use std::sync::Arc; @@ -147,7 +147,7 @@ pub fn build_asset_url(repo_name_with_owner: &str, tag: &str, kind: AssetKind) - #[cfg(test)] mod tests { - use crate::github::{build_asset_url, AssetKind}; + use crate::github::{AssetKind, build_asset_url}; #[test] fn test_build_asset_url() { diff --git a/crates/http_client/src/http_client.rs b/crates/http_client/src/http_client.rs index ebf296c27d65d8315f594d4558bd5d7d7ec8727e..cbbc2f710bf8805aec178b4a7597eb79c7bbcc9a 100644 --- a/crates/http_client/src/http_client.rs +++ b/crates/http_client/src/http_client.rs @@ -1,7 +1,7 @@ mod async_body; pub mod github; -pub use anyhow::{anyhow, Result}; +pub use anyhow::{Result, anyhow}; pub use async_body::{AsyncBody, Inner}; use derive_more::Deref; pub use http::{self, Method, Request, Response, StatusCode, Uri}; diff --git a/crates/image_viewer/src/image_info.rs b/crates/image_viewer/src/image_info.rs index dfee77a22ff638f93302689142352919e9a09f1b..365a2e381de790872146aa9cf0bf0aa837ff85ee 100644 --- a/crates/image_viewer/src/image_info.rs +++ b/crates/image_viewer/src/image_info.rs @@ -1,4 +1,4 @@ -use gpui::{div, Context, Entity, IntoElement, ParentElement, Render, Subscription}; +use gpui::{Context, Entity, IntoElement, ParentElement, Render, Subscription, div}; use project::image_store::{ImageFormat, ImageMetadata}; use settings::Settings; use ui::prelude::*; diff --git a/crates/image_viewer/src/image_viewer.rs b/crates/image_viewer/src/image_viewer.rs index 43e1d7c21e767bd0bce04a7b9db5f5a667e090ec..b9efa8aaa5b1f472a790c5dfc42e1eb88757f332 100644 --- a/crates/image_viewer/src/image_viewer.rs +++ b/crates/image_viewer/src/image_viewer.rs @@ -4,22 +4,22 @@ mod image_viewer_settings; use std::path::PathBuf; use anyhow::Context as _; -use editor::{items::entry_git_aware_label_color, EditorSettings}; +use editor::{EditorSettings, items::entry_git_aware_label_color}; use file_icons::FileIcons; use gpui::{ - canvas, div, fill, img, opaque_grey, point, size, AnyElement, App, Bounds, Context, Entity, - EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, ObjectFit, - ParentElement, Render, Styled, Task, WeakEntity, Window, + AnyElement, App, Bounds, Context, Entity, EventEmitter, FocusHandle, Focusable, + InteractiveElement, IntoElement, ObjectFit, ParentElement, Render, Styled, Task, WeakEntity, + Window, canvas, div, fill, img, opaque_grey, point, size, }; use persistence::IMAGE_VIEWER; -use project::{image_store::ImageItemEvent, ImageItem, Project, ProjectPath}; +use project::{ImageItem, Project, ProjectPath, image_store::ImageItemEvent}; use settings::Settings; use theme::Theme; use ui::prelude::*; use util::paths::PathExt; use workspace::{ - item::{BreadcrumbText, Item, ProjectItem, SerializableItem, TabContentParams}, ItemId, ItemSettings, Pane, ToolbarItemLocation, Workspace, WorkspaceId, + item::{BreadcrumbText, Item, ProjectItem, SerializableItem, TabContentParams}, }; pub use crate::image_info::*; diff --git a/crates/indexed_docs/src/providers/rustdoc.rs b/crates/indexed_docs/src/providers/rustdoc.rs index d4a69f0ebf13493f0371eac148f1529d3eecd1b8..cda93fdc5367b796c16e7efe7afb4c2a6cf4f06f 100644 --- a/crates/indexed_docs/src/providers/rustdoc.rs +++ b/crates/indexed_docs/src/providers/rustdoc.rs @@ -12,7 +12,7 @@ use std::path::PathBuf; use std::sync::{Arc, LazyLock}; use std::time::{Duration, Instant}; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use async_trait::async_trait; use collections::{HashSet, VecDeque}; use fs::Fs; @@ -209,9 +209,12 @@ impl IndexedDocsProvider for DocsDotRsProvider { async fn index_rustdoc( package: PackageName, database: Arc, - fetch_page: impl Fn(&PackageName, Option<&RustdocItem>) -> BoxFuture<'static, Result>> - + Send - + Sync, + fetch_page: impl Fn( + &PackageName, + Option<&RustdocItem>, + ) -> BoxFuture<'static, Result>> + + Send + + Sync, ) -> Result<()> { let Some(package_root_content) = fetch_page(&package, None).await? else { return Ok(()); diff --git a/crates/indexed_docs/src/providers/rustdoc/to_markdown.rs b/crates/indexed_docs/src/providers/rustdoc/to_markdown.rs index 63d5d7913ca4d54477c729b37bff9485e9a414d7..87e3863728c5822c19edf4b1dc79283d95b40481 100644 --- a/crates/indexed_docs/src/providers/rustdoc/to_markdown.rs +++ b/crates/indexed_docs/src/providers/rustdoc/to_markdown.rs @@ -7,8 +7,8 @@ use html_to_markdown::markdown::{ HeadingHandler, ListHandler, ParagraphHandler, StyledTextHandler, TableHandler, }; use html_to_markdown::{ - convert_html_to_markdown, HandleTag, HandlerOutcome, HtmlElement, MarkdownWriter, - StartTagOutcome, TagHandler, + HandleTag, HandlerOutcome, HtmlElement, MarkdownWriter, StartTagOutcome, TagHandler, + convert_html_to_markdown, }; use indexmap::IndexSet; use strum::IntoEnumIterator; @@ -326,7 +326,7 @@ impl HandleTag for RustdocItemCollector { #[cfg(test)] mod tests { - use html_to_markdown::{convert_html_to_markdown, TagHandler}; + use html_to_markdown::{TagHandler, convert_html_to_markdown}; use indoc::indoc; use pretty_assertions::assert_eq; diff --git a/crates/indexed_docs/src/store.rs b/crates/indexed_docs/src/store.rs index 41bdaad81736015669521a3b56ba3b81bfa057d9..191075a2a9a5bfba89cd5b9acfcc36fd97daaf85 100644 --- a/crates/indexed_docs/src/store.rs +++ b/crates/indexed_docs/src/store.rs @@ -1,17 +1,17 @@ use std::path::PathBuf; -use std::sync::atomic::AtomicBool; use std::sync::Arc; +use std::sync::atomic::AtomicBool; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use derive_more::{Deref, Display}; -use futures::future::{self, BoxFuture, Shared}; use futures::FutureExt; +use futures::future::{self, BoxFuture, Shared}; use fuzzy::StringMatchCandidate; use gpui::{App, BackgroundExecutor, Task}; -use heed::types::SerdeBincode; use heed::Database; +use heed::types::SerdeBincode; use parking_lot::RwLock; use serde::{Deserialize, Serialize}; use util::ResultExt; diff --git a/crates/inline_completion_button/src/inline_completion_button.rs b/crates/inline_completion_button/src/inline_completion_button.rs index 3316331545669b7cd7dc5a594684971643086bb8..0ff98fbc541e3b3306cadddf98cfb3cfb42a66bd 100644 --- a/crates/inline_completion_button/src/inline_completion_button.rs +++ b/crates/inline_completion_button/src/inline_completion_button.rs @@ -2,36 +2,36 @@ use anyhow::Result; use client::UserStore; use copilot::{Copilot, Status}; use editor::{ + Editor, actions::{ShowEditPrediction, ToggleEditPrediction}, scroll::Autoscroll, - Editor, }; use feature_flags::{FeatureFlagAppExt, PredictEditsRateCompletionsFeatureFlag}; use fs::Fs; use gpui::{ - actions, div, pulsating_between, Action, Animation, AnimationExt, App, AsyncWindowContext, - Corner, Entity, FocusHandle, Focusable, IntoElement, ParentElement, Render, Subscription, - WeakEntity, + Action, Animation, AnimationExt, App, AsyncWindowContext, Corner, Entity, FocusHandle, + Focusable, IntoElement, ParentElement, Render, Subscription, WeakEntity, actions, div, + pulsating_between, }; use indoc::indoc; use language::{ - language_settings::{self, all_language_settings, AllLanguageSettings, EditPredictionProvider}, EditPredictionsMode, File, Language, + language_settings::{self, AllLanguageSettings, EditPredictionProvider, all_language_settings}, }; use regex::Regex; -use settings::{update_settings_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, update_settings_file}; use std::{ sync::{Arc, LazyLock}, time::Duration, }; use supermaven::{AccountStatus, Supermaven}; use ui::{ - prelude::*, Clickable, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, Indicator, - PopoverMenu, PopoverMenuHandle, Tooltip, + Clickable, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, Indicator, PopoverMenu, + PopoverMenuHandle, Tooltip, prelude::*, }; use workspace::{ - create_and_open_local_file, item::ItemHandle, notifications::NotificationId, StatusItemView, - Toast, Workspace, + StatusItemView, Toast, Workspace, create_and_open_local_file, item::ItemHandle, + notifications::NotificationId, }; use zed_actions::OpenBrowser; use zeta::RateCompletions; diff --git a/crates/install_cli/src/install_cli.rs b/crates/install_cli/src/install_cli.rs index 3bee8d6c583f537f5c76c755c2b554b5152a0033..720b0d10fa75c9a49ebb04fcc7c178a539973fe2 100644 --- a/crates/install_cli/src/install_cli.rs +++ b/crates/install_cli/src/install_cli.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, Result}; -use gpui::{actions, AsyncApp}; +use anyhow::{Result, anyhow}; +use gpui::{AsyncApp, actions}; use std::path::{Path, PathBuf}; use util::ResultExt; diff --git a/crates/journal/src/journal.rs b/crates/journal/src/journal.rs index 0219a1efed897782624218cf49dc4c2cead40647..b75ae93825b5fc321880abc0a3104313f7a98ef7 100644 --- a/crates/journal/src/journal.rs +++ b/crates/journal/src/journal.rs @@ -1,8 +1,8 @@ use anyhow::Result; use chrono::{Datelike, Local, NaiveTime, Timelike}; -use editor::scroll::Autoscroll; use editor::Editor; -use gpui::{actions, App, AppContext as _, Context, Window}; +use editor::scroll::Autoscroll; +use gpui::{App, AppContext as _, Context, Window, actions}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index 853687405837517110da5aad4ada59cfb50e8354..8ec6a9c47ed4e3dd9fde8e2d876b657f07fe3f16 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -1,11 +1,14 @@ pub use crate::{ + Grammar, Language, LanguageRegistry, diagnostic_set::DiagnosticSet, highlight_map::{HighlightId, HighlightMap}, - proto, Grammar, Language, LanguageRegistry, + proto, }; use crate::{ + LanguageScope, Outline, OutlineConfig, RunnableCapture, RunnableTag, TextObject, + TreeSitterOptions, diagnostic_set::{DiagnosticEntry, DiagnosticGroup}, - language_settings::{language_settings, LanguageSettings}, + language_settings::{LanguageSettings, language_settings}, outline::OutlineItem, syntax_map::{ SyntaxLayer, SyntaxMap, SyntaxMapCapture, SyntaxMapCaptures, SyntaxMapMatch, @@ -13,10 +16,8 @@ use crate::{ }, task_context::RunnableRange, text_diff::text_diff, - LanguageScope, Outline, OutlineConfig, RunnableCapture, RunnableTag, TextObject, - TreeSitterOptions, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_watch as watch; use clock::Lamport; pub use clock::ReplicaId; @@ -66,7 +67,7 @@ pub use text::{ use theme::{ActiveTheme as _, SyntaxTheme}; #[cfg(any(test, feature = "test-support"))] use util::RandomCharIter; -use util::{debug_panic, maybe, RangeExt}; +use util::{RangeExt, debug_panic, maybe}; #[cfg(any(test, feature = "test-support"))] pub use {tree_sitter_rust, tree_sitter_typescript}; @@ -3742,47 +3743,49 @@ impl BufferSnapshot { let mut captures = Vec::<(Range, TextObject)>::new(); - iter::from_fn(move || loop { - while let Some(capture) = captures.pop() { - if capture.0.overlaps(&range) { - return Some(capture); + iter::from_fn(move || { + loop { + while let Some(capture) = captures.pop() { + if capture.0.overlaps(&range) { + return Some(capture); + } } - } - let mat = matches.peek()?; + let mat = matches.peek()?; - let Some(config) = configs[mat.grammar_index].as_ref() else { - matches.advance(); - continue; - }; - - for capture in mat.captures { - let Some(ix) = config - .text_objects_by_capture_ix - .binary_search_by_key(&capture.index, |e| e.0) - .ok() - else { + let Some(config) = configs[mat.grammar_index].as_ref() else { + matches.advance(); continue; }; - let text_object = config.text_objects_by_capture_ix[ix].1; - let byte_range = capture.node.byte_range(); - - let mut found = false; - for (range, existing) in captures.iter_mut() { - if existing == &text_object { - range.start = range.start.min(byte_range.start); - range.end = range.end.max(byte_range.end); - found = true; - break; + + for capture in mat.captures { + let Some(ix) = config + .text_objects_by_capture_ix + .binary_search_by_key(&capture.index, |e| e.0) + .ok() + else { + continue; + }; + let text_object = config.text_objects_by_capture_ix[ix].1; + let byte_range = capture.node.byte_range(); + + let mut found = false; + for (range, existing) in captures.iter_mut() { + if existing == &text_object { + range.start = range.start.min(byte_range.start); + range.end = range.end.max(byte_range.end); + found = true; + break; + } } - } - if !found { - captures.push((byte_range, text_object)); + if !found { + captures.push((byte_range, text_object)); + } } - } - matches.advance(); + matches.advance(); + } }) } @@ -4092,11 +4095,7 @@ impl BufferSnapshot { .then(a.diagnostic.severity.cmp(&b.diagnostic.severity)) // and stabilize order with group_id .then(a.diagnostic.group_id.cmp(&b.diagnostic.group_id)); - if reversed { - cmp.reverse() - } else { - cmp - } + if reversed { cmp.reverse() } else { cmp } })?; iterators[next_ix] .next() @@ -4699,22 +4698,24 @@ pub(crate) fn contiguous_ranges( ) -> impl Iterator> { let mut values = values; let mut current_range: Option> = None; - std::iter::from_fn(move || loop { - if let Some(value) = values.next() { - if let Some(range) = &mut current_range { - if value == range.end && range.len() < max_len { - range.end += 1; - continue; + std::iter::from_fn(move || { + loop { + if let Some(value) = values.next() { + if let Some(range) = &mut current_range { + if value == range.end && range.len() < max_len { + range.end += 1; + continue; + } } - } - let prev_range = current_range.clone(); - current_range = Some(value..(value + 1)); - if prev_range.is_some() { - return prev_range; + let prev_range = current_range.clone(); + current_range = Some(value..(value + 1)); + if prev_range.is_some() { + return prev_range; + } + } else { + return current_range.take(); } - } else { - return current_range.take(); } }) } diff --git a/crates/language/src/buffer_tests.rs b/crates/language/src/buffer_tests.rs index af5cd61dfeb4fdf308089e37c36b909ae1c03e40..6f0f25a897eaaedc6c7f18b28133f3617c08e1e9 100644 --- a/crates/language/src/buffer_tests.rs +++ b/crates/language/src/buffer_tests.rs @@ -1,8 +1,8 @@ use super::*; +use crate::Buffer; use crate::language_settings::{ AllLanguageSettings, AllLanguageSettingsContent, LanguageSettingsContent, }; -use crate::Buffer; use clock::ReplicaId; use collections::BTreeMap; use futures::FutureExt as _; @@ -27,7 +27,7 @@ use text::{Point, ToPoint}; use theme::ActiveTheme; use unindent::Unindent as _; use util::test::marked_text_offsets; -use util::{assert_set_eq, post_inc, test::marked_text_ranges, RandomCharIter}; +use util::{RandomCharIter, assert_set_eq, post_inc, test::marked_text_ranges}; pub static TRAILING_WHITESPACE_REGEX: LazyLock = LazyLock::new(|| { RegexBuilder::new(r"[ \t]+$") @@ -156,12 +156,14 @@ async fn test_first_line_pattern(cx: &mut TestAppContext) { ..Default::default() }); - assert!(cx - .read(|cx| languages.language_for_file(&file("the/script"), None, cx)) - .is_none()); - assert!(cx - .read(|cx| languages.language_for_file(&file("the/script"), Some(&"nothing".into()), cx)) - .is_none()); + assert!( + cx.read(|cx| languages.language_for_file(&file("the/script"), None, cx)) + .is_none() + ); + assert!( + cx.read(|cx| languages.language_for_file(&file("the/script"), Some(&"nothing".into()), cx)) + .is_none() + ); assert_eq!( cx.read(|cx| languages.language_for_file( diff --git a/crates/language/src/diagnostic_set.rs b/crates/language/src/diagnostic_set.rs index cff59c8004ce47f28c99ed542dbfb146cbb1041a..661e3ef217a65a24ca59e37f93b137c89ed31dc6 100644 --- a/crates/language/src/diagnostic_set.rs +++ b/crates/language/src/diagnostic_set.rs @@ -1,4 +1,4 @@ -use crate::{range_to_lsp, Diagnostic}; +use crate::{Diagnostic, range_to_lsp}; use anyhow::Result; use collections::HashMap; use lsp::LanguageServerId; diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index fb73f2c18d3dd10dc528a1f9987474bde03ff000..9339fbbf1c87479d99167a7785eb1c2e1cdb34b4 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -24,7 +24,7 @@ pub mod buffer_tests; pub use crate::language_settings::EditPredictionsMode; use crate::language_settings::SoftWrap; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; use collections::{HashMap, HashSet}; use fs::Fs; @@ -38,11 +38,11 @@ pub use manifest::{ManifestName, ManifestProvider, ManifestQuery}; use parking_lot::Mutex; use regex::Regex; use schemars::{ + JsonSchema, r#gen::SchemaGenerator, schema::{InstanceType, Schema, SchemaObject}, - JsonSchema, }; -use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de}; use serde_json::Value; use settings::WorktreeId; use smol::future::FutureExt as _; @@ -57,18 +57,18 @@ use std::{ pin::Pin, str, sync::{ - atomic::{AtomicU64, AtomicUsize, Ordering::SeqCst}, Arc, LazyLock, + atomic::{AtomicU64, AtomicUsize, Ordering::SeqCst}, }, }; use std::{num::NonZeroU32, sync::OnceLock}; use syntax_map::{QueryCursorHandle, SyntaxSnapshot}; use task::RunnableTag; pub use task_context::{ContextProvider, RunnableRange}; -pub use text_diff::{line_diff, text_diff, text_diff_with_options, unified_diff, DiffOptions}; +pub use text_diff::{DiffOptions, line_diff, text_diff, text_diff_with_options, unified_diff}; use theme::SyntaxTheme; pub use toolchain::{LanguageToolchainStore, Toolchain, ToolchainList, ToolchainLister}; -use tree_sitter::{self, wasmtime, Query, QueryCursor, WasmStore}; +use tree_sitter::{self, Query, QueryCursor, WasmStore, wasmtime}; use util::serde::default_true; pub use buffer::Operation; diff --git a/crates/language/src/language_registry.rs b/crates/language/src/language_registry.rs index 79bcb871f4e710acb29ebbda3bb2533d3219147e..e1de25c41be17455079fd095dec5ba3710f8e912 100644 --- a/crates/language/src/language_registry.rs +++ b/crates/language/src/language_registry.rs @@ -1,17 +1,18 @@ use crate::{ + CachedLspAdapter, File, Language, LanguageConfig, LanguageId, LanguageMatcher, + LanguageServerName, LspAdapter, PLAIN_TEXT, ToolchainLister, language_settings::{ - all_language_settings, AllLanguageSettingsContent, LanguageSettingsContent, + AllLanguageSettingsContent, LanguageSettingsContent, all_language_settings, }, task_context::ContextProvider, - with_parser, CachedLspAdapter, File, Language, LanguageConfig, LanguageId, LanguageMatcher, - LanguageServerName, LspAdapter, ToolchainLister, PLAIN_TEXT, + with_parser, }; -use anyhow::{anyhow, Context as _, Result}; -use collections::{hash_map, HashMap, HashSet}; +use anyhow::{Context as _, Result, anyhow}; +use collections::{HashMap, HashSet, hash_map}; use futures::{ - channel::{mpsc, oneshot}, Future, + channel::{mpsc, oneshot}, }; use globset::GlobSet; use gpui::{App, BackgroundExecutor, SharedString}; @@ -31,7 +32,7 @@ use sum_tree::Bias; use text::{Point, Rope}; use theme::Theme; use unicase::UniCase; -use util::{maybe, post_inc, ResultExt}; +use util::{ResultExt, maybe, post_inc}; #[derive( Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, JsonSchema, diff --git a/crates/language/src/language_settings.rs b/crates/language/src/language_settings.rs index 70c1d29346536e2e06f64c981f160067a18b8295..33e8ff4519d5390e13af053c957edca29567ac98 100644 --- a/crates/language/src/language_settings.rs +++ b/crates/language/src/language_settings.rs @@ -5,23 +5,23 @@ use anyhow::Result; use collections::{HashMap, HashSet}; use core::slice; use ec4rs::{ - property::{FinalNewline, IndentSize, IndentStyle, TabWidth, TrimTrailingWs}, Properties as EditorconfigProperties, + property::{FinalNewline, IndentSize, IndentStyle, TabWidth, TrimTrailingWs}, }; use globset::{Glob, GlobMatcher, GlobSet, GlobSetBuilder}; use gpui::{App, Modifiers}; use itertools::{Either, Itertools}; use schemars::{ - schema::{InstanceType, ObjectValidation, Schema, SchemaObject, SingleOrVec}, JsonSchema, + schema::{InstanceType, ObjectValidation, Schema, SchemaObject, SingleOrVec}, }; use serde::{ - de::{self, IntoDeserializer, MapAccess, SeqAccess, Visitor}, Deserialize, Deserializer, Serialize, + de::{self, IntoDeserializer, MapAccess, SeqAccess, Visitor}, }; use serde_json::Value; use settings::{ - add_references_to_properties, Settings, SettingsLocation, SettingsSources, SettingsStore, + Settings, SettingsLocation, SettingsSources, SettingsStore, add_references_to_properties, }; use std::{borrow::Cow, num::NonZeroU32, path::Path, sync::Arc}; use util::serde::default_true; @@ -1308,9 +1308,11 @@ impl settings::Settings for AllLanguageSettings { // Create a schema for a 'languages overrides' object, associating editor // settings with specific languages. - assert!(root_schema - .definitions - .contains_key("LanguageSettingsContent")); + assert!( + root_schema + .definitions + .contains_key("LanguageSettingsContent") + ); let languages_object_schema = SchemaObject { instance_type: Some(InstanceType::Object.into()), diff --git a/crates/language/src/proto.rs b/crates/language/src/proto.rs index a30b8b8a159e6345626f0dbacf98be2164cd1d55..c5179a0e3c2ed95608d0fa7a2c087b37f943afef 100644 --- a/crates/language/src/proto.rs +++ b/crates/language/src/proto.rs @@ -1,7 +1,7 @@ //! Handles conversions of `language` items to and from the [`rpc`] protocol. -use crate::{diagnostic_set::DiagnosticEntry, CursorShape, Diagnostic}; -use anyhow::{anyhow, Context as _, Result}; +use crate::{CursorShape, Diagnostic, diagnostic_set::DiagnosticEntry}; +use anyhow::{Context as _, Result, anyhow}; use clock::ReplicaId; use lsp::{DiagnosticSeverity, LanguageServerId}; use rpc::proto; diff --git a/crates/language/src/syntax_map.rs b/crates/language/src/syntax_map.rs index 85107a530b2523a5b8bb2321ff40b450f87d7fbb..22d9669b782e7d4e7c6ede5ae8868d078b7474e8 100644 --- a/crates/language/src/syntax_map.rs +++ b/crates/language/src/syntax_map.rs @@ -2,7 +2,7 @@ mod syntax_map_tests; use crate::{ - with_parser, Grammar, InjectionConfig, Language, LanguageId, LanguageRegistry, QUERY_CURSORS, + Grammar, InjectionConfig, Language, LanguageId, LanguageRegistry, QUERY_CURSORS, with_parser, }; use collections::HashMap; use futures::FutureExt; @@ -1890,7 +1890,7 @@ impl fmt::Debug for LogChangedRegions<'_> { f.debug_list() .entries( self.0 - .0 + .0 .iter() .map(|region| LogAnchorRange(®ion.range, self.1)), ) diff --git a/crates/language/src/syntax_map/syntax_map_tests.rs b/crates/language/src/syntax_map/syntax_map_tests.rs index 7e78aa52b81a55daac4deeda86d610915f92c3dc..211edad87c5a75d4f61440f41fc075fa92d25c40 100644 --- a/crates/language/src/syntax_map/syntax_map_tests.rs +++ b/crates/language/src/syntax_map/syntax_map_tests.rs @@ -1,7 +1,7 @@ use super::*; use crate::{ - buffer_tests::{markdown_inline_lang, markdown_lang}, LanguageConfig, LanguageMatcher, + buffer_tests::{markdown_inline_lang, markdown_lang}, }; use gpui::App; use rand::rngs::StdRng; diff --git a/crates/language/src/text_diff.rs b/crates/language/src/text_diff.rs index 83c4aba3bb275917ec274f74c264fa01d3f15989..fd95830d666e9d32a0dde4d17e62de4407eb0ebc 100644 --- a/crates/language/src/text_diff.rs +++ b/crates/language/src/text_diff.rs @@ -1,9 +1,8 @@ use crate::{CharClassifier, CharKind, LanguageScope}; use imara_diff::{ - diff, + Algorithm, UnifiedDiffBuilder, diff, intern::{InternedInput, Token}, sources::lines_with_terminator, - Algorithm, UnifiedDiffBuilder, }; use std::{iter, ops::Range, sync::Arc}; diff --git a/crates/language_extension/src/extension_lsp_adapter.rs b/crates/language_extension/src/extension_lsp_adapter.rs index 148e5b59025ae2911a4e51266557379592ce6628..ae325edbd8125c4c735866d9fa3021d0eeff5ebc 100644 --- a/crates/language_extension/src/extension_lsp_adapter.rs +++ b/crates/language_extension/src/extension_lsp_adapter.rs @@ -18,7 +18,7 @@ use language::{ use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerBinaryOptions, LanguageServerName}; use serde::Serialize; use serde_json::Value; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use crate::LanguageServerRegistryProxy; diff --git a/crates/language_model/src/fake_provider.rs b/crates/language_model/src/fake_provider.rs index 0e4c0748fc95d913af7c832cb4ed98535e192e23..9ce8ba333ad39eca3d1f559ec6313ecb8272543e 100644 --- a/crates/language_model/src/fake_provider.rs +++ b/crates/language_model/src/fake_provider.rs @@ -3,7 +3,7 @@ use crate::{ LanguageModelName, LanguageModelProvider, LanguageModelProviderId, LanguageModelProviderName, LanguageModelProviderState, LanguageModelRequest, }; -use futures::{channel::mpsc, future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, channel::mpsc, future::BoxFuture, stream::BoxStream}; use gpui::{AnyView, App, AsyncApp, Entity, Task, Window}; use http_client::Result; use parking_lot::Mutex; diff --git a/crates/language_model/src/language_model.rs b/crates/language_model/src/language_model.rs index 845eff45a5af50a306c4208f522c5942a86a6708..38b4a10489b181dbea4c8928e491cd83057a75c6 100644 --- a/crates/language_model/src/language_model.rs +++ b/crates/language_model/src/language_model.rs @@ -11,13 +11,13 @@ pub mod fake_provider; use anyhow::Result; use client::Client; use futures::FutureExt; -use futures::{future::BoxFuture, stream::BoxStream, StreamExt, TryStreamExt as _}; +use futures::{StreamExt, TryStreamExt as _, future::BoxFuture, stream::BoxStream}; use gpui::{AnyElement, AnyView, App, AsyncApp, SharedString, Task, Window}; use icons::IconName; use parking_lot::Mutex; use proto::Plan; use schemars::JsonSchema; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; use std::fmt; use std::ops::{Add, Sub}; use std::{future::Future, sync::Arc}; diff --git a/crates/language_model/src/registry.rs b/crates/language_model/src/registry.rs index 0c7d3f167f84f68e6e8470cb695d9c57d6389017..93882eafb9e343e793e32fd7df43a6ee99a5dbbb 100644 --- a/crates/language_model/src/registry.rs +++ b/crates/language_model/src/registry.rs @@ -3,7 +3,7 @@ use crate::{ LanguageModelProviderState, }; use collections::BTreeMap; -use gpui::{prelude::*, App, Context, Entity, EventEmitter, Global}; +use gpui::{App, Context, Entity, EventEmitter, Global, prelude::*}; use std::sync::Arc; pub fn init(cx: &mut App) { diff --git a/crates/language_model/src/request.rs b/crates/language_model/src/request.rs index 25ab642fc97ca8535ff7064d9a2bf971edc8ad5b..696e3644f6b3999f96428b51c51bea109408bdeb 100644 --- a/crates/language_model/src/request.rs +++ b/crates/language_model/src/request.rs @@ -5,10 +5,10 @@ use crate::role::Role; use crate::{LanguageModelToolUse, LanguageModelToolUseId}; use base64::write::EncoderWriter; use gpui::{ - point, px, size, App, AppContext as _, DevicePixels, Image, ObjectFit, RenderImage, - SharedString, Size, Task, + App, AppContext as _, DevicePixels, Image, ObjectFit, RenderImage, SharedString, Size, Task, + point, px, size, }; -use image::{codecs::png::PngEncoder, imageops::resize, DynamicImage, ImageDecoder}; +use image::{DynamicImage, ImageDecoder, codecs::png::PngEncoder, imageops::resize}; use serde::{Deserialize, Serialize}; use util::ResultExt; diff --git a/crates/language_model/src/telemetry.rs b/crates/language_model/src/telemetry.rs index 0454d43c73475803192d0dc88862c918010b0082..c24ec9770035a1887b693df634826f05f64156e0 100644 --- a/crates/language_model/src/telemetry.rs +++ b/crates/language_model/src/telemetry.rs @@ -1,5 +1,5 @@ -use anthropic::{AnthropicError, ANTHROPIC_API_URL}; -use anyhow::{anyhow, Context as _, Result}; +use anthropic::{ANTHROPIC_API_URL, AnthropicError}; +use anyhow::{Context as _, Result, anyhow}; use client::telemetry::Telemetry; use gpui::BackgroundExecutor; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; diff --git a/crates/language_model_selector/src/language_model_selector.rs b/crates/language_model_selector/src/language_model_selector.rs index 2acf78a5d2c3e826a2666c227ae10a0f512e4a19..b6ef5a77eb4ea052eebb96bfbe69ba709704123e 100644 --- a/crates/language_model_selector/src/language_model_selector.rs +++ b/crates/language_model_selector/src/language_model_selector.rs @@ -2,15 +2,15 @@ use std::sync::Arc; use feature_flags::ZedPro; use gpui::{ - action_with_deprecated_aliases, Action, AnyElement, AnyView, App, Corner, DismissEvent, Entity, - EventEmitter, FocusHandle, Focusable, Subscription, Task, WeakEntity, + Action, AnyElement, AnyView, App, Corner, DismissEvent, Entity, EventEmitter, FocusHandle, + Focusable, Subscription, Task, WeakEntity, action_with_deprecated_aliases, }; use language_model::{ AuthenticateError, LanguageModel, LanguageModelAvailability, LanguageModelRegistry, }; use picker::{Picker, PickerDelegate}; use proto::Plan; -use ui::{prelude::*, ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, PopoverTrigger}; +use ui::{ListItem, ListItemSpacing, PopoverMenu, PopoverMenuHandle, PopoverTrigger, prelude::*}; use workspace::ShowConfiguration; action_with_deprecated_aliases!( diff --git a/crates/language_models/src/provider/anthropic.rs b/crates/language_models/src/provider/anthropic.rs index b3daaf2ecf7cf8029eafcf0cb3981f4439712cff..7694455cb78698d71991fe81995b2a45411f3c53 100644 --- a/crates/language_models/src/provider/anthropic.rs +++ b/crates/language_models/src/provider/anthropic.rs @@ -1,12 +1,12 @@ -use crate::ui::InstructionListItem; use crate::AllLanguageModelSettings; +use crate::ui::InstructionListItem; use anthropic::{AnthropicError, AnthropicModelMode, ContentDelta, Event, ResponseContent, Usage}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{BTreeMap, HashMap}; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; use futures::Stream; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt, TryStreamExt as _}; +use futures::{FutureExt, StreamExt, TryStreamExt as _, future::BoxFuture, stream::BoxStream}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, }; @@ -25,8 +25,8 @@ use std::str::FromStr; use std::sync::Arc; use strum::IntoEnumIterator; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; -use util::{maybe, ResultExt}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; +use util::{ResultExt, maybe}; const PROVIDER_ID: &str = language_model::ANTHROPIC_PROVIDER_ID; const PROVIDER_NAME: &str = "Anthropic"; diff --git a/crates/language_models/src/provider/bedrock.rs b/crates/language_models/src/provider/bedrock.rs index 894b04a2e709a3e39958d3070b87283cebe27c24..4b84e855919532d67f998532ae80eab34d0afbe0 100644 --- a/crates/language_models/src/provider/bedrock.rs +++ b/crates/language_models/src/provider/bedrock.rs @@ -3,9 +3,9 @@ use std::str::FromStr; use std::sync::Arc; use crate::ui::InstructionListItem; -use anyhow::{anyhow, Context as _, Result}; -use aws_config::stalled_stream_protection::StalledStreamProtectionConfig; +use anyhow::{Context as _, Result, anyhow}; use aws_config::Region; +use aws_config::stalled_stream_protection::StalledStreamProtectionConfig; use aws_credential_types::Credentials; use aws_http_client::AwsHttpClient; use bedrock::bedrock_client::types::{ @@ -13,13 +13,14 @@ use bedrock::bedrock_client::types::{ }; use bedrock::bedrock_client::{self, Config}; use bedrock::{ - value_to_aws_document, BedrockError, BedrockInnerContent, BedrockMessage, BedrockSpecificTool, + BedrockError, BedrockInnerContent, BedrockMessage, BedrockSpecificTool, BedrockStreamingResponse, BedrockTool, BedrockToolChoice, BedrockToolInputSchema, Model, + value_to_aws_document, }; use collections::{BTreeMap, HashMap}; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, Stream, StreamExt}; +use futures::{FutureExt, Stream, StreamExt, future::BoxFuture, stream::BoxStream}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, }; @@ -38,8 +39,8 @@ use settings::{Settings, SettingsStore}; use strum::IntoEnumIterator; use theme::ThemeSettings; use tokio::runtime::Handle; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; -use util::{maybe, ResultExt}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; +use util::{ResultExt, maybe}; use crate::AllLanguageModelSettings; diff --git a/crates/language_models/src/provider/cloud.rs b/crates/language_models/src/provider/cloud.rs index 376d5cd3f5822b3f4379175a7cbb3fa4fc5bf24d..ee6ab37e5f3db1c94e0cfeb4d27410a498b1daf6 100644 --- a/crates/language_models/src/provider/cloud.rs +++ b/crates/language_models/src/provider/cloud.rs @@ -1,14 +1,14 @@ use anthropic::{AnthropicError, AnthropicModelMode}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use client::{ - zed_urls, Client, PerformCompletionParams, UserStore, EXPIRED_LLM_TOKEN_HEADER_NAME, - MAX_LLM_MONTHLY_SPEND_REACHED_HEADER_NAME, + Client, EXPIRED_LLM_TOKEN_HEADER_NAME, MAX_LLM_MONTHLY_SPEND_REACHED_HEADER_NAME, + PerformCompletionParams, UserStore, zed_urls, }; use collections::BTreeMap; use feature_flags::{FeatureFlagAppExt, LlmClosedBeta, ZedPro}; use futures::{ - future::BoxFuture, stream::BoxStream, AsyncBufReadExt, FutureExt, Stream, StreamExt, - TryStreamExt as _, + AsyncBufReadExt, FutureExt, Stream, StreamExt, TryStreamExt as _, future::BoxFuture, + stream::BoxStream, }; use gpui::{AnyElement, AnyView, App, AsyncApp, Context, Entity, Subscription, Task}; use http_client::{AsyncBody, HttpClient, Method, Response, StatusCode}; @@ -23,25 +23,25 @@ use language_model::{ MaxMonthlySpendReachedError, PaymentRequiredError, RefreshLlmTokenListener, }; use schemars::JsonSchema; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; use serde_json::value::RawValue; use settings::{Settings, SettingsStore}; -use smol::io::{AsyncReadExt, BufReader}; use smol::Timer; +use smol::io::{AsyncReadExt, BufReader}; use std::{ future, sync::{Arc, LazyLock}, time::Duration, }; use strum::IntoEnumIterator; -use ui::{prelude::*, TintColor}; +use ui::{TintColor, prelude::*}; +use crate::AllLanguageModelSettings; use crate::provider::anthropic::{ count_anthropic_tokens, into_anthropic, map_to_language_model_completion_events, }; use crate::provider::google::into_google; use crate::provider::open_ai::{count_open_ai_tokens, into_open_ai}; -use crate::AllLanguageModelSettings; pub const PROVIDER_NAME: &str = "Zed"; diff --git a/crates/language_models/src/provider/copilot_chat.rs b/crates/language_models/src/provider/copilot_chat.rs index da9ebbdb289e9e41ddc6890e346db49569df7fc1..1307fdb5118a84ba2a74c38c4f75ba2c6f3b18e4 100644 --- a/crates/language_models/src/provider/copilot_chat.rs +++ b/crates/language_models/src/provider/copilot_chat.rs @@ -1,7 +1,7 @@ use std::future; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use copilot::copilot_chat::{ ChatMessage, CopilotChat, Model as CopilotChatModel, Request as CopilotChatRequest, Role as CopilotChatRole, @@ -11,8 +11,8 @@ use futures::future::BoxFuture; use futures::stream::BoxStream; use futures::{FutureExt, StreamExt}; use gpui::{ - percentage, svg, Action, Animation, AnimationExt, AnyView, App, AsyncApp, Entity, Render, - Subscription, Task, Transformation, + Action, Animation, AnimationExt, AnyView, App, AsyncApp, Entity, Render, Subscription, Task, + Transformation, percentage, svg, }; use language_model::{ AuthenticateError, LanguageModel, LanguageModelCompletionEvent, LanguageModelId, diff --git a/crates/language_models/src/provider/deepseek.rs b/crates/language_models/src/provider/deepseek.rs index 760d6b538b84d79acd1b3bf6cc804e5bc22db2d5..1e33e1071be67bba3828cb35f6c6fc13745f9d08 100644 --- a/crates/language_models/src/provider/deepseek.rs +++ b/crates/language_models/src/provider/deepseek.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::BTreeMap; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream}; use gpui::{ AnyView, AppContext as _, AsyncApp, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, @@ -18,10 +18,10 @@ use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsStore}; use std::sync::Arc; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List}; +use ui::{Icon, IconName, List, prelude::*}; use util::ResultExt; -use crate::{ui::InstructionListItem, AllLanguageModelSettings}; +use crate::{AllLanguageModelSettings, ui::InstructionListItem}; const PROVIDER_ID: &str = "deepseek"; const PROVIDER_NAME: &str = "DeepSeek"; diff --git a/crates/language_models/src/provider/google.rs b/crates/language_models/src/provider/google.rs index 1952d8777a3d361c7c30f9ee37977f7d325b0c89..70ce0832c50dbebfe77fe40d1e1df45682a7d30d 100644 --- a/crates/language_models/src/provider/google.rs +++ b/crates/language_models/src/provider/google.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::BTreeMap; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, FutureExt, Stream, StreamExt}; +use futures::{FutureExt, Stream, StreamExt, future::BoxFuture}; use google_ai::{FunctionDeclaration, GenerateContentResponse, Part, UsageMetadata}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, @@ -24,11 +24,11 @@ use std::pin::Pin; use std::sync::Arc; use strum::IntoEnumIterator; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; use util::ResultExt; -use crate::ui::InstructionListItem; use crate::AllLanguageModelSettings; +use crate::ui::InstructionListItem; const PROVIDER_ID: &str = "google"; const PROVIDER_NAME: &str = "Google AI"; diff --git a/crates/language_models/src/provider/lmstudio.rs b/crates/language_models/src/provider/lmstudio.rs index ae9343f741bcb178e20f4d7686a3af1ff124edc1..dacb0f72bd657b5f085a49d8a6d6b429c92a6857 100644 --- a/crates/language_models/src/provider/lmstudio.rs +++ b/crates/language_models/src/provider/lmstudio.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, Result}; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; +use anyhow::{Result, anyhow}; +use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream}; use gpui::{AnyView, App, AsyncApp, Context, Subscription, Task}; use http_client::HttpClient; use language_model::{AuthenticateError, LanguageModelCompletionEvent}; @@ -9,14 +9,14 @@ use language_model::{ LanguageModelRequest, RateLimiter, Role, }; use lmstudio::{ - get_models, preload_model, stream_chat_completion, ChatCompletionRequest, ChatMessage, - ModelType, + ChatCompletionRequest, ChatMessage, ModelType, get_models, preload_model, + stream_chat_completion, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsStore}; use std::{collections::BTreeMap, sync::Arc}; -use ui::{prelude::*, ButtonLike, Indicator}; +use ui::{ButtonLike, Indicator, prelude::*}; use util::ResultExt; use crate::AllLanguageModelSettings; diff --git a/crates/language_models/src/provider/mistral.rs b/crates/language_models/src/provider/mistral.rs index d9d62e83b9b203e25075c8133f65319d17688d05..6b509d4b4cdaa474f7cfd7cc06128882526e7c88 100644 --- a/crates/language_models/src/provider/mistral.rs +++ b/crates/language_models/src/provider/mistral.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::BTreeMap; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, future::BoxFuture}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, }; @@ -20,10 +20,10 @@ use settings::{Settings, SettingsStore}; use std::sync::Arc; use strum::IntoEnumIterator; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; use util::ResultExt; -use crate::{ui::InstructionListItem, AllLanguageModelSettings}; +use crate::{AllLanguageModelSettings, ui::InstructionListItem}; const PROVIDER_ID: &str = "mistral"; const PROVIDER_NAME: &str = "Mistral"; diff --git a/crates/language_models/src/provider/ollama.rs b/crates/language_models/src/provider/ollama.rs index 16cac27f40082491efb5147cdd5ab73170ae5bf4..810c141e488d5739d38010ee2212242d4346194d 100644 --- a/crates/language_models/src/provider/ollama.rs +++ b/crates/language_models/src/provider/ollama.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, bail, Result}; -use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; +use anyhow::{Result, anyhow, bail}; +use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream}; use gpui::{AnyView, App, AsyncApp, Context, Subscription, Task}; use http_client::HttpClient; use language_model::{AuthenticateError, LanguageModelCompletionEvent}; @@ -9,14 +9,14 @@ use language_model::{ LanguageModelRequest, RateLimiter, Role, }; use ollama::{ - get_models, preload_model, stream_chat_completion, ChatMessage, ChatOptions, ChatRequest, - ChatResponseDelta, KeepAlive, OllamaToolCall, + ChatMessage, ChatOptions, ChatRequest, ChatResponseDelta, KeepAlive, OllamaToolCall, + get_models, preload_model, stream_chat_completion, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsStore}; use std::{collections::BTreeMap, sync::Arc}; -use ui::{prelude::*, ButtonLike, Indicator}; +use ui::{ButtonLike, Indicator, prelude::*}; use util::ResultExt; use crate::AllLanguageModelSettings; diff --git a/crates/language_models/src/provider/open_ai.rs b/crates/language_models/src/provider/open_ai.rs index e914a848b319bb49c6bc3af1f63a92c67fc10e04..10c103eefbea17bdc530491cb973226adc6ced51 100644 --- a/crates/language_models/src/provider/open_ai.rs +++ b/crates/language_models/src/provider/open_ai.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::BTreeMap; use credentials_provider::CredentialsProvider; use editor::{Editor, EditorElement, EditorStyle}; -use futures::{future::BoxFuture, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, future::BoxFuture}; use gpui::{ AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace, }; @@ -13,7 +13,7 @@ use language_model::{ LanguageModelProviderState, LanguageModelRequest, RateLimiter, Role, }; use open_ai::{ - stream_completion, FunctionDefinition, ResponseStreamEvent, ToolChoice, ToolDefinition, + FunctionDefinition, ResponseStreamEvent, ToolChoice, ToolDefinition, stream_completion, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -21,10 +21,10 @@ use settings::{Settings, SettingsStore}; use std::sync::Arc; use strum::IntoEnumIterator; use theme::ThemeSettings; -use ui::{prelude::*, Icon, IconName, List, Tooltip}; +use ui::{Icon, IconName, List, Tooltip, prelude::*}; use util::ResultExt; -use crate::{ui::InstructionListItem, AllLanguageModelSettings}; +use crate::{AllLanguageModelSettings, ui::InstructionListItem}; const PROVIDER_ID: &str = "openai"; const PROVIDER_NAME: &str = "OpenAI"; diff --git a/crates/language_models/src/settings.rs b/crates/language_models/src/settings.rs index 6e25ca3c40b905073ab979b2d07ab4aef7fb8a6d..68833d8d6360a70eda63dd1a587e56a5bfc3f773 100644 --- a/crates/language_models/src/settings.rs +++ b/crates/language_models/src/settings.rs @@ -6,7 +6,7 @@ use language_model::LanguageModelCacheConfiguration; use project::Fs; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use settings::{update_settings_file, Settings, SettingsSources}; +use settings::{Settings, SettingsSources, update_settings_file}; use crate::provider::{ self, diff --git a/crates/language_models/src/ui/instruction_list_item.rs b/crates/language_models/src/ui/instruction_list_item.rs index daf5646d65ce75a9d76e8f8f2b7e74e138568f5f..d3442cf81590aa0efce7f3268b87c51f370fae82 100644 --- a/crates/language_models/src/ui/instruction_list_item.rs +++ b/crates/language_models/src/ui/instruction_list_item.rs @@ -1,5 +1,5 @@ use gpui::{AnyElement, IntoElement, ParentElement, SharedString}; -use ui::{prelude::*, ListItem}; +use ui::{ListItem, prelude::*}; /// A reusable list item component for adding LLM provider configuration instructions pub struct InstructionListItem { diff --git a/crates/language_selector/src/active_buffer_language.rs b/crates/language_selector/src/active_buffer_language.rs index 0d515e3d26ee6a07a54a652b104ad6ed9d1826c4..250d0c23d89e2af2e5e82955eee2249d79720c1b 100644 --- a/crates/language_selector/src/active_buffer_language.rs +++ b/crates/language_selector/src/active_buffer_language.rs @@ -1,10 +1,10 @@ use editor::Editor; use gpui::{ - div, Context, Entity, IntoElement, ParentElement, Render, Subscription, WeakEntity, Window, + Context, Entity, IntoElement, ParentElement, Render, Subscription, WeakEntity, Window, div, }; use language::LanguageName; use ui::{Button, ButtonCommon, Clickable, FluentBuilder, LabelSize, Tooltip}; -use workspace::{item::ItemHandle, StatusItemView, Workspace}; +use workspace::{StatusItemView, Workspace, item::ItemHandle}; use crate::{LanguageSelector, Toggle}; diff --git a/crates/language_selector/src/language_selector.rs b/crates/language_selector/src/language_selector.rs index 24b43a5acf0fdf2e1d14acc0494c37f7202670ac..e5767ea28873000c24318f6f077403aab9c67a3a 100644 --- a/crates/language_selector/src/language_selector.rs +++ b/crates/language_selector/src/language_selector.rs @@ -5,17 +5,17 @@ use anyhow::anyhow; use editor::Editor; use file_finder::file_finder_settings::FileFinderSettings; use file_icons::FileIcons; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - ParentElement, Render, Styled, WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ParentElement, + Render, Styled, WeakEntity, Window, actions, }; use language::{Buffer, LanguageMatcher, LanguageName, LanguageRegistry}; use picker::{Picker, PickerDelegate}; use project::Project; use settings::Settings; use std::{ops::Not as _, path::Path, sync::Arc}; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace}; diff --git a/crates/language_tools/src/key_context_view.rs b/crates/language_tools/src/key_context_view.rs index 9f490cacede3b4200d2cdf2a1d59f198dbcddd08..ec65ccdbe847e120bb5fc8e95510663d620a5346 100644 --- a/crates/language_tools/src/key_context_view.rs +++ b/crates/language_tools/src/key_context_view.rs @@ -1,16 +1,16 @@ use gpui::{ - actions, Action, App, AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, - KeyBindingContextPredicate, KeyContext, Keystroke, MouseButton, Render, Subscription, + Action, App, AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, + KeyBindingContextPredicate, KeyContext, Keystroke, MouseButton, Render, Subscription, actions, }; use itertools::Itertools; use serde_json::json; use settings::get_key_equivalents; +use ui::{Button, ButtonStyle}; use ui::{ - div, h_flex, px, v_flex, ButtonCommon, Clickable, Context, FluentBuilder, InteractiveElement, - Label, LabelCommon, LabelSize, ParentElement, SharedString, StatefulInteractiveElement, Styled, - Window, + ButtonCommon, Clickable, Context, FluentBuilder, InteractiveElement, Label, LabelCommon, + LabelSize, ParentElement, SharedString, StatefulInteractiveElement, Styled, Window, div, + h_flex, px, v_flex, }; -use ui::{Button, ButtonStyle}; use workspace::{Item, SplitDirection, Workspace}; actions!(debug, [OpenKeyContextView]); diff --git a/crates/language_tools/src/lsp_log.rs b/crates/language_tools/src/lsp_log.rs index 09b77b47ce784ba651313bb4df8b37bab9027475..5e1790bd9f4f9fd2fc8d75fb964858ad7a6f773d 100644 --- a/crates/language_tools/src/lsp_log.rs +++ b/crates/language_tools/src/lsp_log.rs @@ -1,23 +1,23 @@ use collections::{HashMap, VecDeque}; use copilot::Copilot; -use editor::{actions::MoveToEnd, scroll::Autoscroll, Editor, EditorEvent}; -use futures::{channel::mpsc, StreamExt}; +use editor::{Editor, EditorEvent, actions::MoveToEnd, scroll::Autoscroll}; +use futures::{StreamExt, channel::mpsc}; use gpui::{ - actions, div, AnyView, App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable, - IntoElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window, + AnyView, App, Context, Corner, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, + ParentElement, Render, Styled, Subscription, WeakEntity, Window, actions, div, }; -use language::{language_settings::SoftWrap, LanguageServerId}; +use language::{LanguageServerId, language_settings::SoftWrap}; use lsp::{ - notification::SetTrace, IoKind, LanguageServer, LanguageServerName, MessageType, - SetTraceParams, TraceValue, + IoKind, LanguageServer, LanguageServerName, MessageType, SetTraceParams, TraceValue, + notification::SetTrace, }; -use project::{search::SearchQuery, Project, WorktreeId}; +use project::{Project, WorktreeId, search::SearchQuery}; use std::{any::TypeId, borrow::Cow, sync::Arc}; -use ui::{prelude::*, Button, Checkbox, ContextMenu, Label, PopoverMenu, ToggleState}; +use ui::{Button, Checkbox, ContextMenu, Label, PopoverMenu, ToggleState, prelude::*}; use workspace::{ + SplitDirection, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, WorkspaceId, item::{Item, ItemHandle}, searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle}, - SplitDirection, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, WorkspaceId, }; const SEND_LINE: &str = "// Send:"; diff --git a/crates/language_tools/src/lsp_log_tests.rs b/crates/language_tools/src/lsp_log_tests.rs index 707d2ca022198303c0e5832c5f2595497c999bb4..a5f15790e990e4d2e7ac6a61b9cbc302ec0620ff 100644 --- a/crates/language_tools/src/lsp_log_tests.rs +++ b/crates/language_tools/src/lsp_log_tests.rs @@ -5,7 +5,7 @@ use crate::lsp_log::LogMenuItem; use super::*; use futures::StreamExt; use gpui::{AppContext as _, SemanticVersion, TestAppContext, VisualTestContext}; -use language::{tree_sitter_rust, FakeLspAdapter, Language, LanguageConfig, LanguageMatcher}; +use language::{FakeLspAdapter, Language, LanguageConfig, LanguageMatcher, tree_sitter_rust}; use lsp::LanguageServerName; use lsp_log::LogKind; use project::{FakeFs, Project}; diff --git a/crates/language_tools/src/syntax_tree_view.rs b/crates/language_tools/src/syntax_tree_view.rs index 3dbdfa2b9125d686816345c225adadf7ce1c6e0f..2098c866734d029f5194e176ed5aede1d928e59b 100644 --- a/crates/language_tools/src/syntax_tree_view.rs +++ b/crates/language_tools/src/syntax_tree_view.rs @@ -1,18 +1,18 @@ -use editor::{scroll::Autoscroll, Anchor, Editor, ExcerptId}; +use editor::{Anchor, Editor, ExcerptId, scroll::Autoscroll}; use gpui::{ - actions, div, rems, uniform_list, App, AppContext as _, Context, Div, Entity, EventEmitter, - FocusHandle, Focusable, Hsla, InteractiveElement, IntoElement, MouseButton, MouseDownEvent, - MouseMoveEvent, ParentElement, Render, ScrollStrategy, SharedString, Styled, - UniformListScrollHandle, WeakEntity, Window, + App, AppContext as _, Context, Div, Entity, EventEmitter, FocusHandle, Focusable, Hsla, + InteractiveElement, IntoElement, MouseButton, MouseDownEvent, MouseMoveEvent, ParentElement, + Render, ScrollStrategy, SharedString, Styled, UniformListScrollHandle, WeakEntity, Window, + actions, div, rems, uniform_list, }; use language::{Buffer, OwnedSyntaxLayer}; use std::{mem, ops::Range}; use theme::ActiveTheme; use tree_sitter::{Node, TreeCursor}; -use ui::{h_flex, ButtonLike, Color, ContextMenu, Label, LabelCommon, PopoverMenu}; +use ui::{ButtonLike, Color, ContextMenu, Label, LabelCommon, PopoverMenu, h_flex}; use workspace::{ - item::{Item, ItemHandle}, SplitDirection, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + item::{Item, ItemHandle}, }; actions!(debug, [OpenSyntaxTreeView]); diff --git a/crates/languages/src/bash.rs b/crates/languages/src/bash.rs index 3f37926d4829770455d58b3a88f86c5e3225099a..75809d6c693bac141197477264d8eedf758ddc1f 100644 --- a/crates/languages/src/bash.rs +++ b/crates/languages/src/bash.rs @@ -19,7 +19,7 @@ pub(super) fn bash_task_context() -> ContextProviderWithTasks { #[cfg(test)] mod tests { use gpui::{AppContext as _, BorrowAppContext, Context, TestAppContext}; - use language::{language_settings::AllLanguageSettings, AutoindentMode, Buffer}; + use language::{AutoindentMode, Buffer, language_settings::AllLanguageSettings}; use settings::SettingsStore; use std::num::NonZeroU32; use unindent::Unindent; diff --git a/crates/languages/src/c.rs b/crates/languages/src/c.rs index 27f4ff2056aa0cac51cbe6a70b2b862adbf96b48..1e0318dee237fcb264d6fd62058a6448b6b64e1b 100644 --- a/crates/languages/src/c.rs +++ b/crates/languages/src/c.rs @@ -1,15 +1,15 @@ -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use async_trait::async_trait; use futures::StreamExt; use gpui::AsyncApp; -use http_client::github::{latest_github_release, GitHubLspBinaryVersion}; +use http_client::github::{GitHubLspBinaryVersion, latest_github_release}; pub use language::*; use lsp::{DiagnosticTag, InitializeParams, LanguageServerBinary, LanguageServerName}; use project::lsp_store::clangd_ext; use serde_json::json; use smol::fs::{self, File}; use std::{any::Any, env::consts, path::PathBuf, sync::Arc}; -use util::{fs::remove_matching, maybe, merge_json_value_into, ResultExt}; +use util::{ResultExt, fs::remove_matching, maybe, merge_json_value_into}; pub struct CLspAdapter; @@ -360,7 +360,7 @@ async fn get_cached_server_binary(container_dir: PathBuf) -> Option Vec { vec!["-mode=stdio".into()] diff --git a/crates/languages/src/json.rs b/crates/languages/src/json.rs index 98a052018041e8cdb3213a94d560f235a7bcb16b..de8a5e513ccad6849d281d71b507a167cc4dbe87 100644 --- a/crates/languages/src/json.rs +++ b/crates/languages/src/json.rs @@ -1,16 +1,16 @@ -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; use collections::HashMap; use futures::StreamExt; use gpui::{App, AsyncApp}; -use http_client::github::{latest_github_release, GitHubLspBinaryVersion}; +use http_client::github::{GitHubLspBinaryVersion, latest_github_release}; use language::{LanguageRegistry, LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use lsp::{LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; -use project::{lsp_store::language_server_settings, ContextProviderWithTasks, Fs}; -use serde_json::{json, Value}; +use project::{ContextProviderWithTasks, Fs, lsp_store::language_server_settings}; +use serde_json::{Value, json}; use settings::{KeymapFile, SettingsJsonSchemaParams, SettingsStore}; use smol::{ fs::{self}, @@ -26,7 +26,7 @@ use std::{ sync::Arc, }; use task::{TaskTemplate, TaskTemplates, VariableName}; -use util::{fs::remove_matching, maybe, merge_json_value_into, ResultExt}; +use util::{ResultExt, fs::remove_matching, maybe, merge_json_value_into}; const SERVER_PATH: &str = "node_modules/vscode-langservers-extracted/bin/vscode-json-language-server"; diff --git a/crates/languages/src/lib.rs b/crates/languages/src/lib.rs index ed8a1fc5b8c96b88baabf6a5188277e3ebbb1c32..3a140e4ae19020299a9c783001e7a5c502f635a6 100644 --- a/crates/languages/src/lib.rs +++ b/crates/languages/src/lib.rs @@ -8,7 +8,7 @@ use rust_embed::RustEmbed; use settings::SettingsStore; use smol::stream::StreamExt; use std::{str, sync::Arc}; -use util::{asset_str, ResultExt}; +use util::{ResultExt, asset_str}; pub use language::*; diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs index cd4add33b1ecac24c2858fc3780cde51d39094ab..7b0400eb9c7d290b1661323aa75071863bf049b5 100644 --- a/crates/languages/src/python.rs +++ b/crates/languages/src/python.rs @@ -1,25 +1,25 @@ use anyhow::ensure; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use gpui::{App, Task}; use gpui::{AsyncApp, SharedString}; -use language::language_settings::language_settings; use language::LanguageToolchainStore; use language::Toolchain; use language::ToolchainList; use language::ToolchainLister; +use language::language_settings::language_settings; use language::{ContextProvider, LspAdapter, LspAdapterDelegate}; use language::{LanguageName, ManifestName, ManifestProvider, ManifestQuery}; use lsp::LanguageServerBinary; use lsp::LanguageServerName; use node_runtime::NodeRuntime; +use pet_core::Configuration; use pet_core::os_environment::Environment; use pet_core::python_environment::PythonEnvironmentKind; -use pet_core::Configuration; -use project::lsp_store::language_server_settings; use project::Fs; -use serde_json::{json, Value}; +use project::lsp_store::language_server_settings; +use serde_json::{Value, json}; use smol::lock::OnceCell; use std::cmp::Ordering; @@ -1127,7 +1127,7 @@ impl LspAdapter for PyLspAdapter { #[cfg(test)] mod tests { use gpui::{AppContext as _, BorrowAppContext, Context, TestAppContext}; - use language::{language_settings::AllLanguageSettings, AutoindentMode, Buffer}; + use language::{AutoindentMode, Buffer, language_settings::AllLanguageSettings}; use settings::SettingsStore; use std::num::NonZeroU32; diff --git a/crates/languages/src/rust.rs b/crates/languages/src/rust.rs index c4d0c2ada03a03e42881d5a42190af59ebb92b30..219a9cd0ce3bfba287bb57c0fea3c0215edcb4ae 100644 --- a/crates/languages/src/rust.rs +++ b/crates/languages/src/rust.rs @@ -1,11 +1,11 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_compression::futures::bufread::GzipDecoder; use async_trait::async_trait; use collections::HashMap; -use futures::{io::BufReader, StreamExt}; +use futures::{StreamExt, io::BufReader}; use gpui::{App, AsyncApp, SharedString, Task}; use http_client::github::AssetKind; -use http_client::github::{latest_github_release, GitHubLspBinaryVersion}; +use http_client::github::{GitHubLspBinaryVersion, latest_github_release}; pub use language::*; use lsp::LanguageServerBinary; use regex::Regex; @@ -18,7 +18,7 @@ use std::{ sync::{Arc, LazyLock}, }; use task::{TaskTemplate, TaskTemplates, TaskType, TaskVariables, VariableName}; -use util::{fs::remove_matching, maybe, ResultExt}; +use util::{ResultExt, fs::remove_matching, maybe}; use crate::language_settings::language_settings; diff --git a/crates/languages/src/tailwind.rs b/crates/languages/src/tailwind.rs index 04127e98bb1e03d981b4918a841822a0c900dd42..a9aba756431b75646fc72c4edf0ae95918daa8bc 100644 --- a/crates/languages/src/tailwind.rs +++ b/crates/languages/src/tailwind.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use futures::StreamExt; @@ -6,8 +6,8 @@ use gpui::AsyncApp; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use lsp::{LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; -use project::{lsp_store::language_server_settings, Fs}; -use serde_json::{json, Value}; +use project::{Fs, lsp_store::language_server_settings}; +use serde_json::{Value, json}; use smol::fs; use std::{ any::Any, @@ -15,7 +15,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; #[cfg(target_os = "windows")] const SERVER_PATH: &str = diff --git a/crates/languages/src/typescript.rs b/crates/languages/src/typescript.rs index db3671ab1a16000a229b52d122abe4e3ad1bb473..20249e00922a1a61b791a871646ada68e9205fd4 100644 --- a/crates/languages/src/typescript.rs +++ b/crates/languages/src/typescript.rs @@ -1,16 +1,16 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; use async_trait::async_trait; use collections::HashMap; use gpui::AsyncApp; -use http_client::github::{build_asset_url, AssetKind, GitHubLspBinaryVersion}; +use http_client::github::{AssetKind, GitHubLspBinaryVersion, build_asset_url}; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; use project::ContextProviderWithTasks; -use project::{lsp_store::language_server_settings, Fs}; -use serde_json::{json, Value}; +use project::{Fs, lsp_store::language_server_settings}; +use serde_json::{Value, json}; use smol::{fs, io::BufReader, stream::StreamExt}; use std::{ any::Any, @@ -19,7 +19,7 @@ use std::{ sync::Arc, }; use task::{TaskTemplate, TaskTemplates, VariableName}; -use util::{fs::remove_matching, maybe, ResultExt}; +use util::{ResultExt, fs::remove_matching, maybe}; pub(super) fn typescript_task_context() -> ContextProviderWithTasks { ContextProviderWithTasks::new(TaskTemplates(vec![ diff --git a/crates/languages/src/vtsls.rs b/crates/languages/src/vtsls.rs index 692dbd5092756f9fefc82fc03ba2dc638476fc37..8b1cf5edc65e039e22bf9adff633a98a22c3fe53 100644 --- a/crates/languages/src/vtsls.rs +++ b/crates/languages/src/vtsls.rs @@ -1,11 +1,11 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use gpui::AsyncApp; use language::{LanguageToolchainStore, LspAdapter, LspAdapterDelegate}; use lsp::{CodeActionKind, LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; -use project::{lsp_store::language_server_settings, Fs}; +use project::{Fs, lsp_store::language_server_settings}; use serde_json::Value; use std::{ any::Any, @@ -13,7 +13,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{maybe, merge_json_value_into, ResultExt}; +use util::{ResultExt, maybe, merge_json_value_into}; fn typescript_server_binary_arguments(server_path: &Path) -> Vec { vec![server_path.into(), "--stdio".into()] diff --git a/crates/languages/src/yaml.rs b/crates/languages/src/yaml.rs index edc176a11716647f4933ab3a91607d05d9c8e240..1b9da5771fb58edd37c25d11649b8cc18dbfa61f 100644 --- a/crates/languages/src/yaml.rs +++ b/crates/languages/src/yaml.rs @@ -1,13 +1,13 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use futures::StreamExt; use gpui::AsyncApp; use language::{ - language_settings::AllLanguageSettings, LanguageToolchainStore, LspAdapter, LspAdapterDelegate, + LanguageToolchainStore, LspAdapter, LspAdapterDelegate, language_settings::AllLanguageSettings, }; use lsp::{LanguageServerBinary, LanguageServerName}; use node_runtime::NodeRuntime; -use project::{lsp_store::language_server_settings, Fs}; +use project::{Fs, lsp_store::language_server_settings}; use serde_json::Value; use settings::{Settings, SettingsLocation}; use smol::fs; @@ -17,7 +17,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{maybe, merge_json_value_into, ResultExt}; +use util::{ResultExt, maybe, merge_json_value_into}; const SERVER_PATH: &str = "node_modules/yaml-language-server/bin/yaml-language-server"; diff --git a/crates/livekit_api/src/livekit_api.rs b/crates/livekit_api/src/livekit_api.rs index d68099c0e3bc88ca0a679e76494d62ae96e1ef0c..ea4279c223a38bb5655c74d2615c169917e76bc3 100644 --- a/crates/livekit_api/src/livekit_api.rs +++ b/crates/livekit_api/src/livekit_api.rs @@ -1,7 +1,7 @@ pub mod proto; pub mod token; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use prost::Message; use reqwest::header::CONTENT_TYPE; diff --git a/crates/livekit_api/src/token.rs b/crates/livekit_api/src/token.rs index aa367028230861ca742aeb1c818b1af1e5a036c0..02602e13931e90461b084ba5cc6337d018c6bfc3 100644 --- a/crates/livekit_api/src/token.rs +++ b/crates/livekit_api/src/token.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use jsonwebtoken::{DecodingKey, EncodingKey, Header, Validation}; use serde::{Deserialize, Serialize}; use std::{ diff --git a/crates/livekit_client/examples/test_app.rs b/crates/livekit_client/examples/test_app.rs index c04d44259286d4cc73622e99599e321b2d9daae9..e1d01df534e142502abb5f17392e19299f8ae158 100644 --- a/crates/livekit_client/examples/test_app.rs +++ b/crates/livekit_client/examples/test_app.rs @@ -2,12 +2,12 @@ use std::sync::Arc; use futures::StreamExt; use gpui::{ - actions, bounds, div, point, - prelude::{FluentBuilder as _, IntoElement}, - px, rgb, size, AppContext as _, AsyncApp, Bounds, Context, Entity, InteractiveElement, - KeyBinding, Menu, MenuItem, ParentElement, Pixels, Render, ScreenCaptureStream, SharedString, + AppContext as _, AsyncApp, Bounds, Context, Entity, InteractiveElement, KeyBinding, Menu, + MenuItem, ParentElement, Pixels, Render, ScreenCaptureStream, SharedString, StatefulInteractiveElement as _, Styled, Task, Window, WindowBounds, WindowHandle, - WindowOptions, + WindowOptions, actions, bounds, div, point, + prelude::{FluentBuilder as _, IntoElement}, + px, rgb, size, }; use livekit_client::{ AudioStream, LocalTrackPublication, Participant, ParticipantIdentity, RemoteParticipant, @@ -302,11 +302,7 @@ impl LivekitWindow { cx: &mut Context, ) -> Option<()> { let participant = self.remote_participants.iter().find_map(|(id, state)| { - if id == identity { - Some(state) - } else { - None - } + if id == identity { Some(state) } else { None } })?; let publication = &participant.audio_output_stream.as_ref()?.0; publication.set_enabled(!publication.is_enabled(), cx); @@ -336,11 +332,7 @@ impl Render for LivekitWindow { button() .id("toggle-mute") .child(if let Some(track) = &self.microphone_track { - if track.is_muted() { - "Unmute" - } else { - "Mute" - } + if track.is_muted() { "Unmute" } else { "Mute" } } else { "Publish mic" }) diff --git a/crates/livekit_client/src/livekit_client.rs b/crates/livekit_client/src/livekit_client.rs index ddab6606782bf6dd5ef368a9ad4b24fdcdd3d921..c258d11de3e0a9553d094ead3580c2cb91acd020 100644 --- a/crates/livekit_client/src/livekit_client.rs +++ b/crates/livekit_client/src/livekit_client.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use anyhow::Result; use collections::HashMap; -use futures::{channel::mpsc, SinkExt}; +use futures::{SinkExt, channel::mpsc}; use gpui::{App, AsyncApp, ScreenCaptureSource, ScreenCaptureStream, Task}; use gpui_tokio::Tokio; use playback::capture_local_video_track; @@ -11,7 +11,7 @@ mod playback; use crate::{LocalTrack, Participant, RemoteTrack, RoomEvent, TrackPublication}; pub use playback::AudioStream; -pub(crate) use playback::{play_remote_video_track, RemoteVideoFrame}; +pub(crate) use playback::{RemoteVideoFrame, play_remote_video_track}; #[derive(Clone, Debug)] pub struct RemoteVideoTrack(livekit::track::RemoteVideoTrack); diff --git a/crates/livekit_client/src/livekit_client/playback.rs b/crates/livekit_client/src/livekit_client/playback.rs index a459fe84a510a6713b8270f8ea8dbdfd322b5e9e..340efc95aa777f33588b9146aa116dea4fa3e76e 100644 --- a/crates/livekit_client/src/livekit_client/playback.rs +++ b/crates/livekit_client/src/livekit_client/playback.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use cpal::traits::{DeviceTrait, HostTrait, StreamTrait as _}; use futures::channel::mpsc::UnboundedSender; @@ -11,19 +11,19 @@ use livekit::track; use livekit::webrtc::{ audio_frame::AudioFrame, - audio_source::{native::NativeAudioSource, AudioSourceOptions, RtcAudioSource}, + audio_source::{AudioSourceOptions, RtcAudioSource, native::NativeAudioSource}, audio_stream::native::NativeAudioStream, video_frame::{VideoBuffer, VideoFrame, VideoRotation}, - video_source::{native::NativeVideoSource, RtcVideoSource, VideoResolution}, + video_source::{RtcVideoSource, VideoResolution, native::NativeVideoSource}, video_stream::native::NativeVideoStream, }; use parking_lot::Mutex; use std::cell::RefCell; -use std::sync::atomic::{self, AtomicI32}; use std::sync::Weak; +use std::sync::atomic::{self, AtomicI32}; use std::time::Duration; use std::{borrow::Cow, collections::VecDeque, sync::Arc, thread}; -use util::{maybe, ResultExt as _}; +use util::{ResultExt as _, maybe}; pub(crate) struct AudioStack { executor: BackgroundExecutor, @@ -576,7 +576,7 @@ fn video_frame_buffer_from_webrtc(buffer: Box) -> Option + Sized { mod macos { use coreaudio::sys::{ - kAudioHardwarePropertyDefaultInputDevice, kAudioHardwarePropertyDefaultOutputDevice, - kAudioObjectPropertyElementMaster, kAudioObjectPropertyScopeGlobal, - kAudioObjectSystemObject, AudioObjectAddPropertyListener, AudioObjectID, - AudioObjectPropertyAddress, AudioObjectRemovePropertyListener, OSStatus, + AudioObjectAddPropertyListener, AudioObjectID, AudioObjectPropertyAddress, + AudioObjectRemovePropertyListener, OSStatus, kAudioHardwarePropertyDefaultInputDevice, + kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyElementMaster, + kAudioObjectPropertyScopeGlobal, kAudioObjectSystemObject, }; - use futures::{channel::mpsc::UnboundedReceiver, StreamExt}; + use futures::{StreamExt, channel::mpsc::UnboundedReceiver}; /// Implementation from: https://github.com/zed-industries/cpal/blob/fd8bc2fd39f1f5fdee5a0690656caff9a26d9d50/src/host/coreaudio/macos/property_listener.rs#L15 pub struct CoreAudioDefaultDeviceChangeListener { diff --git a/crates/livekit_client/src/mock_client/participant.rs b/crates/livekit_client/src/mock_client/participant.rs index 3eb6c56a99b1bf2cb620a12300b9b33e257fe809..1f4168b8e04058f00af3b3117ba17dfa90947736 100644 --- a/crates/livekit_client/src/mock_client/participant.rs +++ b/crates/livekit_client/src/mock_client/participant.rs @@ -1,7 +1,7 @@ use crate::{ - test::{Room, WeakRoom}, AudioStream, LocalAudioTrack, LocalTrackPublication, LocalVideoTrack, Participant, ParticipantIdentity, RemoteTrack, RemoteTrackPublication, TrackSid, + test::{Room, WeakRoom}, }; use anyhow::Result; use collections::HashMap; diff --git a/crates/livekit_client/src/mock_client/publication.rs b/crates/livekit_client/src/mock_client/publication.rs index 0176e63a9eb4cd648372141e400ac411056d724c..70ef3b7c2613235abcabe933ef239a7703eb20df 100644 --- a/crates/livekit_client/src/mock_client/publication.rs +++ b/crates/livekit_client/src/mock_client/publication.rs @@ -1,6 +1,6 @@ use gpui::App; -use crate::{test::WeakRoom, RemoteTrack, TrackSid}; +use crate::{RemoteTrack, TrackSid, test::WeakRoom}; #[derive(Clone, Debug)] pub struct LocalTrackPublication { diff --git a/crates/livekit_client/src/mock_client/track.rs b/crates/livekit_client/src/mock_client/track.rs index aaa1e527834ae591d8fcc9f07d26c3fe5bf0d9f5..61909370aac94cd1930c8db4a57d46d1be1c81e0 100644 --- a/crates/livekit_client/src/mock_client/track.rs +++ b/crates/livekit_client/src/mock_client/track.rs @@ -1,8 +1,8 @@ use std::sync::Arc; use crate::{ - test::{TestServerAudioTrack, TestServerVideoTrack, WeakRoom}, ParticipantIdentity, TrackSid, + test::{TestServerAudioTrack, TestServerVideoTrack, WeakRoom}, }; #[derive(Clone, Debug)] diff --git a/crates/livekit_client/src/test.rs b/crates/livekit_client/src/test.rs index b27479d7b1e566e3b7ae1afc6c4cf33842043ec2..77e1c0038a0596677db8a942fc701cda79be2500 100644 --- a/crates/livekit_client/src/test.rs +++ b/crates/livekit_client/src/test.rs @@ -1,16 +1,16 @@ use crate::{AudioStream, Participant, RemoteTrack, RoomEvent, TrackPublication}; use crate::mock_client::{participant::*, publication::*, track::*}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; -use collections::{btree_map::Entry as BTreeEntry, hash_map::Entry, BTreeMap, HashMap, HashSet}; +use collections::{BTreeMap, HashMap, HashSet, btree_map::Entry as BTreeEntry, hash_map::Entry}; use gpui::{App, AsyncApp, BackgroundExecutor}; use livekit_api::{proto, token}; use parking_lot::Mutex; use postage::{mpsc, sink::Sink}; use std::sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicBool, Ordering::SeqCst}, }; #[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)] diff --git a/crates/lmstudio/src/lmstudio.rs b/crates/lmstudio/src/lmstudio.rs index aadf33248fc25bc04d798a106ec53a3c86322746..0d17db63c1e53a4e80cbae5560b9e9da547d714a 100644 --- a/crates/lmstudio/src/lmstudio.rs +++ b/crates/lmstudio/src/lmstudio.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _, Result}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, StreamExt}; -use http_client::{http, AsyncBody, HttpClient, Method, Request as HttpRequest}; +use anyhow::{Context as _, Result, anyhow}; +use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream}; +use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest, http}; use serde::{Deserialize, Serialize}; -use serde_json::{value::RawValue, Value}; +use serde_json::{Value, value::RawValue}; use std::{convert::TryFrom, sync::Arc, time::Duration}; pub const LMSTUDIO_API_URL: &str = "http://localhost:1234/api/v0"; diff --git a/crates/lsp/src/input_handler.rs b/crates/lsp/src/input_handler.rs index e9f90110aed40e76b6475294e8b28dd210a9afc4..7cebc2fe321394e2f9ac4ef95dde4138c46e6585 100644 --- a/crates/lsp/src/input_handler.rs +++ b/crates/lsp/src/input_handler.rs @@ -1,11 +1,11 @@ use std::str; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use futures::{ - channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}, AsyncBufReadExt, AsyncRead, AsyncReadExt as _, + channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded}, }; use gpui::{BackgroundExecutor, Task}; use log::warn; @@ -13,7 +13,7 @@ use parking_lot::Mutex; use smol::io::BufReader; use crate::{ - AnyNotification, AnyResponse, IoHandler, IoKind, RequestId, ResponseHandler, CONTENT_LEN_HEADER, + AnyNotification, AnyResponse, CONTENT_LEN_HEADER, IoHandler, IoKind, RequestId, ResponseHandler, }; const HEADER_DELIMITER: &[u8; 4] = b"\r\n\r\n"; diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs index e988836fcc2e65e54c49e30e9a933a789386f529..b0abd1067c515fb26596a8e88e472f3ffa302b44 100644 --- a/crates/lsp/src/lsp.rs +++ b/crates/lsp/src/lsp.rs @@ -3,20 +3,20 @@ mod input_handler; pub use lsp_types::request::*; pub use lsp_types::*; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; -use futures::{channel::oneshot, io::BufWriter, select, AsyncRead, AsyncWrite, Future, FutureExt}; +use futures::{AsyncRead, AsyncWrite, Future, FutureExt, channel::oneshot, io::BufWriter, select}; use gpui::{App, AppContext as _, AsyncApp, BackgroundExecutor, SharedString, Task}; use notification::DidChangeWorkspaceFolders; use parking_lot::{Mutex, RwLock}; use postage::{barrier, prelude::Stream}; use schemars::{ + JsonSchema, r#gen::SchemaGenerator, schema::{InstanceType, Schema, SchemaObject}, - JsonSchema, }; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; -use serde_json::{json, value::RawValue, Value}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; +use serde_json::{Value, json, value::RawValue}; use smol::{ channel, io::{AsyncBufReadExt, AsyncWriteExt, BufReader}, @@ -32,8 +32,8 @@ use std::{ path::PathBuf, pin::Pin, sync::{ - atomic::{AtomicI32, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicI32, Ordering::SeqCst}, }, task::Poll, time::{Duration, Instant}, diff --git a/crates/markdown/examples/markdown.rs b/crates/markdown/examples/markdown.rs index bcd210a0db500fb88f76c7dd3391712f8d1c034b..a6014705c3889ad294416ebcd073fbf669b5ffc2 100644 --- a/crates/markdown/examples/markdown.rs +++ b/crates/markdown/examples/markdown.rs @@ -1,13 +1,13 @@ use assets::Assets; -use gpui::{prelude::*, rgb, Application, Entity, KeyBinding, StyleRefinement, WindowOptions}; -use language::{language_settings::AllLanguageSettings, LanguageRegistry}; +use gpui::{Application, Entity, KeyBinding, StyleRefinement, WindowOptions, prelude::*, rgb}; +use language::{LanguageRegistry, language_settings::AllLanguageSettings}; use markdown::{Markdown, MarkdownStyle}; use node_runtime::NodeRuntime; use settings::SettingsStore; use std::sync::Arc; use theme::LoadThemes; use ui::prelude::*; -use ui::{div, App, Window}; +use ui::{App, Window, div}; const MARKDOWN_EXAMPLE: &str = r#" # Markdown Example Document diff --git a/crates/markdown/examples/markdown_as_child.rs b/crates/markdown/examples/markdown_as_child.rs index 4aa97a5e3820dbed47cf368563fd3c48eb768b93..b30f2e21301fbeca5ac0d2b80c38486e65bd3c30 100644 --- a/crates/markdown/examples/markdown_as_child.rs +++ b/crates/markdown/examples/markdown_as_child.rs @@ -1,6 +1,6 @@ use assets::Assets; -use gpui::{rgb, Application, Entity, KeyBinding, Length, StyleRefinement, WindowOptions}; -use language::{language_settings::AllLanguageSettings, LanguageRegistry}; +use gpui::{Application, Entity, KeyBinding, Length, StyleRefinement, WindowOptions, rgb}; +use language::{LanguageRegistry, language_settings::AllLanguageSettings}; use markdown::{Markdown, MarkdownStyle}; use node_runtime::NodeRuntime; use settings::SettingsStore; diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs index b422817ac5405f5cf97928772c497976a2333ba5..122fe3fc169a8f3c3400d06a8c1124f2a689fbda 100644 --- a/crates/markdown/src/markdown.rs +++ b/crates/markdown/src/markdown.rs @@ -9,17 +9,17 @@ use std::sync::Arc; use std::time::Duration; use gpui::{ - actions, point, quad, AnyElement, App, BorderStyle, Bounds, ClipboardItem, CursorStyle, - DispatchPhase, Edges, Entity, FocusHandle, Focusable, FontStyle, FontWeight, GlobalElementId, - Hitbox, Hsla, KeyContext, Length, MouseDownEvent, MouseEvent, MouseMoveEvent, MouseUpEvent, - Point, Render, Stateful, StrikethroughStyle, StyleRefinement, StyledText, Task, TextLayout, - TextRun, TextStyle, TextStyleRefinement, + AnyElement, App, BorderStyle, Bounds, ClipboardItem, CursorStyle, DispatchPhase, Edges, Entity, + FocusHandle, Focusable, FontStyle, FontWeight, GlobalElementId, Hitbox, Hsla, KeyContext, + Length, MouseDownEvent, MouseEvent, MouseMoveEvent, MouseUpEvent, Point, Render, Stateful, + StrikethroughStyle, StyleRefinement, StyledText, Task, TextLayout, TextRun, TextStyle, + TextStyleRefinement, actions, point, quad, }; use language::{Language, LanguageRegistry, Rope}; -use parser::{parse_links_only, parse_markdown, MarkdownEvent, MarkdownTag, MarkdownTagEnd}; +use parser::{MarkdownEvent, MarkdownTag, MarkdownTagEnd, parse_links_only, parse_markdown}; use pulldown_cmark::Alignment; use theme::SyntaxTheme; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use util::{ResultExt, TryFutureExt}; use crate::parser::CodeBlockKind; @@ -294,11 +294,7 @@ impl Selection { } fn tail(&self) -> usize { - if self.reversed { - self.end - } else { - self.start - } + if self.reversed { self.end } else { self.start } } } @@ -535,7 +531,7 @@ impl MarkdownElement { window: &mut Window, _cx: &mut App, mut f: impl 'static - + FnMut(&mut Markdown, &T, DispatchPhase, &mut Window, &mut Context), + + FnMut(&mut Markdown, &T, DispatchPhase, &mut Window, &mut Context), ) { window.on_mouse_event({ let markdown = self.markdown.downgrade(); diff --git a/crates/markdown_preview/src/markdown_elements.rs b/crates/markdown_preview/src/markdown_elements.rs index 256ce6ee4ad0101f2b17eb84794e07701d47a9ec..a570e79f5344d0f35693072f82f947004e24ac65 100644 --- a/crates/markdown_preview/src/markdown_elements.rs +++ b/crates/markdown_preview/src/markdown_elements.rs @@ -1,5 +1,5 @@ use gpui::{ - px, FontStyle, FontWeight, HighlightStyle, SharedString, StrikethroughStyle, UnderlineStyle, + FontStyle, FontWeight, HighlightStyle, SharedString, StrikethroughStyle, UnderlineStyle, px, }; use language::HighlightId; use std::{fmt::Display, ops::Range, path::PathBuf}; diff --git a/crates/markdown_preview/src/markdown_parser.rs b/crates/markdown_preview/src/markdown_parser.rs index 24a88342a668fd37e4bfd3947981cb5583c0017d..0e540fcc9ea570642b0d8f4c7edb738e5cb986f4 100644 --- a/crates/markdown_preview/src/markdown_parser.rs +++ b/crates/markdown_preview/src/markdown_parser.rs @@ -751,12 +751,12 @@ mod tests { use super::*; + use ParsedMarkdownListItemType::*; use gpui::BackgroundExecutor; use language::{ - tree_sitter_rust, HighlightId, Language, LanguageConfig, LanguageMatcher, LanguageRegistry, + HighlightId, Language, LanguageConfig, LanguageMatcher, LanguageRegistry, tree_sitter_rust, }; use pretty_assertions::assert_eq; - use ParsedMarkdownListItemType::*; async fn parse(input: &str) -> ParsedMarkdown { parse_markdown(input, None, None).await diff --git a/crates/markdown_preview/src/markdown_preview.rs b/crates/markdown_preview/src/markdown_preview.rs index da1f35c45e17b4dfd596e1866d63d41f5de59bc7..de3554286bfb68957656660fe834837c5a576ee6 100644 --- a/crates/markdown_preview/src/markdown_preview.rs +++ b/crates/markdown_preview/src/markdown_preview.rs @@ -1,4 +1,4 @@ -use gpui::{actions, App}; +use gpui::{App, actions}; use workspace::Workspace; pub mod markdown_elements; diff --git a/crates/markdown_preview/src/markdown_preview_view.rs b/crates/markdown_preview/src/markdown_preview_view.rs index ae62ea3d62c8fda8447b3eaccc4342282ffffce4..ace832d7bcebb4d33388d4176b4237b9be5e0a65 100644 --- a/crates/markdown_preview/src/markdown_preview_view.rs +++ b/crates/markdown_preview/src/markdown_preview_view.rs @@ -6,22 +6,22 @@ use anyhow::Result; use editor::scroll::Autoscroll; use editor::{Editor, EditorEvent}; use gpui::{ - list, App, ClickEvent, Context, Entity, EventEmitter, FocusHandle, Focusable, - InteractiveElement, IntoElement, ListState, ParentElement, Render, Styled, Subscription, Task, - WeakEntity, Window, + App, ClickEvent, Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + IntoElement, ListState, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, + list, }; use language::LanguageRegistry; use ui::prelude::*; use workspace::item::{Item, ItemHandle}; use workspace::{Pane, Workspace}; -use crate::markdown_elements::ParsedMarkdownElement; use crate::OpenPreviewToTheSide; +use crate::markdown_elements::ParsedMarkdownElement; use crate::{ + OpenPreview, markdown_elements::ParsedMarkdown, markdown_parser::parse_markdown, - markdown_renderer::{render_markdown_block, RenderContext}, - OpenPreview, + markdown_renderer::{RenderContext, render_markdown_block}, }; const REPARSE_DEBOUNCE: Duration = Duration::from_millis(200); diff --git a/crates/markdown_preview/src/markdown_renderer.rs b/crates/markdown_preview/src/markdown_renderer.rs index 77b3e67876d4e4626500b539f9fd0070f181ffc7..e86943fe7cf47b36434b78f1a2f90c45a2eee0aa 100644 --- a/crates/markdown_preview/src/markdown_renderer.rs +++ b/crates/markdown_preview/src/markdown_renderer.rs @@ -5,10 +5,10 @@ use crate::markdown_elements::{ ParsedMarkdownTableAlignment, ParsedMarkdownTableRow, }; use gpui::{ - div, img, px, rems, AbsoluteLength, AnyElement, App, AppContext as _, ClipboardItem, Context, - DefiniteLength, Div, Element, ElementId, Entity, HighlightStyle, Hsla, ImageSource, - InteractiveText, IntoElement, Keystroke, Length, Modifiers, ParentElement, Render, Resource, - SharedString, Styled, StyledText, TextStyle, WeakEntity, Window, + AbsoluteLength, AnyElement, App, AppContext as _, ClipboardItem, Context, DefiniteLength, Div, + Element, ElementId, Entity, HighlightStyle, Hsla, ImageSource, InteractiveText, IntoElement, + Keystroke, Length, Modifiers, ParentElement, Render, Resource, SharedString, Styled, + StyledText, TextStyle, WeakEntity, Window, div, img, px, rems, }; use settings::Settings; use std::{ @@ -18,10 +18,10 @@ use std::{ }; use theme::{ActiveTheme, SyntaxTheme, ThemeSettings}; use ui::{ - h_flex, relative, tooltip_container, v_flex, ButtonCommon, Checkbox, Clickable, Color, - FluentBuilder, IconButton, IconName, IconSize, InteractiveElement, Label, LabelCommon, - LabelSize, LinkPreview, StatefulInteractiveElement, StyledExt, StyledImage, ToggleState, - Tooltip, VisibleOnHover, + ButtonCommon, Checkbox, Clickable, Color, FluentBuilder, IconButton, IconName, IconSize, + InteractiveElement, Label, LabelCommon, LabelSize, LinkPreview, StatefulInteractiveElement, + StyledExt, StyledImage, ToggleState, Tooltip, VisibleOnHover, h_flex, relative, + tooltip_container, v_flex, }; use workspace::{OpenOptions, OpenVisible, Workspace}; diff --git a/crates/media/src/media.rs b/crates/media/src/media.rs index a3071783f8b6e51acb6443ebd69f65db081d9b19..19fb35a41c057ea4cca66ad762c5ed916f43fd33 100644 --- a/crates/media/src/media.rs +++ b/crates/media/src/media.rs @@ -8,10 +8,10 @@ pub mod core_media { #![allow(non_snake_case)] pub use crate::bindings::{ - kCMSampleAttachmentKey_NotSync, kCMTimeInvalid, kCMVideoCodecType_H264, CMItemIndex, - CMSampleTimingInfo, CMTime, CMTimeMake, CMVideoCodecType, + CMItemIndex, CMSampleTimingInfo, CMTime, CMTimeMake, CMVideoCodecType, + kCMSampleAttachmentKey_NotSync, kCMTimeInvalid, kCMVideoCodecType_H264, }; - use anyhow::{anyhow, Result}; + use anyhow::{Result, anyhow}; use core_foundation::{ array::{CFArray, CFArrayRef}, base::{CFTypeID, OSStatus, TCFType}, @@ -226,12 +226,12 @@ pub mod core_video { #[cfg(target_os = "macos")] use std::ffi::c_void; + use crate::bindings::{CVReturn, kCVReturnSuccess}; pub use crate::bindings::{ kCVPixelFormatType_32BGRA, kCVPixelFormatType_420YpCbCr8BiPlanarFullRange, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, kCVPixelFormatType_420YpCbCr8Planar, }; - use crate::bindings::{kCVReturnSuccess, CVReturn}; - use anyhow::{anyhow, Result}; + use anyhow::{Result, anyhow}; use core_foundation::{ base::kCFAllocatorDefault, dictionary::CFDictionaryRef, mach_port::CFAllocatorRef, }; diff --git a/crates/migrator/src/migrations.rs b/crates/migrator/src/migrations.rs index a0a070051c38915c2a32741d51f052c15fd9b7ab..cb34a8d30bf737af16ef5e61ece782fd0467c358 100644 --- a/crates/migrator/src/migrations.rs +++ b/crates/migrator/src/migrations.rs @@ -9,7 +9,7 @@ pub(crate) mod m_2025_01_29 { mod settings; pub(crate) use keymap::KEYMAP_PATTERNS; - pub(crate) use settings::{replace_edit_prediction_provider_setting, SETTINGS_PATTERNS}; + pub(crate) use settings::{SETTINGS_PATTERNS, replace_edit_prediction_provider_setting}; } pub(crate) mod m_2025_01_30 { diff --git a/crates/migrator/src/migrations/m_2025_01_02/settings.rs b/crates/migrator/src/migrations/m_2025_01_02/settings.rs index 3778187231a37255e955b7c81f725de16730c292..3ce85e6b2611b69dfaac5479ee3404eeda9c0ebc 100644 --- a/crates/migrator/src/migrations/m_2025_01_02/settings.rs +++ b/crates/migrator/src/migrations/m_2025_01_02/settings.rs @@ -2,8 +2,8 @@ use collections::HashMap; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::SETTINGS_NESTED_KEY_VALUE_PATTERN; use crate::MigrationPatterns; +use crate::patterns::SETTINGS_NESTED_KEY_VALUE_PATTERN; pub const SETTINGS_PATTERNS: MigrationPatterns = &[( SETTINGS_NESTED_KEY_VALUE_PATTERN, diff --git a/crates/migrator/src/migrations/m_2025_01_29/keymap.rs b/crates/migrator/src/migrations/m_2025_01_29/keymap.rs index 2be465470d0845cea71ae8d8dcb39f300aafd51e..c32da88229b429ad206168eeee30f401863b39bd 100644 --- a/crates/migrator/src/migrations/m_2025_01_29/keymap.rs +++ b/crates/migrator/src/migrations/m_2025_01_29/keymap.rs @@ -2,11 +2,11 @@ use collections::HashMap; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; +use crate::MigrationPatterns; use crate::patterns::{ KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN, KEYMAP_ACTION_ARRAY_PATTERN, KEYMAP_ACTION_STRING_PATTERN, KEYMAP_CONTEXT_PATTERN, }; -use crate::MigrationPatterns; pub const KEYMAP_PATTERNS: MigrationPatterns = &[ ( diff --git a/crates/migrator/src/migrations/m_2025_01_29/settings.rs b/crates/migrator/src/migrations/m_2025_01_29/settings.rs index ba11779c355d74e015e831ed0beee8a812074259..8d3261676b731d00e3dd85f3f5d94737931d74fe 100644 --- a/crates/migrator/src/migrations/m_2025_01_29/settings.rs +++ b/crates/migrator/src/migrations/m_2025_01_29/settings.rs @@ -2,10 +2,10 @@ use collections::HashMap; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; +use crate::MigrationPatterns; use crate::patterns::{ SETTINGS_LANGUAGES_PATTERN, SETTINGS_NESTED_KEY_VALUE_PATTERN, SETTINGS_ROOT_KEY_VALUE_PATTERN, }; -use crate::MigrationPatterns; pub const SETTINGS_PATTERNS: MigrationPatterns = &[ (SETTINGS_ROOT_KEY_VALUE_PATTERN, replace_setting_name), diff --git a/crates/migrator/src/migrations/m_2025_01_30/keymap.rs b/crates/migrator/src/migrations/m_2025_01_30/keymap.rs index e660b99ab1ecc96ce11f704265315bd6ba9ac2e8..0e131fea022787dae851eff67c5fd73f560522df 100644 --- a/crates/migrator/src/migrations/m_2025_01_30/keymap.rs +++ b/crates/migrator/src/migrations/m_2025_01_30/keymap.rs @@ -3,8 +3,8 @@ use convert_case::{Case, Casing}; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN; use crate::MigrationPatterns; +use crate::patterns::KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN; pub const KEYMAP_PATTERNS: MigrationPatterns = &[( KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN, diff --git a/crates/migrator/src/migrations/m_2025_01_30/settings.rs b/crates/migrator/src/migrations/m_2025_01_30/settings.rs index bc65764151cb6ef73be67883242b7cedc08bed5c..23a3243b827b7d44e673208e56858b6cd2e8f2b7 100644 --- a/crates/migrator/src/migrations/m_2025_01_30/settings.rs +++ b/crates/migrator/src/migrations/m_2025_01_30/settings.rs @@ -1,8 +1,8 @@ use std::ops::Range; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::SETTINGS_NESTED_KEY_VALUE_PATTERN; use crate::MigrationPatterns; +use crate::patterns::SETTINGS_NESTED_KEY_VALUE_PATTERN; pub const SETTINGS_PATTERNS: MigrationPatterns = &[ ( diff --git a/crates/migrator/src/migrations/m_2025_03_03/keymap.rs b/crates/migrator/src/migrations/m_2025_03_03/keymap.rs index 0ed7c9e88a0ea62fe2aca49f795f77b9a0682388..2342a8f696b9f4141bc8f03cfcaaabce3272e102 100644 --- a/crates/migrator/src/migrations/m_2025_03_03/keymap.rs +++ b/crates/migrator/src/migrations/m_2025_03_03/keymap.rs @@ -2,8 +2,8 @@ use collections::HashMap; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::KEYMAP_ACTION_STRING_PATTERN; use crate::MigrationPatterns; +use crate::patterns::KEYMAP_ACTION_STRING_PATTERN; pub const KEYMAP_PATTERNS: MigrationPatterns = &[(KEYMAP_ACTION_STRING_PATTERN, replace_string_action)]; diff --git a/crates/migrator/src/migrations/m_2025_03_06/keymap.rs b/crates/migrator/src/migrations/m_2025_03_06/keymap.rs index 6975cdafa2326721bddece1f7fc75574aff02544..333535908deddc8320d2a97869397edb11508671 100644 --- a/crates/migrator/src/migrations/m_2025_03_06/keymap.rs +++ b/crates/migrator/src/migrations/m_2025_03_06/keymap.rs @@ -2,8 +2,8 @@ use collections::HashSet; use std::{ops::Range, sync::LazyLock}; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN; use crate::MigrationPatterns; +use crate::patterns::KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN; pub const KEYMAP_PATTERNS: MigrationPatterns = &[( KEYMAP_ACTION_ARRAY_ARGUMENT_AS_OBJECT_PATTERN, diff --git a/crates/migrator/src/migrations/m_2025_03_29/settings.rs b/crates/migrator/src/migrations/m_2025_03_29/settings.rs index 367929c71342f3046e151cfa6e9aaf00f964751a..47f65b407da2b7079fb68a4877275339d6309433 100644 --- a/crates/migrator/src/migrations/m_2025_03_29/settings.rs +++ b/crates/migrator/src/migrations/m_2025_03_29/settings.rs @@ -1,8 +1,8 @@ use std::ops::Range; use tree_sitter::{Query, QueryMatch}; -use crate::patterns::SETTINGS_ROOT_KEY_VALUE_PATTERN; use crate::MigrationPatterns; +use crate::patterns::SETTINGS_ROOT_KEY_VALUE_PATTERN; pub const SETTINGS_PATTERNS: MigrationPatterns = &[ (SETTINGS_ROOT_KEY_VALUE_PATTERN, replace_setting_name), diff --git a/crates/mistral/src/mistral.rs b/crates/mistral/src/mistral.rs index 19ed244eb99a8e7a211f15d314229c8269ff0be3..de2457e0bf9730e9ac1822d39e424157df23f9d6 100644 --- a/crates/mistral/src/mistral.rs +++ b/crates/mistral/src/mistral.rs @@ -1,5 +1,5 @@ -use anyhow::{anyhow, Result}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, StreamExt}; +use anyhow::{Result, anyhow}; +use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream}; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; use serde_json::Value; diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs index 3952d20a0df0ecdaa34db3e988ea2817e448b1e1..162d2d6e3485404abdffd4f73cb6ede6012b7242 100644 --- a/crates/multi_buffer/src/multi_buffer.rs +++ b/crates/multi_buffer/src/multi_buffer.rs @@ -6,23 +6,23 @@ mod position; pub use anchor::{Anchor, AnchorRangeExt, Offset}; pub use position::{TypedOffset, TypedPoint, TypedRow}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use buffer_diff::{ BufferDiff, BufferDiffEvent, BufferDiffSnapshot, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind, }; use clock::ReplicaId; use collections::{BTreeMap, Bound, HashMap, HashSet}; -use futures::{channel::mpsc, SinkExt}; +use futures::{SinkExt, channel::mpsc}; use gpui::{App, AppContext as _, Context, Entity, EntityId, EventEmitter, Task}; use itertools::Itertools; use language::{ - language_settings::{language_settings, IndentGuideSettings, LanguageSettings}, AutoindentMode, Buffer, BufferChunks, BufferRow, BufferSnapshot, Capability, CharClassifier, CharKind, Chunk, CursorShape, DiagnosticEntry, DiskState, File, IndentSize, Language, LanguageScope, OffsetRangeExt, OffsetUtf16, Outline, OutlineItem, Point, PointUtf16, Selection, TextDimension, TextObject, ToOffset as _, ToPoint as _, TransactionId, TreeSitterOptions, Unclipped, + language_settings::{IndentGuideSettings, LanguageSettings, language_settings}, }; use rope::DimensionPair; @@ -46,9 +46,9 @@ use std::{ }; use sum_tree::{Bias, Cursor, SumTree, TreeMap}; use text::{ + BufferId, Edit, LineIndent, TextSummary, locator::Locator, subscription::{Subscription, Topic}, - BufferId, Edit, LineIndent, TextSummary, }; use theme::SyntaxTheme; use util::post_inc; @@ -2042,12 +2042,12 @@ impl MultiBuffer { ExcerptDimension(excerpt_start.0 + excerpt.text_summary.lines); diff_transforms.seek_forward(&excerpt_start, Bias::Left, &()); - let overshoot = excerpt_start.0 - diff_transforms.start().0 .0; - let start = diff_transforms.start().1 .0 + overshoot; + let overshoot = excerpt_start.0 - diff_transforms.start().0.0; + let start = diff_transforms.start().1.0 + overshoot; diff_transforms.seek_forward(&excerpt_end, Bias::Right, &()); - let overshoot = excerpt_end.0 - diff_transforms.start().0 .0; - let end = diff_transforms.start().1 .0 + overshoot; + let overshoot = excerpt_end.0 - diff_transforms.start().0.0; + let end = diff_transforms.start().1.0 + overshoot; result.push(start..end) } @@ -4674,7 +4674,7 @@ impl MultiBufferSnapshot { D: TextDimension + Ord + Sub, { loop { - let transform_end_position = diff_transforms.end(&()).0 .0; + let transform_end_position = diff_transforms.end(&()).0.0; let at_transform_end = excerpt_position == transform_end_position && diff_transforms.item().is_some(); if at_transform_end && anchor.text_anchor.bias == Bias::Right { @@ -4682,7 +4682,7 @@ impl MultiBufferSnapshot { continue; } - let mut position = diff_transforms.start().1 .0; + let mut position = diff_transforms.start().1.0; match diff_transforms.item() { Some(DiffTransform::DeletedHunk { buffer_id, @@ -4716,7 +4716,7 @@ impl MultiBufferSnapshot { diff_transforms.next(&()); continue; } - let overshoot = excerpt_position - diff_transforms.start().0 .0; + let overshoot = excerpt_position - diff_transforms.start().0.0; position.add_assign(&overshoot); } } @@ -4812,7 +4812,7 @@ impl MultiBufferSnapshot { position.add_assign(&(summary - excerpt_buffer_start)); } - if position > diff_transforms_cursor.start().0 .0 { + if position > diff_transforms_cursor.start().0.0 { diff_transforms_cursor.seek_forward( &ExcerptDimension(position), Bias::Left, @@ -5155,7 +5155,7 @@ impl MultiBufferSnapshot { let excerpt = excerpts.item()?; Some(MultiBufferExcerpt { excerpt, - offset: diff_transforms.start().0 .0, + offset: diff_transforms.start().0.0, buffer_offset: excerpt.range.context.start.to_offset(&excerpt.buffer), excerpt_offset: excerpts.start().1.clone(), diff_transforms, @@ -5209,50 +5209,52 @@ impl MultiBufferSnapshot { cursor.next_excerpt(); - iter::from_fn(move || loop { - if self.singleton { - return None; - } + iter::from_fn(move || { + loop { + if self.singleton { + return None; + } - let next_region = cursor.region()?; - cursor.next_excerpt(); - if !bounds.contains(&next_region.range.start.key) { - prev_region = Some(next_region); - continue; - } + let next_region = cursor.region()?; + cursor.next_excerpt(); + if !bounds.contains(&next_region.range.start.key) { + prev_region = Some(next_region); + continue; + } - let next_region_start = next_region.range.start.value.unwrap(); - let next_region_end = if let Some(region) = cursor.region() { - region.range.start.value.unwrap() - } else { - self.max_point() - }; + let next_region_start = next_region.range.start.value.unwrap(); + let next_region_end = if let Some(region) = cursor.region() { + region.range.start.value.unwrap() + } else { + self.max_point() + }; - let prev = prev_region.as_ref().map(|region| ExcerptInfo { - id: region.excerpt.id, - buffer: region.excerpt.buffer.clone(), - buffer_id: region.excerpt.buffer_id, - range: region.excerpt.range.clone(), - end_row: MultiBufferRow(next_region_start.row), - }); + let prev = prev_region.as_ref().map(|region| ExcerptInfo { + id: region.excerpt.id, + buffer: region.excerpt.buffer.clone(), + buffer_id: region.excerpt.buffer_id, + range: region.excerpt.range.clone(), + end_row: MultiBufferRow(next_region_start.row), + }); - let next = ExcerptInfo { - id: next_region.excerpt.id, - buffer: next_region.excerpt.buffer.clone(), - buffer_id: next_region.excerpt.buffer_id, - range: next_region.excerpt.range.clone(), - end_row: if next_region.excerpt.has_trailing_newline { - MultiBufferRow(next_region_end.row - 1) - } else { - MultiBufferRow(next_region_end.row) - }, - }; + let next = ExcerptInfo { + id: next_region.excerpt.id, + buffer: next_region.excerpt.buffer.clone(), + buffer_id: next_region.excerpt.buffer_id, + range: next_region.excerpt.range.clone(), + end_row: if next_region.excerpt.has_trailing_newline { + MultiBufferRow(next_region_end.row - 1) + } else { + MultiBufferRow(next_region_end.row) + }, + }; - let row = MultiBufferRow(next_region_start.row); + let row = MultiBufferRow(next_region_start.row); - prev_region = Some(next_region); + prev_region = Some(next_region); - return Some(ExcerptBoundary { row, prev, next }); + return Some(ExcerptBoundary { row, prev, next }); + } }) } @@ -6014,11 +6016,11 @@ impl MultiBufferSnapshot { .diff_transforms .cursor::<(ExcerptDimension, OutputDimension)>(&()); diff_transforms.seek(&start, Bias::Left, &()); - let overshoot = start.0 - diff_transforms.start().0 .0; - let start = diff_transforms.start().1 .0 + overshoot; + let overshoot = start.0 - diff_transforms.start().0.0; + let start = diff_transforms.start().1.0 + overshoot; diff_transforms.seek(&end, Bias::Right, &()); - let overshoot = end.0 - diff_transforms.start().0 .0; - let end = diff_transforms.start().1 .0 + overshoot; + let overshoot = end.0 - diff_transforms.start().0.0; + let end = diff_transforms.start().1.0 + overshoot; Some(start..end) } else { None @@ -6224,13 +6226,13 @@ where self.cached_region.take(); self.diff_transforms .seek(&OutputDimension(*position), Bias::Right, &()); - if self.diff_transforms.item().is_none() && *position == self.diff_transforms.start().0 .0 { + if self.diff_transforms.item().is_none() && *position == self.diff_transforms.start().0.0 { self.diff_transforms.prev(&()); } - let mut excerpt_position = self.diff_transforms.start().1 .0; + let mut excerpt_position = self.diff_transforms.start().1.0; if let Some(DiffTransform::BufferContent { .. }) = self.diff_transforms.item() { - let overshoot = *position - self.diff_transforms.start().0 .0; + let overshoot = *position - self.diff_transforms.start().0.0; excerpt_position.add_assign(&overshoot); } @@ -6245,12 +6247,12 @@ where self.cached_region.take(); self.diff_transforms .seek_forward(&OutputDimension(*position), Bias::Right, &()); - if self.diff_transforms.item().is_none() && *position == self.diff_transforms.start().0 .0 { + if self.diff_transforms.item().is_none() && *position == self.diff_transforms.start().0.0 { self.diff_transforms.prev(&()); } - let overshoot = *position - self.diff_transforms.start().0 .0; - let mut excerpt_position = self.diff_transforms.start().1 .0; + let overshoot = *position - self.diff_transforms.start().0.0; + let mut excerpt_position = self.diff_transforms.start().1.0; if let Some(DiffTransform::BufferContent { .. }) = self.diff_transforms.item() { excerpt_position.add_assign(&overshoot); } @@ -6373,7 +6375,7 @@ where let buffer = &excerpt.buffer; let buffer_context_start = excerpt.range.context.start.summary::(buffer); let mut buffer_start = buffer_context_start; - let overshoot = self.diff_transforms.end(&()).1 .0 - self.excerpts.start().0; + let overshoot = self.diff_transforms.end(&()).1.0 - self.excerpts.start().0; buffer_start.add_assign(&overshoot); Some(buffer_start) } @@ -6395,8 +6397,8 @@ where let buffer_range_len = rope_cursor.summary::(base_text_byte_range.end); let mut buffer_end = buffer_start; buffer_end.add_assign(&buffer_range_len); - let start = self.diff_transforms.start().0 .0; - let end = self.diff_transforms.end(&()).0 .0; + let start = self.diff_transforms.start().0.0; + let end = self.diff_transforms.end(&()).0.0; return Some(MultiBufferRegion { buffer, excerpt, @@ -6415,28 +6417,28 @@ where let buffer = &excerpt.buffer; let buffer_context_start = excerpt.range.context.start.summary::(buffer); - let mut start = self.diff_transforms.start().0 .0; + let mut start = self.diff_transforms.start().0.0; let mut buffer_start = buffer_context_start; if self.diff_transforms.start().1 < *self.excerpts.start() { - let overshoot = self.excerpts.start().0 - self.diff_transforms.start().1 .0; + let overshoot = self.excerpts.start().0 - self.diff_transforms.start().1.0; start.add_assign(&overshoot); } else { - let overshoot = self.diff_transforms.start().1 .0 - self.excerpts.start().0; + let overshoot = self.diff_transforms.start().1.0 - self.excerpts.start().0; buffer_start.add_assign(&overshoot); } let mut end; let mut buffer_end; let has_trailing_newline; - if self.diff_transforms.end(&()).1 .0 < self.excerpts.end(&()).0 { - let overshoot = self.diff_transforms.end(&()).1 .0 - self.excerpts.start().0; - end = self.diff_transforms.end(&()).0 .0; + if self.diff_transforms.end(&()).1.0 < self.excerpts.end(&()).0 { + let overshoot = self.diff_transforms.end(&()).1.0 - self.excerpts.start().0; + end = self.diff_transforms.end(&()).0.0; buffer_end = buffer_context_start; buffer_end.add_assign(&overshoot); has_trailing_newline = false; } else { - let overshoot = self.excerpts.end(&()).0 - self.diff_transforms.start().1 .0; - end = self.diff_transforms.start().0 .0; + let overshoot = self.excerpts.end(&()).0 - self.diff_transforms.start().1.0; + end = self.diff_transforms.start().0.0; end.add_assign(&overshoot); buffer_end = excerpt.range.context.end.summary::(buffer); has_trailing_newline = excerpt.has_trailing_newline; @@ -6834,7 +6836,7 @@ impl<'a> MultiBufferExcerpt<'a> { fn map_offset_to_buffer_internal(&self, offset: usize) -> usize { let mut excerpt_offset = self.diff_transforms.start().1.clone(); if let Some(DiffTransform::BufferContent { .. }) = self.diff_transforms.item() { - excerpt_offset.0 += offset - self.diff_transforms.start().0 .0; + excerpt_offset.0 += offset - self.diff_transforms.start().0.0; }; let offset_in_excerpt = excerpt_offset.0.saturating_sub(self.excerpt_offset.0); self.buffer_offset + offset_in_excerpt @@ -6857,22 +6859,22 @@ impl<'a> MultiBufferExcerpt<'a> { let overshoot = buffer_range.start - self.buffer_offset; let excerpt_offset = ExcerptDimension(self.excerpt_offset.0 + overshoot); self.diff_transforms.seek(&excerpt_offset, Bias::Right, &()); - if excerpt_offset.0 < self.diff_transforms.start().1 .0 { + if excerpt_offset.0 < self.diff_transforms.start().1.0 { log::warn!( "Attempting to map a range from a buffer offset that starts before the current buffer offset" ); return buffer_range; } - let overshoot = excerpt_offset.0 - self.diff_transforms.start().1 .0; - let start = self.diff_transforms.start().0 .0 + overshoot; + let overshoot = excerpt_offset.0 - self.diff_transforms.start().1.0; + let start = self.diff_transforms.start().0.0 + overshoot; let end = if buffer_range.end > buffer_range.start { let overshoot = buffer_range.end - self.buffer_offset; let excerpt_offset = ExcerptDimension(self.excerpt_offset.0 + overshoot); self.diff_transforms .seek_forward(&excerpt_offset, Bias::Right, &()); - let overshoot = excerpt_offset.0 - self.diff_transforms.start().1 .0; - self.diff_transforms.start().0 .0 + overshoot + let overshoot = excerpt_offset.0 - self.diff_transforms.start().1.0; + self.diff_transforms.start().0.0 + overshoot } else { start }; @@ -7157,7 +7159,7 @@ impl cursor_location: &(OutputDimension, ExcerptDimension), _: &(), ) -> cmp::Ordering { - Ord::cmp(&self.0, &cursor_location.1 .0) + Ord::cmp(&self.0, &cursor_location.1.0) } } @@ -7239,7 +7241,7 @@ impl Iterator for MultiBufferRows<'_> { if let Some(next_region) = self.cursor.region() { region = next_region; } else { - if self.point == self.cursor.diff_transforms.end(&()).0 .0 { + if self.point == self.cursor.diff_transforms.end(&()).0.0 { let multibuffer_row = MultiBufferRow(self.point.row); let last_excerpt = self .cursor diff --git a/crates/node_runtime/src/archive.rs b/crates/node_runtime/src/archive.rs index 0ac1493d2860cf67bfba795fd1b81b5c60231e5b..76f754eca241ef372c64ce53c7416f1452c8c12d 100644 --- a/crates/node_runtime/src/archive.rs +++ b/crates/node_runtime/src/archive.rs @@ -2,7 +2,7 @@ use std::path::Path; use anyhow::Result; use async_zip::base::read::stream::ZipFileReader; -use futures::{io::BufReader, AsyncRead}; +use futures::{AsyncRead, io::BufReader}; pub async fn extract_zip(destination: &Path, reader: R) -> Result<()> { let mut reader = ZipFileReader::new(BufReader::new(reader)); @@ -35,8 +35,8 @@ pub async fn extract_zip(destination: &Path, reader: R) -> mod tests { use std::path::PathBuf; - use async_zip::base::write::ZipFileWriter; use async_zip::ZipEntryBuilder; + use async_zip::base::write::ZipFileWriter; use futures::AsyncWriteExt; use smol::io::Cursor; use tempfile::TempDir; diff --git a/crates/node_runtime/src/node_runtime.rs b/crates/node_runtime/src/node_runtime.rs index 8fad097505d96744f10a42a085dc4dcf79b713dc..80d7da13739b103261647c1d3de17e52bba8c1dc 100644 --- a/crates/node_runtime/src/node_runtime.rs +++ b/crates/node_runtime/src/node_runtime.rs @@ -1,6 +1,6 @@ mod archive; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; pub use archive::extract_zip; use async_compression::futures::bufread::GzipDecoder; use async_tar::Archive; @@ -279,10 +279,12 @@ impl ManagedNodeRuntime { async fn node_environment_path(&self) -> Result { let node_binary = self.installation_path.join(Self::NODE_PATH); - let mut env_path = vec![node_binary - .parent() - .expect("invalid node binary path") - .to_path_buf()]; + let mut env_path = vec![ + node_binary + .parent() + .expect("invalid node binary path") + .to_path_buf(), + ]; if let Some(existing_path) = std::env::var_os("PATH") { let mut paths = std::env::split_paths(&existing_path).collect::>(); diff --git a/crates/notifications/src/notification_store.rs b/crates/notifications/src/notification_store.rs index 68a3b57f37d4e632a0bc891d2f9359b094c97ad6..c2f18e57001bdc748738850c2f87948ea6196cef 100644 --- a/crates/notifications/src/notification_store.rs +++ b/crates/notifications/src/notification_store.rs @@ -4,7 +4,7 @@ use client::{ChannelId, Client, UserStore}; use collections::HashMap; use db::smol::stream::StreamExt; use gpui::{App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Global, Task}; -use rpc::{proto, Notification, TypedEnvelope}; +use rpc::{Notification, TypedEnvelope, proto}; use std::{ops::Range, sync::Arc}; use sum_tree::{Bias, SumTree}; use time::OffsetDateTime; @@ -368,7 +368,7 @@ impl NotificationStore { new_notifications.append(cursor.slice(&NotificationId(id), Bias::Left, &()), &()); if i == 0 { - old_range.start = cursor.start().1 .0; + old_range.start = cursor.start().1.0; } let old_notification = cursor.item(); @@ -401,7 +401,7 @@ impl NotificationStore { } } - old_range.end = cursor.start().1 .0; + old_range.end = cursor.start().1.0; let new_count = new_notifications.summary().count - old_range.start; new_notifications.append(cursor.suffix(&()), &()); drop(cursor); diff --git a/crates/notifications/src/status_toast.rs b/crates/notifications/src/status_toast.rs index 5f5bb192ac62694e1577b4c8e0902705506f1680..e8e7876d99c703eba199c56c63ff8f31b9101c84 100644 --- a/crates/notifications/src/status_toast.rs +++ b/crates/notifications/src/status_toast.rs @@ -1,7 +1,7 @@ use std::rc::Rc; use gpui::{DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, IntoElement}; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use workspace::{ToastAction, ToastView}; #[derive(Clone, Copy)] diff --git a/crates/ollama/src/ollama.rs b/crates/ollama/src/ollama.rs index 0313ddd7c9aebd5209d3ab76e93c3bf1b02f4b29..640e672f7f197e661d86541c4cf141dd1201bf76 100644 --- a/crates/ollama/src/ollama.rs +++ b/crates/ollama/src/ollama.rs @@ -1,9 +1,9 @@ -use anyhow::{anyhow, Context as _, Result}; -use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, StreamExt}; -use http_client::{http, AsyncBody, HttpClient, Method, Request as HttpRequest}; +use anyhow::{Context as _, Result, anyhow}; +use futures::{AsyncBufReadExt, AsyncReadExt, StreamExt, io::BufReader, stream::BoxStream}; +use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest, http}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use serde_json::{value::RawValue, Value}; +use serde_json::{Value, value::RawValue}; use std::{convert::TryFrom, sync::Arc, time::Duration}; pub const OLLAMA_API_URL: &str = "http://localhost:11434"; diff --git a/crates/open_ai/src/open_ai.rs b/crates/open_ai/src/open_ai.rs index c62b1c2950deab2c12a3e1cac8bdfe422a07e7d2..ca5eafaacdf4055815d6f3c98071a1f88e08626e 100644 --- a/crates/open_ai/src/open_ai.rs +++ b/crates/open_ai/src/open_ai.rs @@ -1,10 +1,10 @@ mod supported_countries; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use futures::{ + AsyncBufReadExt, AsyncReadExt, Stream, StreamExt, io::BufReader, stream::{self, BoxStream}, - AsyncBufReadExt, AsyncReadExt, Stream, StreamExt, }; use http_client::{AsyncBody, HttpClient, Method, Request as HttpRequest}; use serde::{Deserialize, Serialize}; diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index 88b134f6c7cbda6b0c0745eb42467999ef063540..d2aba0bca463a76231d33ad1ef4e0d898440a6b5 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -4,19 +4,19 @@ use std::{ sync::Arc, }; -use editor::{scroll::Autoscroll, Anchor, AnchorRangeExt, Editor, EditorMode}; +use editor::{Anchor, AnchorRangeExt, Editor, EditorMode, scroll::Autoscroll}; use fuzzy::StringMatch; use gpui::{ - div, rems, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - HighlightStyle, ParentElement, Point, Render, Styled, StyledText, Task, TextStyle, WeakEntity, - Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, HighlightStyle, + ParentElement, Point, Render, Styled, StyledText, Task, TextStyle, WeakEntity, Window, div, + rems, }; use language::{Outline, OutlineItem}; use ordered_float::OrderedFloat; use picker::{Picker, PickerDelegate}; use settings::Settings; use theme::{ActiveTheme, ThemeSettings}; -use ui::{prelude::*, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{DismissDecision, ModalView}; diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index 1e6146c1eb3cbd2ae59844bf11e0dc1737f77213..684fedb120fa4c8283f1fba22194898fd1b58718 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -5,35 +5,35 @@ use std::{ collections::BTreeMap, hash::Hash, ops::Range, - path::{Path, PathBuf, MAIN_SEPARATOR_STR}, + path::{MAIN_SEPARATOR_STR, Path, PathBuf}, sync::{ - atomic::{self, AtomicBool}, Arc, OnceLock, + atomic::{self, AtomicBool}, }, time::Duration, u32, }; use anyhow::Context as _; -use collections::{hash_map, BTreeSet, HashMap, HashSet}; +use collections::{BTreeSet, HashMap, HashSet, hash_map}; use db::kvp::KEY_VALUE_STORE; use editor::{ + AnchorRangeExt, Bias, DisplayPoint, Editor, EditorEvent, EditorMode, EditorSettings, ExcerptId, + ExcerptRange, MultiBufferSnapshot, RangeToAnchorExt, ShowScrollbar, display_map::ToDisplayPoint, items::{entry_git_aware_label_color, entry_label_color}, scroll::{Autoscroll, AutoscrollStrategy, ScrollAnchor, ScrollbarAutoHide}, - AnchorRangeExt, Bias, DisplayPoint, Editor, EditorEvent, EditorMode, EditorSettings, ExcerptId, - ExcerptRange, MultiBufferSnapshot, RangeToAnchorExt, ShowScrollbar, }; use file_icons::FileIcons; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, anchored, deferred, div, point, px, size, uniform_list, Action, AnyElement, App, - AppContext as _, AsyncWindowContext, Bounds, ClipboardItem, Context, DismissEvent, Div, - ElementId, Entity, EventEmitter, FocusHandle, Focusable, HighlightStyle, InteractiveElement, - IntoElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, MouseButton, - MouseDownEvent, ParentElement, Pixels, Point, Render, ScrollStrategy, SharedString, Stateful, - StatefulInteractiveElement as _, Styled, Subscription, Task, UniformListScrollHandle, - WeakEntity, Window, + Action, AnyElement, App, AppContext as _, AsyncWindowContext, Bounds, ClipboardItem, Context, + DismissEvent, Div, ElementId, Entity, EventEmitter, FocusHandle, Focusable, HighlightStyle, + InteractiveElement, IntoElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, + MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Render, ScrollStrategy, + SharedString, Stateful, StatefulInteractiveElement as _, Styled, Subscription, Task, + UniformListScrollHandle, WeakEntity, Window, actions, anchored, deferred, div, point, px, size, + uniform_list, }; use itertools::Itertools; use language::{BufferId, BufferSnapshot, OffsetRangeExt, OutlineItem}; @@ -47,18 +47,18 @@ use settings::{Settings, SettingsStore}; use smol::channel; use theme::{SyntaxTheme, ThemeSettings}; use ui::{DynamicSpacing, IndentGuideColors, IndentGuideLayout}; -use util::{debug_panic, RangeExt, ResultExt, TryFutureExt}; +use util::{RangeExt, ResultExt, TryFutureExt, debug_panic}; use workspace::{ + OpenInTerminal, WeakItemHandle, Workspace, dock::{DockPosition, Panel, PanelEvent}, item::ItemHandle, searchable::{SearchEvent, SearchableItem}, ui::{ - h_flex, v_flex, ActiveTheme, ButtonCommon, Clickable, Color, ContextMenu, FluentBuilder, - HighlightedLabel, Icon, IconButton, IconButtonShape, IconName, IconSize, Label, - LabelCommon, ListItem, Scrollbar, ScrollbarState, StyledExt, StyledTypography, Toggleable, - Tooltip, + ActiveTheme, ButtonCommon, Clickable, Color, ContextMenu, FluentBuilder, HighlightedLabel, + Icon, IconButton, IconButtonShape, IconName, IconSize, Label, LabelCommon, ListItem, + Scrollbar, ScrollbarState, StyledExt, StyledTypography, Toggleable, Tooltip, h_flex, + v_flex, }, - OpenInTerminal, WeakItemHandle, Workspace, }; use worktree::{Entry, ProjectEntryId, WorktreeId}; @@ -1767,11 +1767,7 @@ impl OutlinePanel { active_editor.update(cx, |editor, cx| { buffers_to_toggle.retain(|buffer_id| { let folded = editor.is_buffer_folded(*buffer_id, cx); - if fold { - !folded - } else { - folded - } + if fold { !folded } else { folded } }); }); @@ -5165,7 +5161,7 @@ impl GenerationState { mod tests { use db::indoc; use gpui::{TestAppContext, VisualTestContext, WindowHandle}; - use language::{tree_sitter_rust, Language, LanguageConfig, LanguageMatcher}; + use language::{Language, LanguageConfig, LanguageMatcher, tree_sitter_rust}; use pretty_assertions::assert_eq; use project::FakeFs; use search::project_search::{self, perform_project_search}; diff --git a/crates/panel/src/panel.rs b/crates/panel/src/panel.rs index 9859bf6444ff8558031bee0547b8948c0edba0f4..58edb1e81d14481a838235785a42500b416aee98 100644 --- a/crates/panel/src/panel.rs +++ b/crates/panel/src/panel.rs @@ -1,9 +1,9 @@ //! # panel use editor::{Editor, EditorElement, EditorStyle}; -use gpui::{actions, Entity, TextStyle}; +use gpui::{Entity, TextStyle, actions}; use settings::Settings; use theme::ThemeSettings; -use ui::{prelude::*, Tab}; +use ui::{Tab, prelude::*}; actions!(panel, [NextPanelTab, PreviousPanelTab]); diff --git a/crates/picker/src/head.rs b/crates/picker/src/head.rs index 539a301cd4c8346fb9c33a6ae26b4a17d1b39dc4..aba7b8a1d05afdc1f485574178914f50f55bc12c 100644 --- a/crates/picker/src/head.rs +++ b/crates/picker/src/head.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use editor::{Editor, EditorEvent}; -use gpui::{prelude::*, App, Entity, FocusHandle, Focusable}; +use gpui::{App, Entity, FocusHandle, Focusable, prelude::*}; use ui::prelude::*; /// The head of a [`Picker`](crate::Picker). @@ -17,7 +17,7 @@ impl Head { pub fn editor( placeholder_text: Arc, edit_handler: impl FnMut(&mut V, &Entity, &EditorEvent, &mut Window, &mut Context) - + 'static, + + 'static, window: &mut Window, cx: &mut Context, ) -> Self { diff --git a/crates/picker/src/highlighted_match_with_paths.rs b/crates/picker/src/highlighted_match_with_paths.rs index 9455ec3d434cc8ef5d26f2d78d96a21dd7bfeb64..255e0150e8d6d9684b4f5b1315d4975f037ace48 100644 --- a/crates/picker/src/highlighted_match_with_paths.rs +++ b/crates/picker/src/highlighted_match_with_paths.rs @@ -1,4 +1,4 @@ -use ui::{prelude::*, HighlightedLabel}; +use ui::{HighlightedLabel, prelude::*}; #[derive(Clone)] pub struct HighlightedMatchWithPaths { diff --git a/crates/picker/src/picker.rs b/crates/picker/src/picker.rs index 9c6fa555aa99a160845f5253b9c67cceb84cf64d..2caa9ff756cedb149ba7f54190d868e60f595134 100644 --- a/crates/picker/src/picker.rs +++ b/crates/picker/src/picker.rs @@ -1,17 +1,17 @@ use anyhow::Result; -use editor::{scroll::Autoscroll, Editor}; +use editor::{Editor, scroll::Autoscroll}; use gpui::{ - actions, div, impl_actions, list, prelude::*, uniform_list, AnyElement, App, ClickEvent, - Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Length, - ListSizingBehavior, ListState, MouseButton, MouseUpEvent, Render, ScrollHandle, ScrollStrategy, - Stateful, Task, UniformListScrollHandle, Window, + AnyElement, App, ClickEvent, Context, DismissEvent, Entity, EventEmitter, FocusHandle, + Focusable, Length, ListSizingBehavior, ListState, MouseButton, MouseUpEvent, Render, + ScrollHandle, ScrollStrategy, Stateful, Task, UniformListScrollHandle, Window, actions, div, + impl_actions, list, prelude::*, uniform_list, }; use head::Head; use schemars::JsonSchema; use serde::Deserialize; use std::{sync::Arc, time::Duration}; use ui::{ - prelude::*, v_flex, Color, Divider, Label, ListItem, ListItemSpacing, Scrollbar, ScrollbarState, + Color, Divider, Label, ListItem, ListItemSpacing, Scrollbar, ScrollbarState, prelude::*, v_flex, }; use util::ResultExt; use workspace::ModalView; diff --git a/crates/prettier/src/prettier.rs b/crates/prettier/src/prettier.rs index cfba2bca4e22359c9566ebbddc57f6d6ef0d1567..0e6f5c0d3e1ad51e41699711bd8e8449f4c8dff7 100644 --- a/crates/prettier/src/prettier.rs +++ b/crates/prettier/src/prettier.rs @@ -1,8 +1,8 @@ -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use collections::{HashMap, HashSet}; use fs::Fs; use gpui::{AsyncApp, Entity}; -use language::{language_settings::language_settings, Buffer, Diff}; +use language::{Buffer, Diff, language_settings::language_settings}; use lsp::{LanguageServer, LanguageServerId}; use node_runtime::NodeRuntime; use paths::default_prettier_dir; diff --git a/crates/project/src/buffer_store.rs b/crates/project/src/buffer_store.rs index 409a15ca427d175e3c6144bd001294dacbbf5244..c3d5f3b52869db9be1edf92559f5243e1bfa8131 100644 --- a/crates/project/src/buffer_store.rs +++ b/crates/project/src/buffer_store.rs @@ -1,32 +1,32 @@ use crate::{ + ProjectItem as _, ProjectPath, lsp_store::OpenLspBufferHandle, search::SearchQuery, worktree_store::{WorktreeStore, WorktreeStoreEvent}, - ProjectItem as _, ProjectPath, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use client::Client; -use collections::{hash_map, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map}; use fs::Fs; -use futures::{channel::oneshot, future::Shared, Future, FutureExt as _, StreamExt}; +use futures::{Future, FutureExt as _, StreamExt, channel::oneshot, future::Shared}; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity, }; use language::{ + Buffer, BufferEvent, Capability, DiskState, File as _, Language, Operation, proto::{ deserialize_line_ending, deserialize_version, serialize_line_ending, serialize_version, split_operations, }, - Buffer, BufferEvent, Capability, DiskState, File as _, Language, Operation, }; use rpc::{ - proto::{self, ToProto}, AnyProtoClient, ErrorExt as _, TypedEnvelope, + proto::{self, ToProto}, }; use smol::channel::Receiver; use std::{io, path::Path, pin::pin, sync::Arc, time::Instant}; use text::BufferId; -use util::{debug_panic, maybe, ResultExt as _, TryFutureExt}; +use util::{ResultExt as _, TryFutureExt, debug_panic, maybe}; use worktree::{File, PathChange, ProjectEntryId, Worktree, WorktreeId}; /// A set of open buffers. diff --git a/crates/project/src/debounced_delay.rs b/crates/project/src/debounced_delay.rs index e6fc2e0a35763ef446a4fb077d4b821a216c45f4..0ea045be5f581ffa7422fe3fdcf85dd305eff3e7 100644 --- a/crates/project/src/debounced_delay.rs +++ b/crates/project/src/debounced_delay.rs @@ -1,4 +1,4 @@ -use futures::{channel::oneshot, FutureExt}; +use futures::{FutureExt, channel::oneshot}; use gpui::{Context, Task}; use std::{marker::PhantomData, time::Duration}; diff --git a/crates/project/src/debugger/breakpoint_store.rs b/crates/project/src/debugger/breakpoint_store.rs index 478e50b78cc5b324fe6a6f5abd76281a3bd8429f..d3a182162eb47cb70f99017b4c82b7e5bffc017c 100644 --- a/crates/project/src/debugger/breakpoint_store.rs +++ b/crates/project/src/debugger/breakpoint_store.rs @@ -1,20 +1,20 @@ //! Module for managing breakpoints in a project. //! //! Breakpoints are separate from a session because they're not associated with any particular debug session. They can also be set up without a session running. -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use breakpoints_in_file::BreakpointsInFile; use collections::BTreeMap; use dap::client::SessionId; use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, Subscription, Task}; -use language::{proto::serialize_anchor as serialize_text_anchor, Buffer, BufferSnapshot}; +use language::{Buffer, BufferSnapshot, proto::serialize_anchor as serialize_text_anchor}; use rpc::{ - proto::{self}, AnyProtoClient, TypedEnvelope, + proto::{self}, }; use std::{hash::Hash, ops::Range, path::Path, sync::Arc}; use text::PointUtf16; -use crate::{buffer_store::BufferStore, worktree_store::WorktreeStore, Project, ProjectPath}; +use crate::{Project, ProjectPath, buffer_store::BufferStore, worktree_store::WorktreeStore}; mod breakpoints_in_file { use language::BufferEvent; diff --git a/crates/project/src/debugger/dap_command.rs b/crates/project/src/debugger/dap_command.rs index e21480d950a9352d3707c4bc4de74558a7b46b43..0685e513d1030d91ecd2bd27d37dcd1df035a798 100644 --- a/crates/project/src/debugger/dap_command.rs +++ b/crates/project/src/debugger/dap_command.rs @@ -1,14 +1,14 @@ use std::sync::Arc; -use anyhow::{anyhow, Ok, Result}; +use anyhow::{Ok, Result, anyhow}; use dap::{ - client::SessionId, - proto_conversions::ProtoConversion, - requests::{Continue, Next}, Capabilities, ContinueArguments, InitializeRequestArguments, InitializeRequestArgumentsPathFormat, NextArguments, SetVariableResponse, SourceBreakpoint, StepInArguments, StepOutArguments, SteppingGranularity, ValueFormat, Variable, VariablesArgumentsFilter, + client::SessionId, + proto_conversions::ProtoConversion, + requests::{Continue, Next}, }; use rpc::proto; use serde_json::Value; diff --git a/crates/project/src/debugger/dap_store.rs b/crates/project/src/debugger/dap_store.rs index a8e629ecbe2a535a1c391e6504c156045a1d3689..e17d3eef2b7c00645a42728bdf9fc70290b8013d 100644 --- a/crates/project/src/debugger/dap_store.rs +++ b/crates/project/src/debugger/dap_store.rs @@ -3,23 +3,23 @@ use super::{ locator_store::LocatorStore, session::{self, Session}, }; -use crate::{debugger, worktree_store::WorktreeStore, ProjectEnvironment}; -use anyhow::{anyhow, Result}; +use crate::{ProjectEnvironment, debugger, worktree_store::WorktreeStore}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use dap::{ + Capabilities, CompletionItem, CompletionsArguments, DapRegistry, ErrorResponse, + EvaluateArguments, EvaluateArgumentsContext, EvaluateResponse, RunInTerminalRequestArguments, + Source, StartDebuggingRequestArguments, adapters::{DapStatus, DebugAdapterName}, client::SessionId, messages::Message, requests::{Completions, Evaluate, Request as _, RunInTerminal, StartDebugging}, - Capabilities, CompletionItem, CompletionsArguments, DapRegistry, ErrorResponse, - EvaluateArguments, EvaluateArgumentsContext, EvaluateResponse, RunInTerminalRequestArguments, - Source, StartDebuggingRequestArguments, }; use fs::Fs; use futures::{ channel::{mpsc, oneshot}, - future::{join_all, Shared}, + future::{Shared, join_all}, }; use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Task}; use http_client::HttpClient; @@ -28,8 +28,8 @@ use lsp::LanguageServerName; use node_runtime::NodeRuntime; use rpc::{ - proto::{self}, AnyProtoClient, TypedEnvelope, + proto::{self}, }; use serde_json::Value; use settings::WorktreeId; @@ -39,7 +39,7 @@ use std::{ collections::{BTreeMap, HashSet}, ffi::OsStr, path::PathBuf, - sync::{atomic::Ordering::SeqCst, Arc}, + sync::{Arc, atomic::Ordering::SeqCst}, }; use std::{collections::VecDeque, sync::atomic::AtomicU32}; use task::{DebugAdapterConfig, DebugRequestDisposition}; diff --git a/crates/project/src/debugger/locator_store.rs b/crates/project/src/debugger/locator_store.rs index ef7f3a802af092fd8a313021a7d56087835337ad..d951cebfe9ba8eeebf97dc9b246bd11e5dab73da 100644 --- a/crates/project/src/debugger/locator_store.rs +++ b/crates/project/src/debugger/locator_store.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use cargo::CargoLocator; use collections::HashMap; use dap::DebugAdapterConfig; diff --git a/crates/project/src/debugger/locator_store/cargo.rs b/crates/project/src/debugger/locator_store/cargo.rs index 06307efe74f01a8ddee5230351383e73f700d3d4..d2b9d31be14b08f19243bfd54b27c7c5d479cb05 100644 --- a/crates/project/src/debugger/locator_store/cargo.rs +++ b/crates/project/src/debugger/locator_store/cargo.rs @@ -1,5 +1,5 @@ use super::DapLocator; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use async_trait::async_trait; use dap::DebugAdapterConfig; use serde_json::Value; diff --git a/crates/project/src/debugger/session.rs b/crates/project/src/debugger/session.rs index 6705694afe2909e9950d15213a731c646492098a..75926e582452618e9db07733071d575ebc3ef82f 100644 --- a/crates/project/src/debugger/session.rs +++ b/crates/project/src/debugger/session.rs @@ -10,25 +10,25 @@ use super::dap_command::{ VariablesCommand, }; use super::dap_store::DapAdapterDelegate; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::{HashMap, HashSet, IndexMap, IndexSet}; use dap::adapters::{DebugAdapter, DebugAdapterBinary}; use dap::messages::Response; use dap::{ + Capabilities, ContinueArguments, EvaluateArgumentsContext, Module, Source, StackFrameId, + SteppingGranularity, StoppedEvent, VariableReference, adapters::{DapDelegate, DapStatus}, client::{DebugAdapterClient, SessionId}, messages::{Events, Message}, - Capabilities, ContinueArguments, EvaluateArgumentsContext, Module, Source, StackFrameId, - SteppingGranularity, StoppedEvent, VariableReference, }; use dap::{DapRegistry, DebugRequestType, OutputEventCategory}; use futures::channel::oneshot; -use futures::{future::Shared, FutureExt}; +use futures::{FutureExt, future::Shared}; use gpui::{ App, AppContext, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, Task, WeakEntity, }; use rpc::AnyProtoClient; -use serde_json::{json, Value}; +use serde_json::{Value, json}; use settings::Settings; use smol::stream::StreamExt; use std::any::TypeId; @@ -43,7 +43,7 @@ use std::{ }; use task::{DebugAdapterConfig, DebugTaskDefinition}; use text::{PointUtf16, ToPointUtf16}; -use util::{merge_json_value_into, ResultExt}; +use util::{ResultExt, merge_json_value_into}; #[derive(Debug, Copy, Clone, Hash, PartialEq, PartialOrd, Ord, Eq)] #[repr(transparent)] @@ -1194,8 +1194,12 @@ impl Session { fn fetch( &mut self, request: T, - process_result: impl FnOnce(&mut Self, Result, &mut Context) -> Option - + 'static, + process_result: impl FnOnce( + &mut Self, + Result, + &mut Context, + ) -> Option + + 'static, cx: &mut Context, ) { const { @@ -1246,8 +1250,12 @@ impl Session { session_id: SessionId, mode: &Mode, request: T, - process_result: impl FnOnce(&mut Self, Result, &mut Context) -> Option - + 'static, + process_result: impl FnOnce( + &mut Self, + Result, + &mut Context, + ) -> Option + + 'static, cx: &mut Context, ) -> Task> { if !T::is_supported(&capabilities) { @@ -1277,8 +1285,12 @@ impl Session { fn request( &self, request: T, - process_result: impl FnOnce(&mut Self, Result, &mut Context) -> Option - + 'static, + process_result: impl FnOnce( + &mut Self, + Result, + &mut Context, + ) -> Option + + 'static, cx: &mut Context, ) -> Task> { Self::request_inner( diff --git a/crates/project/src/environment.rs b/crates/project/src/environment.rs index 9934b6ac596dfa117064667c7271a78f0ec1a770..7f178c2d70c12a6ccb51a363bdd6c0ecef17ac2a 100644 --- a/crates/project/src/environment.rs +++ b/crates/project/src/environment.rs @@ -1,4 +1,4 @@ -use futures::{future::Shared, FutureExt}; +use futures::{FutureExt, future::Shared}; use std::{path::Path, sync::Arc}; use util::ResultExt; @@ -280,7 +280,7 @@ async fn load_shell_environment( Option>, Option, ) { - use crate::direnv::{load_direnv_environment, DirenvError}; + use crate::direnv::{DirenvError, load_direnv_environment}; use std::path::PathBuf; use util::parse_env_output; diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs index f7b71fe2618e4ae9c9aa3756c080646deb1f6c79..63c18daf5b1b20f0ba0dbec9bf1f0fa17bbffe24 100644 --- a/crates/project/src/git_store.rs +++ b/crates/project/src/git_store.rs @@ -1,22 +1,23 @@ pub mod git_traversal; use crate::{ + ProjectEnvironment, ProjectItem, ProjectPath, buffer_store::{BufferStore, BufferStoreEvent}, worktree_store::{WorktreeStore, WorktreeStoreEvent}, - ProjectEnvironment, ProjectItem, ProjectPath, }; -use anyhow::{anyhow, bail, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow, bail}; use askpass::AskPassDelegate; use buffer_diff::{BufferDiff, BufferDiffEvent}; use client::ProjectId; use collections::HashMap; use fs::Fs; use futures::{ + FutureExt as _, StreamExt as _, channel::{mpsc, oneshot}, future::{self, OptionFuture, Shared}, - FutureExt as _, StreamExt as _, }; use git::{ + BuildPermalinkParams, GitHostingProviderRegistry, blame::Blame, parse_git_remote_url, repository::{ @@ -24,25 +25,24 @@ use git::{ Remote, RemoteCommandOutput, RepoPath, ResetMode, }, status::FileStatus, - BuildPermalinkParams, GitHostingProviderRegistry, }; use gpui::{ App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Subscription, Task, WeakEntity, }; use language::{ - proto::{deserialize_version, serialize_version}, Buffer, BufferEvent, Language, LanguageRegistry, + proto::{deserialize_version, serialize_version}, }; use parking_lot::Mutex; use rpc::{ - proto::{self, git_reset, FromProto, ToProto, SSH_PROJECT_ID}, AnyProtoClient, TypedEnvelope, + proto::{self, FromProto, SSH_PROJECT_ID, ToProto, git_reset}, }; use serde::Deserialize; use settings::WorktreeId; use std::{ - collections::{hash_map, VecDeque}, + collections::{VecDeque, hash_map}, future::Future, ops::Range, path::{Path, PathBuf}, @@ -50,10 +50,10 @@ use std::{ }; use sum_tree::TreeSet; use text::BufferId; -use util::{debug_panic, maybe, ResultExt}; +use util::{ResultExt, debug_panic, maybe}; use worktree::{ - proto_to_branch, File, PathKey, ProjectEntryId, RepositoryEntry, StatusEntry, - UpdatedGitRepositoriesSet, Worktree, + File, PathKey, ProjectEntryId, RepositoryEntry, StatusEntry, UpdatedGitRepositoriesSet, + Worktree, proto_to_branch, }; pub struct GitStore { diff --git a/crates/project/src/image_store.rs b/crates/project/src/image_store.rs index 9ccbdb044d58b46438301fff81193ea3ad042939..f12f790be469991bbda01e959a7da966442b8853 100644 --- a/crates/project/src/image_store.rs +++ b/crates/project/src/image_store.rs @@ -1,13 +1,13 @@ use crate::{ - worktree_store::{WorktreeStore, WorktreeStoreEvent}, Project, ProjectEntryId, ProjectItem, ProjectPath, + worktree_store::{WorktreeStore, WorktreeStoreEvent}, }; -use anyhow::{anyhow, Context as _, Result}; -use collections::{hash_map, HashMap, HashSet}; -use futures::{channel::oneshot, StreamExt}; +use anyhow::{Context as _, Result, anyhow}; +use collections::{HashMap, HashSet, hash_map}; +use futures::{StreamExt, channel::oneshot}; use gpui::{ - hash, prelude::*, App, AsyncApp, Context, Entity, EventEmitter, Img, Subscription, Task, - WeakEntity, + App, AsyncApp, Context, Entity, EventEmitter, Img, Subscription, Task, WeakEntity, hash, + prelude::*, }; pub use image::ImageFormat; use image::{ExtendedColorType, GenericImageView, ImageReader}; diff --git a/crates/project/src/lsp_command.rs b/crates/project/src/lsp_command.rs index 64f2623fe7b0218028e403665b88995833ffbc0b..f10a7b7e5f91a7f336d7e2e20ba5afa3f02c87d8 100644 --- a/crates/project/src/lsp_command.rs +++ b/crates/project/src/lsp_command.rs @@ -1,13 +1,13 @@ mod signature_help; use crate::{ - lsp_store::{LocalLspStore, LspStore}, CodeAction, CompletionSource, CoreCompletion, DocumentHighlight, DocumentSymbol, Hover, HoverBlock, HoverBlockKind, InlayHint, InlayHintLabel, InlayHintLabelPart, InlayHintLabelPartTooltip, InlayHintTooltip, Location, LocationLink, LspAction, MarkupContent, PrepareRenameResponse, ProjectTransaction, ResolveState, + lsp_store::{LocalLspStore, LspStore}, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; use client::proto::{self, PeerId}; use clock::Global; @@ -15,11 +15,12 @@ use collections::HashSet; use futures::future; use gpui::{App, AsyncApp, Entity}; use language::{ - language_settings::{language_settings, InlayHintKind, LanguageSettings}, + Anchor, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CharKind, OffsetRangeExt, PointUtf16, + ToOffset, ToPointUtf16, Transaction, Unclipped, + language_settings::{InlayHintKind, LanguageSettings, language_settings}, point_from_lsp, point_to_lsp, proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version}, - range_from_lsp, range_to_lsp, Anchor, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CharKind, - OffsetRangeExt, PointUtf16, ToOffset, ToPointUtf16, Transaction, Unclipped, + range_from_lsp, range_to_lsp, }; use lsp::{ AdapterServerCapabilities, CodeActionKind, CodeActionOptions, CompletionContext, diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index 4bd8d68dd9b00f560d49498a65310e48f6bb61ef..aacf10dcb716d116933aa67148071457b1aec28f 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -3,6 +3,8 @@ pub mod lsp_ext_command; pub mod rust_analyzer_ext; use crate::{ + CodeAction, Completion, CompletionSource, CoreCompletion, Hover, InlayHint, LspAction, + ProjectItem, ProjectPath, ProjectTransaction, ResolveState, Symbol, ToolchainStore, buffer_store::{BufferStore, BufferStoreEvent}, environment::ProjectEnvironment, lsp_command::{self, *}, @@ -13,18 +15,16 @@ use crate::{ toolchain_store::{EmptyToolchainStore, ToolchainStoreEvent}, worktree_store::{WorktreeStore, WorktreeStoreEvent}, yarn::YarnPathStore, - CodeAction, Completion, CompletionSource, CoreCompletion, Hover, InlayHint, LspAction, - ProjectItem, ProjectPath, ProjectTransaction, ResolveState, Symbol, ToolchainStore, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; -use client::{proto, TypedEnvelope}; -use collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet}; +use client::{TypedEnvelope, proto}; +use collections::{BTreeMap, BTreeSet, HashMap, HashSet, btree_map}; use futures::{ - future::{join_all, Shared}, + AsyncWriteExt, Future, FutureExt, StreamExt, + future::{Shared, join_all}, select, select_biased, stream::FuturesUnordered, - AsyncWriteExt, Future, FutureExt, StreamExt, }; use globset::{Glob, GlobBuilder, GlobMatcher, GlobSet, GlobSetBuilder}; use gpui::{ @@ -34,23 +34,25 @@ use gpui::{ use http_client::HttpClient; use itertools::Itertools as _; use language::{ + Bias, BinaryStatus, Buffer, BufferSnapshot, CachedLspAdapter, CodeLabel, Diagnostic, + DiagnosticEntry, DiagnosticSet, Diff, File as _, Language, LanguageRegistry, + LanguageToolchainStore, LocalFile, LspAdapter, LspAdapterDelegate, Patch, PointUtf16, + TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction, Unclipped, language_settings::{ - language_settings, FormatOnSave, Formatter, LanguageSettings, SelectedFormatter, + FormatOnSave, Formatter, LanguageSettings, SelectedFormatter, language_settings, }, point_to_lsp, proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version}, - range_from_lsp, range_to_lsp, Bias, BinaryStatus, Buffer, BufferSnapshot, CachedLspAdapter, - CodeLabel, Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, File as _, Language, - LanguageRegistry, LanguageToolchainStore, LocalFile, LspAdapter, LspAdapterDelegate, Patch, - PointUtf16, TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction, Unclipped, + range_from_lsp, range_to_lsp, }; use lsp::{ - notification::DidRenameFiles, CodeActionKind, CompletionContext, DiagnosticSeverity, - DiagnosticTag, DidChangeWatchedFilesRegistrationOptions, Edit, FileOperationFilter, - FileOperationPatternKind, FileOperationRegistrationOptions, FileRename, FileSystemWatcher, - LanguageServer, LanguageServerBinary, LanguageServerBinaryOptions, LanguageServerId, - LanguageServerName, LspRequestFuture, MessageActionItem, MessageType, OneOf, RenameFilesParams, - SymbolKind, TextEdit, WillRenameFiles, WorkDoneProgressCancelParams, WorkspaceFolder, + CodeActionKind, CompletionContext, DiagnosticSeverity, DiagnosticTag, + DidChangeWatchedFilesRegistrationOptions, Edit, FileOperationFilter, FileOperationPatternKind, + FileOperationRegistrationOptions, FileRename, FileSystemWatcher, LanguageServer, + LanguageServerBinary, LanguageServerBinaryOptions, LanguageServerId, LanguageServerName, + LspRequestFuture, MessageActionItem, MessageType, OneOf, RenameFilesParams, SymbolKind, + TextEdit, WillRenameFiles, WorkDoneProgressCancelParams, WorkspaceFolder, + notification::DidRenameFiles, }; use node_runtime::read_package_installed_version; use parking_lot::Mutex; @@ -58,8 +60,8 @@ use postage::watch; use rand::prelude::*; use rpc::{ - proto::{FromProto, ToProto}, AnyProtoClient, + proto::{FromProto, ToProto}, }; use serde::Serialize; use settings::{Settings, SettingsLocation, SettingsStore}; @@ -83,8 +85,8 @@ use std::{ use text::{Anchor, BufferId, LineEnding, OffsetRangeExt}; use url::Url; use util::{ - debug_panic, defer, maybe, merge_json_value_into, paths::SanitizedPath, post_inc, ResultExt, - TryFutureExt as _, + ResultExt, TryFutureExt as _, debug_panic, defer, maybe, merge_json_value_into, + paths::SanitizedPath, post_inc, }; pub use fs::*; @@ -92,8 +94,8 @@ pub use language::Location; #[cfg(any(test, feature = "test-support"))] pub use prettier::FORMAT_SUFFIX as TEST_PRETTIER_FORMAT_SUFFIX; pub use worktree::{ - Entry, EntryKind, File, LocalWorktree, PathChange, ProjectEntryId, UpdatedEntriesSet, - UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, FS_WATCH_LATENCY, + Entry, EntryKind, FS_WATCH_LATENCY, File, LocalWorktree, PathChange, ProjectEntryId, + UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, }; const SERVER_LAUNCHING_BEFORE_SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5); @@ -3785,8 +3787,7 @@ impl LspStore { irrefutable_let_patterns, reason = "Make sure to handle new event types in extension properly" )] - let extension::Event::ExtensionsInstalledChanged = evt - else { + let extension::Event::ExtensionsInstalledChanged = evt else { return; }; if self.as_local().is_none() { diff --git a/crates/project/src/lsp_store/lsp_ext_command.rs b/crates/project/src/lsp_store/lsp_ext_command.rs index 1e2b7e55b3702a482532a95edfb720c642bcb450..fed0106a684574d22cca0e5ed4923bca0bf5aba1 100644 --- a/crates/project/src/lsp_store/lsp_ext_command.rs +++ b/crates/project/src/lsp_store/lsp_ext_command.rs @@ -2,7 +2,7 @@ use crate::{lsp_command::LspCommand, lsp_store::LspStore, make_text_document_ide use anyhow::{Context as _, Result}; use async_trait::async_trait; use gpui::{App, AsyncApp, Entity}; -use language::{point_to_lsp, proto::deserialize_anchor, Buffer}; +use language::{Buffer, point_to_lsp, proto::deserialize_anchor}; use lsp::{LanguageServer, LanguageServerId}; use rpc::proto::{self, PeerId}; use serde::{Deserialize, Serialize}; diff --git a/crates/project/src/manifest_tree.rs b/crates/project/src/manifest_tree.rs index fb501980b40b84711e3503e97040ccfa1a16a15a..64b36212a97bfbfaee1a993fd24ca8a38a60edfd 100644 --- a/crates/project/src/manifest_tree.rs +++ b/crates/project/src/manifest_tree.rs @@ -9,7 +9,7 @@ mod server_tree; use std::{ borrow::Borrow, - collections::{hash_map::Entry, BTreeMap}, + collections::{BTreeMap, hash_map::Entry}, ops::ControlFlow, sync::Arc, }; @@ -23,8 +23,8 @@ use settings::{SettingsStore, WorktreeId}; use worktree::{Event as WorktreeEvent, Worktree}; use crate::{ - worktree_store::{WorktreeStore, WorktreeStoreEvent}, ProjectPath, + worktree_store::{WorktreeStore, WorktreeStoreEvent}, }; pub(crate) use server_tree::{AdapterQuery, LanguageServerTree, LaunchDisposition}; diff --git a/crates/project/src/manifest_tree/path_trie.rs b/crates/project/src/manifest_tree/path_trie.rs index 8151b39e4dc4de19ec4620dc929c5ae8742d8eba..5dd14ecf8fbfa7264d871f5da46b1be882b7db68 100644 --- a/crates/project/src/manifest_tree/path_trie.rs +++ b/crates/project/src/manifest_tree/path_trie.rs @@ -1,5 +1,5 @@ use std::{ - collections::{btree_map::Entry, BTreeMap}, + collections::{BTreeMap, btree_map::Entry}, ffi::OsStr, ops::ControlFlow, path::{Path, PathBuf}, diff --git a/crates/project/src/manifest_tree/server_tree.rs b/crates/project/src/manifest_tree/server_tree.rs index 8aba35a03e723abea5f1006c2a7b57c24072c6dd..0a8cbbedb459d5218e49cec0e2060767ec587bed 100644 --- a/crates/project/src/manifest_tree/server_tree.rs +++ b/crates/project/src/manifest_tree/server_tree.rs @@ -16,14 +16,14 @@ use std::{ use collections::{HashMap, IndexMap}; use gpui::{App, AppContext as _, Entity, Subscription}; use language::{ - language_settings::AllLanguageSettings, Attach, CachedLspAdapter, LanguageName, - LanguageRegistry, LspAdapterDelegate, + Attach, CachedLspAdapter, LanguageName, LanguageRegistry, LspAdapterDelegate, + language_settings::AllLanguageSettings, }; use lsp::LanguageServerName; use settings::{Settings, SettingsLocation, WorktreeId}; use std::sync::OnceLock; -use crate::{project_settings::LspSettings, LanguageServerId, ProjectPath}; +use crate::{LanguageServerId, ProjectPath, project_settings::LspSettings}; use super::{ManifestTree, ManifestTreeEvent}; diff --git a/crates/project/src/prettier_store.rs b/crates/project/src/prettier_store.rs index a51bec3df4046dccd346dc45890b9abf0b66d0ae..d3b681fec6336238c4b3617a62dffbfcadb56c40 100644 --- a/crates/project/src/prettier_store.rs +++ b/crates/project/src/prettier_store.rs @@ -4,18 +4,18 @@ use std::{ sync::Arc, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{HashMap, HashSet}; use fs::Fs; use futures::{ + FutureExt, future::{self, Shared}, stream::FuturesUnordered, - FutureExt, }; use gpui::{AppContext as _, AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity}; use language::{ - language_settings::{Formatter, LanguageSettings, SelectedFormatter}, Buffer, LanguageRegistry, LocalFile, + language_settings::{Formatter, LanguageSettings, SelectedFormatter}, }; use lsp::{LanguageServer, LanguageServerId, LanguageServerName}; use node_runtime::NodeRuntime; @@ -25,8 +25,8 @@ use smol::stream::StreamExt; use util::{ResultExt, TryFutureExt}; use crate::{ - lsp_store::WorktreeId, worktree_store::WorktreeStore, File, PathChange, ProjectEntryId, - Worktree, + File, PathChange, ProjectEntryId, Worktree, lsp_store::WorktreeId, + worktree_store::WorktreeStore, }; pub struct PrettierStore { diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 44d8c01890c4068434d92e374add835a20af0167..625108fc155fb1240ed31c551fcfc4aeacb7bb03 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -31,14 +31,14 @@ mod yarn; use crate::git_store::GitStore; pub use git_store::git_traversal::{ChildEntriesGitIter, GitEntry, GitEntryRef, GitTraversal}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use buffer_store::{BufferStore, BufferStoreEvent}; use client::{ - proto, Client, Collaborator, PendingEntitySubscription, ProjectId, TypedEnvelope, UserStore, + Client, Collaborator, PendingEntitySubscription, ProjectId, TypedEnvelope, UserStore, proto, }; use clock::ReplicaId; -use dap::{client::DebugAdapterClient, DapRegistry, DebugAdapterConfig}; +use dap::{DapRegistry, DebugAdapterConfig, client::DebugAdapterClient}; use collections::{BTreeSet, HashMap, HashSet}; use debounced_delay::DebouncedDelay; @@ -49,9 +49,9 @@ use debugger::{ }; pub use environment::ProjectEnvironment; use futures::{ + StreamExt, channel::mpsc::{self, UnboundedReceiver}, future::try_join_all, - StreamExt, }; pub use image_store::{ImageItem, ImageStore}; use image_store::{ImageItemEvent, ImageStoreEvent}; @@ -63,9 +63,9 @@ use gpui::{ }; use itertools::Itertools; use language::{ - language_settings::InlayHintKind, proto::split_operations, Buffer, BufferEvent, Capability, - CodeLabel, File as _, Language, LanguageName, LanguageRegistry, PointUtf16, ToOffset, - ToPointUtf16, Toolchain, ToolchainList, Transaction, Unclipped, + Buffer, BufferEvent, Capability, CodeLabel, File as _, Language, LanguageName, + LanguageRegistry, PointUtf16, ToOffset, ToPointUtf16, Toolchain, ToolchainList, Transaction, + Unclipped, language_settings::InlayHintKind, proto::split_operations, }; use lsp::{ CodeActionKind, CompletionContext, CompletionItemKind, DocumentHighlightKind, LanguageServerId, @@ -80,8 +80,8 @@ pub use prettier_store::PrettierStore; use project_settings::{ProjectSettings, SettingsObserver, SettingsObserverEvent}; use remote::{SshConnectionOptions, SshRemoteClient}; use rpc::{ - proto::{FromProto, LanguageServerPromptResponse, ToProto, SSH_PROJECT_ID}, AnyProtoClient, ErrorCode, + proto::{FromProto, LanguageServerPromptResponse, SSH_PROJECT_ID, ToProto}, }; use search::{SearchInputKind, SearchQuery, SearchResult}; use search_history::SearchHistory; @@ -104,14 +104,13 @@ use terminals::Terminals; use text::{Anchor, BufferId}; use toolchain_store::EmptyToolchainStore; use util::{ - maybe, - paths::{compare_paths, SanitizedPath}, - ResultExt as _, + ResultExt as _, maybe, + paths::{SanitizedPath, compare_paths}, }; use worktree::{CreatedEntry, Snapshot, Traversal}; pub use worktree::{ - Entry, EntryKind, File, LocalWorktree, PathChange, ProjectEntryId, UpdatedEntriesSet, - UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, FS_WATCH_LATENCY, + Entry, EntryKind, FS_WATCH_LATENCY, File, LocalWorktree, PathChange, ProjectEntryId, + UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, }; use worktree_store::{WorktreeStore, WorktreeStoreEvent}; @@ -2988,29 +2987,31 @@ impl Project { } fn recalculate_buffer_diffs(&mut self, cx: &mut Context) -> Task<()> { - cx.spawn(async move |this, cx| loop { - let task = this - .update(cx, |this, cx| { - let buffers = this - .buffers_needing_diff - .drain() - .filter_map(|buffer| buffer.upgrade()) - .collect::>(); - if buffers.is_empty() { - None - } else { - Some(this.git_store.update(cx, |git_store, cx| { - git_store.recalculate_buffer_diffs(buffers, cx) - })) - } - }) - .ok() - .flatten(); + cx.spawn(async move |this, cx| { + loop { + let task = this + .update(cx, |this, cx| { + let buffers = this + .buffers_needing_diff + .drain() + .filter_map(|buffer| buffer.upgrade()) + .collect::>(); + if buffers.is_empty() { + None + } else { + Some(this.git_store.update(cx, |git_store, cx| { + git_store.recalculate_buffer_diffs(buffers, cx) + })) + } + }) + .ok() + .flatten(); - if let Some(task) = task { - task.await; - } else { - break; + if let Some(task) = task { + task.await; + } else { + break; + } } }) } diff --git a/crates/project/src/project_settings.rs b/crates/project/src/project_settings.rs index 4800ce524c446552fcf669970d66309573716efd..f660d236a41f4e2efa190981a19c1a140d742ce4 100644 --- a/crates/project/src/project_settings.rs +++ b/crates/project/src/project_settings.rs @@ -6,18 +6,18 @@ use futures::StreamExt as _; use gpui::{App, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Task}; use lsp::LanguageServerName; use paths::{ - local_debug_file_relative_path, local_settings_file_relative_path, - local_tasks_file_relative_path, local_vscode_tasks_file_relative_path, EDITORCONFIG_NAME, + EDITORCONFIG_NAME, local_debug_file_relative_path, local_settings_file_relative_path, + local_tasks_file_relative_path, local_vscode_tasks_file_relative_path, }; use rpc::{ - proto::{self, FromProto, ToProto}, AnyProtoClient, TypedEnvelope, + proto::{self, FromProto, ToProto}, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::{ - parse_json_with_comments, watch_config_file, InvalidSettingsError, LocalSettingsKind, Settings, - SettingsLocation, SettingsSources, SettingsStore, TaskKind, + InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation, SettingsSources, + SettingsStore, TaskKind, parse_json_with_comments, watch_config_file, }; use std::{ path::{Path, PathBuf}, diff --git a/crates/project/src/project_tests.rs b/crates/project/src/project_tests.rs index 71dee7bc9fdae6a9457f94d7515c12c5213153fb..9aa3482833bccce7e7db120b7455770d58beaf96 100644 --- a/crates/project/src/project_tests.rs +++ b/crates/project/src/project_tests.rs @@ -1,23 +1,23 @@ #![allow(clippy::format_collect)] -use crate::{task_inventory::TaskContexts, task_store::TaskSettingsLocation, Event, *}; +use crate::{Event, task_inventory::TaskContexts, task_store::TaskSettingsLocation, *}; use buffer_diff::{ - assert_hunks, BufferDiffEvent, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind, + BufferDiffEvent, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind, assert_hunks, }; use fs::FakeFs; -use futures::{future, StreamExt}; +use futures::{StreamExt, future}; use git::repository::RepoPath; use gpui::{App, BackgroundExecutor, SemanticVersion, UpdateGlobal}; use http_client::Url; use language::{ - language_settings::{language_settings, AllLanguageSettings, LanguageSettingsContent}, - tree_sitter_rust, tree_sitter_typescript, Diagnostic, DiagnosticEntry, DiagnosticSet, - DiskState, FakeLspAdapter, LanguageConfig, LanguageMatcher, LanguageName, LineEnding, - OffsetRangeExt, Point, ToPoint, + Diagnostic, DiagnosticEntry, DiagnosticSet, DiskState, FakeLspAdapter, LanguageConfig, + LanguageMatcher, LanguageName, LineEnding, OffsetRangeExt, Point, ToPoint, + language_settings::{AllLanguageSettings, LanguageSettingsContent, language_settings}, + tree_sitter_rust, tree_sitter_typescript, }; use lsp::{ - notification::DidRenameFiles, DiagnosticSeverity, DocumentChanges, FileOperationFilter, - NumberOrString, TextDocumentEdit, WillRenameFiles, + DiagnosticSeverity, DocumentChanges, FileOperationFilter, NumberOrString, TextDocumentEdit, + WillRenameFiles, notification::DidRenameFiles, }; use parking_lot::Mutex; use paths::tasks_file; @@ -29,11 +29,11 @@ use std::{mem, num::NonZeroU32, ops::Range, str::FromStr, sync::OnceLock, task:: use task::{ResolvedTask, TaskContext}; use unindent::Unindent as _; use util::{ - assert_set_eq, path, + TryFutureExt as _, assert_set_eq, path, paths::PathMatcher, separator, - test::{marked_text_offsets, TempTree}, - uri, TryFutureExt as _, + test::{TempTree, marked_text_offsets}, + uri, }; use worktree::WorktreeModelHandle as _; diff --git a/crates/project/src/task_inventory.rs b/crates/project/src/task_inventory.rs index 3e68dac156e773c5dd5d6b8eeba1e83509a2e7ea..1a303a9943aecb23903af4029ef7e604b7ee3330 100644 --- a/crates/project/src/task_inventory.rs +++ b/crates/project/src/task_inventory.rs @@ -13,13 +13,13 @@ use collections::{HashMap, HashSet, VecDeque}; use gpui::{App, AppContext as _, Entity, SharedString, Task}; use itertools::Itertools; use language::{ContextProvider, File, Language, LanguageToolchainStore, Location}; -use settings::{parse_json_with_comments, InvalidSettingsError, TaskKind}; +use settings::{InvalidSettingsError, TaskKind, parse_json_with_comments}; use task::{ DebugTaskDefinition, ResolvedTask, TaskContext, TaskId, TaskTemplate, TaskTemplates, TaskVariables, VariableName, }; use text::{Point, ToPoint}; -use util::{paths::PathExt as _, post_inc, NumericPrefixWithSuffix, ResultExt as _}; +use util::{NumericPrefixWithSuffix, ResultExt as _, paths::PathExt as _, post_inc}; use worktree::WorktreeId; use crate::{task_store::TaskSettingsLocation, worktree_store::WorktreeStore}; diff --git a/crates/project/src/task_store.rs b/crates/project/src/task_store.rs index e4fd9bd119b62225fd636489e23fbca189988a1b..188534d75e87c16e06a844236a8ec13c9615830f 100644 --- a/crates/project/src/task_store.rs +++ b/crates/project/src/task_store.rs @@ -7,18 +7,18 @@ use anyhow::Context as _; use collections::HashMap; use gpui::{App, AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity}; use language::{ - proto::{deserialize_anchor, serialize_anchor}, ContextProvider as _, LanguageToolchainStore, Location, + proto::{deserialize_anchor, serialize_anchor}, }; -use rpc::{proto, AnyProtoClient, TypedEnvelope}; +use rpc::{AnyProtoClient, TypedEnvelope, proto}; use settings::{InvalidSettingsError, SettingsLocation, TaskKind}; use task::{TaskContext, TaskVariables, VariableName}; use text::{BufferId, OffsetRangeExt}; use util::ResultExt; use crate::{ - buffer_store::BufferStore, worktree_store::WorktreeStore, BasicContextProvider, Inventory, - ProjectEnvironment, + BasicContextProvider, Inventory, ProjectEnvironment, buffer_store::BufferStore, + worktree_store::WorktreeStore, }; #[allow(clippy::large_enum_variant)] // platform-dependent warning diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs index f26cae3da6629d96979b12651c6a92c5c85620c6..6e24259ebddf2ae652d01188ce289b719f104386 100644 --- a/crates/project/src/terminals.rs +++ b/crates/project/src/terminals.rs @@ -15,8 +15,8 @@ use std::{ }; use task::{Shell, ShellBuilder, SpawnInTerminal}; use terminal::{ - terminal_settings::{self, TerminalSettings, VenvSettings}, TaskState, TaskStatus, Terminal, TerminalBuilder, + terminal_settings::{self, TerminalSettings, VenvSettings}, }; use util::ResultExt; diff --git a/crates/project/src/toolchain_store.rs b/crates/project/src/toolchain_store.rs index df9842f783cab141dcd6e3bb8fda171ed1f8b191..054379231e758fe70ab0f0ad77ac8cb4a65957a4 100644 --- a/crates/project/src/toolchain_store.rs +++ b/crates/project/src/toolchain_store.rs @@ -4,7 +4,7 @@ use std::{ sync::Arc, }; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use async_trait::async_trait; use collections::BTreeMap; @@ -13,13 +13,13 @@ use gpui::{ }; use language::{LanguageName, LanguageRegistry, LanguageToolchainStore, Toolchain, ToolchainList}; use rpc::{ - proto::{self, FromProto, ToProto}, AnyProtoClient, TypedEnvelope, + proto::{self, FromProto, ToProto}, }; use settings::WorktreeId; use util::ResultExt as _; -use crate::{worktree_store::WorktreeStore, ProjectEnvironment, ProjectPath}; +use crate::{ProjectEnvironment, ProjectPath, worktree_store::WorktreeStore}; pub struct ToolchainStore(ToolchainStoreInner); enum ToolchainStoreInner { diff --git a/crates/project/src/worktree_store.rs b/crates/project/src/worktree_store.rs index 20ac7ae0fecac2a4e3cd307d4c86d3494c63fc26..26974992b267da1e9bbca8a166700d801119d2c1 100644 --- a/crates/project/src/worktree_store.rs +++ b/crates/project/src/worktree_store.rs @@ -2,36 +2,36 @@ use std::{ io::{BufRead, BufReader}, path::{Path, PathBuf}, pin::pin, - sync::{atomic::AtomicUsize, Arc}, + sync::{Arc, atomic::AtomicUsize}, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::{HashMap, HashSet}; use fs::Fs; use futures::{ - future::{BoxFuture, Shared}, FutureExt, SinkExt, + future::{BoxFuture, Shared}, }; use gpui::{ App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Task, WeakEntity, }; use postage::oneshot; use rpc::{ - proto::{self, FromProto, ToProto, SSH_PROJECT_ID}, AnyProtoClient, ErrorExt, TypedEnvelope, + proto::{self, FromProto, SSH_PROJECT_ID, ToProto}, }; use smol::{ channel::{Receiver, Sender}, stream::StreamExt, }; use text::ReplicaId; -use util::{paths::SanitizedPath, ResultExt}; +use util::{ResultExt, paths::SanitizedPath}; use worktree::{ Entry, ProjectEntryId, UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, }; -use crate::{search::SearchQuery, ProjectPath}; +use crate::{ProjectPath, search::SearchQuery}; struct MatchingEntry { worktree_path: Arc, diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 7b9238bb0c2ebb032afe49f0009a4d4f9920aa46..35f84c0ce4f4ce0168705b86fce4baecc6f5ba9d 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1,42 +1,43 @@ mod project_panel_settings; mod utils; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use client::{ErrorCode, ErrorExt}; -use collections::{hash_map, BTreeSet, HashMap}; +use collections::{BTreeSet, HashMap, hash_map}; use command_palette_hooks::CommandPaletteFilter; use db::kvp::KEY_VALUE_STORE; use editor::{ + Editor, EditorEvent, EditorSettings, ShowScrollbar, items::{ entry_diagnostic_aware_icon_decoration_and_color, entry_diagnostic_aware_icon_name_and_color, entry_git_aware_label_color, }, scroll::{Autoscroll, ScrollbarAutoHide}, - Editor, EditorEvent, EditorSettings, ShowScrollbar, }; use file_icons::FileIcons; use git::status::GitSummary; use gpui::{ - actions, anchored, deferred, div, impl_actions, point, px, size, uniform_list, Action, - AnyElement, App, ArcCow, AsyncWindowContext, Bounds, ClipboardItem, Context, DismissEvent, Div, - DragMoveEvent, Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable, Hsla, - InteractiveElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, MouseButton, - MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, ScrollStrategy, Stateful, - Styled, Subscription, Task, UniformListScrollHandle, WeakEntity, Window, + Action, AnyElement, App, ArcCow, AsyncWindowContext, Bounds, ClipboardItem, Context, + DismissEvent, Div, DragMoveEvent, Entity, EventEmitter, ExternalPaths, FocusHandle, Focusable, + Hsla, InteractiveElement, KeyContext, ListHorizontalSizingBehavior, ListSizingBehavior, + MouseButton, MouseDownEvent, ParentElement, Pixels, Point, PromptLevel, Render, ScrollStrategy, + Stateful, Styled, Subscription, Task, UniformListScrollHandle, WeakEntity, Window, actions, + anchored, deferred, div, impl_actions, point, px, size, uniform_list, }; use indexmap::IndexMap; use language::DiagnosticSeverity; use menu::{Confirm, SelectFirst, SelectLast, SelectNext, SelectPrevious}; use project::{ - git_store::git_traversal::ChildEntriesGitIter, relativize_path, Entry, EntryKind, Fs, GitEntry, - GitEntryRef, GitTraversal, Project, ProjectEntryId, ProjectPath, Worktree, WorktreeId, + Entry, EntryKind, Fs, GitEntry, GitEntryRef, GitTraversal, Project, ProjectEntryId, + ProjectPath, Worktree, WorktreeId, git_store::git_traversal::ChildEntriesGitIter, + relativize_path, }; use project_panel_settings::{ ProjectPanelDockPosition, ProjectPanelSettings, ShowDiagnostics, ShowIndentGuides, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use settings::{update_settings_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, update_settings_file}; use smallvec::SmallVec; use std::any::TypeId; use std::{ @@ -51,16 +52,16 @@ use std::{ }; use theme::ThemeSettings; use ui::{ - prelude::*, v_flex, ContextMenu, DecoratedIcon, Icon, IconDecoration, IconDecorationKind, - IndentGuideColors, IndentGuideLayout, KeyBinding, Label, ListItem, ListItemSpacing, Scrollbar, - ScrollbarState, Tooltip, + ContextMenu, DecoratedIcon, Icon, IconDecoration, IconDecorationKind, IndentGuideColors, + IndentGuideLayout, KeyBinding, Label, ListItem, ListItemSpacing, Scrollbar, ScrollbarState, + Tooltip, prelude::*, v_flex, }; -use util::{maybe, paths::compare_paths, ResultExt, TakeUntilExt, TryFutureExt}; +use util::{ResultExt, TakeUntilExt, TryFutureExt, maybe, paths::compare_paths}; use workspace::{ - dock::{DockPosition, Panel, PanelEvent}, - notifications::{DetachAndPromptErr, NotifyTaskExt}, DraggedSelection, OpenInTerminal, OpenOptions, OpenVisible, PreviewTabsSettings, SelectedEntry, Workspace, + dock::{DockPosition, Panel, PanelEvent}, + notifications::{DetachAndPromptErr, NotifyTaskExt}, }; use worktree::CreatedEntry; @@ -4424,26 +4425,28 @@ impl Render for ProjectPanel { return; }; let adjustment = point(px(0.), px(vertical_scroll_offset)); - this.hover_scroll_task = Some(cx.spawn_in(window, async move |this, cx| loop { - let should_stop_scrolling = this - .update(cx, |this, cx| { - this.hover_scroll_task.as_ref()?; - let handle = this.scroll_handle.0.borrow_mut(); - let offset = handle.base_handle.offset(); - - handle.base_handle.set_offset(offset + adjustment); - cx.notify(); - Some(()) - }) - .ok() - .flatten() - .is_some(); - if should_stop_scrolling { - return; + this.hover_scroll_task = Some(cx.spawn_in(window, async move |this, cx| { + loop { + let should_stop_scrolling = this + .update(cx, |this, cx| { + this.hover_scroll_task.as_ref()?; + let handle = this.scroll_handle.0.borrow_mut(); + let offset = handle.base_handle.offset(); + + handle.base_handle.set_offset(offset + adjustment); + cx.notify(); + Some(()) + }) + .ok() + .flatten() + .is_some(); + if should_stop_scrolling { + return; + } + cx.background_executor() + .timer(Duration::from_millis(16)) + .await; } - cx.background_executor() - .timer(Duration::from_millis(16)) - .await; })); } h_flex() diff --git a/crates/project_panel/src/project_panel_tests.rs b/crates/project_panel/src/project_panel_tests.rs index dc73ca5f20d74f8622fe0bf5652bf7f5b6743dd3..851a385e0db3fb8ab34fa85bd99cafca76208e2a 100644 --- a/crates/project_panel/src/project_panel_tests.rs +++ b/crates/project_panel/src/project_panel_tests.rs @@ -8,8 +8,9 @@ use settings::SettingsStore; use std::path::{Path, PathBuf}; use util::{path, separator}; use workspace::{ + AppState, Pane, item::{Item, ProjectItem}, - register_project_item, AppState, Pane, + register_project_item, }; #[gpui::test] @@ -4950,11 +4951,7 @@ fn visible_entries_as_strings( let indent = " ".repeat(details.depth); let icon = if details.kind.is_dir() { - if details.is_expanded { - "v " - } else { - "> " - } + if details.is_expanded { "v " } else { "> " } } else { " " }; diff --git a/crates/project_symbols/src/project_symbols.rs b/crates/project_symbols/src/project_symbols.rs index 0f7ebf3a2af5196f0dbc5dabea17cb77ba9cb508..cb8b05f2bcfc10b99a1571d8ea4c4147a3c1b2d4 100644 --- a/crates/project_symbols/src/project_symbols.rs +++ b/crates/project_symbols/src/project_symbols.rs @@ -1,8 +1,8 @@ -use editor::{scroll::Autoscroll, styled_runs_for_code_label, Bias, Editor}; +use editor::{Bias, Editor, scroll::Autoscroll, styled_runs_for_code_label}; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - rems, App, Context, DismissEvent, Entity, FontWeight, ParentElement, StyledText, Task, - WeakEntity, Window, + App, Context, DismissEvent, Entity, FontWeight, ParentElement, StyledText, Task, WeakEntity, + Window, rems, }; use ordered_float::OrderedFloat; use picker::{Picker, PickerDelegate}; @@ -11,8 +11,8 @@ use std::{borrow::Cow, cmp::Reverse, sync::Arc}; use theme::ActiveTheme; use util::ResultExt; use workspace::{ - ui::{v_flex, Color, Label, LabelCommon, LabelLike, ListItem, ListItemSpacing, Toggleable}, Workspace, + ui::{Color, Label, LabelCommon, LabelLike, ListItem, ListItemSpacing, Toggleable, v_flex}, }; pub fn init(cx: &mut App) { diff --git a/crates/prompt_library/src/prompt_library.rs b/crates/prompt_library/src/prompt_library.rs index f68d4a4b85f0dd6314f168745cfcc931a6f0d9ff..48d6c5e8f83be28b71f59a418a0e7910faa9af2d 100644 --- a/crates/prompt_library/src/prompt_library.rs +++ b/crates/prompt_library/src/prompt_library.rs @@ -1,13 +1,13 @@ use anyhow::Result; use collections::{HashMap, HashSet}; use editor::CompletionProvider; -use editor::{actions::Tab, CurrentLineHighlight, Editor, EditorElement, EditorEvent, EditorStyle}; +use editor::{CurrentLineHighlight, Editor, EditorElement, EditorEvent, EditorStyle, actions::Tab}; use gpui::{ - actions, point, size, transparent_black, Action, App, Bounds, Entity, EventEmitter, Focusable, - PromptLevel, Subscription, Task, TextStyle, TitlebarOptions, WindowBounds, WindowHandle, - WindowOptions, + Action, App, Bounds, Entity, EventEmitter, Focusable, PromptLevel, Subscription, Task, + TextStyle, TitlebarOptions, WindowBounds, WindowHandle, WindowOptions, actions, point, size, + transparent_black, }; -use language::{language_settings::SoftWrap, Buffer, LanguageRegistry}; +use language::{Buffer, LanguageRegistry, language_settings::SoftWrap}; use language_model::{ LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role, }; @@ -19,8 +19,8 @@ use std::sync::Arc; use std::time::Duration; use theme::ThemeSettings; use ui::{ - div, prelude::*, Context, IconButtonShape, KeyBinding, ListItem, ListItemSpacing, - ParentElement, Render, SharedString, Styled, Tooltip, Window, + Context, IconButtonShape, KeyBinding, ListItem, ListItemSpacing, ParentElement, Render, + SharedString, Styled, Tooltip, Window, div, prelude::*, }; use util::{ResultExt, TryFutureExt}; use workspace::Workspace; diff --git a/crates/prompt_store/src/prompt_store.rs b/crates/prompt_store/src/prompt_store.rs index 0993d55b38d9a42bf04f7965b3003f516ee8162c..57e3e04e79a7a0b6a23cd101dffb4cd634276621 100644 --- a/crates/prompt_store/src/prompt_store.rs +++ b/crates/prompt_store/src/prompt_store.rs @@ -1,15 +1,15 @@ mod prompts; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use chrono::{DateTime, Utc}; use collections::HashMap; -use futures::future::{self, BoxFuture, Shared}; use futures::FutureExt as _; +use futures::future::{self, BoxFuture, Shared}; use fuzzy::StringMatchCandidate; use gpui::{App, BackgroundExecutor, Global, ReadGlobal, SharedString, Task}; use heed::{ - types::{SerdeBincode, SerdeJson, Str}, Database, RoTxn, + types::{SerdeBincode, SerdeJson, Str}, }; use parking_lot::RwLock; pub use prompts::*; @@ -19,7 +19,7 @@ use std::{ cmp::Reverse, future::Future, path::PathBuf, - sync::{atomic::AtomicBool, Arc}, + sync::{Arc, atomic::AtomicBool}, }; use text::LineEnding; use util::ResultExt; diff --git a/crates/proto/src/typed_envelope.rs b/crates/proto/src/typed_envelope.rs index e45f17f548b41f272f9a6565616214bbbecbf5b0..6f63c0b94a60f6e49049ed0cd2d8a32b2e90f96d 100644 --- a/crates/proto/src/typed_envelope.rs +++ b/crates/proto/src/typed_envelope.rs @@ -1,5 +1,5 @@ use crate::{PeerId, RequestMessage}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use std::{marker::PhantomData, time::Instant}; pub struct Receipt { diff --git a/crates/recent_projects/src/disconnected_overlay.rs b/crates/recent_projects/src/disconnected_overlay.rs index ff5883a0d23575468572b762ec28cd670dcbc0e8..a6cd26355c7741679b546a74afa67320457d5273 100644 --- a/crates/recent_projects/src/disconnected_overlay.rs +++ b/crates/recent_projects/src/disconnected_overlay.rs @@ -5,11 +5,11 @@ use project::project_settings::ProjectSettings; use remote::SshConnectionOptions; use settings::Settings; use ui::{ - div, h_flex, rems, Button, ButtonCommon, ButtonStyle, Clickable, Context, ElevationIndex, - FluentBuilder, Headline, HeadlineSize, IconName, IconPosition, InteractiveElement, IntoElement, - Label, Modal, ModalFooter, ModalHeader, ParentElement, Section, Styled, StyledExt, Window, + Button, ButtonCommon, ButtonStyle, Clickable, Context, ElevationIndex, FluentBuilder, Headline, + HeadlineSize, IconName, IconPosition, InteractiveElement, IntoElement, Label, Modal, + ModalFooter, ModalHeader, ParentElement, Section, Styled, StyledExt, Window, div, h_flex, rems, }; -use workspace::{notifications::DetachAndPromptErr, ModalView, OpenOptions, Workspace}; +use workspace::{ModalView, OpenOptions, Workspace, notifications::DetachAndPromptErr}; use crate::open_ssh_project; diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs index 45fa03dbf12e8d70c362a6d36bc17655ff0b2ab4..77feba9f2c59b11844818cd0fac5db177f5eae36 100644 --- a/crates/recent_projects/src/recent_projects.rs +++ b/crates/recent_projects/src/recent_projects.rs @@ -11,8 +11,8 @@ use gpui::{ }; use ordered_float::OrderedFloat; use picker::{ - highlighted_match_with_paths::{HighlightedMatch, HighlightedMatchWithPaths}, Picker, PickerDelegate, + highlighted_match_with_paths::{HighlightedMatch, HighlightedMatchWithPaths}, }; pub use remote_servers::RemoteServerProjects; use settings::Settings; @@ -21,11 +21,11 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use ui::{prelude::*, tooltip_container, KeyBinding, ListItem, ListItemSpacing, Tooltip}; -use util::{paths::PathExt, ResultExt}; +use ui::{KeyBinding, ListItem, ListItemSpacing, Tooltip, prelude::*, tooltip_container}; +use util::{ResultExt, paths::PathExt}; use workspace::{ - CloseIntent, ModalView, OpenOptions, SerializedWorkspaceLocation, Workspace, WorkspaceId, - WORKSPACE_DB, + CloseIntent, ModalView, OpenOptions, SerializedWorkspaceLocation, WORKSPACE_DB, Workspace, + WorkspaceId, }; use zed_actions::{OpenRecent, OpenRemote}; @@ -594,11 +594,11 @@ mod tests { use dap::debugger_settings::DebuggerSettings; use editor::Editor; use gpui::{TestAppContext, UpdateGlobal, WindowHandle}; - use project::{project_settings::ProjectSettings, Project}; + use project::{Project, project_settings::ProjectSettings}; use serde_json::json; use settings::SettingsStore; use util::path; - use workspace::{open_paths, AppState}; + use workspace::{AppState, open_paths}; use super::*; diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs index 6308b6843cbee132384133898cf0cd79c3069927..392ee3048cd61a339d2888ecaa999c1284692972 100644 --- a/crates/recent_projects/src/remote_servers.rs +++ b/crates/recent_projects/src/remote_servers.rs @@ -4,38 +4,37 @@ use std::sync::Arc; use editor::Editor; use file_finder::OpenPathDelegate; +use futures::FutureExt; use futures::channel::oneshot; use futures::future::Shared; -use futures::FutureExt; -use gpui::canvas; use gpui::ClipboardItem; use gpui::Task; use gpui::WeakEntity; +use gpui::canvas; use gpui::{ AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, ScrollHandle, Window, }; use picker::Picker; use project::Project; -use remote::ssh_session::ConnectionIdentifier; use remote::SshConnectionOptions; use remote::SshRemoteClient; -use settings::update_settings_file; +use remote::ssh_session::ConnectionIdentifier; use settings::Settings; +use settings::update_settings_file; use ui::Navigable; use ui::NavigableEntry; use ui::{ - prelude::*, IconButtonShape, List, ListItem, ListSeparator, Modal, ModalHeader, Scrollbar, - ScrollbarState, Section, Tooltip, + IconButtonShape, List, ListItem, ListSeparator, Modal, ModalHeader, Scrollbar, ScrollbarState, + Section, Tooltip, prelude::*, }; use util::ResultExt; -use workspace::notifications::NotificationId; use workspace::OpenOptions; use workspace::Toast; -use workspace::{notifications::DetachAndPromptErr, ModalView, Workspace}; +use workspace::notifications::NotificationId; +use workspace::{ModalView, Workspace, notifications::DetachAndPromptErr}; -use crate::ssh_connections::connect_over_ssh; -use crate::ssh_connections::open_ssh_project; +use crate::OpenRemote; use crate::ssh_connections::RemoteSettingsContent; use crate::ssh_connections::SshConnection; use crate::ssh_connections::SshConnectionHeader; @@ -43,7 +42,8 @@ use crate::ssh_connections::SshConnectionModal; use crate::ssh_connections::SshProject; use crate::ssh_connections::SshPrompt; use crate::ssh_connections::SshSettings; -use crate::OpenRemote; +use crate::ssh_connections::connect_over_ssh; +use crate::ssh_connections::open_ssh_project; mod navigation_base {} pub struct RemoteServerProjects { diff --git a/crates/recent_projects/src/ssh_connections.rs b/crates/recent_projects/src/ssh_connections.rs index a5fc7d7433fa8b37218d621f56234fc00e55d707..988f5880e0e76e7c6a1f1fc32a06a0477b092b39 100644 --- a/crates/recent_projects/src/ssh_connections.rs +++ b/crates/recent_projects/src/ssh_connections.rs @@ -1,15 +1,15 @@ use std::collections::BTreeSet; use std::{path::PathBuf, sync::Arc, time::Duration}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use auto_update::AutoUpdater; use editor::Editor; use extension_host::ExtensionStore; use futures::channel::oneshot; use gpui::{ - percentage, Animation, AnimationExt, AnyWindowHandle, App, AsyncApp, DismissEvent, Entity, - EventEmitter, Focusable, FontFeatures, ParentElement as _, PromptLevel, Render, - SemanticVersion, SharedString, Task, TextStyleRefinement, Transformation, WeakEntity, + Animation, AnimationExt, AnyWindowHandle, App, AsyncApp, DismissEvent, Entity, EventEmitter, + Focusable, FontFeatures, ParentElement as _, PromptLevel, Render, SemanticVersion, + SharedString, Task, TextStyleRefinement, Transformation, WeakEntity, percentage, }; use language::CursorShape; @@ -22,8 +22,8 @@ use serde::{Deserialize, Serialize}; use settings::{Settings, SettingsSources}; use theme::ThemeSettings; use ui::{ - prelude::*, ActiveTheme, Color, Context, Icon, IconName, IconSize, InteractiveElement, - IntoElement, Label, LabelCommon, Styled, Window, + ActiveTheme, Color, Context, Icon, IconName, IconSize, InteractiveElement, IntoElement, Label, + LabelCommon, Styled, Window, prelude::*, }; use workspace::{AppState, ModalView, Workspace}; diff --git a/crates/refineable/derive_refineable/src/derive_refineable.rs b/crates/refineable/derive_refineable/src/derive_refineable.rs index 7df59faeaa2dd704b990b41965d470770eb405b7..aa297a8c0d87f36bdd0cb4bcf222b7cdad4d7792 100644 --- a/crates/refineable/derive_refineable/src/derive_refineable.rs +++ b/crates/refineable/derive_refineable/src/derive_refineable.rs @@ -2,8 +2,8 @@ use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::{format_ident, quote}; use syn::{ - parse_macro_input, parse_quote, DeriveInput, Field, FieldsNamed, PredicateType, TraitBound, - Type, TypeParamBound, WhereClause, WherePredicate, + DeriveInput, Field, FieldsNamed, PredicateType, TraitBound, Type, TypeParamBound, WhereClause, + WherePredicate, parse_macro_input, parse_quote, }; #[proc_macro_derive(Refineable, attributes(refineable))] diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rs index 7f430f05beb0ddedbce6821576b06779fe1f232e..8dad4780fbb3e40ee6112fb728df395a2ec68e24 100644 --- a/crates/remote/src/ssh_session.rs +++ b/crates/remote/src/ssh_session.rs @@ -1,20 +1,21 @@ use crate::{ json_log::LogRecord, protocol::{ - message_len_from_buffer, read_message_with_len, write_message, MessageId, MESSAGE_LEN_SIZE, + MESSAGE_LEN_SIZE, MessageId, message_len_from_buffer, read_message_with_len, write_message, }, proxy::ProxyLaunchError, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use async_trait::async_trait; use collections::HashMap; use futures::{ + AsyncReadExt as _, Future, FutureExt as _, StreamExt as _, channel::{ mpsc::{self, Sender, UnboundedReceiver, UnboundedSender}, oneshot, }, future::{BoxFuture, Shared}, - select, select_biased, AsyncReadExt as _, Future, FutureExt as _, StreamExt as _, + select, select_biased, }; use gpui::{ App, AppContext as _, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Global, @@ -25,9 +26,9 @@ use parking_lot::Mutex; use paths; use release_channel::{AppCommitSha, AppVersion, ReleaseChannel}; use rpc::{ - proto::{self, build_typed_envelope, Envelope, EnvelopedMessage, PeerId, RequestMessage}, AnyProtoClient, EntityMessageSubscriber, ErrorExt, ProtoClient, ProtoMessageHandlerSet, RpcError, + proto::{self, Envelope, EnvelopedMessage, PeerId, RequestMessage, build_typed_envelope}, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -42,8 +43,8 @@ use std::{ ops::ControlFlow, path::{Path, PathBuf}, sync::{ - atomic::{AtomicU32, AtomicU64, Ordering::SeqCst}, Arc, Weak, + atomic::{AtomicU32, AtomicU64, Ordering::SeqCst}, }, time::{Duration, Instant}, }; @@ -1291,7 +1292,7 @@ trait RemoteConnection: Send + Sync { cx: &mut AsyncApp, ) -> Task>; fn upload_directory(&self, src_path: PathBuf, dest_path: PathBuf, cx: &App) - -> Task>; + -> Task>; async fn kill(&self) -> Result<()>; fn has_been_killed(&self) -> bool; fn ssh_args(&self) -> Vec; @@ -2371,11 +2372,12 @@ mod fake { use anyhow::Result; use async_trait::async_trait; use futures::{ + FutureExt, SinkExt, StreamExt, channel::{ mpsc::{self, Sender}, oneshot, }, - select_biased, FutureExt, SinkExt, StreamExt, + select_biased, }; use gpui::{App, AppContext as _, AsyncApp, SemanticVersion, Task, TestAppContext}; use release_channel::ReleaseChannel; diff --git a/crates/remote_server/src/headless_project.rs b/crates/remote_server/src/headless_project.rs index b1c2a7ec1221335c4069ebc4504bd2e62c72e9d5..4855c16b316d6e40656bc4011c1df5bebcc5af2d 100644 --- a/crates/remote_server/src/headless_project.rs +++ b/crates/remote_server/src/headless_project.rs @@ -1,14 +1,15 @@ use ::proto::{FromProto, ToProto}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use dap::DapRegistry; use extension::ExtensionHostProxy; use extension_host::headless_host::HeadlessExtensionStore; use fs::Fs; use gpui::{App, AppContext as _, AsyncApp, Context, Entity, PromptLevel}; use http_client::HttpClient; -use language::{proto::serialize_operation, Buffer, BufferEvent, LanguageRegistry}; +use language::{Buffer, BufferEvent, LanguageRegistry, proto::serialize_operation}; use node_runtime::NodeRuntime; use project::{ + LspStore, LspStoreEvent, PrettierStore, ProjectPath, ToolchainStore, WorktreeId, buffer_store::{BufferStore, BufferStoreEvent}, debugger::{breakpoint_store::BreakpointStore, dap_store::DapStore}, git_store::GitStore, @@ -16,19 +17,18 @@ use project::{ search::SearchQuery, task_store::TaskStore, worktree_store::WorktreeStore, - LspStore, LspStoreEvent, PrettierStore, ProjectPath, ToolchainStore, WorktreeId, }; use remote::ssh_session::ChannelClient; use rpc::{ - proto::{self, SSH_PEER_ID, SSH_PROJECT_ID}, AnyProtoClient, TypedEnvelope, + proto::{self, SSH_PEER_ID, SSH_PROJECT_ID}, }; use settings::initial_server_settings_content; use smol::stream::StreamExt; use std::{ path::{Path, PathBuf}, - sync::{atomic::AtomicUsize, Arc}, + sync::{Arc, atomic::AtomicUsize}, }; use util::ResultExt; use worktree::Worktree; @@ -371,8 +371,10 @@ impl HeadlessProject { parent = util::paths::home_dir(); } let parent = fs.canonicalize(parent).await.map_err(|_| { - anyhow!(proto::ErrorCode::DevServerProjectPathDoesNotExist - .with_tag("path", &path.to_string_lossy().as_ref())) + anyhow!( + proto::ErrorCode::DevServerProjectPathDoesNotExist + .with_tag("path", &path.to_string_lossy().as_ref()) + ) })?; parent.join(path.file_name().unwrap()) } diff --git a/crates/remote_server/src/main.rs b/crates/remote_server/src/main.rs index 715380dbf9a9b8539767f97159efb889bfed77bf..c43db645f83f354acd3155f0b88feba930127826 100644 --- a/crates/remote_server/src/main.rs +++ b/crates/remote_server/src/main.rs @@ -40,7 +40,7 @@ fn main() { #[cfg(not(windows))] fn main() { - use release_channel::{ReleaseChannel, RELEASE_CHANNEL}; + use release_channel::{RELEASE_CHANNEL, ReleaseChannel}; use remote::proxy::ProxyLaunchError; use remote_server::unix::{execute_proxy, execute_run}; diff --git a/crates/remote_server/src/remote_editing_tests.rs b/crates/remote_server/src/remote_editing_tests.rs index 438ac5c07cee6e387d877fa0956b5f3fa1275de5..30fd2d894085dc1a201609204bb6a68d258e921f 100644 --- a/crates/remote_server/src/remote_editing_tests.rs +++ b/crates/remote_server/src/remote_editing_tests.rs @@ -10,18 +10,18 @@ use fs::{FakeFs, Fs}; use gpui::{AppContext as _, Entity, SemanticVersion, TestAppContext}; use http_client::{BlockedHttpClient, FakeHttpClient}; use language::{ - language_settings::{language_settings, AllLanguageSettings}, Buffer, FakeLspAdapter, LanguageConfig, LanguageMatcher, LanguageRegistry, LineEnding, + language_settings::{AllLanguageSettings, language_settings}, }; use lsp::{CompletionContext, CompletionResponse, CompletionTriggerKind, LanguageServerName}; use node_runtime::NodeRuntime; use project::{ - search::{SearchQuery, SearchResult}, Project, ProjectPath, + search::{SearchQuery, SearchResult}, }; use remote::SshRemoteClient; use serde_json::json; -use settings::{initial_server_settings_content, Settings, SettingsLocation, SettingsStore}; +use settings::{Settings, SettingsLocation, SettingsStore, initial_server_settings_content}; use smol::stream::StreamExt; use std::{ collections::HashSet, diff --git a/crates/remote_server/src/unix.rs b/crates/remote_server/src/unix.rs index b1bff8c1a00fed649e35535b9712e8b34148fe75..0218835f5dedeffef666963ed2146a49fe9c10e4 100644 --- a/crates/remote_server/src/unix.rs +++ b/crates/remote_server/src/unix.rs @@ -1,23 +1,23 @@ -use crate::headless_project::HeadlessAppState; use crate::HeadlessProject; -use anyhow::{anyhow, Context as _, Result}; +use crate::headless_project::HeadlessAppState; +use anyhow::{Context as _, Result, anyhow}; use chrono::Utc; -use client::{telemetry, ProxySettings}; +use client::{ProxySettings, telemetry}; use dap::DapRegistry; use extension::ExtensionHostProxy; use fs::{Fs, RealFs}; use futures::channel::mpsc; -use futures::{select, select_biased, AsyncRead, AsyncWrite, AsyncWriteExt, FutureExt, SinkExt}; +use futures::{AsyncRead, AsyncWrite, AsyncWriteExt, FutureExt, SinkExt, select, select_biased}; use git::GitHostingProviderRegistry; use gpui::{App, AppContext as _, Context, Entity, SemanticVersion, UpdateGlobal as _}; use gpui_tokio::Tokio; -use http_client::{read_proxy_from_env, Uri}; +use http_client::{Uri, read_proxy_from_env}; use language::LanguageRegistry; use node_runtime::{NodeBinaryOptions, NodeRuntime}; use paths::logs_dir; use project::project_settings::ProjectSettings; -use release_channel::{AppVersion, ReleaseChannel, RELEASE_CHANNEL}; +use release_channel::{AppVersion, RELEASE_CHANNEL, ReleaseChannel}; use remote::proxy::ProxyLaunchError; use remote::ssh_session::ChannelClient; use remote::{ @@ -27,7 +27,7 @@ use remote::{ use reqwest_client::ReqwestClient; use rpc::proto::{self, Envelope, SSH_PROJECT_ID}; use rpc::{AnyProtoClient, TypedEnvelope}; -use settings::{watch_config_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, watch_config_file}; use smol::channel::{Receiver, Sender}; use smol::io::AsyncReadExt; diff --git a/crates/repl/src/components/kernel_list_item.rs b/crates/repl/src/components/kernel_list_item.rs index 74129605356bca4010af6fa91ee2e8394b3c1b1a..467407fbd2d3c6413efedb5b7576e5c982c8a0d6 100644 --- a/crates/repl/src/components/kernel_list_item.rs +++ b/crates/repl/src/components/kernel_list_item.rs @@ -1,5 +1,5 @@ use gpui::AnyElement; -use ui::{prelude::*, Indicator, ListItem}; +use ui::{Indicator, ListItem, prelude::*}; use crate::KernelSpecification; diff --git a/crates/repl/src/components/kernel_options.rs b/crates/repl/src/components/kernel_options.rs index 57ee4cdcefae927802cd35213f8247cbae00cde2..0623fd7ea51842d705ae0b491afa13c3e39348fd 100644 --- a/crates/repl/src/components/kernel_options.rs +++ b/crates/repl/src/components/kernel_options.rs @@ -1,6 +1,6 @@ +use crate::KERNEL_DOCS_URL; use crate::kernels::KernelSpecification; use crate::repl_store::ReplStore; -use crate::KERNEL_DOCS_URL; use gpui::AnyView; use gpui::DismissEvent; @@ -15,7 +15,7 @@ use ui::ListItemSpacing; use gpui::SharedString; use gpui::Task; -use ui::{prelude::*, ListItem, PopoverMenu, PopoverMenuHandle, PopoverTrigger}; +use ui::{ListItem, PopoverMenu, PopoverMenuHandle, PopoverTrigger, prelude::*}; type OnSelect = Box; diff --git a/crates/repl/src/kernels/native_kernel.rs b/crates/repl/src/kernels/native_kernel.rs index 0ed933c626ac41a23342ec3c87a0a1e3c6b0e074..a79f14f6e8c0bdfc73d835a3bb1c954d7f3e8f90 100644 --- a/crates/repl/src/kernels/native_kernel.rs +++ b/crates/repl/src/kernels/native_kernel.rs @@ -1,14 +1,14 @@ use anyhow::{Context as _, Result}; use futures::{ + AsyncBufReadExt as _, SinkExt as _, channel::mpsc::{self}, io::BufReader, stream::{SelectAll, StreamExt}, - AsyncBufReadExt as _, SinkExt as _, }; use gpui::{App, AppContext as _, Entity, EntityId, Task, Window}; use jupyter_protocol::{ - connection_info::{ConnectionInfo, Transport}, ExecutionState, JupyterKernelspec, JupyterMessage, JupyterMessageContent, KernelInfoReply, + connection_info::{ConnectionInfo, Transport}, }; use project::Fs; use runtimelib::dirs; diff --git a/crates/repl/src/kernels/remote_kernels.rs b/crates/repl/src/kernels/remote_kernels.rs index fd487e56ca6cdbc2a115fb56e833705ecc249d19..e89560827078d83a34782335906dcf09b7d1366e 100644 --- a/crates/repl/src/kernels/remote_kernels.rs +++ b/crates/repl/src/kernels/remote_kernels.rs @@ -1,4 +1,4 @@ -use futures::{channel::mpsc, SinkExt as _}; +use futures::{SinkExt as _, channel::mpsc}; use gpui::{App, AppContext as _, Entity, Task, Window}; use http_client::{AsyncBody, HttpClient, Request}; use jupyter_protocol::{ExecutionState, JupyterKernelspec, JupyterMessage, KernelInfoReply}; diff --git a/crates/repl/src/notebook/cell.rs b/crates/repl/src/notebook/cell.rs index 7d0a35ccdc81c738afac5c986cbd18eb640ef16a..75fe44a191c46e80a793902b6c2d35ebc47dbe41 100644 --- a/crates/repl/src/notebook/cell.rs +++ b/crates/repl/src/notebook/cell.rs @@ -3,18 +3,18 @@ use std::sync::Arc; use editor::{Editor, EditorMode, MultiBuffer}; use futures::future::Shared; -use gpui::{prelude::*, App, Entity, Hsla, Task, TextStyleRefinement}; +use gpui::{App, Entity, Hsla, Task, TextStyleRefinement, prelude::*}; use language::{Buffer, Language, LanguageRegistry}; use markdown_preview::{markdown_parser::parse_markdown, markdown_renderer::render_markdown_block}; use nbformat::v4::{CellId, CellMetadata, CellType}; use settings::Settings as _; use theme::ThemeSettings; -use ui::{prelude::*, IconButtonShape}; +use ui::{IconButtonShape, prelude::*}; use util::ResultExt; use crate::{ notebook::{CODE_BLOCK_INSET, GUTTER_WIDTH}, - outputs::{plain::TerminalOutput, user_error::ErrorView, Output}, + outputs::{Output, plain::TerminalOutput, user_error::ErrorView}, }; #[derive(Copy, Clone, PartialEq, PartialOrd)] diff --git a/crates/repl/src/notebook/notebook_ui.rs b/crates/repl/src/notebook/notebook_ui.rs index 15bae33ba55338cd513bc1889ab967efd7c796ca..4a539a64a7c740f00adc37cfa311b8a47a279af1 100644 --- a/crates/repl/src/notebook/notebook_ui.rs +++ b/crates/repl/src/notebook/notebook_ui.rs @@ -6,15 +6,15 @@ use anyhow::{Context as _, Result}; use client::proto::ViewId; use collections::HashMap; use feature_flags::{FeatureFlagAppExt as _, NotebookFeatureFlag}; -use futures::future::Shared; use futures::FutureExt; +use futures::future::Shared; use gpui::{ - actions, list, prelude::*, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, - ListScrollEvent, ListState, Point, Task, + AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, ListScrollEvent, ListState, + Point, Task, actions, list, prelude::*, }; use language::{Language, LanguageRegistry}; use project::{Project, ProjectEntryId, ProjectPath}; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use workspace::item::{ItemEvent, TabContentParams}; use workspace::searchable::SearchableItemHandle; use workspace::{Item, ItemHandle, Pane, ProjectItem, ToolbarItemLocation}; diff --git a/crates/repl/src/outputs.rs b/crates/repl/src/outputs.rs index 226dcab85ad7e7f5e4e2c66420ce95694d984081..15062dec3beb622cd76f344e7b008d3d530d3ae6 100644 --- a/crates/repl/src/outputs.rs +++ b/crates/repl/src/outputs.rs @@ -37,12 +37,12 @@ use std::time::Duration; use editor::{Editor, MultiBuffer}; use gpui::{ - percentage, Animation, AnimationExt, AnyElement, ClipboardItem, Entity, Render, Transformation, - WeakEntity, + Animation, AnimationExt, AnyElement, ClipboardItem, Entity, Render, Transformation, WeakEntity, + percentage, }; use language::Buffer; use runtimelib::{ExecutionState, JupyterMessageContent, MimeBundle, MimeType}; -use ui::{div, prelude::*, v_flex, Context, IntoElement, Styled, Tooltip, Window}; +use ui::{Context, IntoElement, Styled, Tooltip, Window, div, prelude::*, v_flex}; mod image; use image::ImageView; diff --git a/crates/repl/src/outputs/image.rs b/crates/repl/src/outputs/image.rs index 6e574c565e3f61b16e4e7a32b433e3ff1ef0895b..c5b54df77a6e51c406c44abf2a1aaf068f259c3e 100644 --- a/crates/repl/src/outputs/image.rs +++ b/crates/repl/src/outputs/image.rs @@ -1,12 +1,11 @@ use anyhow::Result; use base64::{ - alphabet, + Engine as _, alphabet, engine::{DecodePaddingMode, GeneralPurpose, GeneralPurposeConfig}, - Engine as _, }; -use gpui::{img, App, ClipboardItem, Image, ImageFormat, Pixels, RenderImage, Window}; +use gpui::{App, ClipboardItem, Image, ImageFormat, Pixels, RenderImage, Window, img}; use std::sync::Arc; -use ui::{div, prelude::*, IntoElement, Styled}; +use ui::{IntoElement, Styled, div, prelude::*}; use crate::outputs::OutputContent; diff --git a/crates/repl/src/outputs/markdown.rs b/crates/repl/src/outputs/markdown.rs index a5013f691b93a185b9859cd2810f560e8094144e..fb04c9fd440b790255d0f0596633810eb7a60793 100644 --- a/crates/repl/src/outputs/markdown.rs +++ b/crates/repl/src/outputs/markdown.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use gpui::{div, prelude::*, App, ClipboardItem, Context, Entity, Task, Window}; +use gpui::{App, ClipboardItem, Context, Entity, Task, Window, div, prelude::*}; use language::Buffer; use markdown_preview::{ markdown_elements::ParsedMarkdown, markdown_parser::parse_markdown, diff --git a/crates/repl/src/outputs/plain.rs b/crates/repl/src/outputs/plain.rs index 09df40410ae0a6ca54a2e44b666af841017bf226..89ae10eee3e3f9d784483be895a49d83dfdcc90c 100644 --- a/crates/repl/src/outputs/plain.rs +++ b/crates/repl/src/outputs/plain.rs @@ -22,12 +22,12 @@ use alacritty_terminal::{ term::Config, vte::ansi::Processor, }; -use gpui::{canvas, size, Bounds, ClipboardItem, Entity, FontStyle, TextStyle, WhiteSpace}; +use gpui::{Bounds, ClipboardItem, Entity, FontStyle, TextStyle, WhiteSpace, canvas, size}; use language::Buffer; use settings::Settings as _; use terminal_view::terminal_element::TerminalElement; use theme::ThemeSettings; -use ui::{prelude::*, IntoElement}; +use ui::{IntoElement, prelude::*}; use crate::outputs::OutputContent; diff --git a/crates/repl/src/outputs/table.rs b/crates/repl/src/outputs/table.rs index 04eb2cc6e73d4e25a1c9476f5a2fa2f120a00bc7..cb626da895c2e9eb8d5c1d4d0ebdc98ae1066351 100644 --- a/crates/repl/src/outputs/table.rs +++ b/crates/repl/src/outputs/table.rs @@ -60,7 +60,7 @@ use runtimelib::media::datatable::TabularDataResource; use serde_json::Value; use settings::Settings; use theme::ThemeSettings; -use ui::{div, prelude::*, v_flex, IntoElement, Styled}; +use ui::{IntoElement, Styled, div, prelude::*, v_flex}; use util::markdown::MarkdownString; use crate::outputs::OutputContent; diff --git a/crates/repl/src/outputs/user_error.rs b/crates/repl/src/outputs/user_error.rs index f27d71e6eb2979710f447c2cde3936366e956eda..f42be1c867e3273a4cca3b730d55edbdca38ed33 100644 --- a/crates/repl/src/outputs/user_error.rs +++ b/crates/repl/src/outputs/user_error.rs @@ -1,5 +1,5 @@ use gpui::{AnyElement, App, Entity, FontWeight, Window}; -use ui::{h_flex, prelude::*, v_flex, Label}; +use ui::{Label, h_flex, prelude::*, v_flex}; use crate::outputs::plain::TerminalOutput; diff --git a/crates/repl/src/repl.rs b/crates/repl/src/repl.rs index 722e88b0782047940109d4cca638e4f74c2dcafb..7c17b5fac2a3aa9107a44543416f6210dcaa80c7 100644 --- a/crates/repl/src/repl.rs +++ b/crates/repl/src/repl.rs @@ -10,7 +10,7 @@ mod session; use std::{sync::Arc, time::Duration}; -use async_dispatcher::{set_dispatcher, Dispatcher, Runnable}; +use async_dispatcher::{Dispatcher, Runnable, set_dispatcher}; use gpui::{App, PlatformDispatcher}; use project::Fs; pub use runtimelib::ExecutionState; diff --git a/crates/repl/src/repl_editor.rs b/crates/repl/src/repl_editor.rs index 2e919caa727422a9761e0dc8538a17d2e93ba808..05b10f3f955b80ce331f91245f1abfc0492259e6 100644 --- a/crates/repl/src/repl_editor.rs +++ b/crates/repl/src/repl_editor.rs @@ -5,7 +5,7 @@ use std::sync::Arc; use anyhow::{Context as _, Result}; use editor::Editor; -use gpui::{prelude::*, App, Entity, WeakEntity, Window}; +use gpui::{App, Entity, WeakEntity, Window, prelude::*}; use language::{BufferSnapshot, Language, LanguageName, Point}; use project::{ProjectItem as _, WorktreeId}; diff --git a/crates/repl/src/repl_sessions_ui.rs b/crates/repl/src/repl_sessions_ui.rs index 3655ed01363ab6529d63c690fc1f27f8f8de7089..abae381276b76b282974f3ae65b3fdb0ebdcc0ac 100644 --- a/crates/repl/src/repl_sessions_ui.rs +++ b/crates/repl/src/repl_sessions_ui.rs @@ -1,14 +1,14 @@ use editor::Editor; use gpui::{ - actions, prelude::*, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, - Subscription, + AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Subscription, actions, + prelude::*, }; use project::ProjectItem as _; -use ui::{prelude::*, ButtonLike, ElevationIndex, KeyBinding}; +use ui::{ButtonLike, ElevationIndex, KeyBinding, prelude::*}; use util::ResultExt as _; -use workspace::item::ItemEvent; use workspace::WorkspaceId; -use workspace::{item::Item, Workspace}; +use workspace::item::ItemEvent; +use workspace::{Workspace, item::Item}; use crate::jupyter_settings::JupyterSettings; use crate::repl_store::ReplStore; diff --git a/crates/repl/src/repl_store.rs b/crates/repl/src/repl_store.rs index 8597cedaddb95a0d1e1edc6d68494c92fe001567..e6a80e322495bdd2c2bdcdc5211a2cfa4df9b3a9 100644 --- a/crates/repl/src/repl_store.rs +++ b/crates/repl/src/repl_store.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use anyhow::Result; use collections::HashMap; use command_palette_hooks::CommandPaletteFilter; -use gpui::{prelude::*, App, Context, Entity, EntityId, Global, Subscription, Task}; +use gpui::{App, Context, Entity, EntityId, Global, Subscription, Task, prelude::*}; use jupyter_websocket_client::RemoteServer; use language::Language; use project::{Fs, Project, WorktreeId}; diff --git a/crates/repl/src/session.rs b/crates/repl/src/session.rs index 08aaeb605e1aeb247b4911ac2b7c703643a99aed..82d0f915f8acbc6c91a7cade810fb92aeefddab5 100644 --- a/crates/repl/src/session.rs +++ b/crates/repl/src/session.rs @@ -2,22 +2,22 @@ use crate::components::KernelListItem; use crate::kernels::RemoteRunningKernel; use crate::setup_editor_session_actions; use crate::{ + KernelStatus, kernels::{Kernel, KernelSpecification, NativeRunningKernel}, outputs::{ExecutionStatus, ExecutionView}, - KernelStatus, }; use collections::{HashMap, HashSet}; use editor::{ + Anchor, AnchorRangeExt as _, Editor, MultiBuffer, ToPoint, display_map::{ BlockContext, BlockId, BlockPlacement, BlockProperties, BlockStyle, CustomBlockId, RenderBlock, }, scroll::Autoscroll, - Anchor, AnchorRangeExt as _, Editor, MultiBuffer, ToPoint, }; use futures::FutureExt as _; use gpui::{ - div, prelude::*, Context, Entity, EventEmitter, Render, Subscription, Task, WeakEntity, Window, + Context, Entity, EventEmitter, Render, Subscription, Task, WeakEntity, Window, div, prelude::*, }; use language::Point; use project::Fs; @@ -27,7 +27,7 @@ use runtimelib::{ }; use std::{env::temp_dir, ops::Range, sync::Arc, time::Duration}; use theme::ActiveTheme; -use ui::{prelude::*, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*}; use util::ResultExt as _; pub struct Session { diff --git a/crates/reqwest_client/examples/client.rs b/crates/reqwest_client/examples/client.rs index 3a94ca4a83c524104697dceb6a24f3b81b3692d0..71af8d72cb34103102a8762723509937dc0b5dcd 100644 --- a/crates/reqwest_client/examples/client.rs +++ b/crates/reqwest_client/examples/client.rs @@ -1,7 +1,7 @@ use std::time::Instant; -use futures::stream::FuturesUnordered; use futures::AsyncReadExt as _; +use futures::stream::FuturesUnordered; use http_client::AsyncBody; use http_client::HttpClient; use reqwest_client::ReqwestClient; diff --git a/crates/reqwest_client/src/reqwest_client.rs b/crates/reqwest_client/src/reqwest_client.rs index c523aba5ae30a27a5e6b10c99157c968eae72449..11afe18ce95196a48fa6c286e5151d5904f658d0 100644 --- a/crates/reqwest_client/src/reqwest_client.rs +++ b/crates/reqwest_client/src/reqwest_client.rs @@ -4,7 +4,7 @@ use std::{any::type_name, borrow::Cow, mem, pin::Pin, task::Poll, time::Duration use anyhow::anyhow; use bytes::{BufMut, Bytes, BytesMut}; use futures::{AsyncRead, TryStreamExt as _}; -use http_client::{http, RedirectPolicy}; +use http_client::{RedirectPolicy, http}; use regex::Regex; use reqwest::{ header::{HeaderMap, HeaderValue}, @@ -256,7 +256,7 @@ impl http_client::HttpClient for ReqwestClient { #[cfg(test)] mod tests { - use http_client::{http, HttpClient}; + use http_client::{HttpClient, http}; use crate::ReqwestClient; diff --git a/crates/rope/benches/rope_benchmark.rs b/crates/rope/benches/rope_benchmark.rs index 01811c0c86740c2cf8fe0952df612d75a6c80da2..2233708525a8a060c78e66340537317cc6694d18 100644 --- a/crates/rope/benches/rope_benchmark.rs +++ b/crates/rope/benches/rope_benchmark.rs @@ -1,7 +1,7 @@ use std::ops::Range; use criterion::{ - black_box, criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion, Throughput, + BatchSize, BenchmarkId, Criterion, Throughput, black_box, criterion_group, criterion_main, }; use rand::prelude::*; use rand::rngs::StdRng; diff --git a/crates/rope/src/rope.rs b/crates/rope/src/rope.rs index f0d0af76bdebe232dd5b3a75aad244ddf308fd0e..efd89a0f72490010320209e0027c9a85c9f6ec68 100644 --- a/crates/rope/src/rope.rs +++ b/crates/rope/src/rope.rs @@ -1428,10 +1428,10 @@ where #[cfg(test)] mod tests { use super::*; + use Bias::{Left, Right}; use rand::prelude::*; use std::{cmp::Ordering, env, io::Read}; use util::RandomCharIter; - use Bias::{Left, Right}; #[ctor::ctor] fn init_logger() { @@ -1900,12 +1900,14 @@ mod tests { let correct_substring = &text[start..end]; // Test that correct range returns true - assert!(rope - .chunks_in_range(range.clone()) - .equals_str(correct_substring)); - assert!(rope - .reversed_chunks_in_range(range.clone()) - .equals_str(correct_substring)); + assert!( + rope.chunks_in_range(range.clone()) + .equals_str(correct_substring) + ); + assert!( + rope.reversed_chunks_in_range(range.clone()) + .equals_str(correct_substring) + ); // Test that all other ranges return false (unless they happen to match) for other_start in 0..text.len() { @@ -1919,12 +1921,16 @@ mod tests { if other_substring == correct_substring { continue; } - assert!(!rope - .chunks_in_range(range.clone()) - .equals_str(other_substring)); - assert!(!rope - .reversed_chunks_in_range(range.clone()) - .equals_str(other_substring)); + assert!( + !rope + .chunks_in_range(range.clone()) + .equals_str(other_substring) + ); + assert!( + !rope + .reversed_chunks_in_range(range.clone()) + .equals_str(other_substring) + ); } } } diff --git a/crates/rpc/src/auth.rs b/crates/rpc/src/auth.rs index 6cd3581671e302d5389dfe603484e1a0cbd9fd1b..2e3546289d6bbc476ea7dd6002cb70d466a53d3f 100644 --- a/crates/rpc/src/auth.rs +++ b/crates/rpc/src/auth.rs @@ -1,6 +1,6 @@ use anyhow::{Context as _, Result}; use base64::prelude::*; -use rand::{thread_rng, Rng as _}; +use rand::{Rng as _, thread_rng}; use rsa::pkcs1::{DecodeRsaPublicKey, EncodeRsaPublicKey}; use rsa::traits::PaddingScheme; use rsa::{Oaep, Pkcs1v15Encrypt, RsaPrivateKey, RsaPublicKey}; diff --git a/crates/rpc/src/conn.rs b/crates/rpc/src/conn.rs index 18bce4abbadd4b28a7851e6a26bdf883aee63213..2f7db713fd0c8330567aba02882f7b05b73b89e2 100644 --- a/crates/rpc/src/conn.rs +++ b/crates/rpc/src/conn.rs @@ -37,8 +37,8 @@ impl Connection { executor: gpui::BackgroundExecutor, ) -> (Self, Self, std::sync::Arc) { use std::sync::{ - atomic::{AtomicBool, Ordering::SeqCst}, Arc, + atomic::{AtomicBool, Ordering::SeqCst}, }; let killed = Arc::new(AtomicBool::new(false)); diff --git a/crates/rpc/src/notification.rs b/crates/rpc/src/notification.rs index 52108f13dcd01c3ce2dacc0a2c8675660b93ddc7..cb405b63cafaaa76e86820518263e0c9c5544a39 100644 --- a/crates/rpc/src/notification.rs +++ b/crates/rpc/src/notification.rs @@ -1,6 +1,6 @@ use crate::proto; use serde::{Deserialize, Serialize}; -use serde_json::{map, Value}; +use serde_json::{Value, map}; use strum::VariantNames; const KIND: &str = "kind"; diff --git a/crates/rpc/src/peer.rs b/crates/rpc/src/peer.rs index 36448a6967e93f33295fc668c89a0cc6ecdae689..67cc966d88bd355318d92e3b71fe5685613e863e 100644 --- a/crates/rpc/src/peer.rs +++ b/crates/rpc/src/peer.rs @@ -1,27 +1,27 @@ use super::{ + Connection, proto::{ self, AnyTypedEnvelope, EnvelopedMessage, MessageStream, PeerId, Receipt, RequestMessage, TypedEnvelope, }, - Connection, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use futures::{ + FutureExt, SinkExt, Stream, StreamExt, TryFutureExt, channel::{mpsc, oneshot}, stream::BoxStream, - FutureExt, SinkExt, Stream, StreamExt, TryFutureExt, }; use parking_lot::{Mutex, RwLock}; use proto::{ErrorCode, ErrorCodeExt, ErrorExt, RpcError}; -use serde::{ser::SerializeStruct, Serialize}; +use serde::{Serialize, ser::SerializeStruct}; use std::{ fmt, future, future::Future, sync::atomic::Ordering::SeqCst, sync::{ - atomic::{self, AtomicU32}, Arc, + atomic::{self, AtomicU32}, }, time::Duration, time::Instant, @@ -1030,10 +1030,12 @@ mod tests { let _ = io_ended_rx.await; let _ = messages_ended_rx.await; - assert!(server_conn - .send(WebSocketMessage::Binary(vec![])) - .await - .is_err()); + assert!( + server_conn + .send(WebSocketMessage::Binary(vec![])) + .await + .is_err() + ); } #[gpui::test(iterations = 50)] diff --git a/crates/rpc/src/proto_client.rs b/crates/rpc/src/proto_client.rs index f3dbf84da35c44be9667334f7ebb3b49085ac533..e5f7b781b8db94a34ee7ea0c786d7f7a9c39e007 100644 --- a/crates/rpc/src/proto_client.rs +++ b/crates/rpc/src/proto_client.rs @@ -1,13 +1,13 @@ use anyhow::anyhow; use collections::HashMap; use futures::{ - future::{BoxFuture, LocalBoxFuture}, Future, FutureExt as _, + future::{BoxFuture, LocalBoxFuture}, }; use gpui::{AnyEntity, AnyWeakEntity, AsyncApp, Entity}; use proto::{ - error::ErrorExt as _, AnyTypedEnvelope, EntityMessage, Envelope, EnvelopedMessage, - RequestMessage, TypedEnvelope, + AnyTypedEnvelope, EntityMessage, Envelope, EnvelopedMessage, RequestMessage, TypedEnvelope, + error::ErrorExt as _, }; use std::{ any::TypeId, diff --git a/crates/rpc/src/rpc.rs b/crates/rpc/src/rpc.rs index 9c62238733215f9bcda3b5ad2186d6a291a69392..c168c20fa857b043f4772195a3a695e18554b406 100644 --- a/crates/rpc/src/rpc.rs +++ b/crates/rpc/src/rpc.rs @@ -11,7 +11,7 @@ pub use extension::*; pub use llm::*; pub use notification::*; pub use peer::*; -pub use proto::{error::*, Receipt, TypedEnvelope}; +pub use proto::{Receipt, TypedEnvelope, error::*}; mod macros; #[cfg(feature = "gpui")] diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 90da46fa526e412e6836ef23a1dacfef5813b57d..e9a837b16802cef3e45dcef352ee62d9809c2a66 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -1,22 +1,22 @@ mod registrar; use crate::{ - search_bar::render_nav_button, FocusSearch, NextHistoryQuery, PreviousHistoryQuery, ReplaceAll, - ReplaceNext, SearchOptions, SelectAllMatches, SelectNextMatch, SelectPreviousMatch, - ToggleCaseSensitive, ToggleRegex, ToggleReplace, ToggleSelection, ToggleWholeWord, + FocusSearch, NextHistoryQuery, PreviousHistoryQuery, ReplaceAll, ReplaceNext, SearchOptions, + SelectAllMatches, SelectNextMatch, SelectPreviousMatch, ToggleCaseSensitive, ToggleRegex, + ToggleReplace, ToggleSelection, ToggleWholeWord, search_bar::render_nav_button, }; use any_vec::AnyVec; use anyhow::Context as _; use collections::HashMap; use editor::{ - actions::{Backtab, Tab}, DisplayPoint, Editor, EditorElement, EditorSettings, EditorStyle, + actions::{Backtab, Tab}, }; use futures::channel::oneshot; use gpui::{ - actions, div, impl_actions, Action, App, ClickEvent, Context, Entity, EventEmitter, - FocusHandle, Focusable, InteractiveElement as _, IntoElement, KeyContext, ParentElement as _, - Render, ScrollHandle, Styled, Subscription, Task, TextStyle, Window, + Action, App, ClickEvent, Context, Entity, EventEmitter, FocusHandle, Focusable, + InteractiveElement as _, IntoElement, KeyContext, ParentElement as _, Render, ScrollHandle, + Styled, Subscription, Task, TextStyle, Window, actions, div, impl_actions, }; use language::{Language, LanguageRegistry}; use project::{ @@ -31,14 +31,14 @@ use theme::ThemeSettings; use zed_actions::outline::ToggleOutline; use ui::{ - h_flex, prelude::*, utils::SearchInputWidth, IconButton, IconButtonShape, IconName, Tooltip, - BASE_REM_SIZE_IN_PX, + BASE_REM_SIZE_IN_PX, IconButton, IconButtonShape, IconName, Tooltip, h_flex, prelude::*, + utils::SearchInputWidth, }; use util::ResultExt; use workspace::{ + ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, item::ItemHandle, searchable::{Direction, SearchEvent, SearchableItemHandle, WeakSearchableItemHandle}, - ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, }; pub use registrar::DivRegistrar; @@ -1521,7 +1521,7 @@ mod tests { use std::ops::Range; use super::*; - use editor::{display_map::DisplayRow, DisplayPoint, Editor, MultiBuffer, SearchSettings}; + use editor::{DisplayPoint, Editor, MultiBuffer, SearchSettings, display_map::DisplayRow}; use gpui::{Hsla, TestAppContext, UpdateGlobal, VisualTestContext}; use language::{Buffer, Point}; use project::Project; diff --git a/crates/search/src/buffer_search/registrar.rs b/crates/search/src/buffer_search/registrar.rs index deda2fbfc6a6beb217e38c6420da16b38db3d70c..4351e38618dc911d0486ccb1313d2c129e2cedff 100644 --- a/crates/search/src/buffer_search/registrar.rs +++ b/crates/search/src/buffer_search/registrar.rs @@ -1,4 +1,4 @@ -use gpui::{div, Action, Context, Div, Entity, InteractiveElement, Window}; +use gpui::{Action, Context, Div, Entity, InteractiveElement, Window, div}; use workspace::Workspace; use crate::BufferSearchBar; diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 4010554882197b60da7af2999088912e82939e99..2b4872ae779e4eaf8d3466dbcce826eae1e5cb93 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -1,27 +1,27 @@ use crate::{ - buffer_search::Deploy, BufferSearchBar, FocusSearch, NextHistoryQuery, PreviousHistoryQuery, - ReplaceAll, ReplaceNext, SearchOptions, SelectNextMatch, SelectPreviousMatch, - ToggleCaseSensitive, ToggleIncludeIgnored, ToggleRegex, ToggleReplace, ToggleWholeWord, + BufferSearchBar, FocusSearch, NextHistoryQuery, PreviousHistoryQuery, ReplaceAll, ReplaceNext, + SearchOptions, SelectNextMatch, SelectPreviousMatch, ToggleCaseSensitive, ToggleIncludeIgnored, + ToggleRegex, ToggleReplace, ToggleWholeWord, buffer_search::Deploy, }; use anyhow::Context as _; use collections::{HashMap, HashSet}; use editor::{ - actions::SelectAll, items::active_match_index, scroll::Autoscroll, Anchor, Editor, - EditorElement, EditorEvent, EditorSettings, EditorStyle, MultiBuffer, MAX_TAB_TITLE_LEN, + Anchor, Editor, EditorElement, EditorEvent, EditorSettings, EditorStyle, MAX_TAB_TITLE_LEN, + MultiBuffer, actions::SelectAll, items::active_match_index, scroll::Autoscroll, }; use futures::StreamExt; use gpui::{ - actions, div, Action, AnyElement, AnyView, App, Axis, Context, Entity, EntityId, EventEmitter, - FocusHandle, Focusable, Global, Hsla, InteractiveElement, IntoElement, KeyContext, - ParentElement, Point, Render, SharedString, Styled, Subscription, Task, TextStyle, - UpdateGlobal, WeakEntity, Window, + Action, AnyElement, AnyView, App, Axis, Context, Entity, EntityId, EventEmitter, FocusHandle, + Focusable, Global, Hsla, InteractiveElement, IntoElement, KeyContext, ParentElement, Point, + Render, SharedString, Styled, Subscription, Task, TextStyle, UpdateGlobal, WeakEntity, Window, + actions, div, }; use language::{Buffer, Language}; use menu::Confirm; use project::{ + Project, ProjectPath, search::{SearchInputKind, SearchQuery}, search_history::SearchHistoryCursor, - Project, ProjectPath, }; use settings::Settings; use std::{ @@ -34,15 +34,15 @@ use std::{ }; use theme::ThemeSettings; use ui::{ - h_flex, prelude::*, utils::SearchInputWidth, v_flex, Icon, IconButton, IconButtonShape, - IconName, KeyBinding, Label, LabelCommon, LabelSize, Toggleable, Tooltip, + Icon, IconButton, IconButtonShape, IconName, KeyBinding, Label, LabelCommon, LabelSize, + Toggleable, Tooltip, h_flex, prelude::*, utils::SearchInputWidth, v_flex, }; use util::paths::PathMatcher; use workspace::{ - item::{BreadcrumbText, Item, ItemEvent, ItemHandle}, - searchable::{Direction, SearchableItem, SearchableItemHandle}, DeploySearch, ItemNavHistory, NewSearch, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, WorkspaceId, + item::{BreadcrumbText, Item, ItemEvent, ItemHandle}, + searchable::{Direction, SearchableItem, SearchableItemHandle}, }; actions!( @@ -943,11 +943,7 @@ impl ProjectSearchView { let editor = item.act_as::(cx)?; let query = editor.query_suggestion(window, cx); - if query.is_empty() { - None - } else { - Some(query) - } + if query.is_empty() { None } else { Some(query) } }); let search = if let Some(existing) = existing { @@ -2235,7 +2231,7 @@ pub mod tests { use std::{ops::Deref as _, sync::Arc}; use super::*; - use editor::{display_map::DisplayRow, DisplayPoint}; + use editor::{DisplayPoint, display_map::DisplayRow}; use gpui::{Action, TestAppContext, VisualTestContext, WindowHandle}; use project::FakeFs; use serde_json::json; @@ -3633,11 +3629,13 @@ pub mod tests { .unwrap() .unwrap(); assert_eq!(cx.update(|cx| second_pane.read(cx).items_len()), 1); - assert!(window - .update(cx, |_, window, cx| second_pane - .focus_handle(cx) - .contains_focused(window, cx)) - .unwrap()); + assert!( + window + .update(cx, |_, window, cx| second_pane + .focus_handle(cx) + .contains_focused(window, cx)) + .unwrap() + ); let search_bar = window.build_entity(cx, |_, _| ProjectSearchBar::new()); window .update(cx, { @@ -3726,11 +3724,12 @@ pub mod tests { window .update(cx, |_workspace, _, cx| { second_pane.update(cx, |pane, _cx| { - assert!(pane - .active_item() - .unwrap() - .downcast::() - .is_some()); + assert!( + pane.active_item() + .unwrap() + .downcast::() + .is_some() + ); assert_eq!(pane.items_len(), 2); }); diff --git a/crates/search/src/search.rs b/crates/search/src/search.rs index f1329270a8bcad0bb7840468cfb8aceb6747bf4d..593950d4e408e81eb2591374f9ebb19cc009db8f 100644 --- a/crates/search/src/search.rs +++ b/crates/search/src/search.rs @@ -1,11 +1,11 @@ use bitflags::bitflags; pub use buffer_search::BufferSearchBar; use editor::SearchSettings; -use gpui::{actions, Action, App, FocusHandle, IntoElement}; +use gpui::{Action, App, FocusHandle, IntoElement, actions}; use project::search::SearchQuery; pub use project_search::ProjectSearchView; -use ui::{prelude::*, Tooltip}; use ui::{ButtonStyle, IconButton, IconButtonShape}; +use ui::{Tooltip, prelude::*}; use workspace::notifications::NotificationId; use workspace::{Toast, Workspace}; diff --git a/crates/search/src/search_bar.rs b/crates/search/src/search_bar.rs index 84fc534c2f6c77e4e46f61bdcfe83d71803d72b3..805664c7942470e4acab1f3364902df0aa7619c5 100644 --- a/crates/search/src/search_bar.rs +++ b/crates/search/src/search_bar.rs @@ -1,6 +1,6 @@ use gpui::{Action, FocusHandle, IntoElement}; -use ui::{prelude::*, Tooltip}; use ui::{IconButton, IconButtonShape}; +use ui::{Tooltip, prelude::*}; pub(super) fn render_nav_button( icon: ui::IconName, diff --git a/crates/semantic_index/src/chunking.rs b/crates/semantic_index/src/chunking.rs index d7224d9a7eee016c4476c0ae56fe29a2edb71756..c1dfb6ccb5e71713f22183637d2ae14b16ac89f0 100644 --- a/crates/semantic_index/src/chunking.rs +++ b/crates/semantic_index/src/chunking.rs @@ -1,4 +1,4 @@ -use language::{with_parser, with_query_cursor, Language}; +use language::{Language, with_parser, with_query_cursor}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; use std::{ @@ -203,7 +203,7 @@ fn chunk_text_with_syntactic_ranges( #[cfg(test)] mod tests { use super::*; - use language::{tree_sitter_rust, Language, LanguageConfig, LanguageMatcher}; + use language::{Language, LanguageConfig, LanguageMatcher, tree_sitter_rust}; use unindent::Unindent as _; #[test] diff --git a/crates/semantic_index/src/embedding.rs b/crates/semantic_index/src/embedding.rs index 6246347b9e7ac246367bdd7ac0b74b4273904f5d..ef4443283ff0ee5c582560440c68d23080a4a22c 100644 --- a/crates/semantic_index/src/embedding.rs +++ b/crates/semantic_index/src/embedding.rs @@ -10,7 +10,7 @@ pub use open_ai::*; use sha2::{Digest, Sha256}; use anyhow::Result; -use futures::{future::BoxFuture, FutureExt}; +use futures::{FutureExt, future::BoxFuture}; use serde::{Deserialize, Serialize}; use std::{fmt, future}; diff --git a/crates/semantic_index/src/embedding/cloud.rs b/crates/semantic_index/src/embedding/cloud.rs index a5cc2407b09ffe4d09c5af569210d91e69c7a3b4..fdbfca58731b1b932263ded45b55a14332164897 100644 --- a/crates/semantic_index/src/embedding/cloud.rs +++ b/crates/semantic_index/src/embedding/cloud.rs @@ -1,8 +1,8 @@ use crate::{Embedding, EmbeddingProvider, TextToEmbed}; -use anyhow::{anyhow, Context as _, Result}; -use client::{proto, Client}; +use anyhow::{Context as _, Result, anyhow}; +use client::{Client, proto}; use collections::HashMap; -use futures::{future::BoxFuture, FutureExt}; +use futures::{FutureExt, future::BoxFuture}; use std::sync::Arc; pub struct CloudEmbeddingProvider { diff --git a/crates/semantic_index/src/embedding/lmstudio.rs b/crates/semantic_index/src/embedding/lmstudio.rs index 56f70ed4b1dcb02886ed8ccc87b743dbcbbb751a..73e52aa0bfde11307a81dcbee828b86349b6efc5 100644 --- a/crates/semantic_index/src/embedding/lmstudio.rs +++ b/crates/semantic_index/src/embedding/lmstudio.rs @@ -1,5 +1,5 @@ use anyhow::{Context as _, Result}; -use futures::{future::BoxFuture, AsyncReadExt as _, FutureExt}; +use futures::{AsyncReadExt as _, FutureExt, future::BoxFuture}; use http_client::HttpClient; use serde::{Deserialize, Serialize}; use std::sync::Arc; diff --git a/crates/semantic_index/src/embedding/ollama.rs b/crates/semantic_index/src/embedding/ollama.rs index 6d3fa679021ee38f2795712c5a0af6c840223cf5..5737609e24d0cb1adca3a155c09c6045e591c152 100644 --- a/crates/semantic_index/src/embedding/ollama.rs +++ b/crates/semantic_index/src/embedding/ollama.rs @@ -1,5 +1,5 @@ use anyhow::{Context as _, Result}; -use futures::{future::BoxFuture, AsyncReadExt as _, FutureExt}; +use futures::{AsyncReadExt as _, FutureExt, future::BoxFuture}; use http_client::HttpClient; use serde::{Deserialize, Serialize}; use std::sync::Arc; diff --git a/crates/semantic_index/src/embedding/open_ai.rs b/crates/semantic_index/src/embedding/open_ai.rs index d07e7d6b534aba0ed18fc7cd46ee67b5b99c933b..da2b3bd2e4d873a84c380006575d304d356e878a 100644 --- a/crates/semantic_index/src/embedding/open_ai.rs +++ b/crates/semantic_index/src/embedding/open_ai.rs @@ -1,6 +1,6 @@ use crate::{Embedding, EmbeddingProvider, TextToEmbed}; use anyhow::Result; -use futures::{future::BoxFuture, FutureExt}; +use futures::{FutureExt, future::BoxFuture}; use http_client::HttpClient; pub use open_ai::OpenAiEmbeddingModel; use std::sync::Arc; diff --git a/crates/semantic_index/src/embedding_index.rs b/crates/semantic_index/src/embedding_index.rs index 134b409551015a1e6dfa6f46a6caf90eb90a89d1..022034bda6c33e619f5804588cc704842a8e5e37 100644 --- a/crates/semantic_index/src/embedding_index.rs +++ b/crates/semantic_index/src/embedding_index.rs @@ -3,12 +3,12 @@ use crate::{ embedding::{Embedding, EmbeddingProvider, TextToEmbed}, indexing::{IndexingEntryHandle, IndexingEntrySet}, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::Bound; use feature_flags::FeatureFlagAppExt; use fs::Fs; use fs::MTime; -use futures::{stream::StreamExt, FutureExt as _}; +use futures::{FutureExt as _, stream::StreamExt}; use futures_batch::ChunksTimeoutStreamExt; use gpui::{App, AppContext as _, Entity, Task}; use heed::types::{SerdeBincode, Str}; diff --git a/crates/semantic_index/src/project_index.rs b/crates/semantic_index/src/project_index.rs index e739d9b5b9645a29f6ca9d0d94f6798e553979f7..8558a1470e40717d2aaad1de96cf748db148e7b0 100644 --- a/crates/semantic_index/src/project_index.rs +++ b/crates/semantic_index/src/project_index.rs @@ -3,7 +3,7 @@ use crate::{ summary_index::FileSummary, worktree_index::{WorktreeIndex, WorktreeIndexHandle}, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use collections::HashMap; use fs::Fs; use futures::FutureExt; diff --git a/crates/semantic_index/src/project_index_debug_view.rs b/crates/semantic_index/src/project_index_debug_view.rs index 44a194ae454c552c69b1f77bd15ccde78e249fc9..140599d22a4b91eee8db456a0e9f57c16c5a6f1c 100644 --- a/crates/semantic_index/src/project_index_debug_view.rs +++ b/crates/semantic_index/src/project_index_debug_view.rs @@ -1,8 +1,8 @@ use crate::ProjectIndex; use gpui::{ - canvas, div, list, uniform_list, AnyElement, App, CursorStyle, Entity, EventEmitter, - FocusHandle, Focusable, IntoElement, ListOffset, ListState, MouseMoveEvent, Render, - UniformListScrollHandle, + AnyElement, App, CursorStyle, Entity, EventEmitter, FocusHandle, Focusable, IntoElement, + ListOffset, ListState, MouseMoveEvent, Render, UniformListScrollHandle, canvas, div, list, + uniform_list, }; use project::WorktreeId; use settings::Settings; diff --git a/crates/semantic_index/src/semantic_index.rs b/crates/semantic_index/src/semantic_index.rs index 0ae076b40f21e7487f0a01cb20d224bdca117ac4..b2e565692da432796891d18e13f9acaeb210264c 100644 --- a/crates/semantic_index/src/semantic_index.rs +++ b/crates/semantic_index/src/semantic_index.rs @@ -269,7 +269,7 @@ mod tests { use embedding_index::{ChunkedFile, EmbeddingIndex}; use feature_flags::FeatureFlagAppExt; use fs::FakeFs; - use futures::{future::BoxFuture, FutureExt}; + use futures::{FutureExt, future::BoxFuture}; use gpui::TestAppContext; use indexing::IndexingEntrySet; use language::language_settings::AllLanguageSettings; diff --git a/crates/semantic_index/src/summary_index.rs b/crates/semantic_index/src/summary_index.rs index 4d954a298953c0fe011dd3a8d88188d628687747..397b5f07d52cf262802e6d36d3fd8b844545c506 100644 --- a/crates/semantic_index/src/summary_index.rs +++ b/crates/semantic_index/src/summary_index.rs @@ -1,12 +1,12 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use arrayvec::ArrayString; use fs::{Fs, MTime}; -use futures::{stream::StreamExt, TryFutureExt}; +use futures::{TryFutureExt, stream::StreamExt}; use futures_batch::ChunksTimeoutStreamExt; use gpui::{App, AppContext as _, Entity, Task}; use heed::{ - types::{SerdeBincode, Str}, RoTxn, + types::{SerdeBincode, Str}, }; use language_model::{ LanguageModelCompletionEvent, LanguageModelId, LanguageModelRegistry, LanguageModelRequest, diff --git a/crates/semantic_version/src/semantic_version.rs b/crates/semantic_version/src/semantic_version.rs index 243ac91e13a30695304f69aca92d2b3662458c0f..c7519d4c7d49928161bd962fef3b7ed70b1bae37 100644 --- a/crates/semantic_version/src/semantic_version.rs +++ b/crates/semantic_version/src/semantic_version.rs @@ -7,8 +7,8 @@ use std::{ str::FromStr, }; -use anyhow::{anyhow, Result}; -use serde::{de::Error, Deserialize, Serialize}; +use anyhow::{Result, anyhow}; +use serde::{Deserialize, Serialize, de::Error}; /// A [semantic version](https://semver.org/) number. #[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)] diff --git a/crates/session/src/session.rs b/crates/session/src/session.rs index a37a2ebcbb9c08e3bba5c9cea2f9f0755d5499f6..5705d23d3ea0fff554c3503458e55077a6cb8705 100644 --- a/crates/session/src/session.rs +++ b/crates/session/src/session.rs @@ -67,14 +67,16 @@ impl AppSession { pub fn new(session: Session, cx: &Context) -> Self { let _subscriptions = vec![cx.on_app_quit(Self::app_will_quit)]; - let _serialization_task = Some(cx.spawn(async move |_, cx| loop { - if let Some(windows) = cx.update(|cx| cx.window_stack()).ok().flatten() { - store_window_stack(windows).await; + let _serialization_task = Some(cx.spawn(async move |_, cx| { + loop { + if let Some(windows) = cx.update(|cx| cx.window_stack()).ok().flatten() { + store_window_stack(windows).await; + } + + cx.background_executor() + .timer(Duration::from_millis(100)) + .await; } - - cx.background_executor() - .timer(Duration::from_millis(100)) - .await; })); Self { diff --git a/crates/settings/src/editable_setting_control.rs b/crates/settings/src/editable_setting_control.rs index 2893d209d4285893939837266db55ce1cff8a950..0a5b3e9be0f93e9e2c0a20386d68b644af883be9 100644 --- a/crates/settings/src/editable_setting_control.rs +++ b/crates/settings/src/editable_setting_control.rs @@ -1,7 +1,7 @@ use fs::Fs; use gpui::{App, RenderOnce, SharedString}; -use crate::{update_settings_file, Settings}; +use crate::{Settings, update_settings_file}; /// A UI control that can be used to edit a setting. pub trait EditableSettingControl: RenderOnce { diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index c355ba0ba8fccf7c2c86d42c46253a33be49ce1e..937da91dfb2b6cba6366e1fdefd2e1873331abc1 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -1,21 +1,21 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::{BTreeMap, HashMap, IndexMap}; use fs::Fs; use gpui::{ - Action, ActionBuildError, App, InvalidKeystrokeError, KeyBinding, KeyBindingContextPredicate, - NoAction, SharedString, KEYSTROKE_PARSE_EXPECTED_MESSAGE, + Action, ActionBuildError, App, InvalidKeystrokeError, KEYSTROKE_PARSE_EXPECTED_MESSAGE, + KeyBinding, KeyBindingContextPredicate, NoAction, SharedString, }; use schemars::{ + JsonSchema, r#gen::{SchemaGenerator, SchemaSettings}, schema::{ArrayValidation, InstanceType, Schema, SchemaObject, SubschemaValidation}, - JsonSchema, }; use serde::Deserialize; use serde_json::Value; use std::{any::TypeId, fmt::Write, rc::Rc, sync::Arc, sync::LazyLock}; use util::{asset_str, markdown::MarkdownString}; -use crate::{settings_store::parse_json_with_comments, SettingsAssets}; +use crate::{SettingsAssets, settings_store::parse_json_with_comments}; pub trait KeyBindingValidator: Send + Sync { fn action_type_id(&self) -> TypeId; diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index ea6aba84f64b4cc6b2709c27fb6b4c90bdc4471d..5f695cb62bcd290bf0d7530e6d01d44f0dba77e7 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -18,8 +18,8 @@ pub use keymap_file::{ }; pub use settings_file::*; pub use settings_store::{ - parse_json_with_comments, InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation, - SettingsSources, SettingsStore, TaskKind, + InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation, SettingsSources, + SettingsStore, TaskKind, parse_json_with_comments, }; #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash, PartialOrd, Ord)] diff --git a/crates/settings/src/settings_file.rs b/crates/settings/src/settings_file.rs index 4580fa71a69fd3e3878c3b6eee1555e453a0cbbe..0fcdcde8ad886e6a6969d3c23e958a67396cb399 100644 --- a/crates/settings/src/settings_file.rs +++ b/crates/settings/src/settings_file.rs @@ -1,7 +1,7 @@ -use crate::{settings_store::SettingsStore, Settings}; +use crate::{Settings, settings_store::SettingsStore}; use collections::HashSet; use fs::{Fs, PathEventKind}; -use futures::{channel::mpsc, StreamExt}; +use futures::{StreamExt, channel::mpsc}; use gpui::{App, BackgroundExecutor, ReadGlobal}; use std::{path::PathBuf, sync::Arc, time::Duration}; diff --git a/crates/settings/src/settings_store.rs b/crates/settings/src/settings_store.rs index 8f0e4f071dc3c7cad3688923d8ef8178a8675b4f..de696c69d0d3c80610e27a94627ff51695e6fb6a 100644 --- a/crates/settings/src/settings_store.rs +++ b/crates/settings/src/settings_store.rs @@ -1,18 +1,18 @@ -use anyhow::{anyhow, Context as _, Result}; -use collections::{btree_map, hash_map, BTreeMap, HashMap}; +use anyhow::{Context as _, Result, anyhow}; +use collections::{BTreeMap, HashMap, btree_map, hash_map}; use ec4rs::{ConfigParser, PropertiesSource, Section}; use fs::Fs; -use futures::{channel::mpsc, future::LocalBoxFuture, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt, channel::mpsc, future::LocalBoxFuture}; use gpui::{App, AsyncApp, BorrowAppContext, Global, Task, UpdateGlobal}; use paths::{ - debug_task_file_name, local_settings_file_relative_path, task_file_name, EDITORCONFIG_NAME, + EDITORCONFIG_NAME, debug_task_file_name, local_settings_file_relative_path, task_file_name, }; -use schemars::{r#gen::SchemaGenerator, schema::RootSchema, JsonSchema}; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; +use schemars::{JsonSchema, r#gen::SchemaGenerator, schema::RootSchema}; +use serde::{Deserialize, Serialize, de::DeserializeOwned}; use smallvec::SmallVec; use std::{ - any::{type_name, Any, TypeId}, + any::{Any, TypeId, type_name}, fmt::Debug, ops::Range, path::{Path, PathBuf}, @@ -23,7 +23,7 @@ use streaming_iterator::StreamingIterator; use tree_sitter::Query; use util::RangeExt; -use util::{merge_non_null_json_value_into, ResultExt as _}; +use util::{ResultExt as _, merge_non_null_json_value_into}; pub type EditorconfigProperties = ec4rs::Properties; diff --git a/crates/settings_ui/src/appearance_settings_controls.rs b/crates/settings_ui/src/appearance_settings_controls.rs index d1cae1d8a77e9cb220574a9fac8b7b6422d84258..fa7e31c5cdb56719f49fc3f190f53081f0c7221f 100644 --- a/crates/settings_ui/src/appearance_settings_controls.rs +++ b/crates/settings_ui/src/appearance_settings_controls.rs @@ -4,8 +4,8 @@ use gpui::{App, FontFeatures, FontWeight}; use settings::{EditableSettingControl, Settings}; use theme::{FontFamilyCache, SystemAppearance, ThemeMode, ThemeRegistry, ThemeSettings}; use ui::{ - prelude::*, CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, - SettingsGroup, ToggleButton, + CheckboxWithLabel, ContextMenu, DropdownMenu, NumericStepper, SettingsContainer, SettingsGroup, + ToggleButton, prelude::*, }; #[derive(IntoElement)] diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index 8f044fb4b2dba666a2bd16235f9cce97fb6ec941..430997b6d35211e7e77cb2eca67a2388b3a63ca4 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -5,10 +5,10 @@ use std::any::TypeId; use command_palette_hooks::CommandPaletteFilter; use editor::EditorSettingsControls; use feature_flags::{FeatureFlag, FeatureFlagViewExt}; -use gpui::{actions, App, Entity, EventEmitter, FocusHandle, Focusable}; +use gpui::{App, Entity, EventEmitter, FocusHandle, Focusable, actions}; use ui::prelude::*; -use workspace::item::{Item, ItemEvent}; use workspace::Workspace; +use workspace::item::{Item, ItemEvent}; use crate::appearance_settings_controls::AppearanceSettingsControls; diff --git a/crates/snippet/src/snippet.rs b/crates/snippet/src/snippet.rs index 4fadd9b2dda14a6545763d0114a8145bf1de947d..3c6681def199457c232377a0cee528d14d1fe574 100644 --- a/crates/snippet/src/snippet.rs +++ b/crates/snippet/src/snippet.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use smallvec::SmallVec; use std::{collections::BTreeMap, ops::Range}; diff --git a/crates/snippet_provider/src/format.rs b/crates/snippet_provider/src/format.rs index 04f13f5634955aa239454446addb231360d614fb..69afe1f62a6cc296ff4d1b056b57b66f04aa5f4b 100644 --- a/crates/snippet_provider/src/format.rs +++ b/crates/snippet_provider/src/format.rs @@ -1,8 +1,8 @@ use collections::HashMap; use schemars::{ + JsonSchema, r#gen::SchemaSettings, schema::{ObjectValidation, Schema, SchemaObject}, - JsonSchema, }; use serde::Deserialize; use serde_json_lenient::Value; diff --git a/crates/snippet_provider/src/registry.rs b/crates/snippet_provider/src/registry.rs index b4b3e3282afffae05030672f1a3e57cd36a88017..7c4948a48ded93ab56fbccd0718663ebc816ba65 100644 --- a/crates/snippet_provider/src/registry.rs +++ b/crates/snippet_provider/src/registry.rs @@ -5,7 +5,7 @@ use collections::HashMap; use gpui::{App, Global, ReadGlobal, UpdateGlobal}; use parking_lot::RwLock; -use crate::{file_stem_to_key, Snippet, SnippetKind}; +use crate::{Snippet, SnippetKind, file_stem_to_key}; struct GlobalSnippetRegistry(Arc); diff --git a/crates/snippets_ui/src/snippets_ui.rs b/crates/snippets_ui/src/snippets_ui.rs index 92261c5a8b3434032418f1947dcf2dca56f8c2b1..eb2c0b2030bce20bbb229be0f2a1b37b025b8535 100644 --- a/crates/snippets_ui/src/snippets_ui.rs +++ b/crates/snippets_ui/src/snippets_ui.rs @@ -1,15 +1,15 @@ -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, Focusable, ParentElement, Render, - Styled, WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, Focusable, ParentElement, Render, Styled, + WeakEntity, Window, actions, }; use language::LanguageRegistry; use paths::config_dir; use picker::{Picker, PickerDelegate}; use std::{borrow::Borrow, fs, sync::Arc}; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; -use workspace::{notifications::NotifyResultExt, ModalView, OpenOptions, OpenVisible, Workspace}; +use workspace::{ModalView, OpenOptions, OpenVisible, Workspace, notifications::NotifyResultExt}; actions!(snippets, [ConfigureSnippets, OpenFolder]); diff --git a/crates/sqlez/src/connection.rs b/crates/sqlez/src/connection.rs index fdd8ec9ad49249f77bd746bd9f7bdaeae7418621..a79f487ed965fae8fdde722f0befe66634de6a68 100644 --- a/crates/sqlez/src/connection.rs +++ b/crates/sqlez/src/connection.rs @@ -6,7 +6,7 @@ use std::{ ptr, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use libsqlite3_sys::*; pub struct Connection { @@ -429,12 +429,16 @@ mod test { fn test_alter_table_syntax() { let connection = Connection::open_memory(Some("test_alter_table_syntax")); - assert!(connection - .sql_has_syntax_error("ALTER TABLE test ADD x TEXT") - .is_none()); + assert!( + connection + .sql_has_syntax_error("ALTER TABLE test ADD x TEXT") + .is_none() + ); - assert!(connection - .sql_has_syntax_error("ALTER TABLE test AAD x TEXT") - .is_some()); + assert!( + connection + .sql_has_syntax_error("ALTER TABLE test AAD x TEXT") + .is_some() + ); } } diff --git a/crates/sqlez/src/migrations.rs b/crates/sqlez/src/migrations.rs index 8cc79d9efbd5e3d8248f90314e1e25db4a9da2ba..9d0721b7b435fae73311898f6d9e2c9b6f827f9f 100644 --- a/crates/sqlez/src/migrations.rs +++ b/crates/sqlez/src/migrations.rs @@ -6,7 +6,7 @@ use std::ffi::CString; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use indoc::{formatdoc, indoc}; use libsqlite3_sys::sqlite3_exec; diff --git a/crates/sqlez/src/savepoint.rs b/crates/sqlez/src/savepoint.rs index 09c2e941482f829cd6c5c83cd14aad0f091d6562..94e2a20fb9a3c22fa4d177edc138971fc11c8f2a 100644 --- a/crates/sqlez/src/savepoint.rs +++ b/crates/sqlez/src/savepoint.rs @@ -76,23 +76,25 @@ mod tests { connection.with_savepoint("first", || { connection.exec_bound("INSERT INTO text(text, idx) VALUES (?, ?)")?((save1_text, 1))?; - assert!(connection - .with_savepoint("second", || -> Result, anyhow::Error> { - connection.exec_bound("INSERT INTO text(text, idx) VALUES (?, ?)")?(( - save2_text, 2, - ))?; - - assert_eq!( - connection - .select::("SELECT text FROM text ORDER BY text.idx ASC")?( - )?, - vec![save1_text, save2_text], - ); - - anyhow::bail!("Failed second save point :(") - }) - .err() - .is_some()); + assert!( + connection + .with_savepoint("second", || -> Result, anyhow::Error> { + connection.exec_bound("INSERT INTO text(text, idx) VALUES (?, ?)")?(( + save2_text, 2, + ))?; + + assert_eq!( + connection + .select::("SELECT text FROM text ORDER BY text.idx ASC")?( + )?, + vec![save1_text, save2_text], + ); + + anyhow::bail!("Failed second save point :(") + }) + .err() + .is_some() + ); assert_eq!( connection.select::("SELECT text FROM text ORDER BY text.idx ASC")?()?, diff --git a/crates/sqlez/src/statement.rs b/crates/sqlez/src/statement.rs index 35f00050edcd36703f565cdaba1470e67213d3c9..772d679bcf7ba3787936f1c9d79f396d0737c223 100644 --- a/crates/sqlez/src/statement.rs +++ b/crates/sqlez/src/statement.rs @@ -1,8 +1,8 @@ -use std::ffi::{c_int, CStr, CString}; +use std::ffi::{CStr, CString, c_int}; use std::marker::PhantomData; use std::{ptr, slice, str}; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use libsqlite3_sys::*; use crate::bindable::{Bind, Column}; @@ -477,11 +477,13 @@ mod test { .unwrap()() .unwrap(); - assert!(connection - .select_row::("SELECT text FROM texts") - .unwrap()() - .unwrap() - .is_none()); + assert!( + connection + .select_row::("SELECT text FROM texts") + .unwrap()() + .unwrap() + .is_none() + ); let text_to_insert = "This is a test"; diff --git a/crates/sqlez/src/thread_safe_connection.rs b/crates/sqlez/src/thread_safe_connection.rs index 1b9bcc1118e412127a84c376db06627fb730fd25..91cf63443cb5e7b1f068ee2d108cd8c5db02b40f 100644 --- a/crates/sqlez/src/thread_safe_connection.rs +++ b/crates/sqlez/src/thread_safe_connection.rs @@ -1,6 +1,6 @@ use anyhow::Context as _; use collections::HashMap; -use futures::{channel::oneshot, Future, FutureExt}; +use futures::{Future, FutureExt, channel::oneshot}; use parking_lot::{Mutex, RwLock}; use std::{ marker::PhantomData, diff --git a/crates/story/src/story.rs b/crates/story/src/story.rs index d603dbbfd888cb35721ba028ef77de063587f8c4..fddc8258f853e15023a8d768bb570ed2812ce4ee 100644 --- a/crates/story/src/story.rs +++ b/crates/story/src/story.rs @@ -1,6 +1,6 @@ use gpui::{ - div, prelude::*, px, rems, AnyElement, App, DefaultColor, DefaultColors, Div, SharedString, - Window, + AnyElement, App, DefaultColor, DefaultColors, Div, SharedString, Window, div, prelude::*, px, + rems, }; use itertools::Itertools; use smallvec::SmallVec; diff --git a/crates/storybook/src/assets.rs b/crates/storybook/src/assets.rs index f45d1457df91fc5e1b70abe51e7982d678cd9ca1..4049de4934e15afc6b3a247d123d00d52863e039 100644 --- a/crates/storybook/src/assets.rs +++ b/crates/storybook/src/assets.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use gpui::{AssetSource, SharedString}; use rust_embed::RustEmbed; diff --git a/crates/storybook/src/stories/auto_height_editor.rs b/crates/storybook/src/stories/auto_height_editor.rs index b3b09c37e6e4cd9e0ba65fb27dc83e864073c2ca..9abee60238a3934e5ba8cd6e04dc48d8bc299089 100644 --- a/crates/storybook/src/stories/auto_height_editor.rs +++ b/crates/storybook/src/stories/auto_height_editor.rs @@ -1,7 +1,7 @@ use editor::Editor; use gpui::{ - div, white, App, AppContext as _, Context, Entity, IntoElement, KeyBinding, ParentElement, - Render, Styled, Window, + App, AppContext as _, Context, Entity, IntoElement, KeyBinding, ParentElement, Render, Styled, + Window, div, white, }; pub struct AutoHeightEditorStory { diff --git a/crates/storybook/src/stories/default_colors.rs b/crates/storybook/src/stories/default_colors.rs index 78ece11314719a440f959b07bf566250f43e7ca5..4985b5b732c9da86f71efbe146194dda206db620 100644 --- a/crates/storybook/src/stories/default_colors.rs +++ b/crates/storybook/src/stories/default_colors.rs @@ -1,10 +1,10 @@ use gpui::{ - colors, div, prelude::*, App, Context, DefaultColor, DefaultThemeAppearance, Entity, Hsla, - Render, Window, + App, Context, DefaultColor, DefaultThemeAppearance, Entity, Hsla, Render, Window, colors, div, + prelude::*, }; use story::Story; use strum::IntoEnumIterator; -use ui::{h_flex, ActiveTheme}; +use ui::{ActiveTheme, h_flex}; pub struct DefaultColorsStory; diff --git a/crates/storybook/src/stories/focus.rs b/crates/storybook/src/stories/focus.rs index 68e5d0c5f41a6872c4f9fb0edeb95a74a82e38eb..a64c272ba75a902f3debe3dedfe7b95c969e0d45 100644 --- a/crates/storybook/src/stories/focus.rs +++ b/crates/storybook/src/stories/focus.rs @@ -1,5 +1,5 @@ use gpui::{ - actions, div, prelude::*, App, Entity, FocusHandle, KeyBinding, Render, Subscription, Window, + App, Entity, FocusHandle, KeyBinding, Render, Subscription, Window, actions, div, prelude::*, }; use ui::prelude::*; diff --git a/crates/storybook/src/stories/kitchen_sink.rs b/crates/storybook/src/stories/kitchen_sink.rs index d2e021d02f9eb359bd5caa858bb2532302d83d62..0ad6c33eabe8a68fa20ac73e17e2c1dfdf75b801 100644 --- a/crates/storybook/src/stories/kitchen_sink.rs +++ b/crates/storybook/src/stories/kitchen_sink.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Entity, Render}; +use gpui::{Entity, Render, prelude::*}; use story::Story; use strum::IntoEnumIterator; use ui::prelude::*; diff --git a/crates/storybook/src/stories/picker.rs b/crates/storybook/src/stories/picker.rs index a946bfed7c673cbf2f8576b5fe827825cfff5f9d..723829d168ef6aa68b9359f579f981a6caec06c1 100644 --- a/crates/storybook/src/stories/picker.rs +++ b/crates/storybook/src/stories/picker.rs @@ -1,9 +1,9 @@ use fuzzy::StringMatchCandidate; -use gpui::{div, prelude::*, App, Entity, KeyBinding, Render, SharedString, Styled, Task, Window}; +use gpui::{App, Entity, KeyBinding, Render, SharedString, Styled, Task, Window, div, prelude::*}; use picker::{Picker, PickerDelegate}; use std::sync::Arc; -use ui::{prelude::*, ListItemSpacing}; use ui::{Label, ListItem}; +use ui::{ListItemSpacing, prelude::*}; pub struct PickerStory { picker: Entity>, diff --git a/crates/storybook/src/stories/scroll.rs b/crates/storybook/src/stories/scroll.rs index 764724c33531bcff9466fac2e844b1fbab7f3473..8a4c7ea7689042675764bc55faf019a8cc8fc2a9 100644 --- a/crates/storybook/src/stories/scroll.rs +++ b/crates/storybook/src/stories/scroll.rs @@ -1,6 +1,6 @@ -use gpui::{div, prelude::*, px, App, Entity, Render, SharedString, Styled, Window}; -use ui::prelude::*; +use gpui::{App, Entity, Render, SharedString, Styled, Window, div, prelude::*, px}; use ui::Tooltip; +use ui::prelude::*; pub struct ScrollStory; diff --git a/crates/storybook/src/stories/text.rs b/crates/storybook/src/stories/text.rs index 0743a8b6c3d33df765e59d5df23fb48a044efc81..a4b8fc486dbf735b9773de902f0ae4d4e1a3f79f 100644 --- a/crates/storybook/src/stories/text.rs +++ b/crates/storybook/src/stories/text.rs @@ -1,6 +1,6 @@ use gpui::{ - div, green, red, App, AppContext as _, Context, Entity, HighlightStyle, InteractiveText, - IntoElement, ParentElement, Render, Styled, StyledText, Window, + App, AppContext as _, Context, Entity, HighlightStyle, InteractiveText, IntoElement, + ParentElement, Render, Styled, StyledText, Window, div, green, red, }; use indoc::indoc; use story::*; diff --git a/crates/storybook/src/story_selector.rs b/crates/storybook/src/story_selector.rs index a4814404135389344c3af91ff3ea37890d13e9ec..492b06c6acc19b9b05e217930216f5c3d5bf2f9b 100644 --- a/crates/storybook/src/story_selector.rs +++ b/crates/storybook/src/story_selector.rs @@ -3,8 +3,8 @@ use std::sync::OnceLock; use crate::stories::*; use anyhow::anyhow; -use clap::builder::PossibleValue; use clap::ValueEnum; +use clap::builder::PossibleValue; use gpui::AnyView; use strum::{EnumIter, EnumString, IntoEnumIterator}; use ui::prelude::*; diff --git a/crates/storybook/src/storybook.rs b/crates/storybook/src/storybook.rs index 2129b04143e925ee6cf1d588aed1a699af8a915e..c2ae4ef04df7b799ca8e8e5c53e95efb54f1f609 100644 --- a/crates/storybook/src/storybook.rs +++ b/crates/storybook/src/storybook.rs @@ -9,7 +9,7 @@ use std::sync::Arc; use clap::Parser; use dialoguer::FuzzySelect; use gpui::{ - div, px, size, AnyView, App, Bounds, Context, Render, Window, WindowBounds, WindowOptions, + AnyView, App, Bounds, Context, Render, Window, WindowBounds, WindowOptions, div, px, size, }; use log::LevelFilter; use project::Project; diff --git a/crates/sum_tree/src/sum_tree.rs b/crates/sum_tree/src/sum_tree.rs index 14b4614e754ecc5e9e5ebb59ed055fbc65ab09cf..5b53bf7cbf71a841092e2cbaf14e8fb21f83c0b0 100644 --- a/crates/sum_tree/src/sum_tree.rs +++ b/crates/sum_tree/src/sum_tree.rs @@ -134,7 +134,7 @@ where D3: Dimension<'a, S>, { fn cmp(&self, cursor_location: &((D1, D2), D3), cx: &S::Context) -> Ordering { - self.cmp(&cursor_location.0 .0, cx) + self.cmp(&cursor_location.0.0, cx) } } @@ -1418,11 +1418,7 @@ mod tests { let mut ix = 0; let iterator = std::iter::from_fn(|| { ix = (ix + 1) % 2; - if ix == 1 { - Some(1) - } else { - None - } + if ix == 1 { Some(1) } else { None } }); assert_eq!(SumTree::from_iter(iterator, &()).items(&()), vec![1]); } diff --git a/crates/supermaven/src/supermaven.rs b/crates/supermaven/src/supermaven.rs index 9c7e0b1c78b1ca3e0f68dd98d21b5671fb78c7d9..410cc94c88424703d230aab549b4fd5e691714eb 100644 --- a/crates/supermaven/src/supermaven.rs +++ b/crates/supermaven/src/supermaven.rs @@ -5,13 +5,13 @@ pub use supermaven_completion_provider::*; use anyhow::{Context as _, Result}; #[allow(unused_imports)] -use client::{proto, Client}; +use client::{Client, proto}; use collections::BTreeMap; -use futures::{channel::mpsc, io::BufReader, AsyncBufReadExt, StreamExt}; -use gpui::{actions, App, AsyncApp, Context, Entity, EntityId, Global, Task, WeakEntity}; +use futures::{AsyncBufReadExt, StreamExt, channel::mpsc, io::BufReader}; +use gpui::{App, AsyncApp, Context, Entity, EntityId, Global, Task, WeakEntity, actions}; use language::{ - language_settings::all_language_settings, Anchor, Buffer, BufferSnapshot, ToOffset, + Anchor, Buffer, BufferSnapshot, ToOffset, language_settings::all_language_settings, }; use messages::*; use postage::watch; diff --git a/crates/supermaven_api/src/supermaven_api.rs b/crates/supermaven_api/src/supermaven_api.rs index 6d3bb44984334b62af00969c8b7f5ec6d49fd2b8..3dede695dd4346320c5492229785e6b618890cee 100644 --- a/crates/supermaven_api/src/supermaven_api.rs +++ b/crates/supermaven_api/src/supermaven_api.rs @@ -1,6 +1,6 @@ -use anyhow::{anyhow, Context as _, Result}; -use futures::io::BufReader; +use anyhow::{Context as _, Result, anyhow}; use futures::AsyncReadExt; +use futures::io::BufReader; use http_client::{AsyncBody, HttpClient, Request as HttpRequest}; use paths::supermaven_dir; use serde::{Deserialize, Serialize}; diff --git a/crates/tab_switcher/src/tab_switcher.rs b/crates/tab_switcher/src/tab_switcher.rs index 983e29ec4fb11001352c3e13df498e101b6c7ef4..2f3b4a65ae0a80d7a5822b18958f928120d3b4cd 100644 --- a/crates/tab_switcher/src/tab_switcher.rs +++ b/crates/tab_switcher/src/tab_switcher.rs @@ -4,9 +4,9 @@ mod tab_switcher_tests; use collections::HashMap; use editor::items::entry_git_aware_label_color; use gpui::{ - actions, impl_actions, rems, Action, AnyElement, App, Context, DismissEvent, Entity, EntityId, - EventEmitter, FocusHandle, Focusable, Modifiers, ModifiersChangedEvent, MouseButton, - MouseUpEvent, ParentElement, Render, Styled, Task, WeakEntity, Window, + Action, AnyElement, App, Context, DismissEvent, Entity, EntityId, EventEmitter, FocusHandle, + Focusable, Modifiers, ModifiersChangedEvent, MouseButton, MouseUpEvent, ParentElement, Render, + Styled, Task, WeakEntity, Window, actions, impl_actions, rems, }; use picker::{Picker, PickerDelegate}; use project::Project; @@ -14,12 +14,12 @@ use schemars::JsonSchema; use serde::Deserialize; use settings::Settings; use std::sync::Arc; -use ui::{prelude::*, ListItem, ListItemSpacing, Tooltip}; +use ui::{ListItem, ListItemSpacing, Tooltip, prelude::*}; use util::ResultExt; use workspace::{ - item::{ItemHandle, ItemSettings, TabContentParams}, - pane::{render_item_indicator, tab_details, Event as PaneEvent}, ModalView, Pane, SaveIntent, Workspace, + item::{ItemHandle, ItemSettings, TabContentParams}, + pane::{Event as PaneEvent, render_item_indicator, tab_details}, }; const PANEL_WIDTH_REMS: f32 = 28.; diff --git a/crates/task/src/debug_format.rs b/crates/task/src/debug_format.rs index 5eb8e535a8cf6b8dd88af23cef8b63e815be3ffe..ccbd67bfa676f9ccb976601ca5fd9ed98f7a60da 100644 --- a/crates/task/src/debug_format.rs +++ b/crates/task/src/debug_format.rs @@ -1,11 +1,11 @@ use dap_types::StartDebuggingRequestArguments; -use schemars::{r#gen::SchemaSettings, JsonSchema}; +use schemars::{JsonSchema, r#gen::SchemaSettings}; use serde::{Deserialize, Serialize}; use std::net::Ipv4Addr; use std::path::PathBuf; use util::ResultExt; -use crate::{task_template::DebugArgs, TaskTemplate, TaskTemplates, TaskType}; +use crate::{TaskTemplate, TaskTemplates, TaskType, task_template::DebugArgs}; impl Default for DebugConnectionType { fn default() -> Self { diff --git a/crates/task/src/lib.rs b/crates/task/src/lib.rs index bb96f32af980a003d30355651a802d8ccd455a29..3258728f4ba57222664638baa822382d3bee384c 100644 --- a/crates/task/src/lib.rs +++ b/crates/task/src/lib.rs @@ -6,7 +6,7 @@ pub mod static_source; mod task_template; mod vscode_format; -use collections::{hash_map, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map}; use gpui::SharedString; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/crates/task/src/static_source.rs b/crates/task/src/static_source.rs index f53c35e25a1b2bd7d3ffbdbb0f34a0bf0f82f6c8..0e7a021b0685f0bf1003e0cfb99cc8d6763cfc84 100644 --- a/crates/task/src/static_source.rs +++ b/crates/task/src/static_source.rs @@ -2,7 +2,7 @@ use std::sync::Arc; -use futures::{channel::mpsc::UnboundedSender, StreamExt}; +use futures::{StreamExt, channel::mpsc::UnboundedSender}; use gpui::{App, AppContext}; use parking_lot::RwLock; use serde::Deserialize; diff --git a/crates/task/src/task_template.rs b/crates/task/src/task_template.rs index def5fb1a0904fc0b15fe94f4817f1a69643c87a0..c78ec9388506de7d805f439b055aa41ec8d1894d 100644 --- a/crates/task/src/task_template.rs +++ b/crates/task/src/task_template.rs @@ -1,12 +1,12 @@ use std::path::PathBuf; use util::serde::default_true; -use anyhow::{bail, Context}; +use anyhow::{Context, bail}; use collections::{HashMap, HashSet}; -use schemars::{r#gen::SchemaSettings, JsonSchema}; +use schemars::{JsonSchema, r#gen::SchemaSettings}; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; -use util::{truncate_and_remove_front, ResultExt}; +use util::{ResultExt, truncate_and_remove_front}; use crate::{ AttachConfig, ResolvedTask, RevealTarget, Shell, SpawnInTerminal, TCPHost, TaskContext, TaskId, @@ -722,9 +722,10 @@ mod tests { args: vec!["$ZED_VARIABLE".into()], ..TaskTemplate::default() }; - assert!(task - .resolve_task(TEST_ID_BASE, &TaskContext::default()) - .is_none()); + assert!( + task.resolve_task(TEST_ID_BASE, &TaskContext::default()) + .is_none() + ); } #[test] diff --git a/crates/task/src/vscode_format.rs b/crates/task/src/vscode_format.rs index c150ee807fb2588899c29b407dd995cbdb501b52..3e82d6abba8c4437f47b97b3046d8e04560ed7ea 100644 --- a/crates/task/src/vscode_format.rs +++ b/crates/task/src/vscode_format.rs @@ -154,8 +154,8 @@ mod tests { use std::collections::HashMap; use crate::{ - vscode_format::{Command, VsCodeTaskDefinition}, TaskTemplate, TaskTemplates, VsCodeTaskFile, + vscode_format::{Command, VsCodeTaskDefinition}, }; use super::EnvVariableReplacer; diff --git a/crates/tasks_ui/src/modal.rs b/crates/tasks_ui/src/modal.rs index f058582ec47f602b74d1ff091fe51f10350a3539..77a1db53723ef1140dc9997a401cc6a71f6a1603 100644 --- a/crates/tasks_ui/src/modal.rs +++ b/crates/tasks_ui/src/modal.rs @@ -3,23 +3,23 @@ use std::sync::Arc; use crate::TaskContexts; use fuzzy::{StringMatch, StringMatchCandidate}; use gpui::{ - rems, Action, AnyElement, App, AppContext as _, Context, DismissEvent, Entity, EventEmitter, + Action, AnyElement, App, AppContext as _, Context, DismissEvent, Entity, EventEmitter, Focusable, InteractiveElement, ParentElement, Render, SharedString, Styled, Subscription, Task, - WeakEntity, Window, + WeakEntity, Window, rems, }; -use picker::{highlighted_match_with_paths::HighlightedMatch, Picker, PickerDelegate}; -use project::{task_store::TaskStore, TaskSourceKind}; +use picker::{Picker, PickerDelegate, highlighted_match_with_paths::HighlightedMatch}; +use project::{TaskSourceKind, task_store::TaskStore}; use task::{ DebugRequestType, DebugTaskDefinition, ResolvedTask, RevealTarget, TaskContext, TaskModal, TaskTemplate, TaskType, }; use ui::{ - div, h_flex, v_flex, ActiveTheme, Button, ButtonCommon, ButtonSize, Clickable, Color, - FluentBuilder as _, Icon, IconButton, IconButtonShape, IconName, IconSize, IntoElement, - KeyBinding, LabelSize, ListItem, ListItemSpacing, RenderOnce, Toggleable, Tooltip, + ActiveTheme, Button, ButtonCommon, ButtonSize, Clickable, Color, FluentBuilder as _, Icon, + IconButton, IconButtonShape, IconName, IconSize, IntoElement, KeyBinding, LabelSize, ListItem, + ListItemSpacing, RenderOnce, Toggleable, Tooltip, div, h_flex, v_flex, }; use util::ResultExt; -use workspace::{tasks::schedule_resolved_task, ModalView, Workspace}; +use workspace::{ModalView, Workspace, tasks::schedule_resolved_task}; pub use zed_actions::{Rerun, Spawn}; /// A modal used to spawn new tasks. diff --git a/crates/tasks_ui/src/tasks_ui.rs b/crates/tasks_ui/src/tasks_ui.rs index f18afa1b87f5dcaa2dcab794783565a69fe92ea3..016f231b1a6bda9e2a4a11a36e48a64794c3ece8 100644 --- a/crates/tasks_ui/src/tasks_ui.rs +++ b/crates/tasks_ui/src/tasks_ui.rs @@ -8,7 +8,7 @@ use modal::{TaskOverrides, TasksModal}; use project::{Location, TaskContexts, Worktree}; use task::{RevealTarget, TaskContext, TaskId, TaskModal, TaskVariables, VariableName}; use workspace::tasks::schedule_task; -use workspace::{tasks::schedule_resolved_task, Start, Workspace}; +use workspace::{Start, Workspace, tasks::schedule_resolved_task}; mod modal; @@ -347,7 +347,7 @@ mod tests { use editor::Editor; use gpui::TestAppContext; use language::{Language, LanguageConfig}; - use project::{task_store::TaskStore, BasicContextProvider, FakeFs, Project}; + use project::{BasicContextProvider, FakeFs, Project, task_store::TaskStore}; use serde_json::json; use task::{TaskContext, TaskVariables, VariableName}; use ui::VisualContext; diff --git a/crates/terminal/src/mappings/mouse.rs b/crates/terminal/src/mappings/mouse.rs index bd91009a5633f3fc6cf9d95065482877748c3340..8c3eed8b54972806bdb71c5d4671cfe2a4705ce4 100644 --- a/crates/terminal/src/mappings/mouse.rs +++ b/crates/terminal/src/mappings/mouse.rs @@ -6,7 +6,7 @@ use alacritty_terminal::grid::Dimensions; /// with modifications for our circumstances use alacritty_terminal::index::{Column as GridCol, Line as GridLine, Point as AlacPoint, Side}; use alacritty_terminal::term::TermMode; -use gpui::{px, Modifiers, MouseButton, Pixels, Point, ScrollWheelEvent}; +use gpui::{Modifiers, MouseButton, Pixels, Point, ScrollWheelEvent, px}; use crate::TerminalBounds; diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 9668c788dc0c95412d25d08cd0d34461ff56fa33..954dbf4cb8488addd4e192547b26b76d16d36a5b 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -6,6 +6,7 @@ mod pty_info; pub mod terminal_settings; use alacritty_terminal::{ + Term, event::{Event as AlacTermEvent, EventListener, Notify, WindowSize}, event_loop::{EventLoop, Msg, Notifier}, grid::{Dimensions, Grid, Row, Scroll as AlacScroll}, @@ -13,22 +14,21 @@ use alacritty_terminal::{ selection::{Selection, SelectionRange, SelectionType}, sync::FairMutex, term::{ + Config, RenderableCursor, TermMode, cell::{Cell, Flags}, search::{Match, RegexIter, RegexSearch}, - Config, RenderableCursor, TermMode, }, tty::{self}, vi_mode::{ViModeCursor, ViMotion}, vte::ansi::{ ClearMode, CursorStyle as AlacCursorStyle, Handler, NamedPrivateMode, PrivateMode, }, - Term, }; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use futures::{ - channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}, FutureExt, + channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded}, }; use mappings::mouse::{ @@ -59,10 +59,9 @@ use std::{ use thiserror::Error; use gpui::{ - actions, black, px, AnyWindowHandle, App, AppContext as _, Bounds, ClipboardItem, Context, - EventEmitter, Hsla, Keystroke, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, - MouseUpEvent, Pixels, Point, Rgba, ScrollWheelEvent, SharedString, Size, Task, TouchPhase, - Window, + AnyWindowHandle, App, AppContext as _, Bounds, ClipboardItem, Context, EventEmitter, Hsla, + Keystroke, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, + Rgba, ScrollWheelEvent, SharedString, Size, Task, TouchPhase, Window, actions, black, px, }; use crate::mappings::{colors::to_alac_rgb, keys::to_esc_str}; @@ -2146,12 +2145,12 @@ mod tests { index::{Column, Line, Point as AlacPoint}, term::cell::Cell, }; - use gpui::{bounds, point, size, Pixels, Point}; - use rand::{distributions::Alphanumeric, rngs::ThreadRng, thread_rng, Rng}; + use gpui::{Pixels, Point, bounds, point, size}; + use rand::{Rng, distributions::Alphanumeric, rngs::ThreadRng, thread_rng}; use crate::{ - content_index_for_mouse, python_extract_path_and_line, rgb_for_index, IndexedCell, - TerminalBounds, TerminalContent, + IndexedCell, TerminalBounds, TerminalContent, content_index_for_mouse, + python_extract_path_and_line, rgb_for_index, }; #[test] diff --git a/crates/terminal/src/terminal_settings.rs b/crates/terminal/src/terminal_settings.rs index cd0c6d65a161e87c56327735621c16e40b26ceeb..29be1144fe8b698b459efe5611460734a7d5acd7 100644 --- a/crates/terminal/src/terminal_settings.rs +++ b/crates/terminal/src/terminal_settings.rs @@ -3,11 +3,11 @@ use alacritty_terminal::vte::ansi::{ }; use collections::HashMap; use gpui::{ - px, AbsoluteLength, App, FontFallbacks, FontFeatures, FontWeight, Pixels, SharedString, + AbsoluteLength, App, FontFallbacks, FontFeatures, FontWeight, Pixels, SharedString, px, }; -use schemars::{r#gen::SchemaGenerator, schema::RootSchema, JsonSchema}; +use schemars::{JsonSchema, r#gen::SchemaGenerator, schema::RootSchema}; use serde_derive::{Deserialize, Serialize}; -use settings::{add_references_to_properties, SettingsJsonSchemaParams, SettingsSources}; +use settings::{SettingsJsonSchemaParams, SettingsSources, add_references_to_properties}; use std::path::PathBuf; use task::Shell; diff --git a/crates/terminal_view/src/persistence.rs b/crates/terminal_view/src/persistence.rs index ff8a80a7267f8e2374101bce77826bb2e425c332..6d29630a795a5da0ffa7153111c184845c0922ff 100644 --- a/crates/terminal_view/src/persistence.rs +++ b/crates/terminal_view/src/persistence.rs @@ -1,9 +1,9 @@ use anyhow::Result; use async_recursion::async_recursion; use collections::HashSet; -use futures::{stream::FuturesUnordered, StreamExt as _}; +use futures::{StreamExt as _, stream::FuturesUnordered}; use gpui::{AppContext as _, AsyncWindowContext, Axis, Entity, Task, WeakEntity}; -use project::{terminals::TerminalKind, Project}; +use project::{Project, terminals::TerminalKind}; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use ui::{App, Context, Pixels, Window}; @@ -16,9 +16,8 @@ use workspace::{ }; use crate::{ - default_working_directory, - terminal_panel::{new_terminal_pane, TerminalPanel}, - TerminalView, + TerminalView, default_working_directory, + terminal_panel::{TerminalPanel, new_terminal_pane}, }; pub(crate) fn serialize_pane_group( diff --git a/crates/terminal_view/src/terminal_element.rs b/crates/terminal_view/src/terminal_element.rs index cbcc0a0f269120f4e59820938988ea7f7936e73c..66a7b837719eb29f723c3e6b5c0d6a8262963c8a 100644 --- a/crates/terminal_view/src/terminal_element.rs +++ b/crates/terminal_view/src/terminal_element.rs @@ -1,27 +1,28 @@ use editor::{CursorLayout, HighlightedRange, HighlightedRangeLine}; use gpui::{ - div, fill, point, px, relative, size, AnyElement, App, AvailableSpace, Bounds, ContentMask, - Context, DispatchPhase, Element, ElementId, Entity, FocusHandle, Font, FontStyle, FontWeight, - GlobalElementId, HighlightStyle, Hitbox, Hsla, InputHandler, InteractiveElement, Interactivity, - IntoElement, LayoutId, ModifiersChangedEvent, MouseButton, MouseMoveEvent, Pixels, Point, - ShapedLine, StatefulInteractiveElement, StrikethroughStyle, Styled, TextRun, TextStyle, - UTF16Selection, UnderlineStyle, WeakEntity, WhiteSpace, Window, WindowTextSystem, + AnyElement, App, AvailableSpace, Bounds, ContentMask, Context, DispatchPhase, Element, + ElementId, Entity, FocusHandle, Font, FontStyle, FontWeight, GlobalElementId, HighlightStyle, + Hitbox, Hsla, InputHandler, InteractiveElement, Interactivity, IntoElement, LayoutId, + ModifiersChangedEvent, MouseButton, MouseMoveEvent, Pixels, Point, ShapedLine, + StatefulInteractiveElement, StrikethroughStyle, Styled, TextRun, TextStyle, UTF16Selection, + UnderlineStyle, WeakEntity, WhiteSpace, Window, WindowTextSystem, div, fill, point, px, + relative, size, }; use itertools::Itertools; use language::CursorShape; use settings::Settings; use terminal::{ + IndexedCell, Terminal, TerminalBounds, TerminalContent, alacritty_terminal::{ grid::Dimensions, index::Point as AlacPoint, - term::{cell::Flags, TermMode}, + term::{TermMode, cell::Flags}, vte::ansi::{ Color::{self as AnsiColor, Named}, CursorShape as AlacCursorShape, NamedColor, }, }, terminal_settings::TerminalSettings, - IndexedCell, Terminal, TerminalBounds, TerminalContent, }; use theme::{ActiveTheme, Theme, ThemeSettings}; use ui::{ParentElement, Tooltip}; diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index 370172cede0b4ef3d9414bd083e21be18ab97667..75f7b35e1744d34ba55119cf400b9ecdfda025a5 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -1,48 +1,47 @@ use std::{cmp, ops::ControlFlow, path::PathBuf, sync::Arc, time::Duration}; use crate::{ - default_working_directory, + TerminalView, default_working_directory, persistence::{ - deserialize_terminal_panel, serialize_pane_group, SerializedItems, SerializedTerminalPanel, + SerializedItems, SerializedTerminalPanel, deserialize_terminal_panel, serialize_pane_group, }, - TerminalView, }; use breadcrumbs::Breadcrumbs; use collections::HashMap; use db::kvp::KEY_VALUE_STORE; use futures::future::join_all; use gpui::{ - actions, Action, AnyView, App, AsyncApp, AsyncWindowContext, Context, Corner, Entity, - EventEmitter, ExternalPaths, FocusHandle, Focusable, IntoElement, ParentElement, Pixels, - Render, Styled, Task, WeakEntity, Window, + Action, AnyView, App, AsyncApp, AsyncWindowContext, Context, Corner, Entity, EventEmitter, + ExternalPaths, FocusHandle, Focusable, IntoElement, ParentElement, Pixels, Render, Styled, + Task, WeakEntity, Window, actions, }; use itertools::Itertools; -use project::{terminals::TerminalKind, Fs, Project, ProjectEntryId}; -use search::{buffer_search::DivRegistrar, BufferSearchBar}; +use project::{Fs, Project, ProjectEntryId, terminals::TerminalKind}; +use search::{BufferSearchBar, buffer_search::DivRegistrar}; use settings::Settings; use task::{RevealStrategy, RevealTarget, ShellBuilder, SpawnInTerminal, TaskId}; use terminal::{ - terminal_settings::{TerminalDockPosition, TerminalSettings}, Terminal, + terminal_settings::{TerminalDockPosition, TerminalSettings}, }; use ui::{ - prelude::*, ButtonCommon, Clickable, ContextMenu, FluentBuilder, PopoverMenu, Toggleable, - Tooltip, + ButtonCommon, Clickable, ContextMenu, FluentBuilder, PopoverMenu, Toggleable, Tooltip, + prelude::*, }; use util::{ResultExt, TryFutureExt}; use workspace::{ - dock::{DockPosition, Panel, PanelEvent, PanelHandle}, - item::SerializableItem, - move_active_item, move_item, pane, - ui::IconName, ActivateNextPane, ActivatePane, ActivatePaneDown, ActivatePaneLeft, ActivatePaneRight, ActivatePaneUp, ActivatePreviousPane, DraggedSelection, DraggedTab, ItemId, MoveItemToPane, MoveItemToPaneInDirection, NewTerminal, Pane, PaneGroup, SplitDirection, SplitDown, SplitLeft, SplitRight, SplitUp, SwapPaneDown, SwapPaneLeft, SwapPaneRight, SwapPaneUp, ToggleZoom, Workspace, + dock::{DockPosition, Panel, PanelEvent, PanelHandle}, + item::SerializableItem, + move_active_item, move_item, pane, + ui::IconName, }; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use zed_actions::assistant::InlineAssist; const TERMINAL_PANEL_KEY: &str = "TerminalPanel"; diff --git a/crates/terminal_view/src/terminal_scrollbar.rs b/crates/terminal_view/src/terminal_scrollbar.rs index e72a1e7419713189c5cceb69056ee84a95c08fa1..89b63d7f7bfb90f7584acf09660f1f2bceba4539 100644 --- a/crates/terminal_view/src/terminal_scrollbar.rs +++ b/crates/terminal_view/src/terminal_scrollbar.rs @@ -4,9 +4,9 @@ use std::{ rc::Rc, }; -use gpui::{size, Bounds, Point}; +use gpui::{Bounds, Point, size}; use terminal::Terminal; -use ui::{px, ContentSize, Pixels, ScrollableHandle}; +use ui::{ContentSize, Pixels, ScrollableHandle, px}; #[derive(Debug)] struct ScrollHandleState { diff --git a/crates/terminal_view/src/terminal_tab_tooltip.rs b/crates/terminal_view/src/terminal_tab_tooltip.rs index a8fea72c6b5e57126a4acaf7b77651c79650703a..2e25e4798ff4ad9326d76897c56edc9937375793 100644 --- a/crates/terminal_view/src/terminal_tab_tooltip.rs +++ b/crates/terminal_view/src/terminal_tab_tooltip.rs @@ -1,5 +1,5 @@ use gpui::{IntoElement, Render}; -use ui::{prelude::*, tooltip_container, Divider}; +use ui::{Divider, prelude::*, tooltip_container}; pub struct TerminalTooltip { title: SharedString, diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 4f4abaae0b4cc98f53d2a6c99293a27012608d20..4940b655aa1f34e9a176988e79952b7e2cb55249 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -4,42 +4,42 @@ pub mod terminal_panel; pub mod terminal_scrollbar; pub mod terminal_tab_tooltip; -use editor::{actions::SelectAll, scroll::ScrollbarAutoHide, Editor, EditorSettings}; +use editor::{Editor, EditorSettings, actions::SelectAll, scroll::ScrollbarAutoHide}; use gpui::{ - anchored, deferred, div, impl_actions, AnyElement, App, DismissEvent, Entity, EventEmitter, - FocusHandle, Focusable, KeyContext, KeyDownEvent, Keystroke, MouseButton, MouseDownEvent, - Pixels, Render, ScrollWheelEvent, Stateful, Styled, Subscription, Task, WeakEntity, + AnyElement, App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, KeyContext, + KeyDownEvent, Keystroke, MouseButton, MouseDownEvent, Pixels, Render, ScrollWheelEvent, + Stateful, Styled, Subscription, Task, WeakEntity, anchored, deferred, div, impl_actions, }; use itertools::Itertools; use persistence::TERMINAL_DB; -use project::{search::SearchQuery, terminals::TerminalKind, Entry, Metadata, Project}; +use project::{Entry, Metadata, Project, search::SearchQuery, terminals::TerminalKind}; use schemars::JsonSchema; use terminal::{ + Clear, Copy, Event, MaybeNavigationTarget, Paste, ScrollLineDown, ScrollLineUp, ScrollPageDown, + ScrollPageUp, ScrollToBottom, ScrollToTop, ShowCharacterPalette, TaskState, TaskStatus, + Terminal, TerminalBounds, ToggleViMode, alacritty_terminal::{ index::Point, - term::{search::RegexSearch, TermMode}, + term::{TermMode, search::RegexSearch}, }, terminal_settings::{self, CursorShape, TerminalBlink, TerminalSettings, WorkingDirectory}, - Clear, Copy, Event, MaybeNavigationTarget, Paste, ScrollLineDown, ScrollLineUp, ScrollPageDown, - ScrollPageUp, ScrollToBottom, ScrollToTop, ShowCharacterPalette, TaskState, TaskStatus, - Terminal, TerminalBounds, ToggleViMode, }; -use terminal_element::{is_blank, TerminalElement}; +use terminal_element::{TerminalElement, is_blank}; use terminal_panel::TerminalPanel; use terminal_scrollbar::TerminalScrollHandle; use terminal_tab_tooltip::TerminalTooltip; use ui::{ - h_flex, prelude::*, ContextMenu, Icon, IconName, Label, Scrollbar, ScrollbarState, Tooltip, + ContextMenu, Icon, IconName, Label, Scrollbar, ScrollbarState, Tooltip, h_flex, prelude::*, }; -use util::{debug_panic, paths::PathWithPosition, ResultExt}; +use util::{ResultExt, debug_panic, paths::PathWithPosition}; use workspace::{ + CloseActiveItem, NewCenterTerminal, NewTerminal, OpenOptions, OpenVisible, ToolbarItemLocation, + Workspace, WorkspaceId, item::{ BreadcrumbText, Item, ItemEvent, SerializableItem, TabContentParams, TabTooltipContent, }, register_serializable_item, searchable::{Direction, SearchEvent, SearchOptions, SearchableItem, SearchableItemHandle}, - CloseActiveItem, NewCenterTerminal, NewTerminal, OpenOptions, OpenVisible, ToolbarItemLocation, - Workspace, WorkspaceId, }; use anyhow::Context as _; diff --git a/crates/text/src/anchor.rs b/crates/text/src/anchor.rs index d29dfc0bb5736c2490b9c59f1803e75967afdead..83a4fc84298f855fc4185a0b8bdc428cfe67856b 100644 --- a/crates/text/src/anchor.rs +++ b/crates/text/src/anchor.rs @@ -1,6 +1,6 @@ use crate::{ - locator::Locator, BufferId, BufferSnapshot, Point, PointUtf16, TextDimension, ToOffset, - ToPoint, ToPointUtf16, + BufferId, BufferSnapshot, Point, PointUtf16, TextDimension, ToOffset, ToPoint, ToPointUtf16, + locator::Locator, }; use std::{cmp::Ordering, fmt::Debug, ops::Range}; use sum_tree::Bias; diff --git a/crates/text/src/locator.rs b/crates/text/src/locator.rs index e38b9b58af22c228997ac529ab8bc7b1a346559a..d529e60d48ed520b518ed9beee789860eb84860a 100644 --- a/crates/text/src/locator.rs +++ b/crates/text/src/locator.rs @@ -1,4 +1,4 @@ -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use std::iter; use std::sync::LazyLock; diff --git a/crates/text/src/text.rs b/crates/text/src/text.rs index 98d622f547930d5c51b2776416308b91bebd76cc..d042ebf6d03af6d468f209b63927cc1a31921ccd 100644 --- a/crates/text/src/text.rs +++ b/crates/text/src/text.rs @@ -11,9 +11,9 @@ mod tests; mod undo_map; pub use anchor::*; -use anyhow::{anyhow, Context as _, Result}; -pub use clock::ReplicaId; +use anyhow::{Context as _, Result, anyhow}; use clock::LOCAL_BRANCH_REPLICA_ID; +pub use clock::ReplicaId; use collections::{HashMap, HashSet}; use locator::Locator; use operation_queue::OperationQueue; diff --git a/crates/theme/src/default_colors.rs b/crates/theme/src/default_colors.rs index 251f597eaf0f06c791962a182889db94c03a3be9..0b7eeb49587a5bd5e10c98bfd96d1d48e16545d6 100644 --- a/crates/theme/src/default_colors.rs +++ b/crates/theme/src/default_colors.rs @@ -1,7 +1,7 @@ use gpui::{Hsla, Rgba}; -use crate::scale::{ColorScaleSet, ColorScales}; use crate::ColorScale; +use crate::scale::{ColorScaleSet, ColorScales}; use crate::{SystemColors, ThemeColors}; pub(crate) fn neutral() -> ColorScaleSet { diff --git a/crates/theme/src/fallback_themes.rs b/crates/theme/src/fallback_themes.rs index e4ce1d669fe982d24cdadcdb6f717220cc2e46fc..cc91895ca022064fd3197499ce9b5e5f323fd0d3 100644 --- a/crates/theme/src/fallback_themes.rs +++ b/crates/theme/src/fallback_themes.rs @@ -1,11 +1,10 @@ use std::sync::Arc; -use gpui::{hsla, FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance}; +use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance, hsla}; use crate::{ - default_color_scales, AccentColors, Appearance, PlayerColors, StatusColors, - StatusColorsRefinement, SyntaxTheme, SystemColors, Theme, ThemeColors, ThemeFamily, - ThemeStyles, + AccentColors, Appearance, PlayerColors, StatusColors, StatusColorsRefinement, SyntaxTheme, + SystemColors, Theme, ThemeColors, ThemeFamily, ThemeStyles, default_color_scales, }; /// The default theme family for Zed. diff --git a/crates/theme/src/registry.rs b/crates/theme/src/registry.rs index 43328aaad2a4a57da3fc2a432ba65b6452927b2c..f0f0776582e3b0174a3743ad6c1b20c0fd90b0d8 100644 --- a/crates/theme/src/registry.rs +++ b/crates/theme/src/registry.rs @@ -12,9 +12,9 @@ use thiserror::Error; use util::ResultExt; use crate::{ - default_icon_theme, read_icon_theme, read_user_theme, refine_theme_family, Appearance, - AppearanceContent, ChevronIcons, DirectoryIcons, IconDefinition, IconTheme, Theme, ThemeFamily, - ThemeFamilyContent, DEFAULT_ICON_THEME_NAME, + Appearance, AppearanceContent, ChevronIcons, DEFAULT_ICON_THEME_NAME, DirectoryIcons, + IconDefinition, IconTheme, Theme, ThemeFamily, ThemeFamilyContent, default_icon_theme, + read_icon_theme, read_user_theme, refine_theme_family, }; /// The metadata for a theme. diff --git a/crates/theme/src/schema.rs b/crates/theme/src/schema.rs index 52dbbc31ef81552c69508b90a79c1ee8a9ac8bdf..b300a2737afce17505125f91ecbb6047024f9ba8 100644 --- a/crates/theme/src/schema.rs +++ b/crates/theme/src/schema.rs @@ -4,9 +4,9 @@ use anyhow::Result; use gpui::{FontStyle, FontWeight, HighlightStyle, Hsla, WindowBackgroundAppearance}; use indexmap::IndexMap; use palette::FromColor; +use schemars::JsonSchema; use schemars::r#gen::SchemaGenerator; use schemars::schema::{Schema, SchemaObject}; -use schemars::JsonSchema; use serde::{Deserialize, Deserializer, Serialize}; use serde_json::Value; use serde_repr::{Deserialize_repr, Serialize_repr}; diff --git a/crates/theme/src/settings.rs b/crates/theme/src/settings.rs index 4c8d18589052faae4040fecfa93006e4ac3d8226..99480d04a7edc82e9ba3871fdabcdb919624ecc6 100644 --- a/crates/theme/src/settings.rs +++ b/crates/theme/src/settings.rs @@ -1,23 +1,23 @@ use crate::fallback_themes::zed_default_dark; use crate::{ - Appearance, IconTheme, IconThemeNotFoundError, SyntaxTheme, Theme, ThemeNotFoundError, - ThemeRegistry, ThemeStyleContent, DEFAULT_ICON_THEME_NAME, + Appearance, DEFAULT_ICON_THEME_NAME, IconTheme, IconThemeNotFoundError, SyntaxTheme, Theme, + ThemeNotFoundError, ThemeRegistry, ThemeStyleContent, }; use anyhow::Result; use derive_more::{Deref, DerefMut}; use gpui::{ - px, App, Context, Font, FontFallbacks, FontFeatures, FontStyle, FontWeight, Global, Pixels, - Subscription, Window, + App, Context, Font, FontFallbacks, FontFeatures, FontStyle, FontWeight, Global, Pixels, + Subscription, Window, px, }; use refineable::Refineable; use schemars::{ + JsonSchema, r#gen::SchemaGenerator, schema::{InstanceType, Schema, SchemaObject}, - JsonSchema, }; use serde::{Deserialize, Serialize}; use serde_json::Value; -use settings::{add_references_to_properties, Settings, SettingsJsonSchemaParams, SettingsSources}; +use settings::{Settings, SettingsJsonSchemaParams, SettingsSources, add_references_to_properties}; use std::sync::Arc; use util::ResultExt as _; diff --git a/crates/theme/src/styles/accents.rs b/crates/theme/src/styles/accents.rs index 773e3319acf95c7136b2e6f71c32db3774761d6a..54d4be3b638d477330af5ba88d93dcc265dcde9d 100644 --- a/crates/theme/src/styles/accents.rs +++ b/crates/theme/src/styles/accents.rs @@ -2,8 +2,8 @@ use gpui::Hsla; use serde_derive::Deserialize; use crate::{ - amber, blue, cyan, gold, grass, indigo, iris, jade, lime, orange, pink, purple, tomato, - try_parse_color, AccentContent, + AccentContent, amber, blue, cyan, gold, grass, indigo, iris, jade, lime, orange, pink, purple, + tomato, try_parse_color, }; /// A collection of colors that are used to color indent aware lines in the editor. diff --git a/crates/theme/src/styles/players.rs b/crates/theme/src/styles/players.rs index 262048f2c65100a5ae3bea8ee465fcc2011650a0..79369594b4e7ccb82be1db148f3983576960bbe1 100644 --- a/crates/theme/src/styles/players.rs +++ b/crates/theme/src/styles/players.rs @@ -4,7 +4,7 @@ use gpui::Hsla; use serde_derive::Deserialize; use crate::{ - amber, blue, jade, lime, orange, pink, purple, red, try_parse_color, PlayerColorContent, + PlayerColorContent, amber, blue, jade, lime, orange, pink, purple, red, try_parse_color, }; #[derive(Debug, Clone, Copy, Deserialize, Default, PartialEq)] diff --git a/crates/theme/src/styles/system.rs b/crates/theme/src/styles/system.rs index 4f33711793b5f6dbd004fcc2b066ac542c15257b..64dd964b79f903da7918e0bac889ed62b3abd118 100644 --- a/crates/theme/src/styles/system.rs +++ b/crates/theme/src/styles/system.rs @@ -1,6 +1,6 @@ #![allow(missing_docs)] -use gpui::{hsla, Hsla}; +use gpui::{Hsla, hsla}; #[derive(Clone, PartialEq)] pub struct SystemColors { diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index fd3bdb6dc0fa29e08aa22e90fecbdc5dd14901ca..3b5306c216b8f6a100b75ce9d3e915c39989d620 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -28,8 +28,8 @@ use anyhow::Result; use fallback_themes::apply_status_color_defaults; use fs::Fs; use gpui::{ - px, App, AssetSource, HighlightStyle, Hsla, Pixels, Refineable, SharedString, WindowAppearance, - WindowBackgroundAppearance, + App, AssetSource, HighlightStyle, Hsla, Pixels, Refineable, SharedString, WindowAppearance, + WindowBackgroundAppearance, px, }; use serde::Deserialize; use uuid::Uuid; diff --git a/crates/theme_importer/src/assets.rs b/crates/theme_importer/src/assets.rs index 85318d8ed87c765468d6e1f9dab169c2d73e9fab..6ced84ced49f737efa613bed95855153bc9e1782 100644 --- a/crates/theme_importer/src/assets.rs +++ b/crates/theme_importer/src/assets.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use gpui::{AssetSource, SharedString}; use rust_embed::RustEmbed; diff --git a/crates/theme_importer/src/vscode/converter.rs b/crates/theme_importer/src/vscode/converter.rs index a1a6c7a27c134bd7cff5745610ce3b6e05a542ce..85ebe0376786d819897fb0ff8a7f1366b48d70a8 100644 --- a/crates/theme_importer/src/vscode/converter.rs +++ b/crates/theme_importer/src/vscode/converter.rs @@ -6,8 +6,8 @@ use theme::{ ThemeColorsContent, ThemeContent, ThemeStyleContent, }; -use crate::vscode::{VsCodeTheme, VsCodeTokenScope}; use crate::ThemeMetadata; +use crate::vscode::{VsCodeTheme, VsCodeTokenScope}; use super::ZedSyntaxToken; diff --git a/crates/theme_selector/src/icon_theme_selector.rs b/crates/theme_selector/src/icon_theme_selector.rs index 35fc9bab5c85d2d981dfbdeb7c2eabfc388cdced..fe6b9ba8ee019ba7a49c88f082b26847c51221bb 100644 --- a/crates/theme_selector/src/icon_theme_selector.rs +++ b/crates/theme_selector/src/icon_theme_selector.rs @@ -1,16 +1,16 @@ use fs::Fs; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, UpdateGlobal, WeakEntity, Window, }; use picker::{Picker, PickerDelegate}; -use settings::{update_settings_file, Settings as _, SettingsStore}; +use settings::{Settings as _, SettingsStore, update_settings_file}; use std::sync::Arc; use theme::{Appearance, IconTheme, ThemeMeta, ThemeRegistry, ThemeSettings}; -use ui::{prelude::*, v_flex, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*, v_flex}; use util::ResultExt; -use workspace::{ui::HighlightedLabel, ModalView}; +use workspace::{ModalView, ui::HighlightedLabel}; use zed_actions::{ExtensionCategoryFilter, Extensions}; pub(crate) struct IconThemeSelector { diff --git a/crates/theme_selector/src/theme_selector.rs b/crates/theme_selector/src/theme_selector.rs index f4787c6008e2126e3206d1898c1cc7d74697e8a6..849470906557eb188e3d2429fecae575f4ec5e1c 100644 --- a/crates/theme_selector/src/theme_selector.rs +++ b/crates/theme_selector/src/theme_selector.rs @@ -1,18 +1,18 @@ mod icon_theme_selector; use fs::Fs; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, UpdateGlobal, - WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, UpdateGlobal, WeakEntity, + Window, actions, }; use picker::{Picker, PickerDelegate}; -use settings::{update_settings_file, SettingsStore}; +use settings::{SettingsStore, update_settings_file}; use std::sync::Arc; use theme::{Appearance, Theme, ThemeMeta, ThemeRegistry, ThemeSettings}; -use ui::{prelude::*, v_flex, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*, v_flex}; use util::ResultExt; -use workspace::{ui::HighlightedLabel, ModalView, Workspace}; +use workspace::{ModalView, Workspace, ui::HighlightedLabel}; use zed_actions::{ExtensionCategoryFilter, Extensions}; use crate::icon_theme_selector::{IconThemeSelector, IconThemeSelectorDelegate}; diff --git a/crates/time_format/src/time_format.rs b/crates/time_format/src/time_format.rs index fe9a96b87b3a075e85a3b83bf912bb028bcbbcff..7dc0702fbfa806c5ed41dacb6078b85ff9c424b2 100644 --- a/crates/time_format/src/time_format.rs +++ b/crates/time_format/src/time_format.rs @@ -274,8 +274,8 @@ mod macos { use core_foundation_sys::{ base::kCFAllocatorDefault, date_formatter::{ - kCFDateFormatterMediumStyle, kCFDateFormatterNoStyle, kCFDateFormatterShortStyle, - CFDateFormatterCreate, + CFDateFormatterCreate, kCFDateFormatterMediumStyle, kCFDateFormatterNoStyle, + kCFDateFormatterShortStyle, }, locale::CFLocaleCopyCurrent, }; diff --git a/crates/title_bar/src/application_menu.rs b/crates/title_bar/src/application_menu.rs index dec281b47224bff1a9d98f3e0ac6ac905b2778a2..5ce5bd15994c2f91f380decf8b0e6cabf50962fc 100644 --- a/crates/title_bar/src/application_menu.rs +++ b/crates/title_bar/src/application_menu.rs @@ -9,7 +9,7 @@ use schemars::JsonSchema; use serde::Deserialize; use smallvec::SmallVec; -use ui::{prelude::*, ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip}; +use ui::{ContextMenu, PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*}; #[cfg(not(target_os = "macos"))] impl_actions!(app_menu, [OpenApplicationMenu]); diff --git a/crates/title_bar/src/collab.rs b/crates/title_bar/src/collab.rs index b5cdb7acc6b3152fa928b9ac26136bc81a9d110f..20dec0e6ea980f479a6bd8a62d2087592b578205 100644 --- a/crates/title_bar/src/collab.rs +++ b/crates/title_bar/src/collab.rs @@ -1,12 +1,12 @@ use std::sync::Arc; use call::{ActiveCall, ParticipantLocation, Room}; -use client::{proto::PeerId, User}; -use gpui::{actions, App, Task, Window}; -use gpui::{canvas, point, AnyElement, Hsla, IntoElement, MouseButton, Path, Styled}; +use client::{User, proto::PeerId}; +use gpui::{AnyElement, Hsla, IntoElement, MouseButton, Path, Styled, canvas, point}; +use gpui::{App, Task, Window, actions}; use rpc::proto::{self}; use theme::ActiveTheme; -use ui::{prelude::*, Avatar, AvatarAudioStatusIndicator, Facepile, TintColor, Tooltip}; +use ui::{Avatar, AvatarAudioStatusIndicator, Facepile, TintColor, Tooltip, prelude::*}; use workspace::notifications::DetachAndPromptErr; use crate::TitleBar; diff --git a/crates/title_bar/src/onboarding_banner.rs b/crates/title_bar/src/onboarding_banner.rs index 51f6bd2447dd2b85681ae7eacf2a39055afb4cac..169f555f3fe7fb0f6a75be757a01a0b29a4571d3 100644 --- a/crates/title_bar/src/onboarding_banner.rs +++ b/crates/title_bar/src/onboarding_banner.rs @@ -1,5 +1,5 @@ use gpui::{Action, Entity, Global, Render, SharedString}; -use ui::{prelude::*, ButtonLike, Tooltip}; +use ui::{ButtonLike, Tooltip, prelude::*}; use util::ResultExt; /// Prompts the user to try newly released Zed's features diff --git a/crates/title_bar/src/platforms/platform_linux.rs b/crates/title_bar/src/platforms/platform_linux.rs index df7ccf141a98fed5f64579b4b1fc197ad73def32..e175a391efd2ebd5eae397f9b8974fceb14f3ecc 100644 --- a/crates/title_bar/src/platforms/platform_linux.rs +++ b/crates/title_bar/src/platforms/platform_linux.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Action, MouseButton}; +use gpui::{Action, MouseButton, prelude::*}; use ui::prelude::*; diff --git a/crates/title_bar/src/platforms/platform_windows.rs b/crates/title_bar/src/platforms/platform_windows.rs index 5bc55604270b9ecd33e495d00580eac41939552b..96ce6d7380ff71b7a9ae3672c53667b672fc9a2c 100644 --- a/crates/title_bar/src/platforms/platform_windows.rs +++ b/crates/title_bar/src/platforms/platform_windows.rs @@ -1,4 +1,4 @@ -use gpui::{prelude::*, Rgba, WindowAppearance}; +use gpui::{Rgba, WindowAppearance, prelude::*}; use ui::prelude::*; diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index 9f5073e7948f5843b1ab8faef4512ea3480c2120..d19e973394a15556d46f685904fb72fc7f0e4890 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -20,9 +20,9 @@ use call::ActiveCall; use client::{Client, UserStore}; use feature_flags::{FeatureFlagAppExt, ZedPro}; use gpui::{ - actions, div, px, Action, AnyElement, App, Context, Corner, Decorations, Element, Entity, - InteractiveElement, Interactivity, IntoElement, MouseButton, ParentElement, Render, Stateful, - StatefulInteractiveElement, Styled, Subscription, WeakEntity, Window, + Action, AnyElement, App, Context, Corner, Decorations, Element, Entity, InteractiveElement, + Interactivity, IntoElement, MouseButton, ParentElement, Render, Stateful, + StatefulInteractiveElement, Styled, Subscription, WeakEntity, Window, actions, div, px, }; use onboarding_banner::OnboardingBanner; use project::Project; @@ -32,11 +32,11 @@ use smallvec::SmallVec; use std::sync::Arc; use theme::ActiveTheme; use ui::{ - h_flex, prelude::*, Avatar, Button, ButtonLike, ButtonStyle, ContextMenu, Icon, IconName, - IconSize, IconWithIndicator, Indicator, PopoverMenu, Tooltip, + Avatar, Button, ButtonLike, ButtonStyle, ContextMenu, Icon, IconName, IconSize, + IconWithIndicator, Indicator, PopoverMenu, Tooltip, h_flex, prelude::*, }; use util::ResultExt; -use workspace::{notifications::NotifyResultExt, Workspace}; +use workspace::{Workspace, notifications::NotifyResultExt}; use zed_actions::{OpenBrowser, OpenRecent, OpenRemote}; pub use onboarding_banner::restore_banner; diff --git a/crates/title_bar/src/window_controls.rs b/crates/title_bar/src/window_controls.rs index a9930ebc2560f6ca0f74a047435fda0da5916ef5..a4e3ddc234cebf18469654595ad677bd72be6599 100644 --- a/crates/title_bar/src/window_controls.rs +++ b/crates/title_bar/src/window_controls.rs @@ -1,4 +1,4 @@ -use gpui::{svg, Action, Hsla}; +use gpui::{Action, Hsla, svg}; use ui::prelude::*; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)] diff --git a/crates/toolchain_selector/src/active_toolchain.rs b/crates/toolchain_selector/src/active_toolchain.rs index 4bddeb0bb867d3e80017a040fa3063dfa78529c7..04e2e8c19ed87eede495f1751aef7821d3ee0816 100644 --- a/crates/toolchain_selector/src/active_toolchain.rs +++ b/crates/toolchain_selector/src/active_toolchain.rs @@ -2,13 +2,13 @@ use std::sync::Arc; use editor::Editor; use gpui::{ - div, AsyncWindowContext, Context, Entity, IntoElement, ParentElement, Render, Subscription, - Task, WeakEntity, Window, + AsyncWindowContext, Context, Entity, IntoElement, ParentElement, Render, Subscription, Task, + WeakEntity, Window, div, }; use language::{Buffer, BufferEvent, LanguageName, Toolchain}; use project::{Project, ProjectPath, WorktreeId}; use ui::{Button, ButtonCommon, Clickable, FluentBuilder, LabelSize, SharedString, Tooltip}; -use workspace::{item::ItemHandle, StatusItemView, Workspace}; +use workspace::{StatusItemView, Workspace, item::ItemHandle}; use crate::ToolchainSelector; diff --git a/crates/toolchain_selector/src/toolchain_selector.rs b/crates/toolchain_selector/src/toolchain_selector.rs index 37afd2942b76a01e4c7645717c75f8eb1115990d..92620b68b833f04f1854f4ce337e224d44d8f6b0 100644 --- a/crates/toolchain_selector/src/toolchain_selector.rs +++ b/crates/toolchain_selector/src/toolchain_selector.rs @@ -2,16 +2,16 @@ mod active_toolchain; pub use active_toolchain::ActiveToolchain; use editor::Editor; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, - ParentElement, Render, Styled, Task, WeakEntity, Window, + App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ParentElement, + Render, Styled, Task, WeakEntity, Window, actions, }; use language::{LanguageName, Toolchain, ToolchainList}; use picker::{Picker, PickerDelegate}; use project::{Project, ProjectPath, WorktreeId}; use std::{path::Path, sync::Arc}; -use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing}; +use ui::{HighlightedLabel, ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; use workspace::{ModalView, Workspace}; diff --git a/crates/ui/src/components/avatar.rs b/crates/ui/src/components/avatar.rs index 074f0d99f46b586139bf64b4fc2275569178586c..f7badf2ef01b1592dad5a4ff09be33f35244e762 100644 --- a/crates/ui/src/components/avatar.rs +++ b/crates/ui/src/components/avatar.rs @@ -1,6 +1,6 @@ use crate::prelude::*; -use gpui::{img, AnyElement, Hsla, ImageSource, Img, IntoElement, Styled}; +use gpui::{AnyElement, Hsla, ImageSource, Img, IntoElement, Styled, img}; /// An element that renders a user avatar with customizable appearance options. /// diff --git a/crates/ui/src/components/button/button.rs b/crates/ui/src/components/button/button.rs index 7317d05f734f85bba6c85a4a6fbb0b582c5895c2..78fc882e375d2c29e6298252767f5b228db9b1e1 100644 --- a/crates/ui/src/components/button/button.rs +++ b/crates/ui/src/components/button/button.rs @@ -1,12 +1,12 @@ -use component::{example_group_with_title, single_example, ComponentPreview}; +use component::{ComponentPreview, example_group_with_title, single_example}; use gpui::{AnyElement, AnyView, DefiniteLength}; use ui_macros::IntoComponent; +use crate::{ButtonCommon, ButtonLike, ButtonSize, ButtonStyle, IconName, IconSize, Label}; use crate::{ - prelude::*, Color, DynamicSpacing, ElevationIndex, IconPosition, KeyBinding, - KeybindingPosition, TintColor, + Color, DynamicSpacing, ElevationIndex, IconPosition, KeyBinding, KeybindingPosition, TintColor, + prelude::*, }; -use crate::{ButtonCommon, ButtonLike, ButtonSize, ButtonStyle, IconName, IconSize, Label}; use super::button_icon::ButtonIcon; diff --git a/crates/ui/src/components/button/button_icon.rs b/crates/ui/src/components/button/button_icon.rs index 337f10700a1098fe3155abdb10d5b5ec2a1021d9..6c1bab316c88ae1b5220c88cb9510fe2007a206b 100644 --- a/crates/ui/src/components/button/button_icon.rs +++ b/crates/ui/src/components/button/button_icon.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, Icon, IconName, IconSize, IconWithIndicator, Indicator}; +use crate::{Icon, IconName, IconSize, IconWithIndicator, Indicator, prelude::*}; use gpui::Hsla; /// An icon that appears within a button. diff --git a/crates/ui/src/components/button/button_like.rs b/crates/ui/src/components/button/button_like.rs index dc5aca8ca3a59dbc7968decded8ff7e9b33c30d2..f44c2e8b980b71856f30521b39e3945c9781ca6a 100644 --- a/crates/ui/src/components/button/button_like.rs +++ b/crates/ui/src/components/button/button_like.rs @@ -1,8 +1,8 @@ -use gpui::{relative, CursorStyle, DefiniteLength, MouseButton, MouseDownEvent, MouseUpEvent}; -use gpui::{transparent_black, AnyElement, AnyView, ClickEvent, Hsla, Rems}; +use gpui::{AnyElement, AnyView, ClickEvent, Hsla, Rems, transparent_black}; +use gpui::{CursorStyle, DefiniteLength, MouseButton, MouseDownEvent, MouseUpEvent, relative}; use smallvec::SmallVec; -use crate::{prelude::*, DynamicSpacing, ElevationIndex}; +use crate::{DynamicSpacing, ElevationIndex, prelude::*}; /// A trait for buttons that can be Selected. Enables setting the [`ButtonStyle`] of a button when it is selected. pub trait SelectableButton: Toggleable { diff --git a/crates/ui/src/components/button/icon_button.rs b/crates/ui/src/components/button/icon_button.rs index 611a81f6d550099a7ff02161348507b4ed7bdad1..fb56980dcada58e43210dfe0c186328289215053 100644 --- a/crates/ui/src/components/button/icon_button.rs +++ b/crates/ui/src/components/button/icon_button.rs @@ -1,7 +1,7 @@ use gpui::{AnyView, DefiniteLength, Hsla}; use super::button_like::{ButtonCommon, ButtonLike, ButtonSize, ButtonStyle}; -use crate::{prelude::*, ElevationIndex, Indicator, SelectableButton, TintColor}; +use crate::{ElevationIndex, Indicator, SelectableButton, TintColor, prelude::*}; use crate::{IconName, IconSize}; use super::button_icon::ButtonIcon; diff --git a/crates/ui/src/components/button/split_button.rs b/crates/ui/src/components/button/split_button.rs index 84b381768d2cb9539df4da2c05526e943facd74e..6ceeb88377ee053943ef0cc8fb4e971337ee8296 100644 --- a/crates/ui/src/components/button/split_button.rs +++ b/crates/ui/src/components/button/split_button.rs @@ -1,10 +1,10 @@ use gpui::{ - div, hsla, point, px, AnyElement, App, BoxShadow, IntoElement, ParentElement, RenderOnce, - Styled, Window, + AnyElement, App, BoxShadow, IntoElement, ParentElement, RenderOnce, Styled, Window, div, hsla, + point, px, }; use theme::ActiveTheme; -use crate::{h_flex, ElevationIndex}; +use crate::{ElevationIndex, h_flex}; use super::ButtonLike; diff --git a/crates/ui/src/components/button/toggle_button.rs b/crates/ui/src/components/button/toggle_button.rs index 7e114b989cc68e3e5f7e5c2a2cfa4ce75319ddf6..5cfccd82466bb4e60e4f8124878223e0c6e8dead 100644 --- a/crates/ui/src/components/button/toggle_button.rs +++ b/crates/ui/src/components/button/toggle_button.rs @@ -1,6 +1,6 @@ use gpui::{AnyView, ClickEvent}; -use crate::{prelude::*, ButtonLike, ButtonLikeRounding, ElevationIndex}; +use crate::{ButtonLike, ButtonLikeRounding, ElevationIndex, prelude::*}; /// The position of a [`ToggleButton`] within a group of buttons. #[derive(Debug, PartialEq, Eq, Clone, Copy)] diff --git a/crates/ui/src/components/content_group.rs b/crates/ui/src/components/content_group.rs index 2c5fd88847a155910144c85aa67b2431cc2f5f5a..5b26793e56441124621bbc7b41a65f49f875c1a2 100644 --- a/crates/ui/src/components/content_group.rs +++ b/crates/ui/src/components/content_group.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use component::{example_group, single_example, ComponentPreview}; +use component::{ComponentPreview, example_group, single_example}; use gpui::{AnyElement, IntoElement, ParentElement, StyleRefinement, Styled}; use smallvec::SmallVec; diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs index 2728b5f6c835866c50e4abdafc3d031e318c1a4b..4cf73133e2babbdd56be9d9dda2ce0f19659f924 100644 --- a/crates/ui/src/components/context_menu.rs +++ b/crates/ui/src/components/context_menu.rs @@ -1,10 +1,10 @@ use crate::{ - h_flex, prelude::*, utils::WithRemSize, v_flex, Icon, IconName, IconSize, KeyBinding, Label, - List, ListItem, ListSeparator, ListSubHeader, + Icon, IconName, IconSize, KeyBinding, Label, List, ListItem, ListSeparator, ListSubHeader, + h_flex, prelude::*, utils::WithRemSize, v_flex, }; use gpui::{ - px, Action, AnyElement, App, AppContext as _, DismissEvent, Entity, EventEmitter, FocusHandle, - Focusable, IntoElement, Render, Subscription, + Action, AnyElement, App, AppContext as _, DismissEvent, Entity, EventEmitter, FocusHandle, + Focusable, IntoElement, Render, Subscription, px, }; use menu::{SelectFirst, SelectLast, SelectNext, SelectPrevious}; use settings::Settings; diff --git a/crates/ui/src/components/disclosure.rs b/crates/ui/src/components/disclosure.rs index 1bf34ad6ed3332819cab90c327eb4445c7e9c636..ce307e5cc2c90b2df840159ec262b2e113a1b11e 100644 --- a/crates/ui/src/components/disclosure.rs +++ b/crates/ui/src/components/disclosure.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use gpui::{ClickEvent, CursorStyle}; -use crate::{prelude::*, Color, IconButton, IconButtonShape, IconName, IconSize}; +use crate::{Color, IconButton, IconButtonShape, IconName, IconSize, prelude::*}; #[derive(IntoElement)] pub struct Disclosure { diff --git a/crates/ui/src/components/dropdown_menu.rs b/crates/ui/src/components/dropdown_menu.rs index b057e352492293570b80bf4314aa4e419be3a429..c981636670c198cedf4838c874ee8fc7d68d0bd5 100644 --- a/crates/ui/src/components/dropdown_menu.rs +++ b/crates/ui/src/components/dropdown_menu.rs @@ -1,6 +1,6 @@ use gpui::{ClickEvent, Corner, CursorStyle, Entity, MouseButton}; -use crate::{prelude::*, ContextMenu, PopoverMenu}; +use crate::{ContextMenu, PopoverMenu, prelude::*}; #[derive(IntoElement)] pub struct DropdownMenu { diff --git a/crates/ui/src/components/facepile.rs b/crates/ui/src/components/facepile.rs index fb610f0cbf703853cbdb3132393f789c973d29fa..47be6a373d94ded3395aec48b44e24b171941228 100644 --- a/crates/ui/src/components/facepile.rs +++ b/crates/ui/src/components/facepile.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, Avatar}; +use crate::{Avatar, prelude::*}; use gpui::{AnyElement, StyleRefinement}; use smallvec::SmallVec; diff --git a/crates/ui/src/components/group.rs b/crates/ui/src/components/group.rs index f49ab9fe1377eac4390ae1f1ecc7140f4123699d..12462bb24b51cb701188709972177f5b9c95f4f1 100644 --- a/crates/ui/src/components/group.rs +++ b/crates/ui/src/components/group.rs @@ -1,4 +1,4 @@ -use gpui::{div, prelude::*, Div}; +use gpui::{Div, div, prelude::*}; /// Creates a horizontal group with tight, consistent spacing. /// diff --git a/crates/ui/src/components/icon.rs b/crates/ui/src/components/icon.rs index a01dc7627d97680097c9703df2d67c5aaa10c378..24170c1f11d7455f6155a34f8bc16a80c8d89dc1 100644 --- a/crates/ui/src/components/icon.rs +++ b/crates/ui/src/components/icon.rs @@ -5,11 +5,11 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; pub use decorated_icon::*; -use gpui::{img, svg, AnimationElement, AnyElement, Hsla, IntoElement, Rems, Transformation}; +use gpui::{AnimationElement, AnyElement, Hsla, IntoElement, Rems, Transformation, img, svg}; pub use icon_decoration::*; pub use icons::*; -use crate::{prelude::*, Indicator}; +use crate::{Indicator, prelude::*}; #[derive(IntoElement)] pub enum AnyIcon { diff --git a/crates/ui/src/components/icon/decorated_icon.rs b/crates/ui/src/components/icon/decorated_icon.rs index fbe0a095630008a81c735d73296274640dcc062c..99e20e6f0258796e572e8b843715f1cc7569e144 100644 --- a/crates/ui/src/components/icon/decorated_icon.rs +++ b/crates/ui/src/components/icon/decorated_icon.rs @@ -1,6 +1,6 @@ use gpui::{AnyElement, IntoElement, Point}; -use crate::{prelude::*, IconDecoration, IconDecorationKind}; +use crate::{IconDecoration, IconDecorationKind, prelude::*}; #[derive(IntoElement, IntoComponent)] pub struct DecoratedIcon { diff --git a/crates/ui/src/components/icon/icon_decoration.rs b/crates/ui/src/components/icon/icon_decoration.rs index ba73e5a2cb36b656fa9596ba409382ba2371a9fb..f7287145f648bd1acc239f2150ccea6b4ff0ea4c 100644 --- a/crates/ui/src/components/icon/icon_decoration.rs +++ b/crates/ui/src/components/icon/icon_decoration.rs @@ -1,4 +1,4 @@ -use gpui::{svg, Hsla, IntoElement, Point}; +use gpui::{Hsla, IntoElement, Point, svg}; use strum::{EnumIter, EnumString, IntoStaticStr}; use ui_macros::DerivePathStr; diff --git a/crates/ui/src/components/image.rs b/crates/ui/src/components/image.rs index cee5cb3538ec7ee44bb4c547353f3a37a1fbfa1a..e20433a4aed61c9fcbff1e4d8880744964424717 100644 --- a/crates/ui/src/components/image.rs +++ b/crates/ui/src/components/image.rs @@ -1,7 +1,7 @@ -use gpui::{svg, App, IntoElement, Rems, RenderOnce, Size, Styled, Window}; +use gpui::{App, IntoElement, Rems, RenderOnce, Size, Styled, Window, svg}; use serde::{Deserialize, Serialize}; use strum::{EnumIter, EnumString, IntoStaticStr}; -use ui_macros::{path_str, DerivePathStr}; +use ui_macros::{DerivePathStr, path_str}; use crate::Color; diff --git a/crates/ui/src/components/indent_guides.rs b/crates/ui/src/components/indent_guides.rs index 8c99ba0d8e194ddfd5f47f0a7c644991ac802f02..3a5ba8d8353fccd4f7446c5d060aee8adbdcd9ec 100644 --- a/crates/ui/src/components/indent_guides.rs +++ b/crates/ui/src/components/indent_guides.rs @@ -1,7 +1,7 @@ use std::{cmp::Ordering, ops::Range, rc::Rc}; use gpui::{ - fill, point, size, AnyElement, App, Bounds, Entity, Hsla, Point, UniformListDecoration, + AnyElement, App, Bounds, Entity, Hsla, Point, UniformListDecoration, fill, point, size, }; use smallvec::SmallVec; @@ -49,8 +49,13 @@ pub fn indent_guides( entity: Entity, indent_size: Pixels, colors: IndentGuideColors, - compute_indents_fn: impl Fn(&mut V, Range, &mut Window, &mut Context) -> SmallVec<[usize; 64]> - + 'static, + compute_indents_fn: impl Fn( + &mut V, + Range, + &mut Window, + &mut Context, + ) -> SmallVec<[usize; 64]> + + 'static, ) -> IndentGuides { let compute_indents_fn = Box::new(move |range, window: &mut Window, cx: &mut App| { entity.update(cx, |this, cx| compute_indents_fn(this, range, window, cx)) @@ -79,12 +84,12 @@ impl IndentGuides { mut self, entity: Entity, render_fn: impl Fn( - &mut V, - RenderIndentGuideParams, - &mut Window, - &mut App, - ) -> SmallVec<[RenderedIndentGuide; 12]> - + 'static, + &mut V, + RenderIndentGuideParams, + &mut Window, + &mut App, + ) -> SmallVec<[RenderedIndentGuide; 12]> + + 'static, ) -> Self { let render_fn = move |params, window: &mut Window, cx: &mut App| { entity.update(cx, |this, cx| render_fn(this, params, window, cx)) diff --git a/crates/ui/src/components/indicator.rs b/crates/ui/src/components/indicator.rs index c9c27fd561629491f4feb1bb46ee1fbc4cb41927..693ba80c9c9cd6d825168f1b050d9b8de15ca3ec 100644 --- a/crates/ui/src/components/indicator.rs +++ b/crates/ui/src/components/indicator.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, AnyIcon}; +use crate::{AnyIcon, prelude::*}; #[derive(Default)] enum IndicatorKind { diff --git a/crates/ui/src/components/keybinding.rs b/crates/ui/src/components/keybinding.rs index 5f99b142980901dbcd049e4581c786c839672c2d..1d3e80c4fd70a5cbda84931b8ce97e8d45567039 100644 --- a/crates/ui/src/components/keybinding.rs +++ b/crates/ui/src/components/keybinding.rs @@ -1,8 +1,8 @@ use crate::PlatformStyle; -use crate::{h_flex, prelude::*, Icon, IconName, IconSize}; +use crate::{Icon, IconName, IconSize, h_flex, prelude::*}; use gpui::{ - relative, Action, AnyElement, App, FocusHandle, Global, IntoElement, Keystroke, Modifiers, - Window, + Action, AnyElement, App, FocusHandle, Global, IntoElement, Keystroke, Modifiers, Window, + relative, }; use itertools::Itertools; diff --git a/crates/ui/src/components/keybinding_hint.rs b/crates/ui/src/components/keybinding_hint.rs index 6fc2b50ce8e9ad01bb093c2d7c25b11a46d3b684..2423de5188d39ca9e5b26f4696315ac9f1e292b8 100644 --- a/crates/ui/src/components/keybinding_hint.rs +++ b/crates/ui/src/components/keybinding_hint.rs @@ -1,6 +1,6 @@ use crate::KeyBinding; use crate::{h_flex, prelude::*}; -use gpui::{point, AnyElement, App, BoxShadow, FontStyle, Hsla, IntoElement, Window}; +use gpui::{AnyElement, App, BoxShadow, FontStyle, Hsla, IntoElement, Window, point}; use smallvec::smallvec; use theme::Appearance; diff --git a/crates/ui/src/components/label/highlighted_label.rs b/crates/ui/src/components/label/highlighted_label.rs index 065041dae9a08a925de294f5ed2145af4dc8b527..63629450918608c95b1c2588e4747f9ddbdc77dc 100644 --- a/crates/ui/src/components/label/highlighted_label.rs +++ b/crates/ui/src/components/label/highlighted_label.rs @@ -2,7 +2,7 @@ use std::ops::Range; use gpui::{FontWeight, HighlightStyle, StyledText}; -use crate::{prelude::*, LabelCommon, LabelLike, LabelSize, LineHeightStyle}; +use crate::{LabelCommon, LabelLike, LabelSize, LineHeightStyle, prelude::*}; #[derive(IntoElement)] pub struct HighlightedLabel { diff --git a/crates/ui/src/components/label/label.rs b/crates/ui/src/components/label/label.rs index 3fc1dd2826fe427627e8f9c4d57d7ed2cae556f7..388984d3c96970b17111f8461d404aa8159f745f 100644 --- a/crates/ui/src/components/label/label.rs +++ b/crates/ui/src/components/label/label.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, LabelLike}; +use crate::{LabelLike, prelude::*}; use gpui::StyleRefinement; /// A struct representing a label element in the UI. diff --git a/crates/ui/src/components/list/list.rs b/crates/ui/src/components/list/list.rs index 7cd81a51648180633d988a9bc60c7575a812c7c1..1402b5d3d3328f0b5344bb4d81c8bc8413a0dac0 100644 --- a/crates/ui/src/components/list/list.rs +++ b/crates/ui/src/components/list/list.rs @@ -1,7 +1,7 @@ use gpui::AnyElement; use smallvec::SmallVec; -use crate::{prelude::*, v_flex, Label, ListHeader}; +use crate::{Label, ListHeader, prelude::*, v_flex}; pub enum EmptyMessage { Text(SharedString), diff --git a/crates/ui/src/components/list/list_header.rs b/crates/ui/src/components/list/list_header.rs index 91bb0ca76a2a23c73e43f2e66eb6403b49d6ade2..d64f5c7263a4c395a48591a9454c0b518e541a82 100644 --- a/crates/ui/src/components/list/list_header.rs +++ b/crates/ui/src/components/list/list_header.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use crate::{h_flex, prelude::*, Disclosure, Label}; +use crate::{Disclosure, Label, h_flex, prelude::*}; use gpui::{AnyElement, ClickEvent}; use settings::Settings; use theme::ThemeSettings; diff --git a/crates/ui/src/components/list/list_item.rs b/crates/ui/src/components/list/list_item.rs index 25701b6ac029ee587b4abd05ddefb65297df5aa8..8462e99eb8bf97452615556d49d8a1ceea09e1ca 100644 --- a/crates/ui/src/components/list/list_item.rs +++ b/crates/ui/src/components/list/list_item.rs @@ -1,9 +1,9 @@ use std::sync::Arc; -use gpui::{px, AnyElement, AnyView, ClickEvent, MouseButton, MouseDownEvent, Pixels}; +use gpui::{AnyElement, AnyView, ClickEvent, MouseButton, MouseDownEvent, Pixels, px}; use smallvec::SmallVec; -use crate::{prelude::*, Disclosure}; +use crate::{Disclosure, prelude::*}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Default)] pub enum ListItemSpacing { diff --git a/crates/ui/src/components/list/list_sub_header.rs b/crates/ui/src/components/list/list_sub_header.rs index 3cf2fd51d7d71c97ddc74b8ff8e5039242247f17..a1f04af576a4e5ecffe8adf4291aa6123cc0c9e5 100644 --- a/crates/ui/src/components/list/list_sub_header.rs +++ b/crates/ui/src/components/list/list_sub_header.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use crate::{h_flex, Icon, IconName, IconSize, Label}; +use crate::{Icon, IconName, IconSize, Label, h_flex}; #[derive(IntoElement)] pub struct ListSubHeader { diff --git a/crates/ui/src/components/modal.rs b/crates/ui/src/components/modal.rs index 1a8d8b4ed57f28d2ad687b07d0614cb94186c425..a05c20f1a019cd79f7907bc68947f490621b50df 100644 --- a/crates/ui/src/components/modal.rs +++ b/crates/ui/src/components/modal.rs @@ -1,6 +1,6 @@ use crate::{ - h_flex, v_flex, Clickable, Color, DynamicSpacing, Headline, HeadlineSize, IconButton, - IconButtonShape, IconName, Label, LabelCommon, LabelSize, + Clickable, Color, DynamicSpacing, Headline, HeadlineSize, IconButton, IconButtonShape, + IconName, Label, LabelCommon, LabelSize, h_flex, v_flex, }; use gpui::{prelude::FluentBuilder, *}; use smallvec::SmallVec; diff --git a/crates/ui/src/components/notification/alert_modal.rs b/crates/ui/src/components/notification/alert_modal.rs index 5685c197a2dcd8d5d0c65ab96ee7f8fffe303931..0145b7302aa875744ca8e3942a5438b00b6f9cda 100644 --- a/crates/ui/src/components/notification/alert_modal.rs +++ b/crates/ui/src/components/notification/alert_modal.rs @@ -1,6 +1,6 @@ use crate::prelude::*; use gpui::IntoElement; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; #[derive(IntoElement, IntoComponent)] #[component(scope = "Notification")] diff --git a/crates/ui/src/components/numeric_stepper.rs b/crates/ui/src/components/numeric_stepper.rs index 2c611bde378969158a96b32a240f28cb0e94bfe7..f9e6e88f01f64fb7c78e98410178b101383f9be4 100644 --- a/crates/ui/src/components/numeric_stepper.rs +++ b/crates/ui/src/components/numeric_stepper.rs @@ -1,6 +1,6 @@ use gpui::ClickEvent; -use crate::{prelude::*, IconButtonShape}; +use crate::{IconButtonShape, prelude::*}; #[derive(IntoElement)] pub struct NumericStepper { diff --git a/crates/ui/src/components/popover.rs b/crates/ui/src/components/popover.rs index 2ac0b8f5fc9f6ba1d6e0a52e2356574a76399f4d..24460f6d9ce8e28b80c1e345007a88e7ee21a7a9 100644 --- a/crates/ui/src/components/popover.rs +++ b/crates/ui/src/components/popover.rs @@ -1,7 +1,7 @@ use crate::prelude::*; use crate::v_flex; use gpui::{ - div, AnyElement, App, Element, IntoElement, ParentElement, Pixels, RenderOnce, Styled, Window, + AnyElement, App, Element, IntoElement, ParentElement, Pixels, RenderOnce, Styled, Window, div, }; use smallvec::SmallVec; diff --git a/crates/ui/src/components/popover_menu.rs b/crates/ui/src/components/popover_menu.rs index 6be332b6932e1b7daaf651cc0619ef3aa6cd6425..f0c9e74c867c56328679742fcfabe231606aafdc 100644 --- a/crates/ui/src/components/popover_menu.rs +++ b/crates/ui/src/components/popover_menu.rs @@ -1,10 +1,10 @@ use std::{cell::RefCell, rc::Rc}; use gpui::{ - anchored, deferred, div, point, prelude::FluentBuilder, px, size, AnyElement, AnyView, App, - Bounds, Corner, DismissEvent, DispatchPhase, Element, ElementId, Entity, Focusable as _, - GlobalElementId, HitboxId, InteractiveElement, IntoElement, LayoutId, Length, ManagedView, - MouseDownEvent, ParentElement, Pixels, Point, Style, Window, + AnyElement, AnyView, App, Bounds, Corner, DismissEvent, DispatchPhase, Element, ElementId, + Entity, Focusable as _, GlobalElementId, HitboxId, InteractiveElement, IntoElement, LayoutId, + Length, ManagedView, MouseDownEvent, ParentElement, Pixels, Point, Style, Window, anchored, + deferred, div, point, prelude::FluentBuilder, px, size, }; use crate::prelude::*; diff --git a/crates/ui/src/components/right_click_menu.rs b/crates/ui/src/components/right_click_menu.rs index 9d171e6daa26ee847b4367e17555c93a4fe35976..72a907e2b051e06e50d3d648cbc4fae1ce8b353d 100644 --- a/crates/ui/src/components/right_click_menu.rs +++ b/crates/ui/src/components/right_click_menu.rs @@ -1,10 +1,10 @@ use std::{cell::RefCell, rc::Rc}; use gpui::{ - anchored, deferred, div, px, AnyElement, App, Bounds, Corner, DismissEvent, DispatchPhase, - Element, ElementId, Entity, Focusable as _, GlobalElementId, Hitbox, InteractiveElement, - IntoElement, LayoutId, ManagedView, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, - Window, + AnyElement, App, Bounds, Corner, DismissEvent, DispatchPhase, Element, ElementId, Entity, + Focusable as _, GlobalElementId, Hitbox, InteractiveElement, IntoElement, LayoutId, + ManagedView, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, Window, anchored, + deferred, div, px, }; pub struct RightClickMenu { diff --git a/crates/ui/src/components/scrollbar.rs b/crates/ui/src/components/scrollbar.rs index 5e76f57da135ae738e40c86e1e2a5135b6df5277..5756ec20cdd2ae40c92b2b8f1d3ab5605f37a215 100644 --- a/crates/ui/src/components/scrollbar.rs +++ b/crates/ui/src/components/scrollbar.rs @@ -1,11 +1,11 @@ use std::{any::Any, cell::Cell, fmt::Debug, ops::Range, rc::Rc, sync::Arc}; -use crate::{prelude::*, px, relative, IntoElement}; +use crate::{IntoElement, prelude::*, px, relative}; use gpui::{ - point, quad, Along, App, Axis as ScrollbarAxis, BorderStyle, Bounds, ContentMask, Corners, - Edges, Element, ElementId, Entity, EntityId, GlobalElementId, Hitbox, Hsla, LayoutId, - ListState, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, ScrollHandle, - ScrollWheelEvent, Size, Style, UniformListScrollHandle, Window, + Along, App, Axis as ScrollbarAxis, BorderStyle, Bounds, ContentMask, Corners, Edges, Element, + ElementId, Entity, EntityId, GlobalElementId, Hitbox, Hsla, LayoutId, ListState, + MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, Point, ScrollHandle, ScrollWheelEvent, + Size, Style, UniformListScrollHandle, Window, point, quad, }; pub struct Scrollbar { @@ -171,11 +171,7 @@ impl ScrollbarState { let mut current_offset = self.scroll_handle.offset().along(axis).min(px(0.)).abs().0; if let Some(adjustment) = scroll_adjustment.and_then(|adjustment| { let adjust = adjustment.along(axis).0; - if adjust < 0.0 { - Some(adjust) - } else { - None - } + if adjust < 0.0 { Some(adjust) } else { None } }) { current_offset -= adjustment; } diff --git a/crates/ui/src/components/settings_group.rs b/crates/ui/src/components/settings_group.rs index 90cd1b16276ee1db99d0e961b761081bef0e4534..119727533dfb9f05ebf8643ceec447281a768181 100644 --- a/crates/ui/src/components/settings_group.rs +++ b/crates/ui/src/components/settings_group.rs @@ -1,7 +1,7 @@ use gpui::AnyElement; use smallvec::SmallVec; -use crate::{prelude::*, ListHeader}; +use crate::{ListHeader, prelude::*}; /// A group of settings. #[derive(IntoElement)] diff --git a/crates/ui/src/components/stack.rs b/crates/ui/src/components/stack.rs index 74a5e80575bfe0ebe28334f4533f12b91b1fcfb2..2118757548e250abbbbd1a6ba0f91a2914ea95c5 100644 --- a/crates/ui/src/components/stack.rs +++ b/crates/ui/src/components/stack.rs @@ -1,4 +1,4 @@ -use gpui::{div, Div}; +use gpui::{Div, div}; use crate::StyledExt; diff --git a/crates/ui/src/components/stories/context_menu.rs b/crates/ui/src/components/stories/context_menu.rs index d68c26fd6a8c085f962d6e05a0e637c4de4a8849..3a04e2449ebe4ed62a93eb9c13af03c376542028 100644 --- a/crates/ui/src/components/stories/context_menu.rs +++ b/crates/ui/src/components/stories/context_menu.rs @@ -1,8 +1,8 @@ -use gpui::{actions, Corner, Entity, Render}; +use gpui::{Corner, Entity, Render, actions}; use story::Story; use crate::prelude::*; -use crate::{right_click_menu, ContextMenu, Label}; +use crate::{ContextMenu, Label, right_click_menu}; actions!(context_menu, [PrintCurrentDate, PrintBestFood]); diff --git a/crates/ui/src/components/stories/disclosure.rs b/crates/ui/src/components/stories/disclosure.rs index eb5a56cb95ad5e11817d63d7a1e1c2fbe35cb639..62273519219e82c4c7f709d6a67a3137b2f6553a 100644 --- a/crates/ui/src/components/stories/disclosure.rs +++ b/crates/ui/src/components/stories/disclosure.rs @@ -1,8 +1,8 @@ use gpui::Render; use story::Story; -use crate::prelude::*; use crate::Disclosure; +use crate::prelude::*; pub struct DisclosureStory; diff --git a/crates/ui/src/components/stories/icon_button.rs b/crates/ui/src/components/stories/icon_button.rs index 6aae32cbae20d50384b66cedef4693c039eb00fb..f396a31b29a2a338286092be001a27a66c2b9a3d 100644 --- a/crates/ui/src/components/stories/icon_button.rs +++ b/crates/ui/src/components/stories/icon_button.rs @@ -1,8 +1,8 @@ use gpui::Render; use story::{Story, StoryItem, StorySection}; -use crate::{prelude::*, IconButtonShape, Tooltip}; use crate::{IconButton, IconName}; +use crate::{IconButtonShape, Tooltip, prelude::*}; pub struct IconButtonStory; diff --git a/crates/ui/src/components/stories/keybinding.rs b/crates/ui/src/components/stories/keybinding.rs index 2e2b952a4d93dd146aa155191b4fd797ab5cc90c..c2b5fde059049a2b81a445a7f2940ae452456d29 100644 --- a/crates/ui/src/components/stories/keybinding.rs +++ b/crates/ui/src/components/stories/keybinding.rs @@ -3,7 +3,7 @@ use gpui::Render; use itertools::Itertools; use story::Story; -use crate::{prelude::*, KeyBinding}; +use crate::{KeyBinding, prelude::*}; pub struct KeybindingStory; diff --git a/crates/ui/src/components/stories/list.rs b/crates/ui/src/components/stories/list.rs index ff45e141799cdd884ff5a9190aacef91f687a25c..4d0bf6486f92f2f6291422e848086e31a23556fb 100644 --- a/crates/ui/src/components/stories/list.rs +++ b/crates/ui/src/components/stories/list.rs @@ -1,8 +1,8 @@ use gpui::Render; use story::Story; -use crate::{prelude::*, ListHeader, ListSeparator, ListSubHeader}; use crate::{List, ListItem}; +use crate::{ListHeader, ListSeparator, ListSubHeader, prelude::*}; pub struct ListStory; diff --git a/crates/ui/src/components/stories/list_header.rs b/crates/ui/src/components/stories/list_header.rs index c9756ec258158e085107b7e8541dfe0a249f7b70..67e9ecd0beb6c7328c505291fb59c49e27d12540 100644 --- a/crates/ui/src/components/stories/list_header.rs +++ b/crates/ui/src/components/stories/list_header.rs @@ -1,7 +1,7 @@ use gpui::Render; use story::Story; -use crate::{prelude::*, IconButton}; +use crate::{IconButton, prelude::*}; use crate::{IconName, ListHeader}; pub struct ListHeaderStory; diff --git a/crates/ui/src/components/stories/list_item.rs b/crates/ui/src/components/stories/list_item.rs index 6ab7b9ac1e0db840e568b3aa4e01507a4a7f4df8..9edf4b75a7b397906340c0786901c2580326b1d0 100644 --- a/crates/ui/src/components/stories/list_item.rs +++ b/crates/ui/src/components/stories/list_item.rs @@ -1,7 +1,7 @@ use gpui::Render; use story::Story; -use crate::{prelude::*, Avatar}; +use crate::{Avatar, prelude::*}; use crate::{IconName, ListItem}; const OVERFLOWING_TEXT: &str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mauris ligula, luctus vel dignissim eu, vestibulum sed libero. Sed at convallis velit."; diff --git a/crates/ui/src/components/stories/tab.rs b/crates/ui/src/components/stories/tab.rs index b5899be5c126f66532547c2209e35ef9cc270661..f23052a63eae15447ee13ba0b4f76019275978c5 100644 --- a/crates/ui/src/components/stories/tab.rs +++ b/crates/ui/src/components/stories/tab.rs @@ -3,7 +3,7 @@ use std::cmp::Ordering; use gpui::Render; use story::Story; -use crate::{prelude::*, IconButtonShape, TabPosition}; +use crate::{IconButtonShape, TabPosition, prelude::*}; use crate::{Indicator, Tab}; pub struct TabStory; diff --git a/crates/ui/src/components/stories/tab_bar.rs b/crates/ui/src/components/stories/tab_bar.rs index 2137ee797b68b8fdefce76a7555849ed367acd4b..30f0d4b2bd3a5299b17f08d17a2408875d1f225d 100644 --- a/crates/ui/src/components/stories/tab_bar.rs +++ b/crates/ui/src/components/stories/tab_bar.rs @@ -1,7 +1,7 @@ use gpui::Render; use story::Story; -use crate::{prelude::*, Tab, TabBar, TabPosition}; +use crate::{Tab, TabBar, TabPosition, prelude::*}; pub struct TabBarStory; diff --git a/crates/ui/src/components/stories/toggle_button.rs b/crates/ui/src/components/stories/toggle_button.rs index 017ec8b255ffe4fc7d162c9ede8c750ff1e025d4..772c920a25d9440e4c79df0d19a01c31da19181f 100644 --- a/crates/ui/src/components/stories/toggle_button.rs +++ b/crates/ui/src/components/stories/toggle_button.rs @@ -1,7 +1,7 @@ use gpui::Render; use story::{Story, StoryItem, StorySection}; -use crate::{prelude::*, ToggleButton}; +use crate::{ToggleButton, prelude::*}; pub struct ToggleButtonStory; diff --git a/crates/ui/src/components/tab_bar.rs b/crates/ui/src/components/tab_bar.rs index cd6781be593cfc7d7412c0f8c665cb38cd949a45..692e0433bc7e3b739f5f38c016984079c9523c43 100644 --- a/crates/ui/src/components/tab_bar.rs +++ b/crates/ui/src/components/tab_bar.rs @@ -1,8 +1,8 @@ use gpui::{AnyElement, ScrollHandle}; use smallvec::SmallVec; -use crate::prelude::*; use crate::Tab; +use crate::prelude::*; #[derive(IntoElement)] pub struct TabBar { diff --git a/crates/ui/src/components/table.rs b/crates/ui/src/components/table.rs index e0979613582952d1faae15fb847c8e11b50a4b97..59bd5c390e7aac91b47ae0d493127489aad66222 100644 --- a/crates/ui/src/components/table.rs +++ b/crates/ui/src/components/table.rs @@ -1,5 +1,5 @@ -use crate::{prelude::*, Indicator}; -use gpui::{div, AnyElement, FontWeight, IntoElement, Length}; +use crate::{Indicator, prelude::*}; +use gpui::{AnyElement, FontWeight, IntoElement, Length, div}; /// A table component #[derive(IntoElement, IntoComponent)] diff --git a/crates/ui/src/components/toggle.rs b/crates/ui/src/components/toggle.rs index 666bff99fec55427cfaef948402dcd5e7d8dbd95..debd97f7156b487fbfbb3abb5a6682ccad24d1ea 100644 --- a/crates/ui/src/components/toggle.rs +++ b/crates/ui/src/components/toggle.rs @@ -1,11 +1,11 @@ use gpui::{ - div, hsla, prelude::*, AnyElement, AnyView, ElementId, Hsla, IntoElement, Styled, Window, + AnyElement, AnyView, ElementId, Hsla, IntoElement, Styled, Window, div, hsla, prelude::*, }; use std::sync::Arc; use crate::utils::is_light; -use crate::{prelude::*, ElevationIndex, KeyBinding}; use crate::{Color, Icon, IconName, ToggleState}; +use crate::{ElevationIndex, KeyBinding, prelude::*}; // TODO: Checkbox, CheckboxWithLabel, and Switch could all be // restructured to use a ToggleLike, similar to Button/Buttonlike, Label/Labellike diff --git a/crates/ui/src/components/tooltip.rs b/crates/ui/src/components/tooltip.rs index f630c8d72271e08a850da62bfe730eea775a9665..b962b9167dc67016d8ed3d7f3c043df1316a6edd 100644 --- a/crates/ui/src/components/tooltip.rs +++ b/crates/ui/src/components/tooltip.rs @@ -3,7 +3,7 @@ use settings::Settings; use theme::ThemeSettings; use crate::prelude::*; -use crate::{h_flex, v_flex, Color, KeyBinding, Label, LabelSize, StyledExt}; +use crate::{Color, KeyBinding, Label, LabelSize, StyledExt, h_flex, v_flex}; #[derive(IntoComponent)] pub struct Tooltip { diff --git a/crates/ui/src/prelude.rs b/crates/ui/src/prelude.rs index 54551daffbe5a6050988543a37814fc904dda81a..2592e464af83117f23ffc07f9e7b4de45c28255e 100644 --- a/crates/ui/src/prelude.rs +++ b/crates/ui/src/prelude.rs @@ -2,32 +2,32 @@ pub use gpui::prelude::*; pub use gpui::{ - div, px, relative, rems, AbsoluteLength, AnyElement, App, Context, DefiniteLength, Div, - Element, ElementId, InteractiveElement, ParentElement, Pixels, Rems, RenderOnce, SharedString, - Styled, Window, + AbsoluteLength, AnyElement, App, Context, DefiniteLength, Div, Element, ElementId, + InteractiveElement, ParentElement, Pixels, Rems, RenderOnce, SharedString, Styled, Window, div, + px, relative, rems, }; pub use component::{ - example_group, example_group_with_title, single_example, ComponentPreview, ComponentScope, + ComponentPreview, ComponentScope, example_group, example_group_with_title, single_example, }; pub use ui_macros::IntoComponent; +pub use crate::DynamicSpacing; pub use crate::animation::{AnimationDirection, AnimationDuration, DefaultAnimations}; -pub use crate::styles::{rems_from_px, vh, vw, PlatformStyle, StyledTypography, TextSize}; +pub use crate::styles::{PlatformStyle, StyledTypography, TextSize, rems_from_px, vh, vw}; pub use crate::traits::clickable::*; pub use crate::traits::disableable::*; pub use crate::traits::fixed::*; pub use crate::traits::styled_ext::*; pub use crate::traits::toggleable::*; pub use crate::traits::visible_on_hover::*; -pub use crate::DynamicSpacing; -pub use crate::{h_container, h_flex, v_container, v_flex}; -pub use crate::{ - h_group, h_group_lg, h_group_sm, h_group_xl, v_group, v_group_lg, v_group_sm, v_group_xl, -}; pub use crate::{Button, ButtonSize, ButtonStyle, IconButton, SelectableButton}; pub use crate::{ButtonCommon, Color}; pub use crate::{Headline, HeadlineSize}; pub use crate::{Icon, IconName, IconPosition, IconSize}; pub use crate::{Label, LabelCommon, LabelSize, LineHeightStyle}; +pub use crate::{h_container, h_flex, v_container, v_flex}; +pub use crate::{ + h_group, h_group_lg, h_group_sm, h_group_xl, v_group, v_group_lg, v_group_sm, v_group_xl, +}; pub use theme::ActiveTheme; diff --git a/crates/ui/src/styles/animation.rs b/crates/ui/src/styles/animation.rs index d15a6c9f4ce45c14282912a286f5eefb481d009f..a4d5ba145d420eb7306158a8f331284d122cbd62 100644 --- a/crates/ui/src/styles/animation.rs +++ b/crates/ui/src/styles/animation.rs @@ -1,4 +1,4 @@ -use crate::{prelude::*, ContentGroup}; +use crate::{ContentGroup, prelude::*}; use gpui::{AnimationElement, AnimationExt, Styled}; use std::time::Duration; diff --git a/crates/ui/src/styles/elevation.rs b/crates/ui/src/styles/elevation.rs index aea91c8d5fd749ac8e112890efff318a3c0a179c..5967a8f6b8770386124f9054730c3c0ba341d323 100644 --- a/crates/ui/src/styles/elevation.rs +++ b/crates/ui/src/styles/elevation.rs @@ -1,7 +1,7 @@ use std::fmt::{self, Display, Formatter}; -use gpui::{hsla, point, px, App, BoxShadow, Hsla}; -use smallvec::{smallvec, SmallVec}; +use gpui::{App, BoxShadow, Hsla, hsla, point, px}; +use smallvec::{SmallVec, smallvec}; use theme::{ActiveTheme, Appearance}; /// Today, elevation is primarily used to add shadows to elements, and set the correct background for elements like buttons. diff --git a/crates/ui/src/styles/spacing.rs b/crates/ui/src/styles/spacing.rs index 221d3bc774737aa30b1e31e7e668d66ff3660d65..c6629f5d8829b2ebd59a80a2a22c033ab8c389f6 100644 --- a/crates/ui/src/styles/spacing.rs +++ b/crates/ui/src/styles/spacing.rs @@ -1,4 +1,4 @@ -use gpui::{px, rems, App, Pixels, Rems}; +use gpui::{App, Pixels, Rems, px, rems}; use settings::Settings; use theme::{ThemeSettings, UiDensity}; use ui_macros::derive_dynamic_spacing; diff --git a/crates/ui/src/styles/typography.rs b/crates/ui/src/styles/typography.rs index 09146fe67b38fb55a08d59f5d9290a5bac1526ee..c57d157c1abaf26f583965fdd217aa34cb99e17e 100644 --- a/crates/ui/src/styles/typography.rs +++ b/crates/ui/src/styles/typography.rs @@ -1,12 +1,12 @@ use crate::prelude::*; use gpui::{ - div, rems, AnyElement, App, IntoElement, ParentElement, Rems, RenderOnce, SharedString, Styled, - Window, + AnyElement, App, IntoElement, ParentElement, Rems, RenderOnce, SharedString, Styled, Window, + div, rems, }; use settings::Settings; use theme::{ActiveTheme, ThemeSettings}; -use crate::{rems_from_px, Color}; +use crate::{Color, rems_from_px}; /// Extends [`gpui::Styled`] with typography-related styling methods. pub trait StyledTypography: Styled + Sized { diff --git a/crates/ui/src/styles/units.rs b/crates/ui/src/styles/units.rs index aae4137534f7cd9bc69323e3b5c996485e112d53..c859b459c677e58c76019b7e25fa17bb9ab7422d 100644 --- a/crates/ui/src/styles/units.rs +++ b/crates/ui/src/styles/units.rs @@ -1,4 +1,4 @@ -use gpui::{rems, Length, Rems, Window}; +use gpui::{Length, Rems, Window, rems}; /// The base size of a rem, in pixels. pub const BASE_REM_SIZE_IN_PX: f32 = 16.; diff --git a/crates/ui/src/tests/path_str.rs b/crates/ui/src/tests/path_str.rs index 6c1545ec7104d026c18cee8292ace7a010960e99..90598d6eb4c12228318b85a6586863139631dd4d 100644 --- a/crates/ui/src/tests/path_str.rs +++ b/crates/ui/src/tests/path_str.rs @@ -3,7 +3,7 @@ #[cfg(test)] mod tests { use strum::EnumString; - use ui_macros::{path_str, DerivePathStr}; + use ui_macros::{DerivePathStr, path_str}; #[test] fn test_derive_path_str_with_prefix() { diff --git a/crates/ui/src/traits/styled_ext.rs b/crates/ui/src/traits/styled_ext.rs index 57729b64c1de9230392daddda0d221c4b1c30f2a..1365abf6fd4ca92b8a3e1b621cf72ec37ac08a39 100644 --- a/crates/ui/src/traits/styled_ext.rs +++ b/crates/ui/src/traits/styled_ext.rs @@ -1,7 +1,7 @@ -use gpui::{hsla, App, Styled}; +use gpui::{App, Styled, hsla}; -use crate::prelude::*; use crate::ElevationIndex; +use crate::prelude::*; fn elevated(this: E, cx: &App, index: ElevationIndex) -> E { this.bg(cx.theme().colors().elevated_surface_background) diff --git a/crates/ui/src/utils/with_rem_size.rs b/crates/ui/src/utils/with_rem_size.rs index 1c98747c083791ccc7d420be2046b2b55656c06b..59fcc45823ede36204c2916826601a3ff509fc2d 100644 --- a/crates/ui/src/utils/with_rem_size.rs +++ b/crates/ui/src/utils/with_rem_size.rs @@ -1,7 +1,7 @@ use gpui::{ - div, AnyElement, App, Bounds, Div, DivFrameState, Element, ElementId, GlobalElementId, Hitbox, + AnyElement, App, Bounds, Div, DivFrameState, Element, ElementId, GlobalElementId, Hitbox, InteractiveElement as _, IntoElement, LayoutId, ParentElement, Pixels, StyleRefinement, Styled, - Window, + Window, div, }; /// An element that sets a particular rem size for its children. diff --git a/crates/ui_macros/src/derive_component.rs b/crates/ui_macros/src/derive_component.rs index d49b45675fdbe45c6130f2dcdaeaa79da32389a5..128759e42052bbc24d639d8a069a2f3d8551d831 100644 --- a/crates/ui_macros/src/derive_component.rs +++ b/crates/ui_macros/src/derive_component.rs @@ -1,7 +1,7 @@ use convert_case::{Case, Casing}; use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, DeriveInput, Lit, Meta, MetaList, MetaNameValue, NestedMeta}; +use syn::{DeriveInput, Lit, Meta, MetaList, MetaNameValue, NestedMeta, parse_macro_input}; pub fn derive_into_component(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); diff --git a/crates/ui_macros/src/derive_path_str.rs b/crates/ui_macros/src/derive_path_str.rs index 3988bc0c5c2e080f51a5d0c22070f4ff16f7e9bf..e17471fb18e066ac43946d58b6998754b844b1b5 100644 --- a/crates/ui_macros/src/derive_path_str.rs +++ b/crates/ui_macros/src/derive_path_str.rs @@ -1,7 +1,7 @@ use convert_case::{Case, Casing}; use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, Attribute, Data, DeriveInput, Lit, Meta, NestedMeta}; +use syn::{Attribute, Data, DeriveInput, Lit, Meta, NestedMeta, parse_macro_input}; pub fn derive_path_str(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as DeriveInput); diff --git a/crates/ui_macros/src/dynamic_spacing.rs b/crates/ui_macros/src/dynamic_spacing.rs index a8890aca6b71f4e9c120a2847086ed9dda6ccc69..6f9744e94cdbafe2c620b81f26ab167908d34c16 100644 --- a/crates/ui_macros/src/dynamic_spacing.rs +++ b/crates/ui_macros/src/dynamic_spacing.rs @@ -1,7 +1,7 @@ use proc_macro::TokenStream; use quote::{format_ident, quote}; use syn::{ - parse::Parse, parse::ParseStream, parse_macro_input, punctuated::Punctuated, LitInt, Token, + LitInt, Token, parse::Parse, parse::ParseStream, parse_macro_input, punctuated::Punctuated, }; struct DynamicSpacingInput { diff --git a/crates/ui_prompt/src/ui_prompt.rs b/crates/ui_prompt/src/ui_prompt.rs index 780a94cff3b13e0000aa9c58faa4fa8ecb5b9a32..a4602c95f050b0e95689bdf67a3d79523d194681 100644 --- a/crates/ui_prompt/src/ui_prompt.rs +++ b/crates/ui_prompt/src/ui_prompt.rs @@ -1,14 +1,15 @@ use gpui::{ - div, App, AppContext as _, Context, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, + App, AppContext as _, Context, Entity, EventEmitter, FocusHandle, Focusable, FontWeight, InteractiveElement, IntoElement, ParentElement, PromptHandle, PromptLevel, PromptResponse, Refineable, Render, RenderablePromptHandle, SharedString, Styled, TextStyleRefinement, Window, + div, }; use markdown::{Markdown, MarkdownStyle}; use settings::{Settings, SettingsStore}; use theme::ThemeSettings; use ui::{ - h_flex, v_flex, ActiveTheme, ButtonCommon, ButtonStyle, Clickable, ElevationIndex, - FluentBuilder, LabelSize, StyledExt, TintColor, + ActiveTheme, ButtonCommon, ButtonStyle, Clickable, ElevationIndex, FluentBuilder, LabelSize, + StyledExt, TintColor, h_flex, v_flex, }; use workspace::WorkspaceSettings; diff --git a/crates/util/src/fs.rs b/crates/util/src/fs.rs index d6baf9364b701686de7fc9bfb9af9a2d87e20d25..92292d56ca8aaf3b4a929e1799225f34c51339f5 100644 --- a/crates/util/src/fs.rs +++ b/crates/util/src/fs.rs @@ -1,5 +1,5 @@ use crate::ResultExt; -use anyhow::{bail, Result}; +use anyhow::{Result, bail}; use async_fs as fs; use futures_lite::StreamExt; use std::path::{Path, PathBuf}; diff --git a/crates/util/src/util.rs b/crates/util/src/util.rs index 9c8efb5bb27e93af148b3b8c3041db377ea7adc7..e1917de3037dde6e960566c97bee71a1b9641375 100644 --- a/crates/util/src/util.rs +++ b/crates/util/src/util.rs @@ -25,7 +25,7 @@ use std::{ use unicase::UniCase; #[cfg(unix)] -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; pub use take_until::*; #[cfg(any(test, feature = "test-support"))] @@ -727,7 +727,7 @@ pub fn defer(f: F) -> Deferred { #[cfg(any(test, feature = "test-support"))] mod rng { - use rand::{seq::SliceRandom, Rng}; + use rand::{Rng, seq::SliceRandom}; pub struct RandomCharIter { rng: T, simple_text: bool, diff --git a/crates/util_macros/src/util_macros.rs b/crates/util_macros/src/util_macros.rs index df48be8c9973270d2cf02b59571b49e116bca9ec..ebe3517d56d26d53020fee614a24ea6f5b10c85c 100644 --- a/crates/util_macros/src/util_macros.rs +++ b/crates/util_macros/src/util_macros.rs @@ -2,7 +2,7 @@ use proc_macro::TokenStream; use quote::quote; -use syn::{parse_macro_input, LitStr}; +use syn::{LitStr, parse_macro_input}; /// This macro replaces the path separator `/` with `\` for Windows. /// But if the target OS is not Windows, the path is returned as is. diff --git a/crates/vim/src/change_list.rs b/crates/vim/src/change_list.rs index 25bcfc20be27f973a5c6ca79ae84c9bfa62e44de..baa72dbc1f39003265be269ea34af64637f51190 100644 --- a/crates/vim/src/change_list.rs +++ b/crates/vim/src/change_list.rs @@ -1,9 +1,9 @@ use editor::{ - display_map::ToDisplayPoint, movement, scroll::Autoscroll, Anchor, Bias, Direction, Editor, + Anchor, Bias, Direction, Editor, display_map::ToDisplayPoint, movement, scroll::Autoscroll, }; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; -use crate::{state::Mode, Vim}; +use crate::{Vim, state::Mode}; actions!(vim, [ChangeListOlder, ChangeListNewer]); diff --git a/crates/vim/src/command.rs b/crates/vim/src/command.rs index b31bbbd326cb095f580ddd425795a1963b545aaf..5989b1e8ed95d66b060d508da23c573b455783c6 100644 --- a/crates/vim/src/command.rs +++ b/crates/vim/src/command.rs @@ -1,13 +1,13 @@ -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use collections::HashMap; use command_palette_hooks::CommandInterceptResult; use editor::{ + Bias, Editor, ToPoint, actions::{SortLinesCaseInsensitive, SortLinesCaseSensitive}, display_map::ToDisplayPoint, scroll::Autoscroll, - Bias, Editor, ToPoint, }; -use gpui::{actions, impl_internal_actions, Action, App, AppContext as _, Context, Global, Window}; +use gpui::{Action, App, AppContext as _, Context, Global, Window, actions, impl_internal_actions}; use itertools::Itertools; use language::Point; use multi_buffer::MultiBufferRow; @@ -27,19 +27,19 @@ use std::{ use task::{HideStrategy, RevealStrategy, SpawnInTerminal, TaskId}; use ui::ActiveTheme; use util::ResultExt; -use workspace::{notifications::NotifyResultExt, SaveIntent}; +use workspace::{SaveIntent, notifications::NotifyResultExt}; use zed_actions::RevealTarget; use crate::{ + ToggleMarksView, ToggleRegistersView, Vim, motion::{EndOfDocument, Motion, MotionKind, StartOfDocument}, normal::{ - search::{FindCommand, ReplaceCommand, Replacement}, JoinLines, + search::{FindCommand, ReplaceCommand, Replacement}, }, object::Object, state::{Mark, Mode}, visual::VisualDeleteLine, - ToggleMarksView, ToggleRegistersView, Vim, }; #[derive(Clone, Debug, PartialEq)] diff --git a/crates/vim/src/digraph.rs b/crates/vim/src/digraph.rs index f8e7ece1a0c982b3c3e85855c8f16b1ddd5bfdd2..9852b51ade20fe0b639d8f189caacc1ae467c814 100644 --- a/crates/vim/src/digraph.rs +++ b/crates/vim/src/digraph.rs @@ -2,13 +2,13 @@ use std::sync::Arc; use collections::HashMap; use editor::Editor; -use gpui::{impl_actions, App, Context, Keystroke, KeystrokeEvent, Window}; +use gpui::{App, Context, Keystroke, KeystrokeEvent, Window, impl_actions}; use schemars::JsonSchema; use serde::Deserialize; use settings::Settings; use std::sync::LazyLock; -use crate::{state::Operator, Vim, VimSettings}; +use crate::{Vim, VimSettings, state::Operator}; mod default; @@ -229,9 +229,9 @@ mod test { use settings::SettingsStore; use crate::{ + VimSettings, state::Mode, test::{NeovimBackedTestContext, VimTestContext}, - VimSettings, }; #[gpui::test] diff --git a/crates/vim/src/helix.rs b/crates/vim/src/helix.rs index cc91c9bf53debc03d30ae4aba7738b81fd3a3724..33b73ae1a7edc15ed7b27e0c7be8e31266fc3c90 100644 --- a/crates/vim/src/helix.rs +++ b/crates/vim/src/helix.rs @@ -1,10 +1,10 @@ -use editor::{movement, scroll::Autoscroll, DisplayPoint, Editor}; -use gpui::{actions, Action}; +use editor::{DisplayPoint, Editor, movement, scroll::Autoscroll}; +use gpui::{Action, actions}; use gpui::{Context, Window}; use language::{CharClassifier, CharKind}; use crate::motion::MotionKind; -use crate::{motion::Motion, state::Mode, Vim}; +use crate::{Vim, motion::Motion, state::Mode}; actions!(vim, [HelixNormalAfter, HelixDelete]); diff --git a/crates/vim/src/indent.rs b/crates/vim/src/indent.rs index 83b4e3cdaabaadcfae71b66199ab3dea595d1697..3f0ed5251f3fe77ee2224123114e628a6f3bfb51 100644 --- a/crates/vim/src/indent.rs +++ b/crates/vim/src/indent.rs @@ -1,6 +1,6 @@ -use crate::{motion::Motion, object::Object, state::Mode, Vim}; +use crate::{Vim, motion::Motion, object::Object, state::Mode}; use collections::HashMap; -use editor::{display_map::ToDisplayPoint, Bias, Editor}; +use editor::{Bias, Editor, display_map::ToDisplayPoint}; use gpui::actions; use gpui::{Context, Window}; use language::SelectionGoal; diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rs index 22c2d524755600dafdf32443249b68ccc99861d6..550d5b57fd01d4f2952817a5d36f4d2eef7e3fbe 100644 --- a/crates/vim/src/insert.rs +++ b/crates/vim/src/insert.rs @@ -1,6 +1,6 @@ -use crate::{state::Mode, Vim}; -use editor::{scroll::Autoscroll, Bias, Editor}; -use gpui::{actions, Action, Context, Window}; +use crate::{Vim, state::Mode}; +use editor::{Bias, Editor, scroll::Autoscroll}; +use gpui::{Action, Context, Window, actions}; use language::SelectionGoal; actions!(vim, [NormalBefore, TemporaryNormal]); diff --git a/crates/vim/src/mode_indicator.rs b/crates/vim/src/mode_indicator.rs index 9bd37478bcd6c33343b9b56ca2d283eb33d04b52..d54b270074f1928b6308fbfef1c6c3a04f1b851b 100644 --- a/crates/vim/src/mode_indicator.rs +++ b/crates/vim/src/mode_indicator.rs @@ -1,6 +1,6 @@ -use gpui::{div, Context, Element, Entity, Render, Subscription, WeakEntity, Window}; +use gpui::{Context, Element, Entity, Render, Subscription, WeakEntity, Window, div}; use ui::text_for_keystrokes; -use workspace::{item::ItemHandle, ui::prelude::*, StatusItemView}; +use workspace::{StatusItemView, item::ItemHandle, ui::prelude::*}; use crate::{Vim, VimEvent, VimGlobals}; diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rs index 56148654197b3bd57b4335ba146fe6b7b3218c5a..afec9fe0aa2c77548edc194e3e10dc6e0ff1f49a 100644 --- a/crates/vim/src/motion.rs +++ b/crates/vim/src/motion.rs @@ -1,12 +1,12 @@ use editor::{ + Anchor, Bias, DisplayPoint, Editor, RowExt, ToOffset, ToPoint, display_map::{DisplayRow, DisplaySnapshot, FoldPoint, ToDisplayPoint}, movement::{ - self, find_boundary, find_preceding_boundary_display_point, FindRange, TextLayoutDetails, + self, FindRange, TextLayoutDetails, find_boundary, find_preceding_boundary_display_point, }, scroll::Autoscroll, - Anchor, Bias, DisplayPoint, Editor, RowExt, ToOffset, ToPoint, }; -use gpui::{action_with_deprecated_aliases, actions, impl_actions, px, Context, Window}; +use gpui::{Context, Window, action_with_deprecated_aliases, actions, impl_actions, px}; use language::{CharKind, Point, Selection, SelectionGoal}; use multi_buffer::MultiBufferRow; use schemars::JsonSchema; @@ -15,10 +15,10 @@ use std::ops::Range; use workspace::searchable::Direction; use crate::{ + Vim, normal::mark, state::{Mode, Operator}, surrounds::SurroundsType, - Vim, }; #[derive(Clone, Copy, Debug, PartialEq, Eq)] diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index 693785005b483ce9bbf650b87ddd811e55f72011..40fee8fe13b9f466bee5c435e7daceaf0dadf6f6 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -15,21 +15,21 @@ use std::collections::HashMap; use std::sync::Arc; use crate::{ + Vim, indent::IndentDirection, - motion::{self, first_non_whitespace, next_line_end, right, Motion}, + motion::{self, Motion, first_non_whitespace, next_line_end, right}, object::Object, state::{Mark, Mode, Operator}, surrounds::SurroundsType, - Vim, }; use case::CaseTarget; use collections::BTreeSet; -use editor::scroll::Autoscroll; use editor::Anchor; use editor::Bias; use editor::Editor; +use editor::scroll::Autoscroll; use editor::{display_map::ToDisplayPoint, movement}; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; use language::{Point, SelectionGoal, ToPoint}; use log::error; use multi_buffer::MultiBufferRow; @@ -630,10 +630,9 @@ mod test { use settings::SettingsStore; use crate::{ - motion, + VimSettings, motion, state::Mode::{self}, test::{NeovimBackedTestContext, VimTestContext}, - VimSettings, }; #[gpui::test] diff --git a/crates/vim/src/normal/case.rs b/crates/vim/src/normal/case.rs index 72501895bc6f5d24617d2012691105961a993e53..8e6aa5f44d8c7f1b6501d56b236c02639cb6f337 100644 --- a/crates/vim/src/normal/case.rs +++ b/crates/vim/src/normal/case.rs @@ -5,11 +5,11 @@ use language::{Bias, Point, SelectionGoal}; use multi_buffer::MultiBufferRow; use crate::{ + Vim, motion::Motion, normal::{ChangeCase, ConvertToLowerCase, ConvertToUpperCase}, object::Object, state::Mode, - Vim, }; pub enum CaseTarget { diff --git a/crates/vim/src/normal/change.rs b/crates/vim/src/normal/change.rs index 1a04cf631183d94dbab0ec72080126a7d5f5c54a..199ac8b0c784c5a5a7ae28514675310551e7b67c 100644 --- a/crates/vim/src/normal/change.rs +++ b/crates/vim/src/normal/change.rs @@ -1,14 +1,14 @@ use crate::{ + Vim, motion::{self, Motion, MotionKind}, object::Object, state::Mode, - Vim, }; use editor::{ + Bias, DisplayPoint, display_map::{DisplaySnapshot, ToDisplayPoint}, movement::TextLayoutDetails, scroll::Autoscroll, - Bias, DisplayPoint, }; use gpui::{Context, Window}; use language::Selection; diff --git a/crates/vim/src/normal/delete.rs b/crates/vim/src/normal/delete.rs index 76aa47da335f9ae5f42822df94500de75ba0e746..afd6bc402cea44bd2932648ec5f8c0c10879848f 100644 --- a/crates/vim/src/normal/delete.rs +++ b/crates/vim/src/normal/delete.rs @@ -1,13 +1,13 @@ use crate::{ + Vim, motion::{Motion, MotionKind}, object::Object, - Vim, }; use collections::{HashMap, HashSet}; use editor::{ + Bias, DisplayPoint, display_map::{DisplaySnapshot, ToDisplayPoint}, scroll::Autoscroll, - Bias, DisplayPoint, }; use gpui::{Context, Window}; use language::{Point, Selection}; diff --git a/crates/vim/src/normal/increment.rs b/crates/vim/src/normal/increment.rs index f404004f95587a9fe2620f31c8ba5a00149b7714..194a5c880319f249de617761d705dec458cb5a4d 100644 --- a/crates/vim/src/normal/increment.rs +++ b/crates/vim/src/normal/increment.rs @@ -1,11 +1,11 @@ -use editor::{scroll::Autoscroll, Editor, MultiBufferSnapshot, ToOffset, ToPoint}; -use gpui::{impl_actions, Context, Window}; +use editor::{Editor, MultiBufferSnapshot, ToOffset, ToPoint, scroll::Autoscroll}; +use gpui::{Context, Window, impl_actions}; use language::{Bias, Point}; use schemars::JsonSchema; use serde::Deserialize; use std::ops::Range; -use crate::{state::Mode, Vim}; +use crate::{Vim, state::Mode}; const BOOLEAN_PAIRS: &[(&str, &str)] = &[("true", "false"), ("yes", "no"), ("on", "off")]; diff --git a/crates/vim/src/normal/mark.rs b/crates/vim/src/normal/mark.rs index f873e4a6d56c709702400aa26824926a36448081..bc31d237f81e055567cf0208a014883c8ec18444 100644 --- a/crates/vim/src/normal/mark.rs +++ b/crates/vim/src/normal/mark.rs @@ -1,10 +1,10 @@ use std::{ops::Range, path::Path, sync::Arc}; use editor::{ + Anchor, Bias, DisplayPoint, Editor, MultiBuffer, display_map::{DisplaySnapshot, ToDisplayPoint}, movement, scroll::Autoscroll, - Anchor, Bias, DisplayPoint, Editor, MultiBuffer, }; use gpui::{Context, Entity, EntityId, UpdateGlobal, Window}; use language::SelectionGoal; @@ -13,9 +13,9 @@ use ui::App; use workspace::OpenOptions; use crate::{ + Vim, motion::{self, Motion}, state::{Mark, Mode, VimGlobals}, - Vim, }; impl Vim { diff --git a/crates/vim/src/normal/paste.rs b/crates/vim/src/normal/paste.rs index 13305062b616ecb8ba67c19d0d921b85c4cf938c..3f3e27c45799ce3fe7b4824a15dbfe9d4b8cdc1b 100644 --- a/crates/vim/src/normal/paste.rs +++ b/crates/vim/src/normal/paste.rs @@ -1,15 +1,15 @@ -use editor::{display_map::ToDisplayPoint, movement, scroll::Autoscroll, DisplayPoint, RowExt}; -use gpui::{impl_actions, Context, Window}; +use editor::{DisplayPoint, RowExt, display_map::ToDisplayPoint, movement, scroll::Autoscroll}; +use gpui::{Context, Window, impl_actions}; use language::{Bias, SelectionGoal}; use schemars::JsonSchema; use serde::Deserialize; use std::cmp; use crate::{ + Vim, motion::{Motion, MotionKind}, object::Object, state::{Mode, Register}, - Vim, }; #[derive(Clone, Deserialize, JsonSchema, PartialEq)] @@ -283,15 +283,15 @@ impl Vim { #[cfg(test)] mod test { use crate::{ + UseSystemClipboard, VimSettings, state::{Mode, Register}, test::{NeovimBackedTestContext, VimTestContext}, - UseSystemClipboard, VimSettings, }; use gpui::ClipboardItem; use indoc::indoc; use language::{ - language_settings::{AllLanguageSettings, LanguageSettingsContent}, LanguageName, + language_settings::{AllLanguageSettings, LanguageSettingsContent}, }; use settings::SettingsStore; diff --git a/crates/vim/src/normal/repeat.rs b/crates/vim/src/normal/repeat.rs index 62066882677a3679ec9a09c8bb3c57d76e4994df..1ffda0b9d9fc654ffcc79b55c906698b53a42a22 100644 --- a/crates/vim/src/normal/repeat.rs +++ b/crates/vim/src/normal/repeat.rs @@ -1,14 +1,14 @@ use std::{cell::RefCell, rc::Rc}; use crate::{ + Vim, insert::NormalBefore, motion::Motion, normal::InsertBefore, state::{Mode, Operator, RecordedSelection, ReplayableAction, VimGlobals}, - Vim, }; use editor::Editor; -use gpui::{actions, Action, App, Context, Window}; +use gpui::{Action, App, Context, Window, actions}; use workspace::Workspace; actions!(vim, [Repeat, EndRepeat, ToggleRecord, ReplayLastRecording]); diff --git a/crates/vim/src/normal/scroll.rs b/crates/vim/src/normal/scroll.rs index a7ae62741ca23d9d40a263cc50dc8018cb91d33e..0b87a3b3453e3b3e52b884e0e60d0a77d765b7a0 100644 --- a/crates/vim/src/normal/scroll.rs +++ b/crates/vim/src/normal/scroll.rs @@ -1,10 +1,10 @@ use crate::Vim; use editor::{ + DisplayPoint, Editor, EditorSettings, display_map::{DisplayRow, ToDisplayPoint}, scroll::ScrollAmount, - DisplayPoint, Editor, EditorSettings, }; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; use language::Bias; use settings::Settings; @@ -163,7 +163,7 @@ mod test { test::{NeovimBackedTestContext, VimTestContext}, }; use editor::{EditorSettings, ScrollBeyondLastLine}; - use gpui::{point, px, size, AppContext as _}; + use gpui::{AppContext as _, point, px, size}; use indoc::indoc; use language::Point; use settings::SettingsStore; diff --git a/crates/vim/src/normal/search.rs b/crates/vim/src/normal/search.rs index fb79be3195e5c32afa393d61916eda818f9c5c7b..11818ce8a98fc7c0478a2558fd97374b9de2b006 100644 --- a/crates/vim/src/normal/search.rs +++ b/crates/vim/src/normal/search.rs @@ -1,18 +1,18 @@ use editor::Editor; -use gpui::{actions, impl_actions, impl_internal_actions, Context, Window}; +use gpui::{Context, Window, actions, impl_actions, impl_internal_actions}; use language::Point; use schemars::JsonSchema; -use search::{buffer_search, BufferSearchBar, SearchOptions}; +use search::{BufferSearchBar, SearchOptions, buffer_search}; use serde_derive::Deserialize; use std::{iter::Peekable, str::Chars, time::Duration}; use util::serde::default_true; use workspace::{notifications::NotifyResultExt, searchable::Direction}; use crate::{ + Vim, command::CommandRange, motion::Motion, state::{Mode, SearchState}, - Vim, }; #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq)] @@ -590,7 +590,7 @@ mod test { test::{NeovimBackedTestContext, VimTestContext}, }; use editor::EditorSettings; - use editor::{display_map::DisplayRow, DisplayPoint}; + use editor::{DisplayPoint, display_map::DisplayRow}; use indoc::indoc; use search::BufferSearchBar; diff --git a/crates/vim/src/normal/substitute.rs b/crates/vim/src/normal/substitute.rs index 55214613c47406e531a1102d6bcc3d2e3abd3351..78c9ec5b3f05ed2fd9727a43a2c0051a96b76a9b 100644 --- a/crates/vim/src/normal/substitute.rs +++ b/crates/vim/src/normal/substitute.rs @@ -1,10 +1,10 @@ -use editor::{movement, Editor}; -use gpui::{actions, Context, Window}; +use editor::{Editor, movement}; +use gpui::{Context, Window, actions}; use language::Point; use crate::{ - motion::{Motion, MotionKind}, Mode, Vim, + motion::{Motion, MotionKind}, }; actions!(vim, [Substitute, SubstituteLine]); diff --git a/crates/vim/src/normal/toggle_comments.rs b/crates/vim/src/normal/toggle_comments.rs index f20efaa04be704af1381a33211d1f4e2ebcfdc69..363215ffe2167ea41e966d3dbe93df5dd382ac3f 100644 --- a/crates/vim/src/normal/toggle_comments.rs +++ b/crates/vim/src/normal/toggle_comments.rs @@ -1,6 +1,6 @@ -use crate::{motion::Motion, object::Object, Vim}; +use crate::{Vim, motion::Motion, object::Object}; use collections::HashMap; -use editor::{display_map::ToDisplayPoint, Bias}; +use editor::{Bias, display_map::ToDisplayPoint}; use gpui::{Context, Window}; use language::SelectionGoal; diff --git a/crates/vim/src/normal/yank.rs b/crates/vim/src/normal/yank.rs index 5647367432539507d514165709b76ce5f26c297b..0ec19f654b3160bcdbfb72c69dc4e99dc7625172 100644 --- a/crates/vim/src/normal/yank.rs +++ b/crates/vim/src/normal/yank.rs @@ -1,10 +1,10 @@ use std::{ops::Range, time::Duration}; use crate::{ + Vim, VimSettings, motion::{Motion, MotionKind}, object::Object, state::{Mode, Register}, - Vim, VimSettings, }; use collections::HashMap; use editor::{ClipboardSelection, Editor}; diff --git a/crates/vim/src/object.rs b/crates/vim/src/object.rs index 7a7fcae0cfb634ee105630aaccb5c35509ed1514..c54a3daa4567e38474c4f86ce5b45abb850f353e 100644 --- a/crates/vim/src/object.rs +++ b/crates/vim/src/object.rs @@ -1,16 +1,16 @@ use std::ops::Range; use crate::{ + Vim, motion::right, state::{Mode, Operator}, - Vim, }; use editor::{ + Bias, DisplayPoint, Editor, ToOffset, display_map::{DisplaySnapshot, ToDisplayPoint}, movement::{self, FindRange}, - Bias, DisplayPoint, Editor, ToOffset, }; -use gpui::{actions, impl_actions, Window}; +use gpui::{Window, actions, impl_actions}; use itertools::Itertools; use language::{BufferSnapshot, CharKind, Point, Selection, TextObject, TreeSitterOptions}; use multi_buffer::MultiBufferRow; diff --git a/crates/vim/src/replace.rs b/crates/vim/src/replace.rs index 714ff9d80f19e7e2a5dc30196d025432c05c3e19..26437550a1f1919caba19c8ee4d28b01738e8d71 100644 --- a/crates/vim/src/replace.rs +++ b/crates/vim/src/replace.rs @@ -1,14 +1,14 @@ use crate::{ + Vim, motion::{self, Motion}, object::Object, state::Mode, - Vim, }; use editor::{ - display_map::ToDisplayPoint, scroll::Autoscroll, Anchor, Bias, Editor, EditorSnapshot, - ToOffset, ToPoint, + Anchor, Bias, Editor, EditorSnapshot, ToOffset, ToPoint, display_map::ToDisplayPoint, + scroll::Autoscroll, }; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; use language::{Point, SelectionGoal}; use std::ops::Range; use std::sync::Arc; diff --git a/crates/vim/src/rewrap.rs b/crates/vim/src/rewrap.rs index a62e0ab58e50a37b2394567202dbc23f05448905..f7f234c742874e73c8087e725524a037b889b1b1 100644 --- a/crates/vim/src/rewrap.rs +++ b/crates/vim/src/rewrap.rs @@ -1,7 +1,7 @@ -use crate::{motion::Motion, object::Object, state::Mode, Vim}; +use crate::{Vim, motion::Motion, object::Object, state::Mode}; use collections::HashMap; -use editor::{display_map::ToDisplayPoint, scroll::Autoscroll, Bias, Editor, RewrapOptions}; -use gpui::{actions, Context, Window}; +use editor::{Bias, Editor, RewrapOptions, display_map::ToDisplayPoint, scroll::Autoscroll}; +use gpui::{Context, Window, actions}; use language::SelectionGoal; actions!(vim, [Rewrap]); diff --git a/crates/vim/src/state.rs b/crates/vim/src/state.rs index 1f6383167be3eea66d6e144e517d4adc4efafff1..d982d4221172c47e3d3230d56506f94c4ea422c9 100644 --- a/crates/vim/src/state.rs +++ b/crates/vim/src/state.rs @@ -2,8 +2,8 @@ use crate::command::command_interceptor; use crate::motion::MotionKind; use crate::normal::repeat::Replayer; use crate::surrounds::SurroundsType; -use crate::{motion::Motion, object::Object}; use crate::{ToggleMarksView, ToggleRegistersView, UseSystemClipboard, Vim, VimAddon, VimSettings}; +use crate::{motion::Motion, object::Object}; use anyhow::Result; use collections::HashMap; use command_palette_hooks::{CommandPaletteFilter, CommandPaletteInterceptor}; @@ -28,8 +28,8 @@ use std::{fmt::Display, ops::Range, sync::Arc}; use text::{Bias, ToPoint}; use theme::ThemeSettings; use ui::{ - h_flex, rems, ActiveTheme, Context, Div, FluentBuilder, KeyBinding, ParentElement, - SharedString, Styled, StyledTypography, Window, + ActiveTheme, Context, Div, FluentBuilder, KeyBinding, ParentElement, SharedString, Styled, + StyledTypography, Window, h_flex, rems, }; use util::ResultExt; use workspace::searchable::Direction; diff --git a/crates/vim/src/surrounds.rs b/crates/vim/src/surrounds.rs index 8a902ddea66645a3f51b2e8f91199bbc519d1da8..3c450292e1172f00397f8f3d44c4d16886c029dd 100644 --- a/crates/vim/src/surrounds.rs +++ b/crates/vim/src/surrounds.rs @@ -1,10 +1,10 @@ use crate::{ + Vim, motion::{self, Motion}, object::Object, state::Mode, - Vim, }; -use editor::{movement, scroll::Autoscroll, Bias}; +use editor::{Bias, movement, scroll::Autoscroll}; use gpui::{Context, Window}; use language::BracketPair; @@ -544,7 +544,7 @@ mod test { use gpui::KeyBinding; use indoc::indoc; - use crate::{state::Mode, test::VimTestContext, PushAddSurrounds}; + use crate::{PushAddSurrounds, state::Mode, test::VimTestContext}; #[gpui::test] async fn test_add_surrounds(cx: &mut gpui::TestAppContext) { diff --git a/crates/vim/src/test.rs b/crates/vim/src/test.rs index 4dd301b0e381369fbf8d734208ecccb5373c009c..5e84b32d604e558e4e7f1b8db082e92d9514e143 100644 --- a/crates/vim/src/test.rs +++ b/crates/vim/src/test.rs @@ -7,8 +7,8 @@ use std::time::Duration; use collections::HashMap; use command_palette::CommandPalette; use editor::{ - actions::DeleteLine, display_map::DisplayRow, test::editor_test_context::EditorTestContext, - DisplayPoint, Editor, EditorMode, MultiBuffer, + DisplayPoint, Editor, EditorMode, MultiBuffer, actions::DeleteLine, display_map::DisplayRow, + test::editor_test_context::EditorTestContext, }; use futures::StreamExt; use gpui::{KeyBinding, Modifiers, MouseButton, TestAppContext}; @@ -21,7 +21,7 @@ use indoc::indoc; use search::BufferSearchBar; use workspace::WorkspaceSettings; -use crate::{insert::NormalBefore, motion, state::Mode, PushSneak, PushSneakBackward}; +use crate::{PushSneak, PushSneakBackward, insert::NormalBefore, motion, state::Mode}; #[gpui::test] async fn test_initially_disabled(cx: &mut gpui::TestAppContext) { @@ -228,7 +228,9 @@ async fn test_escape_command_palette(cx: &mut gpui::TestAppContext) { cx.set_state("aˇbc\n", Mode::Normal); cx.simulate_keystrokes("i cmd-shift-p"); - assert!(cx.workspace(|workspace, _, cx| workspace.active_modal::(cx).is_some())); + assert!( + cx.workspace(|workspace, _, cx| workspace.active_modal::(cx).is_some()) + ); cx.simulate_keystrokes("escape"); cx.run_until_parked(); assert!( diff --git a/crates/vim/src/test/neovim_backed_test_context.rs b/crates/vim/src/test/neovim_backed_test_context.rs index 963335f88d1b55df5db9e0375875bcf40e483521..271da1b2918af3d103665e7d12200fc40c47176c 100644 --- a/crates/vim/src/test/neovim_backed_test_context.rs +++ b/crates/vim/src/test/neovim_backed_test_context.rs @@ -1,4 +1,4 @@ -use gpui::{px, size, AppContext as _, UpdateGlobal}; +use gpui::{AppContext as _, UpdateGlobal, px, size}; use indoc::indoc; use settings::SettingsStore; use std::{ @@ -9,7 +9,7 @@ use std::{ use language::language_settings::{AllLanguageSettings, SoftWrap}; use util::test::marked_text_offsets; -use super::{neovim_connection::NeovimConnection, VimTestContext}; +use super::{VimTestContext, neovim_connection::NeovimConnection}; use crate::state::{Mode, VimGlobals}; pub struct NeovimBackedTestContext { diff --git a/crates/vim/src/test/neovim_connection.rs b/crates/vim/src/test/neovim_connection.rs index a0a2343bdfb811330d5eea7811181f0accecb6cd..46ea261cd65b6a43005a44b58c870ab6cedd5f5c 100644 --- a/crates/vim/src/test/neovim_connection.rs +++ b/crates/vim/src/test/neovim_connection.rs @@ -17,7 +17,7 @@ use language::Point; #[cfg(feature = "neovim")] use nvim_rs::{ - create::tokio::new_child_cmd, error::LoopError, Handler, Neovim, UiAttachOptions, Value, + Handler, Neovim, UiAttachOptions, Value, create::tokio::new_child_cmd, error::LoopError, }; #[cfg(feature = "neovim")] use parking_lot::ReentrantMutex; diff --git a/crates/vim/src/test/vim_test_context.rs b/crates/vim/src/test/vim_test_context.rs index e163ba499abad4bfd5900337c48e7b66c096cd1b..32e8de3af59ec65a9aa5b8d41eb65caaa6ce6135 100644 --- a/crates/vim/src/test/vim_test_context.rs +++ b/crates/vim/src/test/vim_test_context.rs @@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut}; use editor::test::editor_lsp_test_context::EditorLspTestContext; use gpui::{Context, Entity, SemanticVersion, UpdateGlobal}; -use search::{project_search::ProjectSearchBar, BufferSearchBar}; +use search::{BufferSearchBar, project_search::ProjectSearchBar}; use crate::{state::Operator, *}; diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rs index c4f9f110057309bb25e088363e36bac4c47fe80b..99ec321d572e3b6b9b8716cbc2662e0aff001020 100644 --- a/crates/vim/src/vim.rs +++ b/crates/vim/src/vim.rs @@ -22,12 +22,12 @@ mod visual; use anyhow::Result; use collections::HashMap; use editor::{ - movement::{self, FindRange}, Anchor, Bias, Editor, EditorEvent, EditorMode, EditorSettings, ToPoint, + movement::{self, FindRange}, }; use gpui::{ - actions, impl_actions, Action, App, AppContext, Axis, Context, Entity, EventEmitter, - KeyContext, KeystrokeEvent, Render, Subscription, Task, WeakEntity, Window, + Action, App, AppContext, Axis, Context, Entity, EventEmitter, KeyContext, KeystrokeEvent, + Render, Subscription, Task, WeakEntity, Window, actions, impl_actions, }; use insert::{NormalBefore, TemporaryNormal}; use language::{CharKind, CursorShape, Point, Selection, SelectionGoal, TransactionId}; @@ -38,12 +38,12 @@ use object::Object; use schemars::JsonSchema; use serde::Deserialize; use serde_derive::Serialize; -use settings::{update_settings_file, Settings, SettingsSources, SettingsStore}; +use settings::{Settings, SettingsSources, SettingsStore, update_settings_file}; use state::{Mode, Operator, RecordedSelection, SearchState, VimGlobals}; use std::{mem, ops::Range, sync::Arc}; use surrounds::SurroundsType; use theme::ThemeSettings; -use ui::{px, IntoElement, SharedString}; +use ui::{IntoElement, SharedString, px}; use vim_mode_setting::VimModeSetting; use workspace::{self, Pane, Workspace}; diff --git a/crates/vim/src/visual.rs b/crates/vim/src/visual.rs index 1c1e7a4017b3e105ccd1f33d065e305d24dbc2b7..6fcbf74970a15d323b837e1af56e4c7ac1f282bf 100644 --- a/crates/vim/src/visual.rs +++ b/crates/vim/src/visual.rs @@ -2,12 +2,12 @@ use std::sync::Arc; use collections::HashMap; use editor::{ + Bias, DisplayPoint, Editor, ToOffset, display_map::{DisplaySnapshot, ToDisplayPoint}, movement, scroll::Autoscroll, - Bias, DisplayPoint, Editor, ToOffset, }; -use gpui::{actions, Context, Window}; +use gpui::{Context, Window, actions}; use language::{Point, Selection, SelectionGoal}; use multi_buffer::MultiBufferRow; use search::BufferSearchBar; @@ -15,10 +15,10 @@ use util::ResultExt; use workspace::searchable::Direction; use crate::{ - motion::{first_non_whitespace, next_line_end, start_of_line, Motion, MotionKind}, + Vim, + motion::{Motion, MotionKind, first_non_whitespace, next_line_end, start_of_line}, object::Object, state::{Mark, Mode, Operator}, - Vim, }; actions!( diff --git a/crates/welcome/src/base_keymap_picker.rs b/crates/welcome/src/base_keymap_picker.rs index 031b6a97afe902153c9fbd6cd29cacc3554225a4..c0c7c1999e7a0976f5381df50f0a3c5993d84c34 100644 --- a/crates/welcome/src/base_keymap_picker.rs +++ b/crates/welcome/src/base_keymap_picker.rs @@ -1,16 +1,16 @@ use super::base_keymap_setting::BaseKeymap; -use fuzzy::{match_strings, StringMatch, StringMatchCandidate}; +use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{ - actions, App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, Task, WeakEntity, - Window, + App, Context, DismissEvent, Entity, EventEmitter, Focusable, Render, Task, WeakEntity, Window, + actions, }; use picker::{Picker, PickerDelegate}; use project::Fs; -use settings::{update_settings_file, Settings}; +use settings::{Settings, update_settings_file}; use std::sync::Arc; -use ui::{prelude::*, ListItem, ListItemSpacing}; +use ui::{ListItem, ListItemSpacing, prelude::*}; use util::ResultExt; -use workspace::{ui::HighlightedLabel, ModalView, Workspace}; +use workspace::{ModalView, Workspace, ui::HighlightedLabel}; actions!(welcome, [ToggleBaseKeymapSelector]); diff --git a/crates/welcome/src/multibuffer_hint.rs b/crates/welcome/src/multibuffer_hint.rs index 5ba6b8fe4705ec99b63b699cec0dd3dfcd577a34..ed202006197a2281e9b2557de0f5d215b9ca6313 100644 --- a/crates/welcome/src/multibuffer_hint.rs +++ b/crates/welcome/src/multibuffer_hint.rs @@ -1,10 +1,10 @@ use std::collections::HashSet; -use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::OnceLock; +use std::sync::atomic::{AtomicUsize, Ordering}; use db::kvp::KEY_VALUE_STORE; use gpui::{App, EntityId, EventEmitter, Subscription}; -use ui::{prelude::*, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*}; use workspace::item::{ItemEvent, ItemHandle}; use workspace::{ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView}; diff --git a/crates/welcome/src/welcome.rs b/crates/welcome/src/welcome.rs index fa2b37e8f79fff1151cb04e2f2253e4a322a73d1..aa69517c9f81b0694acc8ff4daa982cd32b2dd2e 100644 --- a/crates/welcome/src/welcome.rs +++ b/crates/welcome/src/welcome.rs @@ -2,21 +2,22 @@ mod base_keymap_picker; mod base_keymap_setting; mod multibuffer_hint; -use client::{telemetry::Telemetry, TelemetrySettings}; +use client::{TelemetrySettings, telemetry::Telemetry}; use db::kvp::KEY_VALUE_STORE; use gpui::{ - actions, svg, Action, App, Context, Entity, EventEmitter, FocusHandle, Focusable, - InteractiveElement, ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, + Action, App, Context, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + ParentElement, Render, Styled, Subscription, Task, WeakEntity, Window, actions, svg, }; -use language::language_settings::{all_language_settings, EditPredictionProvider}; +use language::language_settings::{EditPredictionProvider, all_language_settings}; use settings::{Settings, SettingsStore}; use std::sync::Arc; -use ui::{prelude::*, CheckboxWithLabel, ElevationIndex, Tooltip}; +use ui::{CheckboxWithLabel, ElevationIndex, Tooltip, prelude::*}; use vim_mode_setting::VimModeSetting; use workspace::{ + AppState, Welcome, Workspace, WorkspaceId, dock::DockPosition, item::{Item, ItemEvent}, - open_new, AppState, Welcome, Workspace, WorkspaceId, + open_new, }; pub use base_keymap_setting::BaseKeymap; diff --git a/crates/workspace/src/dock.rs b/crates/workspace/src/dock.rs index a7696777ebacd95a064d73782aeed6f1e0ab7e51..ddd509466f1098479bbf18eb008d9ff34d74022f 100644 --- a/crates/workspace/src/dock.rs +++ b/crates/workspace/src/dock.rs @@ -1,18 +1,19 @@ use crate::persistence::model::DockData; -use crate::{status_bar::StatusItemView, Workspace}; use crate::{DraggedDock, Event, ModalLayer, Pane}; +use crate::{Workspace, status_bar::StatusItemView}; use anyhow::Context as _; use client::proto; use gpui::{ - deferred, div, px, Action, AnyView, App, Axis, Context, Corner, Entity, EntityId, EventEmitter, - FocusHandle, Focusable, IntoElement, KeyContext, MouseButton, MouseDownEvent, MouseUpEvent, - ParentElement, Render, SharedString, StyleRefinement, Styled, Subscription, WeakEntity, Window, + Action, AnyView, App, Axis, Context, Corner, Entity, EntityId, EventEmitter, FocusHandle, + Focusable, IntoElement, KeyContext, MouseButton, MouseDownEvent, MouseUpEvent, ParentElement, + Render, SharedString, StyleRefinement, Styled, Subscription, WeakEntity, Window, deferred, div, + px, }; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use settings::SettingsStore; use std::sync::Arc; -use ui::{h_flex, ContextMenu, Divider, DividerColor, IconButton, Tooltip}; +use ui::{ContextMenu, Divider, DividerColor, IconButton, Tooltip, h_flex}; use ui::{prelude::*, right_click_menu}; pub(crate) const RESIZE_HANDLE_SIZE: Pixels = Pixels(6.); @@ -930,7 +931,7 @@ impl StatusItemView for PanelButtons { #[cfg(any(test, feature = "test-support"))] pub mod test { use super::*; - use gpui::{actions, div, App, Context, Window}; + use gpui::{App, Context, Window, actions, div}; pub struct TestPanel { pub position: DockPosition, diff --git a/crates/workspace/src/item.rs b/crates/workspace/src/item.rs index 47e7e917dd5dc281df4f93e5ce42313babdf9b4f..0cf241ca8c9d28c9be0a0ded4d1ad48d9623f733 100644 --- a/crates/workspace/src/item.rs +++ b/crates/workspace/src/item.rs @@ -1,17 +1,17 @@ use crate::{ + DelayedDebouncedEditAction, FollowableViewRegistry, ItemNavHistory, SerializableItemRegistry, + ToolbarItemLocation, ViewId, Workspace, WorkspaceId, pane::{self, Pane}, persistence::model::ItemId, searchable::SearchableItemHandle, workspace_settings::{AutosaveSetting, WorkspaceSettings}, - DelayedDebouncedEditAction, FollowableViewRegistry, ItemNavHistory, SerializableItemRegistry, - ToolbarItemLocation, ViewId, Workspace, WorkspaceId, }; use anyhow::Result; use client::{ - proto::{self, PeerId}, Client, + proto::{self, PeerId}, }; -use futures::{channel::mpsc, StreamExt}; +use futures::{StreamExt, channel::mpsc}; use gpui::{ Action, AnyElement, AnyView, App, Context, Entity, EntityId, EventEmitter, FocusHandle, Focusable, Font, HighlightStyle, Pixels, Point, Render, SharedString, Task, WeakEntity, Window, diff --git a/crates/workspace/src/notifications.rs b/crates/workspace/src/notifications.rs index 42c35c307727d3aac6de0f1356548c0f1db84c79..3f17b50c392e530fa4b82f25f47eaf55081a3667 100644 --- a/crates/workspace/src/notifications.rs +++ b/crates/workspace/src/notifications.rs @@ -1,13 +1,13 @@ use crate::{Toast, Workspace}; use gpui::{ - svg, AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent, - Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, Render, ScrollHandle, Task, + AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent, + Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, Render, ScrollHandle, Task, svg, }; use parking_lot::Mutex; use std::ops::Deref; use std::sync::{Arc, LazyLock}; use std::{any::TypeId, time::Duration}; -use ui::{prelude::*, Tooltip}; +use ui::{Tooltip, prelude::*}; use util::ResultExt; #[derive(Default)] @@ -408,8 +408,8 @@ pub mod simple_message_notification { use std::sync::Arc; use gpui::{ - div, AnyElement, DismissEvent, EventEmitter, FocusHandle, Focusable, ParentElement, Render, - SharedString, Styled, + AnyElement, DismissEvent, EventEmitter, FocusHandle, Focusable, ParentElement, Render, + SharedString, Styled, div, }; use ui::prelude::*; @@ -770,7 +770,7 @@ pub trait NotifyResultExt { type Ok; fn notify_err(self, workspace: &mut Workspace, cx: &mut Context) - -> Option; + -> Option; fn notify_async_err(self, cx: &mut AsyncWindowContext) -> Option; diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 29f0f0a4adc00938806d51e2b985a2c83b4d6083..71c03d8998c433a80e9d277397805750ce5757a1 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1,4 +1,7 @@ use crate::{ + CloseWindow, NewFile, NewTerminal, OpenInTerminal, OpenOptions, OpenTerminal, OpenVisible, + SplitDirection, ToggleFileFinder, ToggleProjectSymbols, ToggleZoom, Workspace, + WorkspaceItemBuilder, item::{ ActivateOnClose, ClosePosition, Item, ItemHandle, ItemSettings, PreviewTabsSettings, ProjectItemKind, ShowCloseButton, ShowDiagnostics, TabContentParams, TabTooltipContent, @@ -8,19 +11,16 @@ use crate::{ notifications::NotifyResultExt, toolbar::Toolbar, workspace_settings::{AutosaveSetting, TabBarSettings, WorkspaceSettings}, - CloseWindow, NewFile, NewTerminal, OpenInTerminal, OpenOptions, OpenTerminal, OpenVisible, - SplitDirection, ToggleFileFinder, ToggleProjectSymbols, ToggleZoom, Workspace, - WorkspaceItemBuilder, }; use anyhow::Result; use collections::{BTreeSet, HashMap, HashSet, VecDeque}; -use futures::{stream::FuturesUnordered, StreamExt}; +use futures::{StreamExt, stream::FuturesUnordered}; use gpui::{ - actions, anchored, deferred, impl_actions, prelude::*, Action, AnyElement, App, - AsyncWindowContext, ClickEvent, ClipboardItem, Context, Corner, Div, DragMoveEvent, Entity, - EntityId, EventEmitter, ExternalPaths, FocusHandle, FocusOutEvent, Focusable, KeyContext, - MouseButton, MouseDownEvent, NavigationDirection, Pixels, Point, PromptLevel, Render, - ScrollHandle, Subscription, Task, WeakEntity, WeakFocusHandle, Window, + Action, AnyElement, App, AsyncWindowContext, ClickEvent, ClipboardItem, Context, Corner, Div, + DragMoveEvent, Entity, EntityId, EventEmitter, ExternalPaths, FocusHandle, FocusOutEvent, + Focusable, KeyContext, MouseButton, MouseDownEvent, NavigationDirection, Pixels, Point, + PromptLevel, Render, ScrollHandle, Subscription, Task, WeakEntity, WeakFocusHandle, Window, + actions, anchored, deferred, impl_actions, prelude::*, }; use itertools::Itertools; use language::DiagnosticSeverity; @@ -36,18 +36,18 @@ use std::{ path::PathBuf, rc::Rc, sync::{ - atomic::{AtomicUsize, Ordering}, Arc, + atomic::{AtomicUsize, Ordering}, }, }; use theme::ThemeSettings; use ui::{ - prelude::*, right_click_menu, ButtonSize, Color, ContextMenu, ContextMenuEntry, - ContextMenuItem, DecoratedIcon, IconButton, IconButtonShape, IconDecoration, - IconDecorationKind, IconName, IconSize, Indicator, Label, PopoverMenu, PopoverMenuHandle, Tab, - TabBar, TabPosition, Tooltip, + ButtonSize, Color, ContextMenu, ContextMenuEntry, ContextMenuItem, DecoratedIcon, IconButton, + IconButtonShape, IconDecoration, IconDecorationKind, IconName, IconSize, Indicator, Label, + PopoverMenu, PopoverMenuHandle, Tab, TabBar, TabPosition, Tooltip, prelude::*, + right_click_menu, }; -use util::{debug_panic, maybe, truncate_and_remove_front, ResultExt}; +use util::{ResultExt, debug_panic, maybe, truncate_and_remove_front}; /// A selected entry in e.g. project panel. #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -3701,8 +3701,8 @@ mod tests { let pane = workspace.update(cx, |workspace, _| workspace.active_pane().clone()); pane.update_in(cx, |pane, window, cx| { - assert!(pane - .close_active_item( + assert!( + pane.close_active_item( &CloseActiveItem { save_intent: None, close_pinned: false @@ -3710,7 +3710,8 @@ mod tests { window, cx ) - .is_none()) + .is_none() + ) }); } diff --git a/crates/workspace/src/pane_group.rs b/crates/workspace/src/pane_group.rs index ca8d12ebcc21f1f06788a866e39e1321189f024a..e094d93641566d38d490a211bff3a636e3effe25 100644 --- a/crates/workspace/src/pane_group.rs +++ b/crates/workspace/src/pane_group.rs @@ -1,15 +1,15 @@ use crate::{ + AppState, FollowerState, Pane, Workspace, WorkspaceSettings, pane_group::element::pane_axis, workspace_settings::{PaneSplitDirectionHorizontal, PaneSplitDirectionVertical}, - AppState, FollowerState, Pane, Workspace, WorkspaceSettings, }; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use call::{ActiveCall, ParticipantLocation}; use client::proto::PeerId; use collections::HashMap; use gpui::{ - point, size, Along, AnyView, AnyWeakView, Axis, Bounds, Context, Entity, IntoElement, - MouseButton, Pixels, Point, StyleRefinement, Window, + Along, AnyView, AnyWeakView, Axis, Bounds, Context, Entity, IntoElement, MouseButton, Pixels, + Point, StyleRefinement, Window, point, size, }; use parking_lot::Mutex; use project::Project; @@ -803,9 +803,9 @@ mod element { use std::{cell::RefCell, iter, rc::Rc, sync::Arc}; use gpui::{ - px, relative, size, Along, AnyElement, App, Axis, BorderStyle, Bounds, Element, - GlobalElementId, IntoElement, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, - Pixels, Point, Size, Style, WeakEntity, Window, + Along, AnyElement, App, Axis, BorderStyle, Bounds, Element, GlobalElementId, IntoElement, + MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Point, Size, Style, + WeakEntity, Window, px, relative, size, }; use gpui::{CursorStyle, Hitbox}; use parking_lot::Mutex; diff --git a/crates/workspace/src/persistence.rs b/crates/workspace/src/persistence.rs index fb9ba829d7959b2fa6af3e34f74817f11303355a..75ec3b528e6f0028b116b5e96cc48aa74e50721a 100644 --- a/crates/workspace/src/persistence.rs +++ b/crates/workspace/src/persistence.rs @@ -8,10 +8,10 @@ use std::{ sync::Arc, }; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{Context, Result, anyhow, bail}; use client::DevServerProjectId; use db::{define_connection, query, sqlez::connection::Connection, sqlez_macros::sql}; -use gpui::{point, size, Axis, Bounds, WindowBounds, WindowId}; +use gpui::{Axis, Bounds, WindowBounds, WindowId, point, size}; use itertools::Itertools; use project::debugger::breakpoint_store::{BreakpointState, SourceBreakpoint}; @@ -24,7 +24,7 @@ use sqlez::{ }; use ui::px; -use util::{maybe, ResultExt}; +use util::{ResultExt, maybe}; use uuid::Uuid; use crate::WorkspaceId; @@ -259,7 +259,7 @@ impl sqlez::bindable::Bind for SerializedPixels { statement: &sqlez::statement::Statement, start_index: i32, ) -> anyhow::Result { - let this: i32 = self.0 .0 as i32; + let this: i32 = self.0.0 as i32; this.bind(statement, start_index) } } diff --git a/crates/workspace/src/persistence/model.rs b/crates/workspace/src/persistence/model.rs index 0de5d6b3a05fd03b47afb8ec9fe02a049dce7349..da006426753378bf83998bf15fb2239bb057f044 100644 --- a/crates/workspace/src/persistence/model.rs +++ b/crates/workspace/src/persistence/model.rs @@ -1,6 +1,6 @@ use super::{SerializedAxis, SerializedWindowBounds}; use crate::{ - item::ItemHandle, Member, Pane, PaneAxis, SerializableItemRegistry, Workspace, WorkspaceId, + Member, Pane, PaneAxis, SerializableItemRegistry, Workspace, WorkspaceId, item::ItemHandle, }; use anyhow::{Context as _, Result}; use async_recursion::async_recursion; @@ -10,7 +10,7 @@ use db::sqlez::{ }; use gpui::{AsyncWindowContext, Entity, WeakEntity}; use itertools::Itertools as _; -use project::{debugger::breakpoint_store::SourceBreakpoint, Project}; +use project::{Project, debugger::breakpoint_store::SourceBreakpoint}; use remote::ssh_session::SshProjectId; use serde::{Deserialize, Serialize}; use std::{ @@ -18,7 +18,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{paths::SanitizedPath, ResultExt}; +use util::{ResultExt, paths::SanitizedPath}; use uuid::Uuid; #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] diff --git a/crates/workspace/src/searchable.rs b/crates/workspace/src/searchable.rs index c8777df0322b2efa58749c18e4a2e2b79f87e222..e89e949f161ebea85daeb7cdb3b228afb57d3e1e 100644 --- a/crates/workspace/src/searchable.rs +++ b/crates/workspace/src/searchable.rs @@ -8,8 +8,8 @@ use gpui::{ use project::search::SearchQuery; use crate::{ - item::{Item, WeakItemHandle}, ItemHandle, + item::{Item, WeakItemHandle}, }; #[derive(Clone, Debug)] diff --git a/crates/workspace/src/shared_screen.rs b/crates/workspace/src/shared_screen.rs index 7d109074b72fc0ddf85eda38a3dfc0fd0a90e7c3..156424dde6006735a479c13ae5d9980e5b8d6b6e 100644 --- a/crates/workspace/src/shared_screen.rs +++ b/crates/workspace/src/shared_screen.rs @@ -1,15 +1,15 @@ use crate::{ - item::{Item, ItemEvent}, ItemNavHistory, WorkspaceId, + item::{Item, ItemEvent}, }; use call::{RemoteVideoTrack, RemoteVideoTrackView, Room}; -use client::{proto::PeerId, User}; +use client::{User, proto::PeerId}; use gpui::{ - div, AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, - ParentElement, Render, SharedString, Styled, + AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, + ParentElement, Render, SharedString, Styled, div, }; use std::sync::Arc; -use ui::{prelude::*, Icon, IconName}; +use ui::{Icon, IconName, prelude::*}; pub enum Event { Close, diff --git a/crates/workspace/src/theme_preview.rs b/crates/workspace/src/theme_preview.rs index d3a6e7f90d055eeb1ffc8c09f19cbc3ada2a7bf4..60ec195c40b519d1cfdcdef74a14702535b2f141 100644 --- a/crates/workspace/src/theme_preview.rs +++ b/crates/workspace/src/theme_preview.rs @@ -1,12 +1,12 @@ #![allow(unused, dead_code)] -use gpui::{actions, hsla, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Hsla}; +use gpui::{AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Hsla, actions, hsla}; use strum::IntoEnumIterator; use theme::all_theme_colors; use ui::{ - element_cell, prelude::*, string_cell, utils::calculate_contrast_ratio, AudioStatus, Avatar, - AvatarAudioStatusIndicator, AvatarAvailabilityIndicator, ButtonLike, Checkbox, - CheckboxWithLabel, CollaboratorAvailability, ContentGroup, DecoratedIcon, ElevationIndex, - Facepile, IconDecoration, Indicator, KeybindingHint, Switch, Table, TintColor, Tooltip, + AudioStatus, Avatar, AvatarAudioStatusIndicator, AvatarAvailabilityIndicator, ButtonLike, + Checkbox, CheckboxWithLabel, CollaboratorAvailability, ContentGroup, DecoratedIcon, + ElevationIndex, Facepile, IconDecoration, Indicator, KeybindingHint, Switch, Table, TintColor, + Tooltip, element_cell, prelude::*, string_cell, utils::calculate_contrast_ratio, }; use crate::{Item, Workspace}; diff --git a/crates/workspace/src/toast_layer.rs b/crates/workspace/src/toast_layer.rs index d06ad53786c579cf1e2a4ddbde05c8ae0dcbd139..cbefad63fef6938d826af19df0295aa9ba8cb02b 100644 --- a/crates/workspace/src/toast_layer.rs +++ b/crates/workspace/src/toast_layer.rs @@ -3,7 +3,7 @@ use std::{ time::{Duration, Instant}, }; -use gpui::{actions, AnyView, DismissEvent, Entity, FocusHandle, ManagedView, Subscription, Task}; +use gpui::{AnyView, DismissEvent, Entity, FocusHandle, ManagedView, Subscription, Task, actions}; use ui::{animation::DefaultAnimations, prelude::*}; use crate::Workspace; diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 8ddb79ca485015da5236d3cf8c891c133f2b4aaa..2978e365f24a7126de7dd5627ad5564544886b44 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -17,31 +17,31 @@ mod workspace_settings; use dap::DapRegistry; pub use toast_layer::{RunAction, ToastAction, ToastLayer, ToastView}; -use anyhow::{anyhow, Context as _, Result}; -use call::{call_settings::CallSettings, ActiveCall}; +use anyhow::{Context as _, Result, anyhow}; +use call::{ActiveCall, call_settings::CallSettings}; use client::{ - proto::{self, ErrorCode, PanelId, PeerId}, ChannelId, Client, ErrorExt, Status, TypedEnvelope, UserStore, + proto::{self, ErrorCode, PanelId, PeerId}, }; -use collections::{hash_map, HashMap, HashSet}; +use collections::{HashMap, HashSet, hash_map}; use derive_more::{Deref, DerefMut}; pub use dock::Panel; use dock::{Dock, DockPosition, PanelButtons, PanelHandle, RESIZE_HANDLE_SIZE}; use futures::{ + Future, FutureExt, StreamExt, channel::{ mpsc::{self, UnboundedReceiver, UnboundedSender}, oneshot, }, future::try_join_all, - Future, FutureExt, StreamExt, }; use gpui::{ - action_as, actions, canvas, impl_action_as, impl_actions, point, relative, size, - transparent_black, Action, AnyView, AnyWeakView, App, AsyncApp, AsyncWindowContext, Bounds, - Context, CursorStyle, Decorations, DragMoveEvent, Entity, EntityId, EventEmitter, FocusHandle, - Focusable, Global, Hsla, KeyContext, Keystroke, ManagedView, MouseButton, PathPromptOptions, - Point, PromptLevel, Render, ResizeEdge, Size, Stateful, Subscription, Task, Tiling, WeakEntity, - WindowBounds, WindowHandle, WindowId, WindowOptions, + Action, AnyView, AnyWeakView, App, AsyncApp, AsyncWindowContext, Bounds, Context, CursorStyle, + Decorations, DragMoveEvent, Entity, EntityId, EventEmitter, FocusHandle, Focusable, Global, + Hsla, KeyContext, Keystroke, ManagedView, MouseButton, PathPromptOptions, Point, PromptLevel, + Render, ResizeEdge, Size, Stateful, Subscription, Task, Tiling, WeakEntity, WindowBounds, + WindowHandle, WindowId, WindowOptions, action_as, actions, canvas, impl_action_as, + impl_actions, point, relative, size, transparent_black, }; pub use item::{ FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, PreviewTabsSettings, @@ -52,24 +52,24 @@ use language::{LanguageRegistry, Rope}; pub use modal_layer::*; use node_runtime::NodeRuntime; use notifications::{ - simple_message_notification::MessageNotification, DetachAndPromptErr, Notifications, + DetachAndPromptErr, Notifications, simple_message_notification::MessageNotification, }; pub use pane::*; pub use pane_group::*; -pub use persistence::{ - model::{ItemId, LocalPaths, SerializedWorkspaceLocation}, - WorkspaceDb, DB as WORKSPACE_DB, -}; use persistence::{ + DB, SerializedWindowBounds, model::{SerializedSshProject, SerializedWorkspace}, - SerializedWindowBounds, DB, +}; +pub use persistence::{ + DB as WORKSPACE_DB, WorkspaceDb, + model::{ItemId, LocalPaths, SerializedWorkspaceLocation}, }; use postage::stream::Stream; use project::{ - debugger::breakpoint_store::BreakpointStoreEvent, DirectoryLister, Project, ProjectEntryId, - ProjectPath, ResolvedPath, Worktree, WorktreeId, + DirectoryLister, Project, ProjectEntryId, ProjectPath, ResolvedPath, Worktree, WorktreeId, + debugger::breakpoint_store::BreakpointStoreEvent, }; -use remote::{ssh_session::ConnectionIdentifier, SshClientDelegate, SshConnectionOptions}; +use remote::{SshClientDelegate, SshConnectionOptions, ssh_session::ConnectionIdentifier}; use schemars::JsonSchema; use serde::Deserialize; use session::AppSession; @@ -91,7 +91,7 @@ use std::{ hash::{Hash, Hasher}, path::{Path, PathBuf}, rc::Rc, - sync::{atomic::AtomicUsize, Arc, LazyLock, Weak}, + sync::{Arc, LazyLock, Weak, atomic::AtomicUsize}, time::Duration, }; use task::{DebugAdapterConfig, SpawnInTerminal, TaskId}; @@ -99,7 +99,7 @@ use theme::{ActiveTheme, SystemAppearance, ThemeSettings}; pub use toolbar::{Toolbar, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView}; pub use ui; use ui::prelude::*; -use util::{paths::SanitizedPath, serde::default_true, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, paths::SanitizedPath, serde::default_true}; use uuid::Uuid; pub use workspace_settings::{ AutosaveSetting, RestoreOnStartupBehavior, TabBarSettings, WorkspaceSettings, @@ -107,8 +107,8 @@ pub use workspace_settings::{ use crate::notifications::NotificationId; use crate::persistence::{ - model::{DockData, DockStructure, SerializedItem, SerializedPane, SerializedPaneGroup}, SerializedAxis, + model::{DockData, DockStructure, SerializedItem, SerializedPane, SerializedPaneGroup}, }; pub const SERIALIZATION_THROTTLE_TIME: Duration = Duration::from_millis(200); @@ -6918,16 +6918,16 @@ mod tests { use super::*; use crate::{ - dock::{test::TestPanel, PanelEvent}, + dock::{PanelEvent, test::TestPanel}, item::{ - test::{TestItem, TestProjectItem}, ItemEvent, + test::{TestItem, TestProjectItem}, }, }; use fs::FakeFs; use gpui::{ - px, DismissEvent, Empty, EventEmitter, FocusHandle, Focusable, Render, TestAppContext, - UpdateGlobal, VisualTestContext, + DismissEvent, Empty, EventEmitter, FocusHandle, Focusable, Render, TestAppContext, + UpdateGlobal, VisualTestContext, px, }; use project::{Project, ProjectEntryId}; use serde_json::json; diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 89c0a076b3ccb3656c53ab561712be418c71220b..e75bd59edeb68edc354ed400c5214cefe67093b9 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -4,11 +4,12 @@ mod worktree_settings; mod worktree_tests; use ::ignore::gitignore::{Gitignore, GitignoreBuilder}; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use clock::ReplicaId; use collections::{HashMap, HashSet, VecDeque}; -use fs::{copy_recursive, Fs, MTime, PathEvent, RemoveOptions, Watcher}; +use fs::{Fs, MTime, PathEvent, RemoveOptions, Watcher, copy_recursive}; use futures::{ + FutureExt as _, Stream, StreamExt, channel::{ mpsc::{self, UnboundedSender}, oneshot, @@ -16,16 +17,15 @@ use futures::{ future::join_all, select_biased, task::Poll, - FutureExt as _, Stream, StreamExt, }; use fuzzy::CharBag; use git::{ + COMMIT_MESSAGE, DOT_GIT, FSMONITOR_DAEMON, GITIGNORE, GitHostingProviderRegistry, INDEX_LOCK, + LFS_DIR, repository::{Branch, GitRepository, RepoPath, UpstreamTrackingStatus}, status::{ FileStatus, GitSummary, StatusCode, TrackedStatus, UnmergedStatus, UnmergedStatusCode, }, - GitHostingProviderRegistry, COMMIT_MESSAGE, DOT_GIT, FSMONITOR_DAEMON, GITIGNORE, INDEX_LOCK, - LFS_DIR, }; use gpui::{ App, AppContext as _, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, Task, @@ -41,12 +41,12 @@ use postage::{ watch, }; use rpc::{ - proto::{self, split_worktree_update, FromProto, ToProto}, AnyProtoClient, + proto::{self, FromProto, ToProto, split_worktree_update}, }; pub use settings::WorktreeId; use settings::{Settings, SettingsLocation, SettingsStore}; -use smallvec::{smallvec, SmallVec}; +use smallvec::{SmallVec, smallvec}; use smol::channel::{self, Sender}; use std::{ any::Any, @@ -61,16 +61,16 @@ use std::{ path::{Component, Path, PathBuf}, pin::Pin, sync::{ - atomic::{self, AtomicI32, AtomicUsize, Ordering::SeqCst}, Arc, + atomic::{self, AtomicI32, AtomicUsize, Ordering::SeqCst}, }, time::{Duration, Instant}, }; use sum_tree::{Bias, Edit, KeyedItem, SeekTarget, SumTree, Summary, TreeMap, TreeSet, Unit}; use text::{LineEnding, Rope}; use util::{ - paths::{home_dir, PathMatcher, SanitizedPath}, ResultExt, + paths::{PathMatcher, SanitizedPath, home_dir}, }; pub use worktree_settings::WorktreeSettings; @@ -3117,9 +3117,10 @@ impl LocalSnapshot { .strip_prefix(self.abs_path.as_path()) .unwrap(); assert!(self.entry_for_path(ignore_parent_path).is_some()); - assert!(self - .entry_for_path(ignore_parent_path.join(*GITIGNORE)) - .is_some()); + assert!( + self.entry_for_path(ignore_parent_path.join(*GITIGNORE)) + .is_some() + ); } } } @@ -3587,11 +3588,7 @@ pub struct File { impl language::File for File { fn as_local(&self) -> Option<&dyn language::LocalFile> { - if self.is_local { - Some(self) - } else { - None - } + if self.is_local { Some(self) } else { None } } fn disk_state(&self) -> DiskState { diff --git a/crates/worktree/src/worktree_tests.rs b/crates/worktree/src/worktree_tests.rs index 50b693227c517bef6d566bdf80cb9ae4b31e24bf..a4bbdd8937d2d5b854d2b2b73e3744e1112da511 100644 --- a/crates/worktree/src/worktree_tests.rs +++ b/crates/worktree/src/worktree_tests.rs @@ -1,13 +1,13 @@ use crate::{ - worktree_settings::WorktreeSettings, Entry, EntryKind, Event, PathChange, StatusEntry, - WorkDirectory, Worktree, WorktreeModelHandle, + Entry, EntryKind, Event, PathChange, StatusEntry, WorkDirectory, Worktree, WorktreeModelHandle, + worktree_settings::WorktreeSettings, }; use anyhow::Result; use fs::{FakeFs, Fs, RealFs, RemoveOptions}; use git::{ + GITIGNORE, repository::RepoPath, status::{FileStatus, StatusCode, TrackedStatus}, - GITIGNORE, }; use git2::RepositoryInitOptions; use gpui::{AppContext as _, BorrowAppContext, Context, Task, TestAppContext}; @@ -25,7 +25,7 @@ use std::{ path::{Path, PathBuf}, sync::Arc, }; -use util::{path, test::TempTree, ResultExt}; +use util::{ResultExt, path, test::TempTree}; #[gpui::test] async fn test_traversal(cx: &mut TestAppContext) { @@ -1096,12 +1096,14 @@ async fn test_file_scan_inclusions_reindexes_on_setting_change(cx: &mut TestAppC tree.flush_fs_events(cx).await; tree.read_with(cx, |tree, _| { - assert!(tree - .entry_for_path("node_modules") - .is_some_and(|f| f.is_always_included)); - assert!(tree - .entry_for_path("node_modules/prettier/package.json") - .is_some_and(|f| f.is_always_included)); + assert!( + tree.entry_for_path("node_modules") + .is_some_and(|f| f.is_always_included) + ); + assert!( + tree.entry_for_path("node_modules/prettier/package.json") + .is_some_and(|f| f.is_always_included) + ); }); cx.update(|cx| { @@ -1117,12 +1119,14 @@ async fn test_file_scan_inclusions_reindexes_on_setting_change(cx: &mut TestAppC tree.flush_fs_events(cx).await; tree.read_with(cx, |tree, _| { - assert!(tree - .entry_for_path("node_modules") - .is_some_and(|f| !f.is_always_included)); - assert!(tree - .entry_for_path("node_modules/prettier/package.json") - .is_some_and(|f| !f.is_always_included)); + assert!( + tree.entry_for_path("node_modules") + .is_some_and(|f| !f.is_always_included) + ); + assert!( + tree.entry_for_path("node_modules/prettier/package.json") + .is_some_and(|f| !f.is_always_included) + ); }); } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index 0c4e87084284fd7be1b472d7ab286a400e6f3c87..afb4d7952bcaa87a5ed752336ab22355e7dd1a16 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -5,10 +5,10 @@ mod logger; mod reliability; mod zed; -use anyhow::{anyhow, Context as _, Result}; -use clap::{command, Parser}; +use anyhow::{Context as _, Result, anyhow}; +use clap::{Parser, command}; use cli::FORCE_CLI_MODE_ENV_VAR_NAME; -use client::{parse_zed_link, Client, ProxySettings, UserStore}; +use client::{Client, ProxySettings, UserStore, parse_zed_link}; use collab_ui::channel_view::ChannelView; use collections::HashMap; use dap::DapRegistry; @@ -17,12 +17,12 @@ use editor::Editor; use extension::ExtensionHostProxy; use extension_host::ExtensionStore; use fs::{Fs, RealFs}; -use futures::{future, StreamExt}; +use futures::{StreamExt, future}; use git::GitHostingProviderRegistry; use gpui::{App, AppContext as _, Application, AsyncApp, UpdateGlobal as _}; use gpui_tokio::Tokio; -use http_client::{read_proxy_from_env, Uri}; +use http_client::{Uri, read_proxy_from_env}; use language::LanguageRegistry; use prompt_store::PromptBuilder; use reqwest_client::ReqwestClient; @@ -32,10 +32,10 @@ use logger::{init_logger, init_stdout_logger}; use node_runtime::{NodeBinaryOptions, NodeRuntime}; use parking_lot::Mutex; use project::project_settings::ProjectSettings; -use recent_projects::{open_ssh_project, SshSettings}; +use recent_projects::{SshSettings, open_ssh_project}; use release_channel::{AppCommitSha, AppVersion, ReleaseChannel}; use session::{AppSession, Session}; -use settings::{watch_config_file, Settings, SettingsStore}; +use settings::{Settings, SettingsStore, watch_config_file}; use std::{ env, io::{self, IsTerminal}, @@ -47,15 +47,15 @@ use theme::{ ActiveTheme, IconThemeNotFoundError, SystemAppearance, ThemeNotFoundError, ThemeRegistry, ThemeSettings, }; -use util::{maybe, ResultExt, TryFutureExt}; +use util::{ResultExt, TryFutureExt, maybe}; use uuid::Uuid; -use welcome::{show_welcome_view, BaseKeymap, FIRST_OPEN}; +use welcome::{BaseKeymap, FIRST_OPEN, show_welcome_view}; use workspace::{AppState, SerializedWorkspaceLocation, WorkspaceSettings, WorkspaceStore}; use zed::{ - app_menus, build_window_options, derive_paths_with_position, handle_cli_connection, - handle_keymap_file_changes, handle_settings_changed, handle_settings_file_changes, - initialize_workspace, inline_completion_registry, open_paths_with_positions, OpenListener, - OpenRequest, + OpenListener, OpenRequest, app_menus, build_window_options, derive_paths_with_position, + handle_cli_connection, handle_keymap_file_changes, handle_settings_changed, + handle_settings_file_changes, initialize_workspace, inline_completion_registry, + open_paths_with_positions, }; #[cfg(unix)] @@ -174,7 +174,7 @@ fn main() { #[cfg(all(not(debug_assertions), target_os = "windows"))] unsafe { - use windows::Win32::System::Console::{AttachConsole, ATTACH_PARENT_PROCESS}; + use windows::Win32::System::Console::{ATTACH_PARENT_PROCESS, AttachConsole}; if args.foreground { let _ = AttachConsole(ATTACH_PARENT_PROCESS); diff --git a/crates/zed/src/reliability.rs b/crates/zed/src/reliability.rs index 614401b149390747b426eee7f568203888cae258..86d17c83c12ed1f3d524396031fc3e7521c30762 100644 --- a/crates/zed/src/reliability.rs +++ b/crates/zed/src/reliability.rs @@ -2,19 +2,19 @@ use crate::stdout_is_a_pty; use anyhow::{Context as _, Result}; use backtrace::{self, Backtrace}; use chrono::Utc; -use client::{telemetry, TelemetrySettings}; +use client::{TelemetrySettings, telemetry}; use db::kvp::KEY_VALUE_STORE; use gpui::{App, AppContext as _, SemanticVersion}; use http_client::{self, HttpClient, HttpClientWithUrl, HttpRequestExt, Method}; use paths::{crashes_dir, crashes_retired_dir}; use project::Project; -use release_channel::{AppCommitSha, ReleaseChannel, RELEASE_CHANNEL}; +use release_channel::{AppCommitSha, RELEASE_CHANNEL, ReleaseChannel}; use settings::Settings; use smol::stream::StreamExt; use std::{ env, - ffi::{c_void, OsStr}, - sync::{atomic::Ordering, Arc}, + ffi::{OsStr, c_void}, + sync::{Arc, atomic::Ordering}, }; use std::{io::Write, panic, sync::atomic::AtomicU32, thread}; use telemetry_events::{LocationData, Panic, PanicRequest}; @@ -255,8 +255,9 @@ pub fn monitor_main_thread_hangs( } use nix::sys::signal::{ - sigaction, SaFlags, SigAction, SigHandler, SigSet, + SaFlags, SigAction, SigHandler, SigSet, Signal::{self, SIGUSR2}, + sigaction, }; use parking_lot::Mutex; @@ -264,7 +265,7 @@ pub fn monitor_main_thread_hangs( use http_client::Method; use std::{ ffi::c_int, - sync::{mpsc, OnceLock}, + sync::{OnceLock, mpsc}, time::Duration, }; use telemetry_events::{BacktraceFrame, HangReport}; diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 33b60d00674f006ef6bf604b32f908b32fe0b594..1ffd302e2f29d60d2425eb5e6a48b8c5049caaea 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -11,24 +11,24 @@ pub(crate) mod windows_only_instance; use anyhow::Context as _; pub use app_menus::*; use assets::Assets; -use assistant2::AssistantDiffToolbar; use assistant_context_editor::AssistantPanelDelegate; +use assistant2::AssistantDiffToolbar; use breadcrumbs::Breadcrumbs; -use client::{zed_urls, ZED_URL_SCHEME}; +use client::{ZED_URL_SCHEME, zed_urls}; use collections::VecDeque; use command_palette_hooks::CommandPaletteFilter; use debugger_ui::debugger_panel::DebugPanel; use editor::ProposedChangesEditorToolbar; -use editor::{scroll::Autoscroll, Editor, MultiBuffer}; +use editor::{Editor, MultiBuffer, scroll::Autoscroll}; use feature_flags::{Debugger, FeatureFlagAppExt, FeatureFlagViewExt}; -use futures::{channel::mpsc, select_biased, StreamExt}; +use futures::{StreamExt, channel::mpsc, select_biased}; use git_ui::git_panel::GitPanel; use git_ui::project_diff::ProjectDiffToolbar; use gpui::{ - actions, point, px, Action, App, AppContext as _, AsyncApp, AsyncWindowContext, Context, - DismissEvent, Element, Entity, Focusable, KeyBinding, MenuItem, ParentElement, - PathPromptOptions, PromptLevel, ReadGlobal, SharedString, Styled, Task, TitlebarOptions, - UpdateGlobal, Window, WindowKind, WindowOptions, + Action, App, AppContext as _, AsyncApp, AsyncWindowContext, Context, DismissEvent, Element, + Entity, Focusable, KeyBinding, MenuItem, ParentElement, PathPromptOptions, PromptLevel, + ReadGlobal, SharedString, Styled, Task, TitlebarOptions, UpdateGlobal, Window, WindowKind, + WindowOptions, actions, point, px, }; use image_viewer::ImageInfo; use migrate::{MigrationBanner, MigrationEvent, MigrationNotification, MigrationType}; @@ -48,9 +48,9 @@ use release_channel::{AppCommitSha, ReleaseChannel}; use rope::Rope; use search::project_search::ProjectSearchBar; use settings::{ - initial_debug_tasks_content, initial_project_settings_content, initial_tasks_content, - update_settings_file, InvalidSettingsError, KeymapFile, KeymapFileLoadResult, Settings, - SettingsStore, DEFAULT_KEYMAP_PATH, VIM_KEYMAP_PATH, + DEFAULT_KEYMAP_PATH, InvalidSettingsError, KeymapFile, KeymapFileLoadResult, Settings, + SettingsStore, VIM_KEYMAP_PATH, initial_debug_tasks_content, initial_project_settings_content, + initial_tasks_content, update_settings_file, }; use std::any::TypeId; use std::path::PathBuf; @@ -59,19 +59,20 @@ use std::time::Duration; use std::{borrow::Cow, ops::Deref, path::Path, sync::Arc}; use terminal_view::terminal_panel::{self, TerminalPanel}; use theme::{ActiveTheme, ThemeSettings}; -use ui::{prelude::*, PopoverMenuHandle}; +use ui::{PopoverMenuHandle, prelude::*}; use util::markdown::MarkdownString; -use util::{asset_str, ResultExt}; +use util::{ResultExt, asset_str}; use uuid::Uuid; use vim_mode_setting::VimModeSetting; use welcome::{BaseKeymap, MultibufferHint}; -use workspace::notifications::{dismiss_app_notification, show_app_notification, NotificationId}; +use workspace::notifications::{NotificationId, dismiss_app_notification, show_app_notification}; use workspace::{ + AppState, NewFile, NewWindow, OpenLog, Toast, Workspace, WorkspaceSettings, create_and_open_local_file, notifications::simple_message_notification::MessageNotification, - open_new, AppState, NewFile, NewWindow, OpenLog, Toast, Workspace, WorkspaceSettings, + open_new, }; -use workspace::{notifications::DetachAndPromptErr, Pane}; use workspace::{CloseIntent, RestoreBanner}; +use workspace::{Pane, notifications::DetachAndPromptErr}; use zed_actions::{ OpenAccountSettings, OpenBrowser, OpenServerSettings, OpenSettings, OpenZedUrl, Quit, }; @@ -1751,15 +1752,15 @@ mod tests { use super::*; use assets::Assets; use collections::HashSet; - use editor::{display_map::DisplayRow, scroll::Autoscroll, DisplayPoint, Editor}; + use editor::{DisplayPoint, Editor, display_map::DisplayRow, scroll::Autoscroll}; use gpui::{ - actions, Action, AnyWindowHandle, App, AssetSource, BorrowAppContext, SemanticVersion, - TestAppContext, UpdateGlobal, VisualTestContext, WindowHandle, + Action, AnyWindowHandle, App, AssetSource, BorrowAppContext, SemanticVersion, + TestAppContext, UpdateGlobal, VisualTestContext, WindowHandle, actions, }; use language::{LanguageMatcher, LanguageRegistry}; - use project::{project_settings::ProjectSettings, Project, ProjectPath, WorktreeSettings}; + use project::{Project, ProjectPath, WorktreeSettings, project_settings::ProjectSettings}; use serde_json::json; - use settings::{watch_config_file, SettingsStore}; + use settings::{SettingsStore, watch_config_file}; use std::{ path::{Path, PathBuf}, time::Duration, @@ -1767,9 +1768,10 @@ mod tests { use theme::{ThemeRegistry, ThemeSettings}; use util::{path, separator}; use workspace::{ + NewFile, OpenOptions, OpenVisible, SERIALIZATION_THROTTLE_TIME, SaveIntent, SplitDirection, + WorkspaceHandle, item::{Item, ItemHandle}, - open_new, open_paths, pane, NewFile, OpenOptions, OpenVisible, SaveIntent, SplitDirection, - WorkspaceHandle, SERIALIZATION_THROTTLE_TIME, + open_new, open_paths, pane, }; #[gpui::test] @@ -1871,11 +1873,13 @@ mod tests { .update(cx, |workspace, window, cx| { assert_eq!(workspace.worktrees(cx).count(), 2); assert!(workspace.left_dock().read(cx).is_open()); - assert!(workspace - .active_pane() - .read(cx) - .focus_handle(cx) - .is_focused(window)); + assert!( + workspace + .active_pane() + .read(cx) + .focus_handle(cx) + .is_focused(window) + ); }) .unwrap(); diff --git a/crates/zed/src/zed/inline_completion_registry.rs b/crates/zed/src/zed/inline_completion_registry.rs index b099dc4cb399b57fff06873af583bf3d0c4c4e02..5064a57a8ae0c781d3fcebb9c7464ff35f75c621 100644 --- a/crates/zed/src/zed/inline_completion_registry.rs +++ b/crates/zed/src/zed/inline_completion_registry.rs @@ -3,7 +3,7 @@ use collections::HashMap; use copilot::{Copilot, CopilotCompletionProvider}; use editor::{Editor, EditorMode}; use gpui::{AnyWindowHandle, App, AppContext as _, Context, Entity, WeakEntity}; -use language::language_settings::{all_language_settings, EditPredictionProvider}; +use language::language_settings::{EditPredictionProvider, all_language_settings}; use settings::SettingsStore; use std::{cell::RefCell, rc::Rc, sync::Arc}; use supermaven::{Supermaven, SupermavenCompletionProvider}; diff --git a/crates/zed/src/zed/open_listener.rs b/crates/zed/src/zed/open_listener.rs index 2bda7bbdc3041bbbb4a54d45fe9e61a139831454..9134b3e9139e8495a5559fa4fcf007279874dee2 100644 --- a/crates/zed/src/zed/open_listener.rs +++ b/crates/zed/src/zed/open_listener.rs @@ -1,8 +1,8 @@ use crate::handle_open_request; use crate::restorable_workspace_locations; -use anyhow::{anyhow, Context as _, Result}; -use cli::{ipc, IpcHandshake}; -use cli::{ipc::IpcSender, CliRequest, CliResponse}; +use anyhow::{Context as _, Result, anyhow}; +use cli::{CliRequest, CliResponse, ipc::IpcSender}; +use cli::{IpcHandshake, ipc}; use client::parse_zed_link; use collections::HashMap; use db::kvp::KEY_VALUE_STORE; @@ -14,16 +14,16 @@ use futures::future::join_all; use futures::{FutureExt, SinkExt, StreamExt}; use gpui::{App, AsyncApp, Global, WindowHandle}; use language::Point; -use recent_projects::{open_ssh_project, SshSettings}; +use recent_projects::{SshSettings, open_ssh_project}; use remote::SshConnectionOptions; use settings::Settings; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::thread; use std::time::Duration; -use util::paths::PathWithPosition; use util::ResultExt; -use welcome::{show_welcome_view, FIRST_OPEN}; +use util::paths::PathWithPosition; +use welcome::{FIRST_OPEN, show_welcome_view}; use workspace::item::ItemHandle; use workspace::{AppState, OpenOptions, SerializedWorkspaceLocation, Workspace}; @@ -532,8 +532,8 @@ mod tests { use std::sync::Arc; use cli::{ - ipc::{self}, CliResponse, + ipc::{self}, }; use editor::Editor; use gpui::TestAppContext; diff --git a/crates/zed/src/zed/quick_action_bar.rs b/crates/zed/src/zed/quick_action_bar.rs index 0b4ec87973106f26649741fcf66e3c79b276c8a7..6f8b6efa70ea0ad704b196a168fdebb5082e3e5d 100644 --- a/crates/zed/src/zed/quick_action_bar.rs +++ b/crates/zed/src/zed/quick_action_bar.rs @@ -12,15 +12,15 @@ use gpui::{ Action, ClickEvent, Context, Corner, ElementId, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement, ParentElement, Render, Styled, Subscription, WeakEntity, Window, }; -use search::{buffer_search, BufferSearchBar}; +use search::{BufferSearchBar, buffer_search}; use settings::{Settings, SettingsStore}; use ui::{ - prelude::*, ButtonStyle, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, IconName, - IconSize, PopoverMenu, PopoverMenuHandle, Tooltip, + ButtonStyle, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, IconName, IconSize, + PopoverMenu, PopoverMenuHandle, Tooltip, prelude::*, }; use vim_mode_setting::VimModeSetting; use workspace::{ - item::ItemHandle, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, + ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace, item::ItemHandle, }; use zed_actions::{assistant::InlineAssist, outline::ToggleOutline}; diff --git a/crates/zed/src/zed/quick_action_bar/markdown_preview.rs b/crates/zed/src/zed/quick_action_bar/markdown_preview.rs index cf9f7073410b7f5e96d33faee6af9c52d265540b..44008f71100bed6a39874cdfa807a3046842ae53 100644 --- a/crates/zed/src/zed/quick_action_bar/markdown_preview.rs +++ b/crates/zed/src/zed/quick_action_bar/markdown_preview.rs @@ -1,8 +1,8 @@ use gpui::{AnyElement, Modifiers, WeakEntity}; use markdown_preview::{ - markdown_preview_view::MarkdownPreviewView, OpenPreview, OpenPreviewToTheSide, + OpenPreview, OpenPreviewToTheSide, markdown_preview_view::MarkdownPreviewView, }; -use ui::{prelude::*, text_for_keystroke, IconButtonShape, Tooltip}; +use ui::{IconButtonShape, Tooltip, prelude::*, text_for_keystroke}; use workspace::Workspace; use super::QuickActionBar; diff --git a/crates/zed/src/zed/quick_action_bar/repl_menu.rs b/crates/zed/src/zed/quick_action_bar/repl_menu.rs index 51ed0af6b88c8b5b97e9fb6d360f6b159c07c6d9..a7e00adf0c7ffac66ef8e29ef715f5217bee178f 100644 --- a/crates/zed/src/zed/quick_action_bar/repl_menu.rs +++ b/crates/zed/src/zed/quick_action_bar/repl_menu.rs @@ -1,16 +1,17 @@ use std::time::Duration; use gpui::ElementId; -use gpui::{percentage, Animation, AnimationExt, AnyElement, Entity, Transformation}; +use gpui::{Animation, AnimationExt, AnyElement, Entity, Transformation, percentage}; use picker::Picker; use repl::{ + ExecutionState, JupyterSettings, Kernel, KernelSpecification, KernelStatus, Session, + SessionSupport, components::{KernelPickerDelegate, KernelSelector}, - worktree_id_for_editor, ExecutionState, JupyterSettings, Kernel, KernelSpecification, - KernelStatus, Session, SessionSupport, + worktree_id_for_editor, }; use ui::{ - prelude::*, ButtonLike, ContextMenu, IconWithIndicator, Indicator, IntoElement, PopoverMenu, - PopoverMenuHandle, Tooltip, + ButtonLike, ContextMenu, IconWithIndicator, Indicator, IntoElement, PopoverMenu, + PopoverMenuHandle, Tooltip, prelude::*, }; use util::ResultExt; diff --git a/crates/zed/src/zed/windows_only_instance.rs b/crates/zed/src/zed/windows_only_instance.rs index 05f24393b00d3db2836b409024338ef3837b7bd8..e3d20f6527882f510f8459409cf2794aa3c66a01 100644 --- a/crates/zed/src/zed/windows_only_instance.rs +++ b/crates/zed/src/zed/windows_only_instance.rs @@ -1,17 +1,16 @@ use std::{sync::Arc, thread::JoinHandle}; use anyhow::Context; -use cli::{ipc::IpcOneShotServer, CliRequest, CliResponse, IpcHandshake}; +use cli::{CliRequest, CliResponse, IpcHandshake, ipc::IpcOneShotServer}; use parking_lot::Mutex; use release_channel::app_identifier; use util::ResultExt; use windows::{ - core::HSTRING, Win32::{ - Foundation::{CloseHandle, GetLastError, ERROR_ALREADY_EXISTS, GENERIC_WRITE, HANDLE}, + Foundation::{CloseHandle, ERROR_ALREADY_EXISTS, GENERIC_WRITE, GetLastError, HANDLE}, Storage::FileSystem::{ - CreateFileW, ReadFile, WriteFile, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, - OPEN_EXISTING, PIPE_ACCESS_INBOUND, + CreateFileW, FILE_FLAGS_AND_ATTRIBUTES, FILE_SHARE_MODE, OPEN_EXISTING, + PIPE_ACCESS_INBOUND, ReadFile, WriteFile, }, System::{ Pipes::{ @@ -21,6 +20,7 @@ use windows::{ Threading::CreateMutexW, }, }, + core::HSTRING, }; use crate::{Args, OpenListener}; diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index 40a2292ba808a782b4630ffea66051ae5f659e7e..1e358c9bbd47bbb3ada3dd31243a7668371eee75 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -275,7 +275,7 @@ impl_actions!(task, [Spawn, Rerun]); pub mod outline { use std::sync::OnceLock; - use gpui::{action_as, AnyView, App, Window}; + use gpui::{AnyView, App, Window, action_as}; action_as!(outline, ToggleOutline as Toggle); /// A pointer to outline::toggle function, exposed here to sewer the breadcrumbs <-> outline dependency. diff --git a/crates/zeta/src/completion_diff_element.rs b/crates/zeta/src/completion_diff_element.rs index 9344c43c5e142146c34e39287b6d68afd2f9ce78..b395f1882489056a5abeb13fb2d7c080ef72d320 100644 --- a/crates/zeta/src/completion_diff_element.rs +++ b/crates/zeta/src/completion_diff_element.rs @@ -2,8 +2,8 @@ use std::cmp; use crate::InlineCompletion; use gpui::{ - point, prelude::*, quad, size, AnyElement, App, BorderStyle, Bounds, Corners, Edges, - HighlightStyle, Hsla, StyledText, TextLayout, TextStyle, + AnyElement, App, BorderStyle, Bounds, Corners, Edges, HighlightStyle, Hsla, StyledText, + TextLayout, TextStyle, point, prelude::*, quad, size, }; use language::OffsetRangeExt; use settings::Settings; diff --git a/crates/zeta/src/init.rs b/crates/zeta/src/init.rs index e0e3578af1448419a54c02eee8fc058e07d8a74a..e63ac4ec3d7841dd827456823c0d50e788a6b8d2 100644 --- a/crates/zeta/src/init.rs +++ b/crates/zeta/src/init.rs @@ -8,7 +8,7 @@ use settings::update_settings_file; use ui::App; use workspace::Workspace; -use crate::{onboarding_modal::ZedPredictModal, RateCompletionModal}; +use crate::{RateCompletionModal, onboarding_modal::ZedPredictModal}; actions!(edit_prediction, [ResetOnboarding, RateCompletions]); diff --git a/crates/zeta/src/input_excerpt.rs b/crates/zeta/src/input_excerpt.rs index 7171facaffdad66acd4438c23e684ea51eb306bb..5949e713e9eae1a3f5151b35bfbb4eb5d6889555 100644 --- a/crates/zeta/src/input_excerpt.rs +++ b/crates/zeta/src/input_excerpt.rs @@ -1,6 +1,6 @@ use crate::{ - tokens_for_bytes, CURSOR_MARKER, EDITABLE_REGION_END_MARKER, EDITABLE_REGION_START_MARKER, - START_OF_FILE_MARKER, + CURSOR_MARKER, EDITABLE_REGION_END_MARKER, EDITABLE_REGION_START_MARKER, START_OF_FILE_MARKER, + tokens_for_bytes, }; use language::{BufferSnapshot, Point}; use std::{fmt::Write, ops::Range}; diff --git a/crates/zeta/src/onboarding_modal.rs b/crates/zeta/src/onboarding_modal.rs index b45259333168ea7a88fa8a0675291b75d9a03e5a..abd409dd78a18b2ab952b4a3549a600efa6e3b37 100644 --- a/crates/zeta/src/onboarding_modal.rs +++ b/crates/zeta/src/onboarding_modal.rs @@ -1,19 +1,19 @@ use std::{sync::Arc, time::Duration}; -use crate::{onboarding_event, ZED_PREDICT_DATA_COLLECTION_CHOICE}; +use crate::{ZED_PREDICT_DATA_COLLECTION_CHOICE, onboarding_event}; use anyhow::Context as _; use client::{Client, UserStore}; use db::kvp::KEY_VALUE_STORE; use fs::Fs; use gpui::{ - ease_in_out, svg, Animation, AnimationExt as _, ClickEvent, DismissEvent, Entity, EventEmitter, - FocusHandle, Focusable, MouseDownEvent, Render, + Animation, AnimationExt as _, ClickEvent, DismissEvent, Entity, EventEmitter, FocusHandle, + Focusable, MouseDownEvent, Render, ease_in_out, svg, }; use language::language_settings::{AllLanguageSettings, EditPredictionProvider}; -use settings::{update_settings_file, Settings}; -use ui::{prelude::*, Checkbox, TintColor}; +use settings::{Settings, update_settings_file}; +use ui::{Checkbox, TintColor, prelude::*}; use util::ResultExt; -use workspace::{notifications::NotifyTaskExt, ModalView, Workspace}; +use workspace::{ModalView, Workspace, notifications::NotifyTaskExt}; /// Introduces user to Zed's Edit Prediction feature and terms of service pub struct ZedPredictModal { diff --git a/crates/zeta/src/rate_completion_modal.rs b/crates/zeta/src/rate_completion_modal.rs index 2d944813794df1f7dbbd69264daa33cc07fa153d..17c3b0bdef46fc18f92e8e53ce27d511272cd5e8 100644 --- a/crates/zeta/src/rate_completion_modal.rs +++ b/crates/zeta/src/rate_completion_modal.rs @@ -1,9 +1,9 @@ use crate::{CompletionDiffElement, InlineCompletion, InlineCompletionRating, Zeta}; use editor::Editor; -use gpui::{actions, prelude::*, App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable}; +use gpui::{App, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, actions, prelude::*}; use language::language_settings; use std::time::Duration; -use ui::{prelude::*, KeyBinding, List, ListItem, ListItemSpacing, Tooltip}; +use ui::{KeyBinding, List, ListItem, ListItemSpacing, Tooltip, prelude::*}; use workspace::{ModalView, Workspace}; actions!( diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rs index 78ad51247d1898b7325ddc82c0588fd6831856a3..14aa2820cb3f3c6d7f43d3dda3765aa08dda5b8a 100644 --- a/crates/zeta/src/zeta.rs +++ b/crates/zeta/src/zeta.rs @@ -10,23 +10,23 @@ pub(crate) use completion_diff_element::*; use db::kvp::KEY_VALUE_STORE; pub use init::*; use inline_completion::DataCollectionState; -pub use license_detection::is_license_eligible_for_data_collection; use license_detection::LICENSE_FILES_TO_CHECK; +pub use license_detection::is_license_eligible_for_data_collection; pub use rate_completion_modal::*; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use arrayvec::ArrayVec; use client::{Client, UserStore}; use collections::{HashMap, HashSet, VecDeque}; use futures::AsyncReadExt; use gpui::{ - actions, App, AppContext as _, AsyncApp, Context, Entity, EntityId, Global, SemanticVersion, - Subscription, Task, WeakEntity, + App, AppContext as _, AsyncApp, Context, Entity, EntityId, Global, SemanticVersion, + Subscription, Task, WeakEntity, actions, }; use http_client::{HttpClient, Method}; use input_excerpt::excerpt_for_cursor_position; use language::{ - text_diff, Anchor, Buffer, BufferSnapshot, EditPreview, OffsetRangeExt, ToOffset, ToPoint, + Anchor, Buffer, BufferSnapshot, EditPreview, OffsetRangeExt, ToOffset, ToPoint, text_diff, }; use language_model::{LlmApiToken, RefreshLlmTokenListener}; use postage::watch; @@ -50,12 +50,12 @@ use telemetry_events::InlineCompletionRating; use thiserror::Error; use util::ResultExt; use uuid::Uuid; -use workspace::notifications::{ErrorMessagePrompt, NotificationId}; use workspace::Workspace; +use workspace::notifications::{ErrorMessagePrompt, NotificationId}; use worktree::Worktree; use zed_llm_client::{ - PredictEditsBody, PredictEditsResponse, EXPIRED_LLM_TOKEN_HEADER_NAME, - MINIMUM_REQUIRED_VERSION_HEADER_NAME, + EXPIRED_LLM_TOKEN_HEADER_NAME, MINIMUM_REQUIRED_VERSION_HEADER_NAME, PredictEditsBody, + PredictEditsResponse, }; const CURSOR_MARKER: &'static str = "<|user_cursor_is_here|>"; @@ -165,11 +165,7 @@ fn interpolate( edits.extend(model_edits.cloned()); - if edits.is_empty() { - None - } else { - Some(edits) - } + if edits.is_empty() { None } else { Some(edits) } } impl std::fmt::Debug for InlineCompletion { diff --git a/crates/zlog/src/zlog.rs b/crates/zlog/src/zlog.rs index 5dea8ebd659ff669c2a2c0dfafd97a9ed7bec75e..56705d7f7bad2f3eeb7a733678d4ca3f79b872c3 100644 --- a/crates/zlog/src/zlog.rs +++ b/crates/zlog/src/zlog.rs @@ -275,8 +275,8 @@ pub mod scope_map { collections::{HashMap, VecDeque}, hash::{DefaultHasher, Hasher}, sync::{ - atomic::{AtomicU64, Ordering}, RwLock, + atomic::{AtomicU64, Ordering}, }, usize, }; diff --git a/extensions/glsl/src/glsl.rs b/extensions/glsl/src/glsl.rs index b3867d9c3822a0ccdfff37310cbf3c94aa84c740..a42403ebefeff89b749d5091e84ceea2528aba79 100644 --- a/extensions/glsl/src/glsl.rs +++ b/extensions/glsl/src/glsl.rs @@ -1,6 +1,6 @@ use std::fs; use zed::settings::LspSettings; -use zed_extension_api::{self as zed, serde_json, LanguageServerId, Result}; +use zed_extension_api::{self as zed, LanguageServerId, Result, serde_json}; struct GlslExtension { cached_binary_path: Option, diff --git a/extensions/html/src/html.rs b/extensions/html/src/html.rs index 07abea9b7776ed3b19e531914d0336e9c3ae749e..2d3de1233766772f2b6275ff205a16067469187e 100644 --- a/extensions/html/src/html.rs +++ b/extensions/html/src/html.rs @@ -1,6 +1,6 @@ use std::{env, fs}; use zed::settings::LspSettings; -use zed_extension_api::{self as zed, serde_json::json, LanguageServerId, Result}; +use zed_extension_api::{self as zed, LanguageServerId, Result, serde_json::json}; const BINARY_NAME: &str = "vscode-html-language-server"; const SERVER_PATH: &str = diff --git a/extensions/perplexity/src/perplexity.rs b/extensions/perplexity/src/perplexity.rs index 1772793cde9ff8f0055a1788079e12f562081287..95b829c11238a08ecd10679222d882612e611fd8 100644 --- a/extensions/perplexity/src/perplexity.rs +++ b/extensions/perplexity/src/perplexity.rs @@ -3,7 +3,7 @@ use zed::{ http_client::HttpRequest, serde_json::{self, json}, }; -use zed_extension_api::{self as zed, http_client::RedirectPolicy, Result}; +use zed_extension_api::{self as zed, Result, http_client::RedirectPolicy}; struct Perplexity; diff --git a/extensions/proto/src/proto.rs b/extensions/proto/src/proto.rs index c692a0932766b4fa69174b7ad6451edb7adcf965..70c5b9c84a9ecbb1b9567e75bf60b7d818525a5a 100644 --- a/extensions/proto/src/proto.rs +++ b/extensions/proto/src/proto.rs @@ -1,4 +1,4 @@ -use zed_extension_api::{self as zed, settings::LspSettings, Result}; +use zed_extension_api::{self as zed, Result, settings::LspSettings}; const PROTOBUF_LANGUAGE_SERVER_NAME: &str = "protobuf-language-server"; diff --git a/extensions/ruff/src/ruff.rs b/extensions/ruff/src/ruff.rs index 048c5893ca773d174086a8aaded27bde3a4a108e..da9b6c0bf1a03cd69f0e29f2a7b2282c30149fe5 100644 --- a/extensions/ruff/src/ruff.rs +++ b/extensions/ruff/src/ruff.rs @@ -1,6 +1,6 @@ use std::fs; use zed::LanguageServerId; -use zed_extension_api::{self as zed, settings::LspSettings, Result}; +use zed_extension_api::{self as zed, Result, settings::LspSettings}; struct RuffBinary { path: String, diff --git a/extensions/snippets/src/snippets.rs b/extensions/snippets/src/snippets.rs index 913071eeb0bd4a80e616b08451150dba3ae0fa51..46ba7469301699d423ecd5ef35dbf015901b2bfe 100644 --- a/extensions/snippets/src/snippets.rs +++ b/extensions/snippets/src/snippets.rs @@ -1,7 +1,7 @@ use serde_json::json; use std::fs; use zed::LanguageServerId; -use zed_extension_api::{self as zed, settings::LspSettings, Result}; +use zed_extension_api::{self as zed, Result, settings::LspSettings}; struct SnippetExtension { cached_binary_path: Option, diff --git a/tooling/xtask/src/tasks/clippy.rs b/tooling/xtask/src/tasks/clippy.rs index 85d0adf5839277a47788cddc254c6a2360e6cd31..32574a907e371e251da1e0d177c5c6cd14aa59ea 100644 --- a/tooling/xtask/src/tasks/clippy.rs +++ b/tooling/xtask/src/tasks/clippy.rs @@ -1,6 +1,6 @@ use std::process::Command; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use clap::Parser; #[derive(Parser)] diff --git a/tooling/xtask/src/tasks/licenses.rs b/tooling/xtask/src/tasks/licenses.rs index 415bb30741ebf248be4bf03496cb48828f92b0f6..943b36cb289307200963d33418415e4bfaa85464 100644 --- a/tooling/xtask/src/tasks/licenses.rs +++ b/tooling/xtask/src/tasks/licenses.rs @@ -1,6 +1,6 @@ use std::path::{Path, PathBuf}; -use anyhow::{anyhow, Result}; +use anyhow::{Result, anyhow}; use clap::Parser; use crate::workspace::load_workspace; diff --git a/tooling/xtask/src/tasks/package_conformity.rs b/tooling/xtask/src/tasks/package_conformity.rs index de2db3cdd14453d691ac32ce6694c97ab46402e5..fe7d6672fb66be097dc600e66097e6e05c99d381 100644 --- a/tooling/xtask/src/tasks/package_conformity.rs +++ b/tooling/xtask/src/tasks/package_conformity.rs @@ -2,7 +2,7 @@ use std::collections::BTreeMap; use std::fs; use std::path::Path; -use anyhow::{anyhow, Context as _, Result}; +use anyhow::{Context as _, Result, anyhow}; use cargo_toml::{Dependency, Manifest}; use clap::Parser;