Cargo.toml 🔗
@@ -198,7 +198,7 @@ default-members = ["crates/zed"]
[workspace.package]
publish = false
-edition = "2021"
+edition = "2024"
[workspace.dependencies]
Piotr Osiewicz created
Follow-up to https://github.com/zed-industries/zed/pull/27791
Release Notes:
- N/A
Cargo.toml | 2
crates/activity_indicator/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
crates/assistant/src/assistant_configuration.rs | 4
crates/assistant/src/assistant_panel.rs | 37
crates/assistant/src/inline_assistant.rs | 39
crates/assistant/src/terminal_inline_assistant.rs | 16
crates/assistant2/src/active_thread.rs | 16
crates/assistant2/src/assistant.rs | 2
crates/assistant2/src/assistant_configuration.rs | 2
crates/assistant2/src/assistant_configuration/add_context_server_modal.rs | 4
crates/assistant2/src/assistant_configuration/manage_profiles_modal.rs | 8
crates/assistant2/src/assistant_configuration/tool_picker.rs | 6
crates/assistant2/src/assistant_diff.rs | 52
crates/assistant2/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
crates/assistant2/src/context_picker/completion_provider.rs | 4
crates/assistant2/src/context_picker/fetch_context_picker.rs | 12
crates/assistant2/src/context_picker/file_context_picker.rs | 6
crates/assistant2/src/context_picker/symbol_context_picker.rs | 4
crates/assistant2/src/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
crates/assistant2/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
crates/assistant2/src/ui/agent_notification.rs | 8
crates/assistant2/src/ui/context_pill.rs | 2
crates/assistant_context_editor/src/context.rs | 16
crates/assistant_context_editor/src/context/context_tests.rs | 8
crates/assistant_context_editor/src/context_editor.rs | 40
crates/assistant_context_editor/src/context_history.rs | 18
crates/assistant_context_editor/src/context_store.rs | 91
crates/assistant_context_editor/src/patch.rs | 6
crates/assistant_context_editor/src/slash_command.rs | 6
crates/assistant_context_editor/src/slash_command_picker.rs | 2
crates/assistant_eval/src/headless_assistant.rs | 4
crates/assistant_eval/src/main.rs | 2
crates/assistant_settings/src/assistant_settings.rs | 2
crates/assistant_slash_command/src/assistant_slash_command.rs | 6
crates/assistant_slash_command/src/extension_slash_command.rs | 2
crates/assistant_slash_commands/src/cargo_workspace_command.rs | 4
crates/assistant_slash_commands/src/context_server_command.rs | 4
crates/assistant_slash_commands/src/default_command.rs | 4
crates/assistant_slash_commands/src/delta_command.rs | 4
crates/assistant_slash_commands/src/diagnostics_command.rs | 6
crates/assistant_slash_commands/src/docs_command.rs | 6
crates/assistant_slash_commands/src/fetch_command.rs | 6
crates/assistant_slash_commands/src/file_command.rs | 30
crates/assistant_slash_commands/src/now_command.rs | 2
crates/assistant_slash_commands/src/prompt_command.rs | 4
crates/assistant_slash_commands/src/selection_command.rs | 4
crates/assistant_slash_commands/src/streaming_example_command.rs | 4
crates/assistant_slash_commands/src/symbols_command.rs | 2
crates/assistant_slash_commands/src/tab_command.rs | 4
crates/assistant_slash_commands/src/terminal_command.rs | 6
crates/assistant_tools/src/bash_tool.rs | 2
crates/assistant_tools/src/batch_tool.rs | 2
crates/assistant_tools/src/code_symbols_tool.rs | 2
crates/assistant_tools/src/copy_path_tool.rs | 2
crates/assistant_tools/src/create_directory_tool.rs | 2
crates/assistant_tools/src/create_file_tool.rs | 2
crates/assistant_tools/src/delete_path_tool.rs | 4
crates/assistant_tools/src/diagnostics_tool.rs | 2
crates/assistant_tools/src/edit_files_tool.rs | 6
crates/assistant_tools/src/edit_files_tool/log.rs | 6
crates/assistant_tools/src/fetch_tool.rs | 4
crates/assistant_tools/src/find_replace_file_tool.rs | 2
crates/assistant_tools/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
crates/assistant_tools/src/path_search_tool.rs | 2
crates/assistant_tools/src/read_file_tool.rs | 2
crates/assistant_tools/src/regex_search_tool.rs | 4
crates/assistant_tools/src/replace.rs | 4
crates/assistant_tools/src/schema.rs | 2
crates/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
crates/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
crates/collab/src/tests/channel_buffer_tests.rs | 4
crates/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
crates/collab/src/tests/random_channel_buffer_tests.rs | 2
crates/collab/src/tests/random_project_collaboration_tests.rs | 18
crates/collab/src/tests/randomized_test_helpers.rs | 4
crates/collab/src/tests/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
crates/collab_ui/src/chat_panel/message_editor.rs | 8
crates/collab_ui/src/collab_panel.rs | 40
crates/collab_ui/src/collab_panel/channel_modal.rs | 12
crates/collab_ui/src/collab_panel/contact_finder.rs | 2
crates/collab_ui/src/collab_ui.rs | 4
crates/collab_ui/src/notification_panel.rs | 14
crates/collab_ui/src/notifications/collab_notification.rs | 2
crates/collab_ui/src/notifications/incoming_call_notification.rs | 4
crates/collab_ui/src/notifications/project_shared_notification.rs | 4
crates/command_palette/src/command_palette.rs | 4
crates/component/src/component.rs | 2
crates/component_preview/src/component_preview.rs | 10
crates/context_server/src/client.rs | 10
crates/context_server/src/context_server.rs | 2
crates/context_server/src/context_server_tool.rs | 2
crates/context_server/src/manager.rs | 5
crates/context_server_settings/src/context_server_settings.rs | 2
crates/copilot/src/copilot.rs | 18
crates/copilot/src/copilot_chat.rs | 6
crates/copilot/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
crates/debugger_ui/src/session/running/console.rs | 2
crates/debugger_ui/src/session/running/loaded_source_list.rs | 2
crates/debugger_ui/src/session/running/module_list.rs | 4
crates/debugger_ui/src/session/running/stack_frame_list.rs | 8
crates/debugger_ui/src/session/running/variable_list.rs | 8
crates/debugger_ui/src/session/starting.rs | 6
crates/debugger_ui/src/tests/attach_modal.rs | 2
crates/debugger_ui/src/tests/debugger_panel.rs | 98
crates/debugger_ui/src/tests/module_list.rs | 4
crates/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
crates/editor/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
crates/extension_host/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
crates/extension_host/src/wasm_host/wit/since_v0_0_1.rs | 2
crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs | 10
crates/extension_host/src/wasm_host/wit/since_v0_4_0.rs | 10
crates/extensions_ui/src/components/extension_card.rs | 2
crates/extensions_ui/src/components/feature_upsell.rs | 2
crates/extensions_ui/src/extension_suggest.rs | 2
crates/extensions_ui/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
crates/git_hosting_providers/src/git_hosting_providers.rs | 4
crates/git_hosting_providers/src/providers/chromium.rs | 2
crates/git_hosting_providers/src/providers/codeberg.rs | 2
crates/git_hosting_providers/src/providers/github.rs | 2
crates/git_hosting_providers/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
crates/gpui/src/platform/linux/wayland/client.rs | 23
crates/gpui/src/platform/linux/wayland/clipboard.rs | 6
crates/gpui/src/platform/linux/wayland/cursor.rs | 2
crates/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
crates/gpui/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
crates/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
crates/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
crates/gpui/src/platform/windows/direct_write.rs | 4
crates/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
crates/gpui/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
crates/gpui_macros/src/derive_path_static_str.rs | 2
crates/gpui_macros/src/derive_render.rs | 2
crates/gpui_macros/src/derive_visual_context.rs | 2
crates/gpui_macros/src/styles.rs | 4
crates/gpui_macros/src/test.rs | 4
crates/html_to_markdown/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
crates/indexed_docs/src/providers/rustdoc/to_markdown.rs | 6
crates/indexed_docs/src/store.rs | 8
crates/inline_completion_button/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
crates/language/src/syntax_map/syntax_map_tests.rs | 2
crates/language/src/text_diff.rs | 3
crates/language_extension/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
crates/language_model_selector/src/language_model_selector.rs | 6
crates/language_models/src/provider/anthropic.rs | 10
crates/language_models/src/provider/bedrock.rs | 13
crates/language_models/src/provider/cloud.rs | 18
crates/language_models/src/provider/copilot_chat.rs | 6
crates/language_models/src/provider/deepseek.rs | 8
crates/language_models/src/provider/google.rs | 8
crates/language_models/src/provider/lmstudio.rs | 10
crates/language_models/src/provider/mistral.rs | 8
crates/language_models/src/provider/ollama.rs | 10
crates/language_models/src/provider/open_ai.rs | 10
crates/language_models/src/settings.rs | 2
crates/language_models/src/ui/instruction_list_item.rs | 2
crates/language_selector/src/active_buffer_language.rs | 4
crates/language_selector/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
crates/livekit_client/src/livekit_client/playback.rs | 22
crates/livekit_client/src/mock_client/participant.rs | 2
crates/livekit_client/src/mock_client/publication.rs | 2
crates/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
crates/markdown_preview/src/markdown_elements.rs | 2
crates/markdown_preview/src/markdown_parser.rs | 4
crates/markdown_preview/src/markdown_preview.rs | 2
crates/markdown_preview/src/markdown_preview_view.rs | 12
crates/markdown_preview/src/markdown_renderer.rs | 16
crates/media/src/media.rs | 10
crates/migrator/src/migrations.rs | 2
crates/migrator/src/migrations/m_2025_01_02/settings.rs | 2
crates/migrator/src/migrations/m_2025_01_29/keymap.rs | 2
crates/migrator/src/migrations/m_2025_01_29/settings.rs | 2
crates/migrator/src/migrations/m_2025_01_30/keymap.rs | 2
crates/migrator/src/migrations/m_2025_01_30/settings.rs | 2
crates/migrator/src/migrations/m_2025_03_03/keymap.rs | 2
crates/migrator/src/migrations/m_2025_03_06/keymap.rs | 2
crates/migrator/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
crates/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
crates/picker/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
crates/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
crates/project/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
crates/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
crates/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
crates/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
crates/recent_projects/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
crates/refineable/derive_refineable/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
crates/remote_server/src/remote_editing_tests.rs | 6
crates/remote_server/src/unix.rs | 14
crates/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
crates/semantic_index/src/embedding/lmstudio.rs | 2
crates/semantic_index/src/embedding/ollama.rs | 2
crates/semantic_index/src/embedding/open_ai.rs | 2
crates/semantic_index/src/embedding_index.rs | 4
crates/semantic_index/src/project_index.rs | 2
crates/semantic_index/src/project_index_debug_view.rs | 6
crates/semantic_index/src/semantic_index.rs | 2
crates/semantic_index/src/summary_index.rs | 6
crates/semantic_version/src/semantic_version.rs | 4
crates/session/src/session.rs | 16
crates/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
crates/settings_ui/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
crates/storybook/src/stories/auto_height_editor.rs | 4
crates/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
crates/terminal_view/src/terminal_scrollbar.rs | 4
crates/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
crates/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
crates/title_bar/src/platforms/platform_linux.rs | 2
crates/title_bar/src/platforms/platform_windows.rs | 2
crates/title_bar/src/title_bar.rs | 12
crates/title_bar/src/window_controls.rs | 2
crates/toolchain_selector/src/active_toolchain.rs | 6
crates/toolchain_selector/src/toolchain_selector.rs | 8
crates/ui/src/components/avatar.rs | 2
crates/ui/src/components/button/button.rs | 8
crates/ui/src/components/button/button_icon.rs | 2
crates/ui/src/components/button/button_like.rs | 6
crates/ui/src/components/button/icon_button.rs | 2
crates/ui/src/components/button/split_button.rs | 6
crates/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
crates/ui/src/components/icon/decorated_icon.rs | 2
crates/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
crates/ui/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
crates/ui/src/components/list/list_sub_header.rs | 2
crates/ui/src/components/modal.rs | 4
crates/ui/src/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
crates/ui/src/components/stories/context_menu.rs | 4
crates/ui/src/components/stories/disclosure.rs | 2
crates/ui/src/components/stories/icon_button.rs | 2
crates/ui/src/components/stories/keybinding.rs | 2
crates/ui/src/components/stories/list.rs | 2
crates/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
crates/ui/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
crates/vim/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
crates/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
crates/zed/src/zed/quick_action_bar/markdown_preview.rs | 4
crates/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, 3,766 insertions(+), 3,653 deletions(-)
@@ -198,7 +198,7 @@ default-members = ["crates/zed"]
[workspace.package]
publish = false
-edition = "2021"
+edition = "2024"
[workspace.dependencies]
@@ -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]);
@@ -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};
@@ -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)]
@@ -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()
}
}
@@ -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,
};
@@ -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 {
@@ -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};
@@ -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<dyn Fs>,
@@ -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::*;
@@ -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<dyn Fs>,
@@ -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<LanguageRegistry>,
@@ -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;
@@ -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;
@@ -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;
@@ -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};
@@ -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;
@@ -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(),
@@ -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<LanguageModelSelector>,
@@ -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;
@@ -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::*;
@@ -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 {
@@ -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<Workspace>,
@@ -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<SharedString> {
@@ -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};
@@ -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;
@@ -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};
@@ -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};
@@ -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<usize> {
@@ -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};
@@ -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<dyn Fs>,
@@ -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<T: 'static> PromptEditor<T> {
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)
@@ -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};
@@ -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 _;
@@ -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;
@@ -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<dyn Fs>,
@@ -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,
@@ -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;
@@ -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;
@@ -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,
@@ -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,
@@ -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};
@@ -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)]
@@ -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;
@@ -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,
@@ -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(),
+ ]
}),
)
}
@@ -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<Self>| {
- 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<Self>| {
+ 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)
})
@@ -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;
@@ -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;
@@ -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;
@@ -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,
@@ -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};
@@ -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};
@@ -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);
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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::*;
@@ -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");
@@ -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::{
@@ -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;
@@ -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;
@@ -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;
@@ -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,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;
@@ -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;
@@ -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};
@@ -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};
@@ -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};
@@ -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;
@@ -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;
@@ -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;
@@ -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};
@@ -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};
@@ -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::{
@@ -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;
@@ -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;
@@ -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};
@@ -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};
@@ -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};
@@ -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};
@@ -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};
@@ -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};
@@ -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;
@@ -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};
@@ -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]
@@ -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<T: JsonSchema>(format: LanguageModelToolSchemaFormat) -> serde_json::Value {
@@ -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};
@@ -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};
@@ -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<SamplesConverter<Decoder<Cursor<Vec<u8>>>, f32>>;
@@ -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<Self>) -> Task<Result<()>> {
- 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;
+ }
})
}
@@ -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]);
@@ -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::{
@@ -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 {
@@ -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;
@@ -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,
@@ -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;
@@ -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),
@@ -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};
@@ -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;
@@ -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;
@@ -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);
@@ -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;
@@ -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,
@@ -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},
};
@@ -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::{
@@ -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;
@@ -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,
};
@@ -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};
@@ -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()
@@ -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};
@@ -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;
@@ -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()
@@ -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) {
@@ -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};
@@ -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]
@@ -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};
@@ -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.
@@ -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)]
@@ -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 {
@@ -111,10 +111,11 @@ async fn test_channel_buffers(db: &Arc<Database>) {
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!(
@@ -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<Database>) {
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<Database>) {
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<Database>) {
.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<Database>) {
})
.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<Database>) {
.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<Database>) {
.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]
@@ -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};
@@ -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<Database>) {
}
// 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();
@@ -1,4 +1,4 @@
-use anyhow::{anyhow, Result};
+use anyhow::{Result, anyhow};
use std::fs;
use std::path::Path;
@@ -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;
@@ -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 {
@@ -1,4 +1,4 @@
-use sea_orm::{entity::prelude::*, DbErr};
+use sea_orm::{DbErr, entity::prelude::*};
use serde::{Deserialize, Serialize};
use crate::id_type;
@@ -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 _;
@@ -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;
@@ -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;
@@ -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};
@@ -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");
@@ -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(
@@ -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;
@@ -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(),
@@ -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 {
@@ -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;
@@ -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;
@@ -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};
@@ -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;
@@ -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]
@@ -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()
@@ -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;
@@ -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,
};
@@ -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());
@@ -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;
@@ -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};
@@ -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 {
@@ -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},
},
};
@@ -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};
@@ -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;
@@ -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;
@@ -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]);
@@ -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;
@@ -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;
@@ -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())
@@ -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,
@@ -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;
@@ -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::{
@@ -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;
@@ -1,4 +1,4 @@
-use gpui::{img, prelude::*, AnyElement, SharedUri};
+use gpui::{AnyElement, SharedUri, img, prelude::*};
use smallvec::SmallVec;
use ui::prelude::*;
@@ -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;
@@ -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;
@@ -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);
@@ -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;
@@ -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<AppState>, cx: &mut App) {
let app_state = app_state.clone();
@@ -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},
};
@@ -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;
@@ -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;
@@ -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 {
@@ -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};
@@ -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,
@@ -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};
@@ -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<T1: Iterator<Item = char>, T2: Iterator<Item = char>>(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)]
@@ -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};
@@ -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};
@@ -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) {
@@ -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,
@@ -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},
@@ -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<DapRegistry>) {
@@ -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};
@@ -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;
@@ -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 {
@@ -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;
@@ -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 {
@@ -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;
@@ -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 {
@@ -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;
@@ -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;
@@ -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};
@@ -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;
@@ -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::*;
@@ -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;
@@ -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]);
@@ -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,
@@ -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};
@@ -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::<TerminalView>()
- .unwrap()
- .read(cx)
- .terminal()
- .read(cx)
- .debug_terminal());
+ assert!(
+ panel
+ .active_item()
+ .unwrap()
+ .downcast::<TerminalView>()
+ .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()
+ );
});
}
@@ -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;
@@ -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};
@@ -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};
@@ -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};
@@ -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]);
@@ -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() {
@@ -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};
@@ -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<WeakEntity<ProjectDiagnosticsEditor>>,
@@ -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;
@@ -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.);
@@ -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;
@@ -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) {
@@ -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};
@@ -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]
@@ -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<FoldOffset>;
#[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) {
@@ -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<Transform>, 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};
@@ -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) {
@@ -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<WrapEdit>) -> Vec<WrapEdit> {
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::*;
@@ -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<Self>,
- ) -> Option<Entity<ui::ContextMenu>>,
+ + Fn(
+ &mut Self,
+ DisplayPoint,
+ &mut Window,
+ &mut Context<Self>,
+ ) -> Option<Entity<ui::ContextMenu>>,
) {
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 {
@@ -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;
@@ -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]
@@ -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;
@@ -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) => {
@@ -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::<HoveredLinkState>()
- .unwrap_or_default()
- .1
- .is_empty());
+ assert!(
+ editor
+ .snapshot(window, cx)
+ .text_highlight_ranges::<HoveredLinkState>()
+ .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::<HoveredLinkState>()
- .unwrap_or_default()
- .1
- .is_empty());
+ assert!(
+ editor
+ .snapshot(window, cx)
+ .text_highlight_ranges::<HoveredLinkState>()
+ .unwrap_or_default()
+ .1
+ .is_empty()
+ );
});
// Does not open the directory
@@ -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;
@@ -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<ExcerptId, Arc<RwLock<CachedExcerptHints>>>,
@@ -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;
@@ -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]
@@ -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;
@@ -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};
@@ -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};
@@ -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;
@@ -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 {
@@ -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 {
@@ -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;
@@ -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};
@@ -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};
@@ -1,5 +1,5 @@
use serde::Deserialize;
-use ui::{px, Pixels};
+use ui::{Pixels, px};
#[derive(Debug)]
pub enum ScrollDirection {
@@ -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)]
@@ -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.
@@ -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};
@@ -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;
@@ -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::{
@@ -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},
},
};
@@ -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};
@@ -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::{
@@ -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
}
}
@@ -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<Box<dyn Extension>> = 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"));
@@ -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 {
@@ -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::*;
@@ -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;
@@ -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::{
@@ -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;
@@ -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,
@@ -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;
@@ -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;
@@ -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;
@@ -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::{
@@ -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::{
@@ -1,4 +1,4 @@
-use gpui::{prelude::*, AnyElement};
+use gpui::{AnyElement, prelude::*};
use smallvec::SmallVec;
use ui::prelude::*;
@@ -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 {
@@ -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"]),
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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]);
@@ -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};
@@ -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;
@@ -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;
@@ -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::{
@@ -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<dyn Watcher>,
) {
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<Mutex<Vec<PathEvent>>> = Default::default();
@@ -2300,7 +2300,7 @@ async fn file_id(path: impl AsRef<Path>) -> Result<u64> {
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,
},
};
@@ -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};
@@ -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,
@@ -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};
@@ -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)]
@@ -1,6 +1,6 @@
use crate::{
- matcher::{MatchCandidate, Matcher},
CharBag,
+ matcher::{MatchCandidate, Matcher},
};
use gpui::BackgroundExecutor;
use std::{
@@ -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<Vec<BlameEntry>> {
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"));
@@ -1,5 +1,5 @@
use crate::Oid;
-use anyhow::{anyhow, Result};
+use anyhow::{Result, anyhow};
use collections::HashMap;
use std::path::Path;
@@ -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;
@@ -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]
@@ -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;
@@ -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;
@@ -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::{
@@ -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;
@@ -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;
@@ -1,6 +1,6 @@
use std::str::FromStr;
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use url::Url;
use git::{
@@ -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;
@@ -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};
@@ -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.
@@ -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()
}
}
@@ -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(
@@ -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;
@@ -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};
@@ -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;
@@ -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) {
@@ -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 {
@@ -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;
@@ -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};
@@ -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 {}
@@ -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;
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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;
@@ -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 {}
@@ -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::*;
@@ -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]);
@@ -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;
+ }
}
}));
}
@@ -1,4 +1,4 @@
-use gpui::{prelude::*, App, Application, Context, Entity, EventEmitter};
+use gpui::{App, Application, Context, Entity, EventEmitter, prelude::*};
struct Counter {
count: usize,
@@ -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 {
@@ -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;
@@ -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;
@@ -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;
@@ -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 {
@@ -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 {}
@@ -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 {}
@@ -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 {}
@@ -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 {
@@ -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 {
@@ -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 {}
@@ -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},
@@ -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)))
}
@@ -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};
@@ -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,
};
@@ -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
@@ -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};
@@ -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},
@@ -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;
@@ -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.
@@ -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
///
@@ -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;
@@ -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::{
@@ -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();
@@ -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;
@@ -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;
@@ -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};
@@ -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},
@@ -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::*;
@@ -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 {
@@ -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]
@@ -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
@@ -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 {
@@ -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.
@@ -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;
@@ -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;
@@ -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() {
@@ -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,
@@ -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
@@ -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";
@@ -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 {
@@ -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)]
@@ -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.
@@ -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 {
@@ -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,
@@ -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 {
@@ -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 }
}
}
@@ -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,
};
@@ -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,
@@ -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},
@@ -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;
@@ -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;
@@ -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},
@@ -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;
@@ -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,
@@ -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;
@@ -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<String> {
@@ -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
}
}
@@ -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<Mutex<MacWindowState>> {
@@ -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)]
@@ -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.
@@ -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
@@ -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;
@@ -1,5 +1,5 @@
use std::{
- thread::{current, ThreadId},
+ thread::{ThreadId, current},
time::Duration,
};
@@ -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 {
@@ -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<WindowsWindowStatePtr>) -> Option<isize> {
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
}
@@ -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<bool> {
#[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() {
@@ -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,
},
};
@@ -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::*;
@@ -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]
@@ -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,
};
@@ -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};
@@ -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;
@@ -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::{
@@ -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<Option<Pixels>>, Size<AvailableSpace>, &mut Window, &mut App) -> Size<Pixels>
- + 'static,
+ measure: impl FnMut(
+ Size<Option<Pixels>>,
+ Size<AvailableSpace>,
+ &mut Window,
+ &mut App,
+ ) -> Size<Pixels>
+ + 'static,
) -> LayoutId {
let taffy_style = style.to_taffy(rem_size);
@@ -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,
@@ -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;
@@ -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;
@@ -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())
@@ -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;
@@ -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;
@@ -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;
@@ -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);
@@ -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);
@@ -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);
@@ -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;
@@ -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)]
@@ -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 {
@@ -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::*;
@@ -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() {
@@ -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};
@@ -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::*;
@@ -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::*;
@@ -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<IndexedDocsDatabase>,
- fetch_page: impl Fn(&PackageName, Option<&RustdocItem>) -> BoxFuture<'static, Result<Option<String>>>
- + Send
- + Sync,
+ fetch_page: impl Fn(
+ &PackageName,
+ Option<&RustdocItem>,
+ ) -> BoxFuture<'static, Result<Option<String>>>
+ + Send
+ + Sync,
) -> Result<()> {
let Some(package_root_content) = fetch_page(&package, None).await? else {
return Ok(());
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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};
@@ -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<usize>, 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<Item = Range<u32>> {
let mut values = values;
let mut current_range: Option<Range<u32>> = 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();
}
})
}
@@ -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<regex::Regex> = 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(
@@ -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;
@@ -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;
@@ -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,
@@ -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()),
@@ -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;
@@ -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)),
)
@@ -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;
@@ -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};
@@ -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;
@@ -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;
@@ -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};
@@ -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) {
@@ -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;
@@ -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};
@@ -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!(
@@ -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";
@@ -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;
@@ -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";
@@ -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,
@@ -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";
@@ -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";
@@ -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;
@@ -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";
@@ -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;
@@ -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";
@@ -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,
@@ -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 {
@@ -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};
@@ -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};
@@ -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]);
@@ -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:";
@@ -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};
@@ -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]);
@@ -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;
@@ -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<LanguageServ
#[cfg(test)]
mod tests {
use gpui::{AppContext as _, BorrowAppContext, TestAppContext};
- use language::{language_settings::AllLanguageSettings, AutoindentMode, Buffer};
+ use language::{AutoindentMode, Buffer, language_settings::AllLanguageSettings};
use settings::SettingsStore;
use std::num::NonZeroU32;
@@ -1,4 +1,4 @@
-use anyhow::{anyhow, Result};
+use anyhow::{Result, anyhow};
use async_trait::async_trait;
use futures::StreamExt;
use gpui::AsyncApp;
@@ -14,7 +14,7 @@ use std::{
path::{Path, PathBuf},
sync::Arc,
};
-use util::{maybe, ResultExt};
+use util::{ResultExt, maybe};
const SERVER_PATH: &str =
"node_modules/vscode-langservers-extracted/bin/vscode-css-language-server";
@@ -1,4 +1,4 @@
-use anyhow::{anyhow, Context as _, Result};
+use anyhow::{Context as _, Result, anyhow};
use async_trait::async_trait;
use collections::HashMap;
use futures::StreamExt;
@@ -19,12 +19,12 @@ use std::{
process::Output,
str,
sync::{
- atomic::{AtomicBool, Ordering::SeqCst},
Arc, LazyLock,
+ atomic::{AtomicBool, Ordering::SeqCst},
},
};
use task::{TaskTemplate, TaskTemplates, TaskVariables, VariableName};
-use util::{fs::remove_matching, maybe, ResultExt};
+use util::{ResultExt, fs::remove_matching, maybe};
fn server_binary_arguments() -> Vec<OsString> {
vec!["-mode=stdio".into()]
@@ -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";
@@ -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::*;
@@ -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;
@@ -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;
@@ -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 =
@@ -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![
@@ -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<OsString> {
vec![server_path.into(), "--stdio".into()]
@@ -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";
@@ -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;
@@ -1,4 +1,4 @@
-use anyhow::{anyhow, Result};
+use anyhow::{Result, anyhow};
use jsonwebtoken::{DecodingKey, EncodingKey, Header, Validation};
use serde::{Deserialize, Serialize};
use std::{
@@ -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<Self>,
) -> 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"
})
@@ -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);
@@ -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<dyn VideoBuffer>) -> Option<Remote
use image::{Frame, RgbaImage};
use livekit::webrtc::prelude::VideoFormatType;
use smallvec::SmallVec;
- use std::alloc::{alloc, Layout};
+ use std::alloc::{Layout, alloc};
let width = buffer.width();
let height = buffer.height();
@@ -634,12 +634,12 @@ trait DeviceChangeListenerApi: Stream<Item = ()> + 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 {
@@ -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;
@@ -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 {
@@ -1,8 +1,8 @@
use std::sync::Arc;
use crate::{
- test::{TestServerAudioTrack, TestServerVideoTrack, WeakRoom},
ParticipantIdentity, TrackSid,
+ test::{TestServerAudioTrack, TestServerVideoTrack, WeakRoom},
};
#[derive(Clone, Debug)]
@@ -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)]
@@ -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";
@@ -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";
@@ -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},
@@ -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
@@ -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;
@@ -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<Markdown>),
+ + FnMut(&mut Markdown, &T, DispatchPhase, &mut Window, &mut Context<Markdown>),
) {
window.on_mouse_event({
let markdown = self.markdown.downgrade();
@@ -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};
@@ -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
@@ -1,4 +1,4 @@
-use gpui::{actions, App};
+use gpui::{App, actions};
use workspace::Workspace;
pub mod markdown_elements;
@@ -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);
@@ -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};
@@ -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,
};
@@ -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 {
@@ -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,
@@ -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 = &[
(
@@ -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),
@@ -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,
@@ -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 = &[
(
@@ -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)];
@@ -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,
@@ -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),
@@ -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;
@@ -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<D, Output = D>,
{
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<Point>, OutputDimension<Point>)>(&());
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::<D>(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::<D>(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::<D>(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::<D>(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<D: TextDimension + Ord>
cursor_location: &(OutputDimension<D>, ExcerptDimension<D>),
_: &(),
) -> 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
@@ -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<R: AsyncRead + Unpin>(destination: &Path, reader: R) -> Result<()> {
let mut reader = ZipFileReader::new(BufReader::new(reader));
@@ -35,8 +35,8 @@ pub async fn extract_zip<R: AsyncRead + Unpin>(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;
@@ -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<OsString> {
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::<Vec<_>>();
@@ -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);
@@ -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)]
@@ -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";
@@ -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};
@@ -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};
@@ -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};
@@ -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]);
@@ -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<V: 'static>(
placeholder_text: Arc<str>,
edit_handler: impl FnMut(&mut V, &Entity<Editor>, &EditorEvent, &mut Window, &mut Context<V>)
- + 'static,
+ + 'static,
window: &mut Window,
cx: &mut Context<V>,
) -> Self {
@@ -1,4 +1,4 @@
-use ui::{prelude::*, HighlightedLabel};
+use ui::{HighlightedLabel, prelude::*};
#[derive(Clone)]
pub struct HighlightedMatchWithPaths {
@@ -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;
@@ -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;
@@ -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.
@@ -1,4 +1,4 @@
-use futures::{channel::oneshot, FutureExt};
+use futures::{FutureExt, channel::oneshot};
use gpui::{Context, Task};
use std::{marker::PhantomData, time::Duration};
@@ -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;
@@ -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;
@@ -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};
@@ -1,4 +1,4 @@
-use anyhow::{anyhow, Result};
+use anyhow::{Result, anyhow};
use cargo::CargoLocator;
use collections::HashMap;
use dap::DebugAdapterConfig;
@@ -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;
@@ -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<T: DapCommand + PartialEq + Eq + Hash>(
&mut self,
request: T,
- process_result: impl FnOnce(&mut Self, Result<T::Response>, &mut Context<Self>) -> Option<T::Response>
- + 'static,
+ process_result: impl FnOnce(
+ &mut Self,
+ Result<T::Response>,
+ &mut Context<Self>,
+ ) -> Option<T::Response>
+ + 'static,
cx: &mut Context<Self>,
) {
const {
@@ -1246,8 +1250,12 @@ impl Session {
session_id: SessionId,
mode: &Mode,
request: T,
- process_result: impl FnOnce(&mut Self, Result<T::Response>, &mut Context<Self>) -> Option<T::Response>
- + 'static,
+ process_result: impl FnOnce(
+ &mut Self,
+ Result<T::Response>,
+ &mut Context<Self>,
+ ) -> Option<T::Response>
+ + 'static,
cx: &mut Context<Self>,
) -> Task<Option<T::Response>> {
if !T::is_supported(&capabilities) {
@@ -1277,8 +1285,12 @@ impl Session {
fn request<T: DapCommand + PartialEq + Eq + Hash>(
&self,
request: T,
- process_result: impl FnOnce(&mut Self, Result<T::Response>, &mut Context<Self>) -> Option<T::Response>
- + 'static,
+ process_result: impl FnOnce(
+ &mut Self,
+ Result<T::Response>,
+ &mut Context<Self>,
+ ) -> Option<T::Response>
+ + 'static,
cx: &mut Context<Self>,
) -> Task<Option<T::Response>> {
Self::request_inner(
@@ -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<HashMap<String, String>>,
Option<EnvironmentErrorMessage>,
) {
- use crate::direnv::{load_direnv_environment, DirenvError};
+ use crate::direnv::{DirenvError, load_direnv_environment};
use std::path::PathBuf;
use util::parse_env_output;
@@ -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 {
@@ -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};
@@ -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,
@@ -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() {
@@ -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};
@@ -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};
@@ -1,5 +1,5 @@
use std::{
- collections::{btree_map::Entry, BTreeMap},
+ collections::{BTreeMap, btree_map::Entry},
ffi::OsStr,
ops::ControlFlow,
path::{Path, PathBuf},
@@ -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};
@@ -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 {
@@ -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<Self>) -> 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::<Vec<_>>();
- 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::<Vec<_>>();
+ 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;
+ }
}
})
}
@@ -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},
@@ -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 _;
@@ -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};
@@ -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
@@ -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;
@@ -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 {
@@ -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<Path>,
@@ -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()
@@ -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 {
" "
};
@@ -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) {
@@ -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;
@@ -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;
@@ -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<T> {
@@ -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;
@@ -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::*;
@@ -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 {
@@ -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};
@@ -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))]
@@ -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<Result<i32>>;
fn upload_directory(&self, src_path: PathBuf, dest_path: PathBuf, cx: &App)
- -> Task<Result<()>>;
+ -> Task<Result<()>>;
async fn kill(&self) -> Result<()>;
fn has_been_killed(&self) -> bool;
fn ssh_args(&self) -> Vec<String>;
@@ -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;
@@ -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())
}
@@ -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};
@@ -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,
@@ -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;
@@ -1,5 +1,5 @@
use gpui::AnyElement;
-use ui::{prelude::*, Indicator, ListItem};
+use ui::{Indicator, ListItem, prelude::*};
use crate::KernelSpecification;
@@ -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<dyn Fn(KernelSpecification, &mut Window, &mut App)>;
@@ -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;
@@ -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};
@@ -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)]
@@ -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};
@@ -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;
@@ -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;
@@ -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,
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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};
@@ -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;
@@ -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};
@@ -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 {
@@ -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;
@@ -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;
@@ -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;
@@ -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)
+ );
}
}
}
@@ -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};
@@ -37,8 +37,8 @@ impl Connection {
executor: gpui::BackgroundExecutor,
) -> (Self, Self, std::sync::Arc<std::sync::atomic::AtomicBool>) {
use std::sync::{
- atomic::{AtomicBool, Ordering::SeqCst},
Arc,
+ atomic::{AtomicBool, Ordering::SeqCst},
};
let killed = Arc::new(AtomicBool::new(false));
@@ -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";
@@ -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)]
@@ -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,
@@ -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")]
@@ -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;
@@ -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;
@@ -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::<Editor>(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::<ProjectSearchView>()
- .is_some());
+ assert!(
+ pane.active_item()
+ .unwrap()
+ .downcast::<ProjectSearchView>()
+ .is_some()
+ );
assert_eq!(pane.items_len(), 2);
});
@@ -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};
@@ -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,
@@ -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]
@@ -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};
@@ -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 {
@@ -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;
@@ -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;
@@ -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;
@@ -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};
@@ -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;
@@ -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;
@@ -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;
@@ -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,
@@ -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)]
@@ -67,14 +67,16 @@ impl AppSession {
pub fn new(session: Session, cx: &Context<Self>) -> 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 {
@@ -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 {
@@ -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;
@@ -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)]
@@ -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};
@@ -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;
@@ -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)]
@@ -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;
@@ -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};
@@ -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;
@@ -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<SnippetRegistry>);
@@ -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]);
@@ -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()
+ );
}
}
@@ -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;
@@ -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<Option<()>, anyhow::Error> {
- connection.exec_bound("INSERT INTO text(text, idx) VALUES (?, ?)")?((
- save2_text, 2,
- ))?;
-
- assert_eq!(
- connection
- .select::<String>("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<Option<()>, anyhow::Error> {
+ connection.exec_bound("INSERT INTO text(text, idx) VALUES (?, ?)")?((
+ save2_text, 2,
+ ))?;
+
+ assert_eq!(
+ connection
+ .select::<String>("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::<String>("SELECT text FROM text ORDER BY text.idx ASC")?()?,
@@ -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::<String>("SELECT text FROM texts")
- .unwrap()()
- .unwrap()
- .is_none());
+ assert!(
+ connection
+ .select_row::<String>("SELECT text FROM texts")
+ .unwrap()()
+ .unwrap()
+ .is_none()
+ );
let text_to_insert = "This is a test";
@@ -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,
@@ -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;
@@ -1,6 +1,6 @@
use std::borrow::Cow;
-use anyhow::{anyhow, Result};
+use anyhow::{Result, anyhow};
use gpui::{AssetSource, SharedString};
use rust_embed::RustEmbed;
@@ -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 {
@@ -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;
@@ -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::*;
@@ -1,4 +1,4 @@
-use gpui::{prelude::*, Entity, Render};
+use gpui::{Entity, Render, prelude::*};
use story::Story;
use strum::IntoEnumIterator;
use ui::prelude::*;
@@ -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<Picker<Delegate>>,
@@ -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;
@@ -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::*;
@@ -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::*;
@@ -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;
@@ -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]);
}
@@ -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;
@@ -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};
@@ -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.;
@@ -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 {
@@ -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};
@@ -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;
@@ -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]
@@ -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;
@@ -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.
@@ -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;
@@ -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;
@@ -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]
@@ -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;
@@ -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(
@@ -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};
@@ -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";
@@ -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 {
@@ -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,
@@ -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 _;
@@ -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;
@@ -1,4 +1,4 @@
-use smallvec::{smallvec, SmallVec};
+use smallvec::{SmallVec, smallvec};
use std::iter;
use std::sync::LazyLock;
@@ -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;
@@ -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 {
@@ -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.
@@ -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.
@@ -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};
@@ -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 _;
@@ -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.
@@ -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)]
@@ -1,6 +1,6 @@
#![allow(missing_docs)]
-use gpui::{hsla, Hsla};
+use gpui::{Hsla, hsla};
#[derive(Clone, PartialEq)]
pub struct SystemColors {
@@ -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;
@@ -1,6 +1,6 @@
use std::borrow::Cow;
-use anyhow::{anyhow, Result};
+use anyhow::{Result, anyhow};
use gpui::{AssetSource, SharedString};
use rust_embed::RustEmbed;
@@ -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;
@@ -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 {
@@ -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};
@@ -274,8 +274,8 @@ mod macos {
use core_foundation_sys::{
base::kCFAllocatorDefault,
date_formatter::{
- kCFDateFormatterMediumStyle, kCFDateFormatterNoStyle, kCFDateFormatterShortStyle,
- CFDateFormatterCreate,
+ CFDateFormatterCreate, kCFDateFormatterMediumStyle, kCFDateFormatterNoStyle,
+ kCFDateFormatterShortStyle,
},
locale::CFLocaleCopyCurrent,
};
@@ -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]);
@@ -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;
@@ -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
@@ -1,4 +1,4 @@
-use gpui::{prelude::*, Action, MouseButton};
+use gpui::{Action, MouseButton, prelude::*};
use ui::prelude::*;
@@ -1,4 +1,4 @@
-use gpui::{prelude::*, Rgba, WindowAppearance};
+use gpui::{Rgba, WindowAppearance, prelude::*};
use ui::prelude::*;
@@ -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;
@@ -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)]
@@ -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;
@@ -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};
@@ -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.
///
@@ -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;
@@ -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.
@@ -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 {
@@ -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;
@@ -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;
@@ -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)]
@@ -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;
@@ -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;
@@ -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 {
@@ -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 {
@@ -1,4 +1,4 @@
-use crate::{prelude::*, Avatar};
+use crate::{Avatar, prelude::*};
use gpui::{AnyElement, StyleRefinement};
use smallvec::SmallVec;
@@ -1,4 +1,4 @@
-use gpui::{div, prelude::*, Div};
+use gpui::{Div, div, prelude::*};
/// Creates a horizontal group with tight, consistent spacing.
///
@@ -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 {
@@ -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 {
@@ -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;
@@ -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;
@@ -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<V: Render>(
entity: Entity<V>,
indent_size: Pixels,
colors: IndentGuideColors,
- compute_indents_fn: impl Fn(&mut V, Range<usize>, &mut Window, &mut Context<V>) -> SmallVec<[usize; 64]>
- + 'static,
+ compute_indents_fn: impl Fn(
+ &mut V,
+ Range<usize>,
+ &mut Window,
+ &mut Context<V>,
+ ) -> 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<V>,
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))
@@ -1,4 +1,4 @@
-use crate::{prelude::*, AnyIcon};
+use crate::{AnyIcon, prelude::*};
#[derive(Default)]
enum IndicatorKind {
@@ -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;
@@ -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;
@@ -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 {
@@ -1,4 +1,4 @@
-use crate::{prelude::*, LabelLike};
+use crate::{LabelLike, prelude::*};
use gpui::StyleRefinement;
/// A struct representing a label element in the UI.
@@ -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),
@@ -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;
@@ -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 {
@@ -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 {
@@ -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;
@@ -1,6 +1,6 @@
use crate::prelude::*;
use gpui::IntoElement;
-use smallvec::{smallvec, SmallVec};
+use smallvec::{SmallVec, smallvec};
#[derive(IntoElement, IntoComponent)]
#[component(scope = "Notification")]
@@ -1,6 +1,6 @@
use gpui::ClickEvent;
-use crate::{prelude::*, IconButtonShape};
+use crate::{IconButtonShape, prelude::*};
#[derive(IntoElement)]
pub struct NumericStepper {
@@ -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;
@@ -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::*;
@@ -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<M: ManagedView> {
@@ -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;
}
@@ -1,7 +1,7 @@
use gpui::AnyElement;
use smallvec::SmallVec;
-use crate::{prelude::*, ListHeader};
+use crate::{ListHeader, prelude::*};
/// A group of settings.
#[derive(IntoElement)]
@@ -1,4 +1,4 @@
-use gpui::{div, Div};
+use gpui::{Div, div};
use crate::StyledExt;
@@ -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]);
@@ -1,8 +1,8 @@
use gpui::Render;
use story::Story;
-use crate::prelude::*;
use crate::Disclosure;
+use crate::prelude::*;
pub struct DisclosureStory;
@@ -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;
@@ -3,7 +3,7 @@ use gpui::Render;
use itertools::Itertools;
use story::Story;
-use crate::{prelude::*, KeyBinding};
+use crate::{KeyBinding, prelude::*};
pub struct KeybindingStory;
@@ -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;
@@ -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;
@@ -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.";
@@ -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;
@@ -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;
@@ -1,7 +1,7 @@
use gpui::Render;
use story::{Story, StoryItem, StorySection};
-use crate::{prelude::*, ToggleButton};
+use crate::{ToggleButton, prelude::*};
pub struct ToggleButtonStory;
@@ -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 {
@@ -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)]
@@ -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
@@ -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 {
@@ -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;
@@ -1,4 +1,4 @@
-use crate::{prelude::*, ContentGroup};
+use crate::{ContentGroup, prelude::*};
use gpui::{AnimationElement, AnimationExt, Styled};
use std::time::Duration;
@@ -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.
@@ -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;
@@ -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 {
@@ -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.;
@@ -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() {
@@ -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<E: Styled>(this: E, cx: &App, index: ElevationIndex) -> E {
this.bg(cx.theme().colors().elevated_surface_background)
@@ -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.
@@ -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);
@@ -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);
@@ -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 {
@@ -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;
@@ -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};
@@ -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: FnOnce()>(f: F) -> Deferred<F> {
#[cfg(any(test, feature = "test-support"))]
mod rng {
- use rand::{seq::SliceRandom, Rng};
+ use rand::{Rng, seq::SliceRandom};
pub struct RandomCharIter<T: Rng> {
rng: T,
simple_text: bool,
@@ -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.
@@ -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]);
@@ -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)]
@@ -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]
@@ -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]);
@@ -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;
@@ -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]);
@@ -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};
@@ -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)]
@@ -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]
@@ -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 {
@@ -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;
@@ -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};
@@ -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")];
@@ -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 {
@@ -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;
@@ -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]);
@@ -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;
@@ -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;
@@ -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]);
@@ -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;
@@ -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};
@@ -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;
@@ -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;
@@ -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]);
@@ -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;
@@ -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) {
@@ -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::<CommandPalette>(cx).is_some()));
+ assert!(
+ cx.workspace(|workspace, _, cx| workspace.active_modal::<CommandPalette>(cx).is_some())
+ );
cx.simulate_keystrokes("escape");
cx.run_until_parked();
assert!(
@@ -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 {
@@ -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;
@@ -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, *};
@@ -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};
@@ -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!(
@@ -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]);
@@ -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};
@@ -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;
@@ -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,
@@ -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,
@@ -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<Workspace>)
- -> Option<Self::Ok>;
+ -> Option<Self::Ok>;
fn notify_async_err(self, cx: &mut AsyncWindowContext) -> Option<Self::Ok>;
@@ -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()
+ )
});
}
@@ -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;
@@ -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<i32> {
- let this: i32 = self.0 .0 as i32;
+ let this: i32 = self.0.0 as i32;
this.bind(statement, start_index)
}
}
@@ -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)]
@@ -8,8 +8,8 @@ use gpui::{
use project::search::SearchQuery;
use crate::{
- item::{Item, WeakItemHandle},
ItemHandle,
+ item::{Item, WeakItemHandle},
};
#[derive(Clone, Debug)]
@@ -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,
@@ -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};
@@ -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;
@@ -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;
@@ -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 {
@@ -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)
+ );
});
}
@@ -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);
@@ -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};
@@ -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();
@@ -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};
@@ -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;
@@ -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};
@@ -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;
@@ -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;
@@ -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};
@@ -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.
@@ -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;
@@ -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]);
@@ -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};
@@ -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 {
@@ -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!(
@@ -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 {
@@ -275,8 +275,8 @@ pub mod scope_map {
collections::{HashMap, VecDeque},
hash::{DefaultHasher, Hasher},
sync::{
- atomic::{AtomicU64, Ordering},
RwLock,
+ atomic::{AtomicU64, Ordering},
},
usize,
};
@@ -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<String>,
@@ -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 =
@@ -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;
@@ -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";
@@ -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,
@@ -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<String>,
@@ -1,6 +1,6 @@
use std::process::Command;
-use anyhow::{bail, Context, Result};
+use anyhow::{Context, Result, bail};
use clap::Parser;
#[derive(Parser)]
@@ -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;
@@ -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;