mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-02 13:30:26 +01:00
eadffde6e9
## Summary Removes code, files and config entries that nothing in the repository uses. Follow-up to the cleanups in #67126 through #67219. No behavior changes. - `project`: removes `SshLspAdapter`, which nothing has constructed since language server adapters moved to the remote server. Also removes `RepositorySnapshot::diff_stat_for_path` and its `Repository` wrapper, `BufferStore::loading_buffers` and `LocalLspStore::running_language_server_for_id`. - `git_ui`: removes `move_to_project_path` from `ProjectDiff` and `DiffMultibuffer`. #67149 removed their last caller. - `editor`: removes `DisplaySnapshot::reverse_text_chunks` and `DisplaySnapshot::excerpt_header_height`, and `BlockSnapshot`'s copy of the excerpt header height, which only the latter read. - `copilot`: removes the `setEditorInfo`, `notifyAccepted` and `notifyRejected` request types, which Zed no longer sends. - Removes unused helpers in `acp_thread`, `agent`, `client`, `collab`, `fs`, `git`, `markdown`, `settings_ui`, `text`, `ui`, `util` and `workspace`. `util` drops its `serde_json_lenient` dependency. - `edit_prediction_cli` drops its library target, which only held a private module. `cli` drops an uncalled `wait_for_socket` on Linux. - Deletes orphaned files: - 12 vim Neovim recordings for tests that were removed or don't use `NeovimBackedTestContext` - `script/seed-db`, which runs a removed `collab` subcommand, and `crates/collab/seed/github_users.json`, which only seeding read - `script/squawk` and its config, `script/upload-nightly.ps1` and its helper, and the dev drive scripts, which no workflow or script calls - `Dockerfile-cross.dockerignore`, `crates/db/README.md` and `assets/themes/.gitkeep` - Removes config entries for things that no longer exist: typos excludes and an ignore pattern, a clippy entry for the removed `cocoa` crate, license clarifications for crates no longer in `Cargo.lock`, `ci.yml` references in actionlint and `check-todos`, AGENTS.md links to deleted crash tooling, a dependency line in the `new-crate` template for a crate that no longer exists, and the unread `repl.output_max_width_columns` default with its docs. ### Suggested AGENTS.md additions > For `crates/vim`: `NeovimBackedTestContext` reads `test_data/<test name>.json`. When you remove or rename a Neovim-backed test, delete or rename its recording too; nothing flags orphaned recordings. ## Testing - No references to the removed items, files or settings key remain in the tree, including in other platforms' cfg-gated code, docs and scripts. - `./script/clippy` - `cargo check --workspace --all-targets` with `-D warnings`, with default features and with `--all-features` - `cargo fmt --all -- --check` - `cargo test -p xtask -- workspace::` - `cargo test -p vim -p util -p git -p text -p markdown -p fs` ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A
86 lines
2.0 KiB
Bash
Executable File
86 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Try to make sure we are in the zed repo root
|
|
if [ ! -d "crates" ] || [ ! -d "script" ]; then
|
|
echo "Error: Run from the \`zed\` repo root"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "Cargo.toml" ]; then
|
|
echo "Error: Run from the \`zed\` repo root"
|
|
exit 1
|
|
fi
|
|
|
|
if [ $# -eq 0 ]; then
|
|
echo "Usage: $0 <crate_name> [optional_license_flag]"
|
|
exit 1
|
|
fi
|
|
|
|
CRATE_NAME="$1"
|
|
|
|
LICENSE_FLAG=$(echo "${2:-}" | tr '[:upper:]' '[:lower:]')
|
|
if [[ "$LICENSE_FLAG" == *"apache"* ]]; then
|
|
LICENSE_MODE="Apache-2.0"
|
|
LICENSE_FILE="LICENSE-APACHE"
|
|
elif [[ "$LICENSE_FLAG" == *"agpl"* ]]; then
|
|
echo "Error: New first-party crates cannot use AGPL. Use GPL or Apache."
|
|
exit 1
|
|
else
|
|
LICENSE_MODE="GPL-3.0-or-later"
|
|
LICENSE_FILE="LICENSE-GPL"
|
|
fi
|
|
|
|
if [[ ! "$CRATE_NAME" =~ ^[a-z0-9_]+$ ]]; then
|
|
echo "Error: Crate name must be lowercase and contain only alphanumeric characters and underscores"
|
|
exit 1
|
|
fi
|
|
|
|
CRATE_PATH="crates/$CRATE_NAME"
|
|
mkdir -p "$CRATE_PATH/src"
|
|
|
|
# Symlink the license
|
|
ln -sf "../../$LICENSE_FILE" "$CRATE_PATH/$LICENSE_FILE"
|
|
|
|
CARGO_TOML_TEMPLATE=$(cat << 'EOF'
|
|
[package]
|
|
name = "$CRATE_NAME"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
publish.workspace = true
|
|
license = "$LICENSE_MODE"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
path = "src/$CRATE_NAME.rs"
|
|
|
|
[features]
|
|
default = []
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
gpui.workspace = true
|
|
ui.workspace = true
|
|
util.workspace = true
|
|
|
|
# Uncomment other workspace dependencies as needed
|
|
# client.workspace = true
|
|
# project.workspace = true
|
|
# settings.workspace = true
|
|
EOF
|
|
)
|
|
|
|
# Populate template
|
|
CARGO_TOML_CONTENT=$(echo "$CARGO_TOML_TEMPLATE" | sed \
|
|
-e "s/\$CRATE_NAME/$CRATE_NAME/g" \
|
|
-e "s/\$LICENSE_MODE/$LICENSE_MODE/g")
|
|
|
|
echo "$CARGO_TOML_CONTENT" > "$CRATE_PATH/Cargo.toml"
|
|
|
|
echo "//! # $CRATE_NAME" > "$CRATE_PATH/src/$CRATE_NAME.rs"
|
|
|
|
echo "Created new crate: $CRATE_NAME in $CRATE_PATH"
|
|
echo "License: $LICENSE_MODE (symlinked from $LICENSE_FILE)"
|
|
echo "Don't forget to add the new crate to the workspace!"
|