Compare commits

..

9 Commits

Author SHA1 Message Date
Nate Butler
a3e04867ab Update git_ui.rs 2024-12-16 15:30:27 -05:00
Nate Butler
3abf165c1d Update git_panel.rs 2024-12-16 15:30:25 -05:00
Nate Butler
48eae645f2 Revert "Merge branch 'main' into git-panel-commit-editor"
This reverts commit 78b6cae754, reversing
changes made to 1cac4b6c00.
2024-12-16 15:29:44 -05:00
Nate Butler
78b6cae754 Merge branch 'main' into git-panel-commit-editor 2024-12-16 15:26:45 -05:00
Nate Butler
1cac4b6c00 Revert "wip"
This reverts commit aee641d79d.
2024-12-16 15:12:49 -05:00
Nate Butler
aee641d79d wip 2024-12-16 13:24:55 -05:00
Nate Butler
4f439ae35f Update git_panel.rs 2024-12-13 21:19:16 -05:00
Nate Butler
c2eea3a474 start on commit editor 2024-12-13 21:06:18 -05:00
Nate Butler
695f06c020 Checkpoint 2024-12-13 20:18:09 -05:00
1218 changed files with 60421 additions and 99069 deletions

View File

@@ -1,12 +0,0 @@
# This config is different from config.toml in this directory, as the latter is recognized by Cargo.
# This file is placed in ./../.cargo/config.toml on CI runs. Cargo then merges Zeds .cargo/config.toml with ./../.cargo/config.toml
# with preference for settings from Zeds config.toml.
# TL;DR: If a value is set in both ci-config.toml and config.toml, config.toml value takes precedence.
# Arrays are merged together though. See: https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure
# The intent for this file is to configure CI build process with a divergance from Zed developers experience; for example, in this config file
# we use `-D warnings` for rustflags (which makes compilation fail in presence of warnings during build process). Placing that in developers `config.toml`
# would be incovenient.
# The reason for not using the RUSTFLAGS environment variable is that doing so would override all the settings in the config.toml file, even if the contents of the latter are completely nonsensical. See: https://github.com/rust-lang/cargo/issues/5376
# Here, we opted to use `[target.'cfg(all())']` instead of `[build]` because `[target.'**']` is guaranteed to be cumulative.
[target.'cfg(all())']
rustflags = ["-D", "warnings"]

View File

@@ -19,10 +19,6 @@ rustflags = ["-C", "link-args=-Objc -all_load"]
[target.x86_64-apple-darwin] [target.x86_64-apple-darwin]
rustflags = ["-C", "link-args=-Objc -all_load"] rustflags = ["-C", "link-args=-Objc -all_load"]
# This cfg will reduce the size of `windows::core::Error` from 16 bytes to 4 bytes
[target.'cfg(target_os = "windows")'] [target.'cfg(target_os = "windows")']
rustflags = [ rustflags = ["--cfg", "windows_slim_errors"]
"--cfg",
"windows_slim_errors", # This cfg will reduce the size of `windows::core::Error` from 16 bytes to 4 bytes
"-C",
"target-feature=+crt-static", # This fixes the linking issue when compiling livekit on Windows
]

View File

@@ -0,0 +1,31 @@
name: Feature Request
description: "Tip: open this issue template from within Zed with the `request feature` command palette action"
labels: ["admin read", "triage", "enhancement"]
body:
- type: checkboxes
attributes:
label: Check for existing issues
description: Check the backlog of issues to reduce the chances of creating duplicates; if an issue already exists, place a `+1` (👍) on it.
options:
- label: Completed
required: true
- type: textarea
attributes:
label: Describe the feature
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: environment
attributes:
label: Environment
description: Run the `copy system specs into clipboard` command palette action and paste the output in the field below. If you are unable to run the command, please include your Zed version and release channel, operating system and version, RAM amount, and architecture.
validations:
required: true
- type: textarea
attributes:
label: |
If applicable, add mockups / screenshots to help present your vision of the feature
description: Drag images into the text input below
validations:
required: false

View File

@@ -1,34 +1,49 @@
name: Bug Report name: Bug Report
description: | description: |
Something is broken in Zed (exclude crashing). Use this template for **non-crash-related** bug reports.
type: "Bug" Tip: open this issue template from within Zed with the `file bug report` command palette action.
labels: ["admin read", "triage", "bug"]
body: body:
- type: checkboxes
attributes:
label: Check for existing issues
description: Check the backlog of issues to reduce the chances of creating duplicates; if an issue already exists, place a `+1` (👍) on it.
options:
- label: Completed
required: true
- type: textarea - type: textarea
attributes: attributes:
label: Summary label: Describe the bug / provide steps to reproduce it
description: Describe the bug with a one line summary, and provide detailed reproduction steps description: A clear and concise description of what the bug is.
value: |
<!-- Please insert a one line summary of the issue below -->
<!-- Include all steps necessary to reproduce from a clean Zed installation. Be verbose -->
Steps to trigger the problem:
1.
2.
3.
Actual Behavior:
Expected Behavior:
validations: validations:
required: true required: true
- type: textarea - type: textarea
id: environment id: environment
attributes: attributes:
label: Zed Version and System Specs label: Environment
description: 'Open Zed, and in the command palette select "zed: Copy System Specs Into Clipboard"' description: Run the `copy system specs into clipboard` command palette action and paste the output in the field below. If you are unable to run the command, please include your Zed version and release channel, operating system and version, RAM amount, and architecture.
placeholder: |
Output of "zed: Copy System Specs Into Clipboard"
validations: validations:
required: true required: true
- type: textarea
attributes:
label: If applicable, add screenshots or screencasts of the incorrect state / behavior
description: Drag images / videos into the text input below
validations:
required: false
- type: textarea
attributes:
label: If applicable, attach your Zed.log file to this issue.
description: |
macOS: `~/Library/Logs/Zed/Zed.log`
Linux: `~/.local/share/zed/logs/Zed.log` or $XDG_DATA_HOME
If you only need the most recent lines, you can run the `zed: open log` command palette action to see the last 1000.
value: |
<details><summary>Zed.log</summary>
<!-- Click below this line and paste or drag-and-drop your log-->
```
```
<!-- Click above this line and paste or drag-and-drop your log--></details>
validations:
required: false

View File

@@ -1,33 +1,26 @@
name: Crash Report name: Crash Report
description: Zed is Crashing or Hanging description: |
type: "Crash" Use this template for crash reports.
labels: ["admin read", "triage", "bug", "panic / crash"]
body: body:
- type: checkboxes
attributes:
label: Check for existing issues
description: Check the backlog of issues to reduce the chances of creating duplicates; if an issue already exists, place a `+1` (👍) on it.
options:
- label: Completed
required: true
- type: textarea - type: textarea
attributes: attributes:
label: Summary label: Describe the bug / provide steps to reproduce it
description: Describe the bug with a one line summary, and provide detailed reproduction steps description: A clear and concise description of what the bug is.
value: |
<!-- Please insert a one line summary of the issue below -->
<!-- Include all steps necessary to reproduce from a clean Zed installation. Be verbose -->
Steps to trigger the problem:
1.
2.
3.
Actual Behavior:
Expected Behavior:
validations: validations:
required: true required: true
- type: textarea - type: textarea
id: environment id: environment
attributes: attributes:
label: Zed Version and System Specs label: Environment
description: 'Open Zed, and in the command palette select "zed: Copy System Specs Into Clipboard"' description: Run the `copy system specs into clipboard` command palette action and paste the output in the field below. If you are unable to run the command, please include your Zed version and release channel, operating system and version, RAM amount, and architecture.
placeholder: |
Output of "zed: Copy System Specs Into Clipboard"
validations: validations:
required: true required: true
- type: textarea - type: textarea

View File

@@ -1,12 +1,18 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-issue-config.json # yaml-language-server: $schema=https://json.schemastore.org/github-issue-config.json
blank_issues_enabled: false blank_issues_enabled: false
contact_links: contact_links:
- name: Feature Request - name: Language Request
url: https://github.com/zed-industries/zed/discussions/new/choose url: https://github.com/zed-industries/extensions/issues/new?assignees=&labels=language&projects=&template=1_language_request.yml&title=%3Cname_of_language%3E
about: To request a feature, open a new Discussion in one of the appropriate Discussion categories about: Request a language in the extensions repository
- name: Zed Discussion Forum - name: Theme Request
url: https://github.com/zed-industries/zed/discussions url: https://github.com/zed-industries/extensions/issues/new?assignees=&labels=theme&projects=&template=0_theme_request.yml&title=%3Cname_of_theme%3E+theme
about: A community discussion forum about: Request a theme in the extensions repository
- name: "Zed Discord: #Support Channel" - name: Top-Ranking Issues
url: https://zed.dev/community-links url: https://github.com/zed-industries/zed/issues/5393
about: Real-time discussion and user support about: See an overview of the most popular Zed issues
- name: Platform Support
url: https://github.com/zed-industries/zed/issues/5391
about: A quick note on platform support
- name: Positive Feedback
url: https://github.com/zed-industries/zed/discussions/5397
about: A central location for kind words about Zed

View File

@@ -7,10 +7,10 @@ runs:
- name: Install Rust - name: Install Rust
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
run: | run: |
cargo install cargo-nextest --locked cargo install cargo-nextest
- name: Install Node - name: Install Node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with: with:
node-version: "18" node-version: "18"

View File

@@ -14,7 +14,6 @@ concurrency:
jobs: jobs:
bump_patch_version: bump_patch_version:
if: github.repository_owner == 'zed-industries'
runs-on: runs-on:
- buildjet-16vcpu-ubuntu-2204 - buildjet-16vcpu-ubuntu-2204
steps: steps:

View File

@@ -7,10 +7,14 @@ on:
- "v[0-9]+.[0-9]+.x" - "v[0-9]+.[0-9]+.x"
tags: tags:
- "v*" - "v*"
paths-ignore:
- "docs/**"
pull_request: pull_request:
branches: branches:
- "**" - "**"
paths-ignore:
- "docs/**/*"
- ".github/workflows/community_*"
concurrency: concurrency:
# Allow only one workflow per any non-`main` branch. # Allow only one workflow per any non-`main` branch.
@@ -21,6 +25,7 @@ env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0 CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
jobs: jobs:
migration_checks: migration_checks:
@@ -76,10 +81,6 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
# To support writing comments that they will certainly be revisited.
- name: Check for todo! and FIXME comments
run: script/check-todos
- name: Run style checks - name: Run style checks
uses: ./.github/actions/check_style uses: ./.github/actions/check_style
@@ -101,11 +102,6 @@ jobs:
with: with:
clean: false clean: false
- name: Configure CI
run: |
mkdir -p ./../.cargo
cp ./.cargo/ci-config.toml ./../.cargo/config.toml
- name: cargo clippy - name: cargo clippy
run: ./script/clippy run: ./script/clippy
@@ -137,11 +133,6 @@ jobs:
cargo build -p remote_server cargo build -p remote_server
script/check-rust-livekit-macos script/check-rust-livekit-macos
# Since the macOS runners are stateful, so we need to remove the config file to prevent potential bug.
- name: Clean CI config file
if: always()
run: rm -rf ./../.cargo
linux_tests: linux_tests:
timeout-minutes: 60 timeout-minutes: 60
name: (Linux) Run Clippy and tests name: (Linux) Run Clippy and tests
@@ -158,7 +149,7 @@ jobs:
clean: false clean: false
- name: Cache dependencies - name: Cache dependencies
uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
cache-provider: "buildjet" cache-provider: "buildjet"
@@ -166,11 +157,6 @@ jobs:
- name: Install Linux dependencies - name: Install Linux dependencies
run: ./script/linux run: ./script/linux
- name: Configure CI
run: |
mkdir -p ./../.cargo
cp ./.cargo/ci-config.toml ./../.cargo/config.toml
- name: cargo clippy - name: cargo clippy
run: ./script/clippy run: ./script/clippy
@@ -182,14 +168,6 @@ jobs:
cargo build -p zed cargo build -p zed
cargo check -p workspace cargo check -p workspace
# Even the Linux runner is not stateful, in theory there is no need to do this cleanup.
# But, to avoid potential issues in the future if we choose to use a stateful Linux runner and forget to add code
# to clean up the config file, Ive included the cleanup code here as a precaution.
# While its not strictly necessary at this moment, I believe its better to err on the side of caution.
- name: Clean CI config file
if: always()
run: rm -rf ./../.cargo
build_remote_server: build_remote_server:
timeout-minutes: 60 timeout-minutes: 60
name: (Linux) Build Remote Server name: (Linux) Build Remote Server
@@ -206,7 +184,7 @@ jobs:
clean: false clean: false
- name: Cache dependencies - name: Cache dependencies
uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
cache-provider: "buildjet" cache-provider: "buildjet"
@@ -214,18 +192,9 @@ jobs:
- name: Install Clang & Mold - name: Install Clang & Mold
run: ./script/remote-server && ./script/install-mold 2.34.0 run: ./script/remote-server && ./script/install-mold 2.34.0
- name: Configure CI
run: |
mkdir -p ./../.cargo
cp ./.cargo/ci-config.toml ./../.cargo/config.toml
- name: Build Remote Server - name: Build Remote Server
run: cargo build -p remote_server run: cargo build -p remote_server
- name: Clean CI config file
if: always()
run: rm -rf ./../.cargo
# todo(windows): Actually run the tests # todo(windows): Actually run the tests
windows_tests: windows_tests:
timeout-minutes: 60 timeout-minutes: 60
@@ -242,16 +211,11 @@ jobs:
clean: false clean: false
- name: Cache dependencies - name: Cache dependencies
uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
cache-provider: "github" cache-provider: "github"
- name: Configure CI
run: |
mkdir -p ./../.cargo
cp ./.cargo/ci-config.toml ./../.cargo/config.toml
- name: cargo clippy - name: cargo clippy
# Windows can't run shell scripts, so we need to use `cargo xtask`. # Windows can't run shell scripts, so we need to use `cargo xtask`.
run: cargo xtask clippy run: cargo xtask clippy
@@ -259,13 +223,8 @@ jobs:
- name: Build Zed - name: Build Zed
run: cargo build run: cargo build
# Since the Windows runners are stateful, so we need to remove the config file to prevent potential bug.
- name: Clean CI config file
if: always()
run: Remove-Item -Path "./../.cargo" -Recurse -Force
bundle-mac: bundle-mac:
timeout-minutes: 120 timeout-minutes: 60
name: Create a macOS bundle name: Create a macOS bundle
runs-on: runs-on:
- self-hosted - self-hosted
@@ -283,7 +242,7 @@ jobs:
DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }} DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
steps: steps:
- name: Install Node - name: Install Node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with: with:
node-version: "18" node-version: "18"
@@ -317,6 +276,9 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate license file
run: script/generate-licenses
- name: Create macOS app bundle - name: Create macOS app bundle
run: script/bundle-mac run: script/bundle-mac
@@ -327,14 +289,14 @@ jobs:
mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg mv target/x86_64-apple-darwin/release/Zed.dmg target/x86_64-apple-darwin/release/Zed-x86_64.dmg
- name: Upload app bundle (aarch64) to workflow run if main branch or specific label - name: Upload app bundle (aarch64) to workflow run if main branch or specific label
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }} if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
with: with:
name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-aarch64.dmg
path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg path: target/aarch64-apple-darwin/release/Zed-aarch64.dmg
- name: Upload app bundle (x86_64) to workflow run if main branch or specific label - name: Upload app bundle (x86_64) to workflow run if main branch or specific label
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }} if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
with: with:
name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg name: Zed_${{ github.event.pull_request.head.sha || github.sha }}-x86_64.dmg
@@ -354,9 +316,9 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bundle-linux-x86_x64: bundle-linux:
timeout-minutes: 60 timeout-minutes: 60
name: Linux x86_x64 release bundle name: Create a Linux bundle
runs-on: runs-on:
- buildjet-16vcpu-ubuntu-2004 - buildjet-16vcpu-ubuntu-2004
if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }} if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
@@ -364,8 +326,6 @@ jobs:
env: env:
ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }} ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -385,7 +345,7 @@ jobs:
run: script/bundle-linux run: script/bundle-linux
- name: Upload Linux bundle to workflow run if main branch or specific label - name: Upload Linux bundle to workflow run if main branch or specific label
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }} if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
with: with:
name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz name: zed-${{ github.event.pull_request.head.sha || github.sha }}-x86_64-unknown-linux-gnu.tar.gz
@@ -404,7 +364,7 @@ jobs:
bundle-linux-aarch64: # this runs on ubuntu22.04 bundle-linux-aarch64: # this runs on ubuntu22.04
timeout-minutes: 60 timeout-minutes: 60
name: Linux arm64 release bundle name: Create arm64 Linux bundle
runs-on: runs-on:
- buildjet-16vcpu-ubuntu-2204-arm - buildjet-16vcpu-ubuntu-2204-arm
if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }} if: ${{ startsWith(github.ref, 'refs/tags/v') || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
@@ -412,8 +372,6 @@ jobs:
env: env:
ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }} ZED_CLIENT_CHECKSUM_SEED: ${{ secrets.ZED_CLIENT_CHECKSUM_SEED }}
ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }} ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
@@ -433,7 +391,7 @@ jobs:
run: script/bundle-linux run: script/bundle-linux
- name: Upload Linux bundle to workflow run if main branch or specific label - name: Upload Linux bundle to workflow run if main branch or specific label
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }} if: ${{ github.ref == 'refs/heads/main' }} || contains(github.event.pull_request.labels.*.name, 'run-bundling') }}
with: with:
name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz name: zed-${{ github.event.pull_request.head.sha || github.sha }}-aarch64-unknown-linux-gnu.tar.gz
@@ -453,7 +411,7 @@ jobs:
auto-release-preview: auto-release-preview:
name: Auto release preview name: Auto release preview
if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre') }} if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '-pre') && !endsWith(github.ref, '.0-pre') }}
needs: [bundle-mac, bundle-linux-x86_x64, bundle-linux-aarch64] needs: [bundle-mac, bundle-linux, bundle-linux-aarch64]
runs-on: runs-on:
- self-hosted - self-hosted
- bundle - bundle

View File

@@ -9,7 +9,7 @@ jobs:
if: github.repository_owner == 'zed-industries' if: github.repository_owner == 'zed-industries'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9 - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: > stale-issue-message: >
@@ -19,7 +19,11 @@ jobs:
Thanks for your help! Thanks for your help!
close-issue-message: "This issue was closed due to inactivity. If you're still experiencing this problem, please open a new issue with a link to this issue." close-issue-message: "This issue was closed due to inactivity. If you're still experiencing this problem, please open a new issue with a link to this issue."
days-before-stale: 120 # We will increase `days-before-stale` to 365 on or after Jan 24th,
# 2024. This date marks one year since migrating issues from
# 'community' to 'zed' repository. The migration added activity to all
# issues, preventing 365 days from working until then.
days-before-stale: 180
days-before-close: 7 days-before-close: 7
any-of-issue-labels: "bug,panic / crash" any-of-issue-labels: "bug,panic / crash"
operations-per-run: 1000 operations-per-run: 1000

View File

@@ -9,7 +9,6 @@ permissions:
jobs: jobs:
delete_comment: delete_comment:
if: github.repository_owner == 'zed-industries'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check for specific strings in comment - name: Check for specific strings in comment

View File

@@ -6,7 +6,6 @@ on:
jobs: jobs:
discord_release: discord_release:
if: github.repository_owner == 'zed-industries'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get release URL - name: Get release URL
@@ -19,7 +18,7 @@ jobs:
fi fi
echo "::set-output name=URL::$URL" echo "::set-output name=URL::$URL"
- name: Get content - name: Get content
uses: 2428392/gh-truncate-string-action@b3ff790d21cf42af3ca7579146eedb93c8fb0757 # v1.4.1 uses: 2428392/gh-truncate-string-action@e6b5885fb83c81ca9a700a91b079baec2133be3e # v1.4.0
id: get-content id: get-content
with: with:
stringToTruncate: | stringToTruncate: |

View File

@@ -0,0 +1,25 @@
name: Update All Top Ranking Issues
on:
schedule:
- cron: "0 */12 * * *"
workflow_dispatch:
jobs:
update_top_ranking_issues:
runs-on: ubuntu-latest
if: github.repository == 'zed-industries/zed'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "script/update_top_ranking_issues/pyproject.toml"
- name: Install Python 3.13
run: uv python install 3.13
- name: Install dependencies
run: uv sync --project script/update_top_ranking_issues -p 3.13
- name: Run script
run: uv run --project script/update_top_ranking_issues script/update_top_ranking_issues/main.py --github-token ${{ secrets.GITHUB_TOKEN }} --issue-reference-number 5393

View File

@@ -0,0 +1,25 @@
name: Update Weekly Top Ranking Issues
on:
schedule:
- cron: "0 15 * * *"
workflow_dispatch:
jobs:
update_top_ranking_issues:
runs-on: ubuntu-latest
if: github.repository == 'zed-industries/zed'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up uv
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # v3
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "script/update_top_ranking_issues/pyproject.toml"
- name: Install Python 3.13
run: uv python install 3.13
- name: Install dependencies
run: uv sync --project script/update_top_ranking_issues -p 3.13
- name: Run script
run: uv run --project script/update_top_ranking_issues script/update_top_ranking_issues/main.py --github-token ${{ secrets.GITHUB_TOKEN }} --issue-reference-number 6952 --query-day-interval 7

View File

@@ -11,7 +11,6 @@ on:
jobs: jobs:
danger: danger:
if: github.repository_owner == 'zed-industries'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -22,7 +21,7 @@ jobs:
version: 9 version: 9
- name: Setup Node - name: Setup Node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with: with:
node-version: "20" node-version: "20"
cache: "pnpm" cache: "pnpm"

View File

@@ -37,28 +37,28 @@ jobs:
mdbook build ./docs --dest-dir=../target/deploy/docs/ mdbook build ./docs --dest-dir=../target/deploy/docs/
- name: Deploy Docs - name: Deploy Docs
uses: cloudflare/wrangler-action@7a5f8bbdfeedcde38e6777a50fe685f89259d4ca # v3 uses: cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3
with: with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy target/deploy --project-name=docs command: pages deploy target/deploy --project-name=docs
- name: Deploy Install - name: Deploy Install
uses: cloudflare/wrangler-action@7a5f8bbdfeedcde38e6777a50fe685f89259d4ca # v3 uses: cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3
with: with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: r2 object put -f script/install.sh zed-open-source-website-assets/install.sh command: r2 object put -f script/install.sh zed-open-source-website-assets/install.sh
- name: Deploy Docs Workers - name: Deploy Docs Workers
uses: cloudflare/wrangler-action@7a5f8bbdfeedcde38e6777a50fe685f89259d4ca # v3 uses: cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3
with: with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy .cloudflare/docs-proxy/src/worker.js command: deploy .cloudflare/docs-proxy/src/worker.js
- name: Deploy Install Workers - name: Deploy Install Workers
uses: cloudflare/wrangler-action@7a5f8bbdfeedcde38e6777a50fe685f89259d4ca # v3 uses: cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3
with: with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

View File

@@ -12,7 +12,6 @@ env:
jobs: jobs:
style: style:
name: Check formatting and Clippy lints name: Check formatting and Clippy lints
if: github.repository_owner == 'zed-industries'
runs-on: runs-on:
- self-hosted - self-hosted
- test - test
@@ -45,7 +44,7 @@ jobs:
- name: Install cargo nextest - name: Install cargo nextest
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}
run: | run: |
cargo install cargo-nextest --locked cargo install cargo-nextest
- name: Limit target directory size - name: Limit target directory size
shell: bash -euxo pipefail {0} shell: bash -euxo pipefail {0}

View File

@@ -12,7 +12,6 @@ env:
jobs: jobs:
publish: publish:
name: Publish zed-extension CLI name: Publish zed-extension CLI
if: github.repository_owner == 'zed-industries'
runs-on: runs-on:
- ubuntu-latest - ubuntu-latest
steps: steps:
@@ -22,7 +21,7 @@ jobs:
clean: false clean: false
- name: Cache dependencies - name: Cache dependencies
uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2 uses: swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2
with: with:
save-if: ${{ github.ref == 'refs/heads/main' }} save-if: ${{ github.ref == 'refs/heads/main' }}
cache-provider: "github" cache-provider: "github"

View File

@@ -18,12 +18,11 @@ env:
jobs: jobs:
tests: tests:
name: Run randomized tests name: Run randomized tests
if: github.repository_owner == 'zed-industries'
runs-on: runs-on:
- buildjet-16vcpu-ubuntu-2204 - buildjet-16vcpu-ubuntu-2204
steps: steps:
- name: Install Node - name: Install Node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with: with:
node-version: "18" node-version: "18"

View File

@@ -70,7 +70,7 @@ jobs:
ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }} ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON: ${{ secrets.ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON }}
steps: steps:
- name: Install Node - name: Install Node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4 uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with: with:
node-version: "18" node-version: "18"
@@ -86,6 +86,9 @@ jobs:
echo "Publishing version: ${version} on release channel nightly" echo "Publishing version: ${version} on release channel nightly"
echo "nightly" > crates/zed/RELEASE_CHANNEL echo "nightly" > crates/zed/RELEASE_CHANNEL
- name: Generate license file
run: script/generate-licenses
- name: Create macOS app bundle - name: Create macOS app bundle
run: script/bundle-mac run: script/bundle-mac

View File

@@ -9,8 +9,6 @@
# Keep these entries sorted alphabetically. # Keep these entries sorted alphabetically.
# In Zed: `editor: sort lines case insensitive` # In Zed: `editor: sort lines case insensitive`
Agus Zubiaga <agus@zed.dev>
Agus Zubiaga <agus@zed.dev> <hi@aguz.me>
Alex Viscreanu <alexviscreanu@gmail.com> Alex Viscreanu <alexviscreanu@gmail.com>
Alex Viscreanu <alexviscreanu@gmail.com> <alexandru.viscreanu@kiwi.com> Alex Viscreanu <alexviscreanu@gmail.com> <alexandru.viscreanu@kiwi.com>
Alexander Mankuta <alex@pointless.one> Alexander Mankuta <alex@pointless.one>
@@ -26,7 +24,6 @@ Bennet Bo Fenner <bennet@zed.dev> <53836821+bennetbo@users.noreply.github.com>
Bennet Bo Fenner <bennet@zed.dev> <bennetbo@gmx.de> Bennet Bo Fenner <bennet@zed.dev> <bennetbo@gmx.de>
Boris Cherny <boris@anthropic.com> Boris Cherny <boris@anthropic.com>
Boris Cherny <boris@anthropic.com> <boris@performancejs.com> Boris Cherny <boris@anthropic.com> <boris@performancejs.com>
Brian Tan <brian.tan88@gmail.com>
Chris Hayes <chris+git@hayes.software> Chris Hayes <chris+git@hayes.software>
Christian Bergschneider <christian.bergschneider@gmx.de> Christian Bergschneider <christian.bergschneider@gmx.de>
Christian Bergschneider <christian.bergschneider@gmx.de> <magiclake@gmx.de> Christian Bergschneider <christian.bergschneider@gmx.de> <magiclake@gmx.de>
@@ -35,16 +32,11 @@ Conrad Irwin <conrad@zed.dev> <conrad.irwin@gmail.com>
Dairon Medina <dairon.medina@gmail.com> Dairon Medina <dairon.medina@gmail.com>
Danilo Leal <danilo@zed.dev> Danilo Leal <danilo@zed.dev>
Danilo Leal <danilo@zed.dev> <67129314+danilo-leal@users.noreply.github.com> Danilo Leal <danilo@zed.dev> <67129314+danilo-leal@users.noreply.github.com>
Edwin Aronsson <75266237+4teapo@users.noreply.github.com>
Evren Sen <nervenes@icloud.com> Evren Sen <nervenes@icloud.com>
Evren Sen <nervenes@icloud.com> <146845123+evrensen467@users.noreply.github.com> Evren Sen <nervenes@icloud.com> <146845123+evrensen467@users.noreply.github.com>
Evren Sen <nervenes@icloud.com> <146845123+evrsen@users.noreply.github.com> Evren Sen <nervenes@icloud.com> <146845123+evrsen@users.noreply.github.com>
Fernando Tagawa <tagawafernando@gmail.com> Fernando Tagawa <tagawafernando@gmail.com>
Fernando Tagawa <tagawafernando@gmail.com> <fernando.tagawa.gamail.com@gmail.com> Fernando Tagawa <tagawafernando@gmail.com> <fernando.tagawa.gamail.com@gmail.com>
Finn Evers <dev@bahn.sh>
Finn Evers <dev@bahn.sh> <75036051+MrSubidubi@users.noreply.github.com>
Finn Evers <dev@bahn.sh> <finn.evers@outlook.de>
Gowtham K <73059450+dovakin0007@users.noreply.github.com>
Greg Morenz <greg-morenz@droid.cafe> Greg Morenz <greg-morenz@droid.cafe>
Greg Morenz <greg-morenz@droid.cafe> <morenzg@gmail.com> Greg Morenz <greg-morenz@droid.cafe> <morenzg@gmail.com>
Ihnat Aŭtuška <autushka.ihnat@gmail.com> Ihnat Aŭtuška <autushka.ihnat@gmail.com>
@@ -62,14 +54,11 @@ Kirill Bulatov <kirill@zed.dev>
Kirill Bulatov <kirill@zed.dev> <mail4score@gmail.com> Kirill Bulatov <kirill@zed.dev> <mail4score@gmail.com>
Kyle Caverly <kylebcaverly@gmail.com> Kyle Caverly <kylebcaverly@gmail.com>
Kyle Caverly <kylebcaverly@gmail.com> <kyle@zed.dev> Kyle Caverly <kylebcaverly@gmail.com> <kyle@zed.dev>
Lilith Iris <itslirissama@gmail.com>
Lilith Iris <itslirissama@gmail.com> <83819417+Irilith@users.noreply.github.com>
LoganDark <contact@logandark.mozmail.com> LoganDark <contact@logandark.mozmail.com>
LoganDark <contact@logandark.mozmail.com> <git@logandark.mozmail.com> LoganDark <contact@logandark.mozmail.com> <git@logandark.mozmail.com>
LoganDark <contact@logandark.mozmail.com> <github@logandark.mozmail.com> LoganDark <contact@logandark.mozmail.com> <github@logandark.mozmail.com>
Marshall Bowers <git@maxdeviant.com> Marshall Bowers <elliott.codes@gmail.com>
Marshall Bowers <git@maxdeviant.com> <elliott.codes@gmail.com> Marshall Bowers <elliott.codes@gmail.com> <marshall@zed.dev>
Marshall Bowers <git@maxdeviant.com> <marshall@zed.dev>
Matt Fellenz <matt@felle.nz> Matt Fellenz <matt@felle.nz>
Matt Fellenz <matt@felle.nz> <matt+github@felle.nz> Matt Fellenz <matt@felle.nz> <matt+github@felle.nz>
Max Brunsfeld <maxbrunsfeld@gmail.com> Max Brunsfeld <maxbrunsfeld@gmail.com>
@@ -123,7 +112,5 @@ Uladzislau Kaminski <i@uladkaminski.com>
Uladzislau Kaminski <i@uladkaminski.com> <uladzislau_kaminski@epam.com> Uladzislau Kaminski <i@uladkaminski.com> <uladzislau_kaminski@epam.com>
Vitaly Slobodin <vitaliy.slobodin@gmail.com> Vitaly Slobodin <vitaliy.slobodin@gmail.com>
Vitaly Slobodin <vitaliy.slobodin@gmail.com> <vitaly_slobodin@fastmail.com> Vitaly Slobodin <vitaliy.slobodin@gmail.com> <vitaly_slobodin@fastmail.com>
Will Bradley <williambbradley@gmail.com>
Will Bradley <williambbradley@gmail.com> <will@zed.dev>
WindSoilder <WindSoilder@outlook.com> WindSoilder <WindSoilder@outlook.com>
张小白 <364772080@qq.com> 张小白 <364772080@qq.com>

1960
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,10 +6,7 @@ members = [
"crates/assets", "crates/assets",
"crates/assistant", "crates/assistant",
"crates/assistant2", "crates/assistant2",
"crates/assistant_context_editor",
"crates/assistant_settings",
"crates/assistant_slash_command", "crates/assistant_slash_command",
"crates/assistant_slash_commands",
"crates/assistant_tool", "crates/assistant_tool",
"crates/assistant_tools", "crates/assistant_tools",
"crates/audio", "crates/audio",
@@ -30,7 +27,6 @@ members = [
"crates/context_server_settings", "crates/context_server_settings",
"crates/copilot", "crates/copilot",
"crates/db", "crates/db",
"crates/deepseek",
"crates/diagnostics", "crates/diagnostics",
"crates/docs_preprocessor", "crates/docs_preprocessor",
"crates/editor", "crates/editor",
@@ -49,12 +45,10 @@ members = [
"crates/fuzzy", "crates/fuzzy",
"crates/git", "crates/git",
"crates/git_hosting_providers", "crates/git_hosting_providers",
"crates/git_ui",
"crates/go_to_line", "crates/go_to_line",
"crates/google_ai", "crates/google_ai",
"crates/gpui", "crates/gpui",
"crates/gpui_macros", "crates/gpui_macros",
"crates/gpui_tokio",
"crates/html_to_markdown", "crates/html_to_markdown",
"crates/http_client", "crates/http_client",
"crates/image_viewer", "crates/image_viewer",
@@ -74,7 +68,6 @@ members = [
"crates/livekit_client", "crates/livekit_client",
"crates/livekit_client_macos", "crates/livekit_client_macos",
"crates/livekit_server", "crates/livekit_server",
"crates/lmstudio",
"crates/lsp", "crates/lsp",
"crates/markdown", "crates/markdown",
"crates/markdown_preview", "crates/markdown_preview",
@@ -93,7 +86,6 @@ members = [
"crates/project", "crates/project",
"crates/project_panel", "crates/project_panel",
"crates/project_symbols", "crates/project_symbols",
"crates/prompt_library",
"crates/proto", "crates/proto",
"crates/recent_projects", "crates/recent_projects",
"crates/refineable", "crates/refineable",
@@ -103,11 +95,9 @@ members = [
"crates/remote_server", "crates/remote_server",
"crates/repl", "crates/repl",
"crates/reqwest_client", "crates/reqwest_client",
"crates/reqwest_client",
"crates/rich_text", "crates/rich_text",
"crates/rope", "crates/rope",
"crates/rpc", "crates/rpc",
"crates/schema_generator",
"crates/search", "crates/search",
"crates/semantic_index", "crates/semantic_index",
"crates/semantic_version", "crates/semantic_version",
@@ -121,14 +111,12 @@ members = [
"crates/sqlez_macros", "crates/sqlez_macros",
"crates/story", "crates/story",
"crates/storybook", "crates/storybook",
"crates/streaming_diff",
"crates/sum_tree", "crates/sum_tree",
"crates/supermaven", "crates/supermaven",
"crates/supermaven_api", "crates/supermaven_api",
"crates/tab_switcher", "crates/tab_switcher",
"crates/task", "crates/task",
"crates/tasks_ui", "crates/tasks_ui",
"crates/telemetry",
"crates/telemetry_events", "crates/telemetry_events",
"crates/terminal", "crates/terminal",
"crates/terminal_view", "crates/terminal_view",
@@ -143,6 +131,7 @@ members = [
"crates/ui", "crates/ui",
"crates/ui_input", "crates/ui_input",
"crates/ui_macros", "crates/ui_macros",
"crates/reqwest_client",
"crates/util", "crates/util",
"crates/vcs_menu", "crates/vcs_menu",
"crates/vim", "crates/vim",
@@ -152,16 +141,19 @@ members = [
"crates/worktree", "crates/worktree",
"crates/zed", "crates/zed",
"crates/zed_actions", "crates/zed_actions",
"crates/zed_predict_onboarding",
"crates/zeta", "crates/zeta",
"crates/git_ui",
# #
# Extensions # Extensions
# #
"extensions/astro",
"extensions/clojure",
"extensions/csharp", "extensions/csharp",
"extensions/deno", "extensions/deno",
"extensions/elixir", "extensions/elixir",
"extensions/elm",
"extensions/emmet", "extensions/emmet",
"extensions/erlang", "extensions/erlang",
"extensions/glsl", "extensions/glsl",
@@ -170,6 +162,7 @@ members = [
"extensions/lua", "extensions/lua",
"extensions/php", "extensions/php",
"extensions/perplexity", "extensions/perplexity",
"extensions/prisma",
"extensions/proto", "extensions/proto",
"extensions/purescript", "extensions/purescript",
"extensions/ruff", "extensions/ruff",
@@ -189,10 +182,6 @@ members = [
] ]
default-members = ["crates/zed"] default-members = ["crates/zed"]
[workspace.package]
publish = false
edition = "2021"
[workspace.dependencies] [workspace.dependencies]
# #
@@ -205,10 +194,7 @@ anthropic = { path = "crates/anthropic" }
assets = { path = "crates/assets" } assets = { path = "crates/assets" }
assistant = { path = "crates/assistant" } assistant = { path = "crates/assistant" }
assistant2 = { path = "crates/assistant2" } assistant2 = { path = "crates/assistant2" }
assistant_context_editor = { path = "crates/assistant_context_editor" }
assistant_settings = { path = "crates/assistant_settings" }
assistant_slash_command = { path = "crates/assistant_slash_command" } assistant_slash_command = { path = "crates/assistant_slash_command" }
assistant_slash_commands = { path = "crates/assistant_slash_commands" }
assistant_tool = { path = "crates/assistant_tool" } assistant_tool = { path = "crates/assistant_tool" }
assistant_tools = { path = "crates/assistant_tools" } assistant_tools = { path = "crates/assistant_tools" }
audio = { path = "crates/audio" } audio = { path = "crates/audio" }
@@ -229,7 +215,6 @@ context_server = { path = "crates/context_server" }
context_server_settings = { path = "crates/context_server_settings" } context_server_settings = { path = "crates/context_server_settings" }
copilot = { path = "crates/copilot" } copilot = { path = "crates/copilot" }
db = { path = "crates/db" } db = { path = "crates/db" }
deepseek = { path = "crates/deepseek" }
diagnostics = { path = "crates/diagnostics" } diagnostics = { path = "crates/diagnostics" }
editor = { path = "crates/editor" } editor = { path = "crates/editor" }
extension = { path = "crates/extension" } extension = { path = "crates/extension" }
@@ -251,7 +236,6 @@ gpui = { path = "crates/gpui", default-features = false, features = [
"http_client", "http_client",
] } ] }
gpui_macros = { path = "crates/gpui_macros" } gpui_macros = { path = "crates/gpui_macros" }
gpui_tokio = { path = "crates/gpui_tokio" }
html_to_markdown = { path = "crates/html_to_markdown" } html_to_markdown = { path = "crates/html_to_markdown" }
http_client = { path = "crates/http_client" } http_client = { path = "crates/http_client" }
image_viewer = { path = "crates/image_viewer" } image_viewer = { path = "crates/image_viewer" }
@@ -271,7 +255,6 @@ languages = { path = "crates/languages" }
livekit_client = { path = "crates/livekit_client" } livekit_client = { path = "crates/livekit_client" }
livekit_client_macos = { path = "crates/livekit_client_macos" } livekit_client_macos = { path = "crates/livekit_client_macos" }
livekit_server = { path = "crates/livekit_server" } livekit_server = { path = "crates/livekit_server" }
lmstudio = { path = "crates/lmstudio" }
lsp = { path = "crates/lsp" } lsp = { path = "crates/lsp" }
markdown = { path = "crates/markdown" } markdown = { path = "crates/markdown" }
markdown_preview = { path = "crates/markdown_preview" } markdown_preview = { path = "crates/markdown_preview" }
@@ -292,7 +275,6 @@ prettier = { path = "crates/prettier" }
project = { path = "crates/project" } project = { path = "crates/project" }
project_panel = { path = "crates/project_panel" } project_panel = { path = "crates/project_panel" }
project_symbols = { path = "crates/project_symbols" } project_symbols = { path = "crates/project_symbols" }
prompt_library = { path = "crates/prompt_library" }
proto = { path = "crates/proto" } proto = { path = "crates/proto" }
recent_projects = { path = "crates/recent_projects" } recent_projects = { path = "crates/recent_projects" }
refineable = { path = "crates/refineable" } refineable = { path = "crates/refineable" }
@@ -317,14 +299,12 @@ sqlez = { path = "crates/sqlez" }
sqlez_macros = { path = "crates/sqlez_macros" } sqlez_macros = { path = "crates/sqlez_macros" }
story = { path = "crates/story" } story = { path = "crates/story" }
storybook = { path = "crates/storybook" } storybook = { path = "crates/storybook" }
streaming_diff = { path = "crates/streaming_diff" }
sum_tree = { path = "crates/sum_tree" } sum_tree = { path = "crates/sum_tree" }
supermaven = { path = "crates/supermaven" } supermaven = { path = "crates/supermaven" }
supermaven_api = { path = "crates/supermaven_api" } supermaven_api = { path = "crates/supermaven_api" }
tab_switcher = { path = "crates/tab_switcher" } tab_switcher = { path = "crates/tab_switcher" }
task = { path = "crates/task" } task = { path = "crates/task" }
tasks_ui = { path = "crates/tasks_ui" } tasks_ui = { path = "crates/tasks_ui" }
telemetry = { path = "crates/telemetry" }
telemetry_events = { path = "crates/telemetry_events" } telemetry_events = { path = "crates/telemetry_events" }
terminal = { path = "crates/terminal" } terminal = { path = "crates/terminal" }
terminal_view = { path = "crates/terminal_view" } terminal_view = { path = "crates/terminal_view" }
@@ -348,7 +328,6 @@ workspace = { path = "crates/workspace" }
worktree = { path = "crates/worktree" } worktree = { path = "crates/worktree" }
zed = { path = "crates/zed" } zed = { path = "crates/zed" }
zed_actions = { path = "crates/zed_actions" } zed_actions = { path = "crates/zed_actions" }
zed_predict_onboarding = { path = "crates/zed_predict_onboarding" }
zeta = { path = "crates/zeta" } zeta = { path = "crates/zeta" }
# #
@@ -356,8 +335,7 @@ zeta = { path = "crates/zeta" }
# #
aho-corasick = "1.1" aho-corasick = "1.1"
# TODO(#18342): Update to version 0.25 from crates.io when it is released. alacritty_terminal = { git = "https://github.com/alacritty/alacritty", rev = "91d034ff8b53867143c005acfaa14609147c9a2c" }
alacritty_terminal = { git = "https://github.com/alacritty/alacritty.git", rev = "5e78d20c709cb1ab8d44ca7a8702cc26d779227c" }
any_vec = "0.14" any_vec = "0.14"
anyhow = "1.0.86" anyhow = "1.0.86"
arrayvec = { version = "0.7.4", features = ["serde"] } arrayvec = { version = "0.7.4", features = ["serde"] }
@@ -365,7 +343,7 @@ ashpd = { version = "0.10", default-features = false, features = ["async-std"]}
async-compat = "0.2.1" async-compat = "0.2.1"
async-compression = { version = "0.4", features = ["gzip", "futures-io"] } async-compression = { version = "0.4", features = ["gzip", "futures-io"] }
async-dispatcher = "0.1" async-dispatcher = "0.1"
async-fs = "2.1" async-fs = "1.6"
async-pipe = { git = "https://github.com/zed-industries/async-pipe-rs", rev = "82d00a04211cf4e1236029aa03e6b6ce2a74c553" } async-pipe = { git = "https://github.com/zed-industries/async-pipe-rs", rev = "82d00a04211cf4e1236029aa03e6b6ce2a74c553" }
async-recursion = "1.0.0" async-recursion = "1.0.0"
async-tar = "0.5.0" async-tar = "0.5.0"
@@ -375,19 +353,18 @@ async-watch = "0.3.1"
async_zip = { version = "0.0.17", features = ["deflate", "deflate64"] } async_zip = { version = "0.0.17", features = ["deflate", "deflate64"] }
base64 = "0.22" base64 = "0.22"
bitflags = "2.6.0" bitflags = "2.6.0"
blade-graphics = { git = "https://github.com/kvark/blade", rev = "b16f5c7bd873c7126f48c82c39e7ae64602ae74f" } blade-graphics = { git = "https://github.com/kvark/blade", rev = "e142a3a5e678eb6a13e642ad8401b1f3aa38e969" }
blade-macros = { git = "https://github.com/kvark/blade", rev = "b16f5c7bd873c7126f48c82c39e7ae64602ae74f" } blade-macros = { git = "https://github.com/kvark/blade", rev = "e142a3a5e678eb6a13e642ad8401b1f3aa38e969" }
blade-util = { git = "https://github.com/kvark/blade", rev = "b16f5c7bd873c7126f48c82c39e7ae64602ae74f" } blade-util = { git = "https://github.com/kvark/blade", rev = "e142a3a5e678eb6a13e642ad8401b1f3aa38e969" }
naga = { version = "23.1.0", features = ["wgsl-in"] }
blake3 = "1.5.3" blake3 = "1.5.3"
bytes = "1.0" bytes = "1.0"
cargo_metadata = "0.19" cargo_metadata = "0.19"
cargo_toml = "0.21" cargo_toml = "0.20"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
clap = { version = "4.4", features = ["derive"] } clap = { version = "4.4", features = ["derive"] }
cocoa = "0.26" cocoa = "0.26"
cocoa-foundation = "0.2.0" cocoa-foundation = "0.2.0"
convert_case = "0.7.0" convert_case = "0.6.0"
core-foundation = "0.9.3" core-foundation = "0.9.3"
core-foundation-sys = "0.8.6" core-foundation-sys = "0.8.6"
ctor = "0.2.6" ctor = "0.2.6"
@@ -403,44 +380,43 @@ fork = "0.2.0"
futures = "0.3" futures = "0.3"
futures-batch = "0.6.1" futures-batch = "0.6.1"
futures-lite = "1.13" futures-lite = "1.13"
# TODO: get back to regular versions when https://github.com/rust-lang/git2-rs/pull/1120 is released git2 = { version = "0.19", default-features = false }
git2 = { git = "https://github.com/rust-lang/git2-rs", rev = "a3b90cb3756c1bb63e2317bf9cfa57838178de5c", default-features = false }
globset = "0.4" globset = "0.4"
handlebars = "4.3" handlebars = "4.3"
heed = { version = "0.21.0", features = ["read-txn-no-tls"] } heed = { version = "0.20.1", features = ["read-txn-no-tls"] }
hex = "0.4.3" hex = "0.4.3"
html5ever = "0.27.0" html5ever = "0.27.0"
hyper = "0.14" hyper = "0.14"
http = "1.1" http = "1.1"
ignore = "0.4.22" ignore = "0.4.22"
image = "0.25.1" image = "0.25.1"
indexmap = { version = "2.7.0", features = ["serde"] } indexmap = { version = "1.6.2", features = ["serde"] }
indoc = "2" indoc = "2"
itertools = "0.14.0" itertools = "0.13.0"
jsonwebtoken = "9.3" jsonwebtoken = "9.3"
jupyter-protocol = { version = "0.6.0" } jupyter-protocol = { version = "0.5.0" }
jupyter-websocket-client = { version = "0.9.0" } jupyter-websocket-client = { version = "0.8.0" }
libc = "0.2" libc = "0.2"
libsqlite3-sys = { version = "0.30.1", features = ["bundled"] } libsqlite3-sys = { version = "0.30.1", features = ["bundled"] }
linkify = "0.10.0" linkify = "0.10.0"
livekit = { git = "https://github.com/zed-industries/livekit-rust-sdks", rev="060964da10574cd9bf06463a53bf6e0769c5c45e", features = ["dispatcher", "services-dispatcher", "rustls-tls-native-roots"], default-features = false } livekit = { git = "https://github.com/zed-industries/rust-sdks", rev="799f10133d93ba2a88642cd480d01ec4da53408c", features = ["dispatcher", "services-dispatcher", "rustls-tls-native-roots"], default-features = false }
log = { version = "0.4.16", features = ["kv_unstable_serde", "serde"] } log = { version = "0.4.16", features = ["kv_unstable_serde", "serde"] }
markup5ever_rcdom = "0.3.0" markup5ever_rcdom = "0.3.0"
nanoid = "0.4" nanoid = "0.4"
nbformat = { version = "0.10.0" } nbformat = { version = "0.9.0" }
nix = "0.29" nix = "0.29"
num-format = "0.4.4" num-format = "0.4.4"
once_cell = "1.19.0"
ordered-float = "2.1.1" ordered-float = "2.1.1"
palette = { version = "0.7.5", default-features = false, features = ["std"] } palette = { version = "0.7.5", default-features = false, features = ["std"] }
parking_lot = "0.12.1" parking_lot = "0.12.1"
pathdiff = "0.2" pathdiff = "0.2"
pet = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "1abe5cec5ebfbe97ca71746a4cfc7fe89bddf8e0" } pet = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "ffcbf3f28c46633abd5448a52b1f396c322e0d6c" }
pet-fs = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "1abe5cec5ebfbe97ca71746a4cfc7fe89bddf8e0" } pet-fs = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "ffcbf3f28c46633abd5448a52b1f396c322e0d6c" }
pet-pixi = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "1abe5cec5ebfbe97ca71746a4cfc7fe89bddf8e0" } pet-conda = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "ffcbf3f28c46633abd5448a52b1f396c322e0d6c" }
pet-conda = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "1abe5cec5ebfbe97ca71746a4cfc7fe89bddf8e0" } pet-core = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "ffcbf3f28c46633abd5448a52b1f396c322e0d6c" }
pet-core = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "1abe5cec5ebfbe97ca71746a4cfc7fe89bddf8e0" } pet-poetry = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "ffcbf3f28c46633abd5448a52b1f396c322e0d6c" }
pet-poetry = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "1abe5cec5ebfbe97ca71746a4cfc7fe89bddf8e0" } pet-reporter = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "ffcbf3f28c46633abd5448a52b1f396c322e0d6c" }
pet-reporter = { git = "https://github.com/microsoft/python-environment-tools.git", rev = "1abe5cec5ebfbe97ca71746a4cfc7fe89bddf8e0" }
postage = { version = "0.5", features = ["futures-traits"] } postage = { version = "0.5", features = ["futures-traits"] }
pretty_assertions = { version = "1.3.0", features = ["unstable"] } pretty_assertions = { version = "1.3.0", features = ["unstable"] }
profiling = "1" profiling = "1"
@@ -461,15 +437,14 @@ reqwest = { git = "https://github.com/zed-industries/reqwest.git", rev = "fd110f
"stream", "stream",
] } ] }
rsa = "0.9.6" rsa = "0.9.6"
runtimelib = { version = "0.25.0", default-features = false, features = [ runtimelib = { version = "0.24.0", default-features = false, features = [
"async-dispatcher-runtime", "async-dispatcher-runtime",
] } ] }
rustc-demangle = "0.1.23" rustc-demangle = "0.1.23"
rust-embed = { version = "8.4", features = ["include-exclude"] } rust-embed = { version = "8.4", features = ["include-exclude"] }
rustc-hash = "2.1.0"
rustls = "0.21.12" rustls = "0.21.12"
rustls-native-certs = "0.8.0" rustls-native-certs = "0.8.0"
schemars = { version = "0.8", features = ["impl_json_schema", "indexmap2"] } schemars = { version = "0.8", features = ["impl_json_schema"] }
semver = "1.0" semver = "1.0"
serde = { version = "1.0", features = ["derive", "rc"] } serde = { version = "1.0", features = ["derive", "rc"] }
serde_derive = { version = "1.0", features = ["deserialize_in_place"] } serde_derive = { version = "1.0", features = ["deserialize_in_place"] }
@@ -486,17 +461,16 @@ signal-hook = "0.3.17"
similar = "1.3" similar = "1.3"
simplelog = "0.12.2" simplelog = "0.12.2"
smallvec = { version = "1.6", features = ["union"] } smallvec = { version = "1.6", features = ["union"] }
smol = "2.0" smol = "1.2"
sqlformat = "0.2" sqlformat = "0.2"
strsim = "0.11" strsim = "0.11"
strum = { version = "0.26.0", features = ["derive"] } strum = { version = "0.25.0", features = ["derive"] }
subtle = "2.5.0" subtle = "2.5.0"
sys-locale = "0.3.1" sys-locale = "0.3.1"
sysinfo = "0.31.0" sysinfo = "0.31.0"
take-until = "0.2.0"
tempfile = "3.9.0" tempfile = "3.9.0"
thiserror = "1.0.29" thiserror = "1.0.29"
tiktoken-rs = "0.6.0" tiktoken-rs = "0.5.9"
time = { version = "0.3", features = [ time = { version = "0.3", features = [
"macros", "macros",
"parsing", "parsing",
@@ -516,22 +490,22 @@ tree-sitter-css = "0.23"
tree-sitter-elixir = "0.3" tree-sitter-elixir = "0.3"
tree-sitter-embedded-template = "0.23.0" tree-sitter-embedded-template = "0.23.0"
tree-sitter-go = "0.23" tree-sitter-go = "0.23"
tree-sitter-go-mod = { git = "https://github.com/camdencheek/tree-sitter-go-mod", rev = "6efb59652d30e0e9cd5f3b3a669afd6f1a926d3c", package = "tree-sitter-gomod" } tree-sitter-go-mod = { git = "https://github.com/zed-industries/tree-sitter-go-mod", rev = "a9aea5e358cde4d0f8ff20b7bc4fa311e359c7ca", package = "tree-sitter-gomod" }
tree-sitter-gowork = { git = "https://github.com/zed-industries/tree-sitter-go-work", rev = "acb0617bf7f4fda02c6217676cc64acb89536dc7" } tree-sitter-gowork = { git = "https://github.com/zed-industries/tree-sitter-go-work", rev = "acb0617bf7f4fda02c6217676cc64acb89536dc7" }
tree-sitter-heex = { git = "https://github.com/zed-industries/tree-sitter-heex", rev = "1dd45142fbb05562e35b2040c6129c9bca346592" } tree-sitter-heex = { git = "https://github.com/zed-industries/tree-sitter-heex", rev = "1dd45142fbb05562e35b2040c6129c9bca346592" }
tree-sitter-diff = "0.1.0" tree-sitter-diff = "0.1.0"
tree-sitter-html = "0.20" tree-sitter-html = "0.20"
tree-sitter-jsdoc = "0.23" tree-sitter-jsdoc = "0.23"
tree-sitter-json = "0.24" tree-sitter-json = "0.23"
tree-sitter-md = { git = "https://github.com/tree-sitter-grammars/tree-sitter-markdown", rev = "9a23c1a96c0513d8fc6520972beedd419a973539" } tree-sitter-md = { git = "https://github.com/tree-sitter-grammars/tree-sitter-markdown", rev = "9a23c1a96c0513d8fc6520972beedd419a973539" }
tree-sitter-python = "0.23" tree-sitter-python = "0.23"
tree-sitter-regex = "0.24" tree-sitter-regex = "0.23"
tree-sitter-ruby = "0.23" tree-sitter-ruby = "0.23"
tree-sitter-rust = "0.23" tree-sitter-rust = "0.23"
tree-sitter-typescript = "0.23" tree-sitter-typescript = "0.23"
tree-sitter-yaml = { git = "https://github.com/zed-industries/tree-sitter-yaml", rev = "baff0b51c64ef6a1fb1f8390f3ad6015b83ec13a" } tree-sitter-yaml = { git = "https://github.com/zed-industries/tree-sitter-yaml", rev = "baff0b51c64ef6a1fb1f8390f3ad6015b83ec13a" }
unicase = "2.6" unicase = "2.6"
unindent = "0.2.0" unindent = "0.1.7"
unicode-segmentation = "1.10" unicode-segmentation = "1.10"
unicode-script = "0.5.7" unicode-script = "0.5.7"
url = "2.2" url = "2.2"
@@ -549,7 +523,6 @@ wasmtime-wasi = "24"
which = "6.0.0" which = "6.0.0"
wit-component = "0.201" wit-component = "0.201"
zstd = "0.11" zstd = "0.11"
metal = "0.31"
[workspace.dependencies.async-stripe] [workspace.dependencies.async-stripe]
git = "https://github.com/zed-industries/async-stripe" git = "https://github.com/zed-industries/async-stripe"
@@ -638,7 +611,6 @@ image_viewer = { codegen-units = 1 }
inline_completion_button = { codegen-units = 1 } inline_completion_button = { codegen-units = 1 }
install_cli = { codegen-units = 1 } install_cli = { codegen-units = 1 }
journal = { codegen-units = 1 } journal = { codegen-units = 1 }
lmstudio = { codegen-units = 1 }
menu = { codegen-units = 1 } menu = { codegen-units = 1 }
notifications = { codegen-units = 1 } notifications = { codegen-units = 1 }
ollama = { codegen-units = 1 } ollama = { codegen-units = 1 }

View File

@@ -1 +0,0 @@
<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>DeepSeek</title><path d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z" fill="black"></path></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Artboard</title>
<g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<rect id="Rectangle" stroke="black" stroke-width="1.26" x="1.22" y="1.22" width="13.56" height="13.56" rx="2.66"></rect>
<g id="Group-7" transform="translate(2.44, 3.03)" fill="black">
<g id="Group" transform="translate(0.37, 0)">
<rect id="Rectangle" opacity="0.487118676" x="1.9" y="0" width="6.28" height="1.43" rx="0.71"></rect>
<rect id="Rectangle" opacity="0.845098586" x="0" y="0" width="6.28" height="1.43" rx="0.71"></rect>
</g>
<g id="Group-2" transform="translate(2.88, 1.7)">
<rect id="Rectangle" opacity="0.487118676" x="1.9" y="0" width="6.28" height="1.43" rx="0.71"></rect>
<rect id="Rectangle" opacity="0.845098586" x="0" y="0" width="6.28" height="1.43" rx="0.71"></rect>
</g>
<g id="Group-3" transform="translate(1.53, 3.38)">
<rect id="Rectangle" opacity="0.487118676" x="1.92" y="0" width="6.28" height="1.43" rx="0.71"></rect>
<rect id="Rectangle" opacity="0.845098586" x="0" y="0" width="6.28" height="1.43" rx="0.71"></rect>
</g>
<g id="Group-4" transform="translate(0, 5.09)">
<rect id="Rectangle" opacity="0.487118676" x="1.9" y="0" width="6.28" height="1.43" rx="0.71"></rect>
<rect id="Rectangle" opacity="0.845098586" x="0" y="0" width="6.28" height="1.43" rx="0.71"></rect>
</g>
<g id="Group-5" transform="translate(1.64, 6.77)">
<rect id="Rectangle" opacity="0.487118676" x="1.94" y="0" width="5.46" height="1.43" rx="0.71"></rect>
<rect id="Rectangle" opacity="0.845098586" x="0" y="0" width="5.46" height="1.43" rx="0.71"></rect>
</g>
<g id="Group-6" transform="translate(4.24, 8.47)">
<rect id="Rectangle" opacity="0.487118676" x="2.11" y="0" width="4.56" height="1.43" rx="0.71"></rect>
<rect id="Rectangle" opacity="0.845098586" x="0" y="0" width="4.56" height="1.43" rx="0.71"></rect>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,4 +1 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>
<path d="M18.4286 9H10.5714C9.70355 9 9 9.70355 9 10.5714V18.4286C9 19.2964 9.70355 20 10.5714 20H18.4286C19.2964 20 20 19.2964 20 18.4286V10.5714C20 9.70355 19.2964 9 18.4286 9Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5.57143 15C4.70714 15 4 14.2929 4 13.4286V5.57143C4 4.70714 4.70714 4 5.57143 4H13.4286C14.2929 4 15 4.70714 15 5.57143" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 338 B

View File

@@ -1,4 +1,8 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.0001 1.33334H4.00008C3.64646 1.33334 3.30732 1.47382 3.05727 1.72387C2.80722 1.97392 2.66675 2.31305 2.66675 2.66668V13.3333C2.66675 13.687 2.80722 14.0261 3.05727 14.2762C3.30732 14.5262 3.64646 14.6667 4.00008 14.6667H12.0001C12.3537 14.6667 12.6928 14.5262 12.9429 14.2762C13.1929 14.0261 13.3334 13.687 13.3334 13.3333V4.66668L10.0001 1.33334Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path
<path d="M9.33325 1.33334V4.00001C9.33325 4.35363 9.47373 4.69277 9.72378 4.94282C9.97383 5.19287 10.313 5.33334 10.6666 5.33334H13.3333" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> fill-rule="evenodd"
clip-rule="evenodd"
d="M3.5 2C3.22386 2 3 2.22386 3 2.5V12.5C3 12.7761 3.22386 13 3.5 13H11.5C11.7761 13 12 12.7761 12 12.5V6H8.5C8.22386 6 8 5.77614 8 5.5V2H3.5ZM9 2.70711L11.2929 5H9V2.70711ZM2 2.5C2 1.67157 2.67157 1 3.5 1H8.5C8.63261 1 8.75979 1.05268 8.85355 1.14645L12.8536 5.14645C12.9473 5.24021 13 5.36739 13 5.5V12.5C13 13.3284 12.3284 14 11.5 14H3.5C2.67157 14 2 13.3284 2 12.5V2.5Z"
fill="currentColor"
/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 769 B

After

Width:  |  Height:  |  Size: 567 B

View File

@@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.58 2H2.5V12.08C2.5 12.5892 2.70229 13.0776 3.06235 13.4376C3.42242 13.7977 3.91078 14 4.42 14H12.58C13.0892 14 13.5776 13.7977 13.9376 13.4376C14.2977 13.0776 14.5 12.5892 14.5 12.08V3.92C14.5 3.41078 14.2977 2.92242 13.9376 2.56235C13.5776 2.20229 13.0892 2 12.58 2ZM3.358 11.6285C3.34615 12.6668 3.96437 13.2311 4.96636 13.232H4.96621C6.06429 13.2456 6.70951 12.4798 6.63088 11.3867H5.48085C5.4899 11.601 5.47243 11.8974 5.36026 12.0313C5.27992 12.1441 5.16183 12.2005 5.00645 12.2005C4.67402 12.1952 4.50788 11.9534 4.50788 11.4753V9.19488C4.50788 8.94247 4.54407 8.75168 4.61645 8.62283C4.73423 8.38524 5.17961 8.3584 5.34825 8.58663C5.47804 8.71252 5.48974 9.04683 5.48101 9.26757H6.63104C6.66099 8.70582 6.53494 8.10381 6.20079 7.80913C5.65853 7.23521 4.37403 7.26765 3.82039 7.80102C3.51213 8.07495 3.358 8.47525 3.358 9.00159V11.6285ZM7.04116 11.3867C7.01043 12.4573 7.50713 13.2473 8.61739 13.232L8.61723 13.2317C10.1571 13.2967 10.5874 11.592 9.96023 10.4759C9.74995 10.1097 9.16994 9.80702 8.71379 9.62981C8.36155 9.46772 8.21038 9.3086 8.20711 8.92079C8.20711 8.55559 8.35983 8.37291 8.66543 8.37291C8.83688 8.37291 8.95357 8.42939 9.01519 8.54217C9.10317 8.6754 9.12454 9.0409 9.11565 9.26742H10.1612C10.1866 8.71627 10.0554 8.11739 9.75509 7.81303C9.26822 7.22257 7.99791 7.24909 7.5115 7.82504C7.0109 8.29179 6.97783 9.4437 7.3346 9.96848C7.49278 10.205 7.75143 10.409 8.1107 10.5809C8.15897 10.6051 8.21552 10.6314 8.27633 10.6598C8.53247 10.7792 8.86416 10.9338 8.97119 11.1046C9.16073 11.3241 9.13593 11.8913 9.00333 12.0877C8.9336 12.1952 8.81285 12.2489 8.64141 12.2489C8.25703 12.2785 8.09666 11.8534 8.12677 11.3867H7.04116ZM10.5474 11.3867C10.5167 12.4573 11.0134 13.2473 12.1236 13.232L12.1235 13.2317C13.6634 13.2967 14.0936 11.592 13.4665 10.4759C13.2562 10.1097 12.6762 9.80702 12.2201 9.62981C11.8678 9.46772 11.7166 9.3086 11.7134 8.92079C11.7134 8.55559 11.8661 8.37291 12.1717 8.37291C12.3431 8.37291 12.4598 8.42939 12.5214 8.54217C12.6094 8.6754 12.6308 9.0409 12.6219 9.26742H13.6674C13.6928 8.71627 13.5617 8.11739 13.2614 7.81303C12.7745 7.22257 11.5042 7.24909 11.0178 7.82504C10.5172 8.29179 10.4841 9.4437 10.8409 9.96848C10.999 10.205 11.2577 10.409 11.617 10.5809C11.6652 10.6051 11.7218 10.6314 11.7826 10.6598C12.0387 10.7792 12.3704 10.9338 12.4775 11.1046C12.667 11.3241 12.6422 11.8913 12.5096 12.0877C12.4399 12.1952 12.3191 12.2489 12.1477 12.2489C11.7633 12.2785 11.6029 11.8534 11.633 11.3867H10.5474Z" fill="black"/> <path d="M11.7633 4.2078H4.23674L4.3551 5.5189H10.1429L9.99592 6.87645H6.20408L6.33877 8.16255H9.86939L9.66122 9.92379L8 10.3275L6.3102 9.92021L6.20408 8.86633H4.7102L4.87755 10.7955L8 11.6457L11.0694 10.8812L11.7633 4.2078ZM2 2H14L12.9061 12.7818L7.98775 14L3.09388 12.7818L2 2Z" fill="black"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 403 B

View File

@@ -42,12 +42,6 @@
"elm": "elm", "elm": "elm",
"erl": "erlang", "erl": "erlang",
"escript": "erlang", "escript": "erlang",
"eslint.config.cjs": "eslint",
"eslint.config.cts": "eslint",
"eslint.config.js": "eslint",
"eslint.config.mjs": "eslint",
"eslint.config.mts": "eslint",
"eslint.config.ts": "eslint",
"eslintrc": "eslint", "eslintrc": "eslint",
"eslintrc.js": "eslint", "eslintrc.js": "eslint",
"eslintrc.json": "eslint", "eslintrc.json": "eslint",
@@ -216,5 +210,208 @@
"zsh_profile": "terminal", "zsh_profile": "terminal",
"zshenv": "terminal", "zshenv": "terminal",
"zshrc": "terminal" "zshrc": "terminal"
},
"types": {
"astro": {
"icon": "icons/file_icons/astro.svg"
},
"audio": {
"icon": "icons/file_icons/audio.svg"
},
"bun": {
"icon": "icons/file_icons/bun.svg"
},
"c": {
"icon": "icons/file_icons/c.svg"
},
"code": {
"icon": "icons/file_icons/code.svg"
},
"coffeescript": {
"icon": "icons/file_icons/coffeescript.svg"
},
"collapsed_chevron": {
"icon": "icons/file_icons/chevron_right.svg"
},
"collapsed_folder": {
"icon": "icons/file_icons/folder.svg"
},
"cpp": {
"icon": "icons/file_icons/cpp.svg"
},
"css": {
"icon": "icons/file_icons/css.svg"
},
"dart": {
"icon": "icons/file_icons/dart.svg"
},
"default": {
"icon": "icons/file_icons/file.svg"
},
"diff": {
"icon": "icons/file_icons/diff.svg"
},
"docker": {
"icon": "icons/file_icons/docker.svg"
},
"document": {
"icon": "icons/file_icons/book.svg"
},
"elixir": {
"icon": "icons/file_icons/elixir.svg"
},
"elm": {
"icon": "icons/file_icons/elm.svg"
},
"erlang": {
"icon": "icons/file_icons/erlang.svg"
},
"eslint": {
"icon": "icons/file_icons/eslint.svg"
},
"expanded_chevron": {
"icon": "icons/file_icons/chevron_down.svg"
},
"expanded_folder": {
"icon": "icons/file_icons/folder_open.svg"
},
"font": {
"icon": "icons/file_icons/font.svg"
},
"fsharp": {
"icon": "icons/file_icons/fsharp.svg"
},
"gleam": {
"icon": "icons/file_icons/gleam.svg"
},
"go": {
"icon": "icons/file_icons/go.svg"
},
"graphql": {
"icon": "icons/file_icons/graphql.svg"
},
"haskell": {
"icon": "icons/file_icons/haskell.svg"
},
"hcl": {
"icon": "icons/file_icons/hcl.svg"
},
"heroku": {
"icon": "icons/file_icons/heroku.svg"
},
"image": {
"icon": "icons/file_icons/image.svg"
},
"java": {
"icon": "icons/file_icons/java.svg"
},
"javascript": {
"icon": "icons/file_icons/javascript.svg"
},
"julia": {
"icon": "icons/file_icons/julia.svg"
},
"kotlin": {
"icon": "icons/file_icons/kotlin.svg"
},
"lock": {
"icon": "icons/file_icons/lock.svg"
},
"log": {
"icon": "icons/file_icons/info.svg"
},
"lua": {
"icon": "icons/file_icons/lua.svg"
},
"metal": {
"icon": "icons/file_icons/metal.svg"
},
"nim": {
"icon": "icons/file_icons/nim.svg"
},
"nix": {
"icon": "icons/file_icons/nix.svg"
},
"ocaml": {
"icon": "icons/file_icons/ocaml.svg"
},
"phoenix": {
"icon": "icons/file_icons/phoenix.svg"
},
"php": {
"icon": "icons/file_icons/php.svg"
},
"prettier": {
"icon": "icons/file_icons/prettier.svg"
},
"prisma": {
"icon": "icons/file_icons/prisma.svg"
},
"python": {
"icon": "icons/file_icons/python.svg"
},
"r": {
"icon": "icons/file_icons/r.svg"
},
"react": {
"icon": "icons/file_icons/react.svg"
},
"roc": {
"icon": "icons/file_icons/roc.svg"
},
"ruby": {
"icon": "icons/file_icons/ruby.svg"
},
"rust": {
"icon": "icons/file_icons/rust.svg"
},
"sass": {
"icon": "icons/file_icons/sass.svg"
},
"scala": {
"icon": "icons/file_icons/scala.svg"
},
"settings": {
"icon": "icons/file_icons/settings.svg"
},
"storage": {
"icon": "icons/file_icons/database.svg"
},
"swift": {
"icon": "icons/file_icons/swift.svg"
},
"tcl": {
"icon": "icons/file_icons/tcl.svg"
},
"template": {
"icon": "icons/file_icons/html.svg"
},
"terminal": {
"icon": "icons/file_icons/terminal.svg"
},
"terraform": {
"icon": "icons/file_icons/terraform.svg"
},
"toml": {
"icon": "icons/file_icons/toml.svg"
},
"typescript": {
"icon": "icons/file_icons/typescript.svg"
},
"v": {
"icon": "icons/file_icons/v.svg"
},
"vcs": {
"icon": "icons/file_icons/git.svg"
},
"video": {
"icon": "icons/file_icons/video.svg"
},
"vue": {
"icon": "icons/file_icons/vue.svg"
},
"zig": {
"icon": "icons/file_icons/zig.svg"
}
} }
} }

View File

@@ -1,5 +1 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-search"><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3"/><path d="m9 18-1.5-1.5"/><circle cx="5" cy="14" r="3"/></svg>
<path d="M5.2345 20.1C5.38772 20.373 5.60794 20.5998 5.87313 20.7577C6.13832 20.9157 6.43919 20.9992 6.74562 21H17.25C17.7141 21 18.1592 20.8104 18.4874 20.4728C18.8156 20.1352 19 19.6774 19 19.2V7.5L14.625 3H6.75C6.28587 3 5.84075 3.18964 5.51256 3.52721C5.18437 3.86477 5 4.32261 5 4.8V6.5" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10 16.8182L8.5 15.3182" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M6 15.8182C7.65685 15.8182 9 14.475 9 12.8182C9 11.1613 7.65685 9.81818 6 9.81818C4.34315 9.81818 3 11.1613 3 12.8182C3 14.475 4.34315 15.8182 6 15.8182Z" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 837 B

After

Width:  |  Height:  |  Size: 393 B

View File

@@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.9416 2.99643C13.08 2.79636 12.9568 2.5 12.7352 2.5H3.26475C3.04317 2.5 2.91999 2.79636 3.0584 2.99643L6.04033 7.30646C6.24713 7.60535 6.35981 7.97674 6.35981 8.3596C6.35981 9.18422 6.35981 11.4639 6.35981 12.891C6.35981 13.2285 6.59643 13.5 6.88831 13.5H9.11168C9.40357 13.5 9.64019 13.2285 9.64019 12.891C9.64019 11.4639 9.64019 9.18422 9.64019 8.3596C9.64019 7.97674 9.75289 7.60535 9.95969 7.30646L12.9416 2.99643Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M11.6749 2.40608C11.8058 2.24239 11.6893 1.99991 11.4796 1.99991H2.51996C2.31033 1.99991 2.19379 2.24239 2.32474 2.40608L5.14583 5.93246C5.34148 6.17701 5.44808 6.48087 5.44808 6.79412C5.44808 7.46881 5.44808 10.334 5.44808 11.5016C5.44808 11.7778 5.67194 11.9999 5.94808 11.9999H8.05153C8.32767 11.9999 8.55153 11.7778 8.55153 11.5016C8.55153 10.334 8.55153 7.46881 8.55153 6.79412C8.55153 6.48087 8.65815 6.17701 8.8538 5.93246L11.6749 2.40608Z" stroke="black" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 644 B

View File

@@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.3333 13.3333C13.6869 13.3333 14.026 13.1929 14.2761 12.9428C14.5261 12.6928 14.6666 12.3536 14.6666 12V5.33333C14.6666 4.97971 14.5261 4.64057 14.2761 4.39052C14.026 4.14048 13.6869 4 13.3333 4H8.06659C7.84359 4.00219 7.62362 3.94841 7.42679 3.84359C7.22996 3.73877 7.06256 3.58625 6.93992 3.4L6.39992 2.6C6.27851 2.41565 6.11324 2.26432 5.91892 2.1596C5.7246 2.05488 5.50732 2.00004 5.28659 2H2.66659C2.31296 2 1.97382 2.14048 1.72378 2.39052C1.47373 2.64057 1.33325 2.97971 1.33325 3.33333V12C1.33325 12.3536 1.47373 12.6928 1.72378 12.9428C1.97382 13.1929 2.31296 13.3333 2.66659 13.3333H13.3333Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M8.26046 3.97337C8.3527 4.17617 8.4795 4.47151 8.57375 4.69341C8.65258 4.87898 8.83437 4.99999 9.03599 4.99999H12.5C12.7761 4.99999 13 5.22385 13 5.49999V12.125C13 12.4011 12.7761 12.625 12.5 12.625H3.5C3.22386 12.625 3 12.4011 3 12.125V3.86932C3 3.59318 3.22386 3.36932 3.5 3.36932H7.34219C7.74141 3.36932 8.09483 3.60924 8.26046 3.97337Z" stroke="black" stroke-width="1.5" stroke-linecap="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 800 B

After

Width:  |  Height:  |  Size: 512 B

View File

@@ -1,12 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-globe"><circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/></svg>
<g clip-path="url(#clip0_2226_61)">
<path d="M7.99992 14.6667C11.6818 14.6667 14.6666 11.6819 14.6666 8C14.6666 4.3181 11.6818 1.33333 7.99992 1.33333C4.31802 1.33333 1.33325 4.3181 1.33325 8C1.33325 11.6819 4.31802 14.6667 7.99992 14.6667Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M7.99992 1.33333C6.28807 3.13076 5.33325 5.51782 5.33325 8C5.33325 10.4822 6.28807 12.8692 7.99992 14.6667C9.71176 12.8692 10.6666 10.4822 10.6666 8C10.6666 5.51782 9.71176 3.13076 7.99992 1.33333Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M1.33325 8H14.6666" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_2226_61">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 937 B

After

Width:  |  Height:  |  Size: 327 B

View File

@@ -1,5 +1,5 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2 8C2 9.18669 2.35189 10.3467 3.01118 11.3334C3.67047 12.3201 4.60754 13.0892 5.7039 13.5433C6.80026 13.9974 8.00666 14.1162 9.17054 13.8847C10.3344 13.6532 11.4035 13.0818 12.2426 12.2426C13.0818 11.4035 13.6532 10.3344 13.8847 9.17054C14.1162 8.00666 13.9974 6.80026 13.5433 5.7039C13.0892 4.60754 12.3201 3.67047 11.3334 3.01118C10.3467 2.35189 9.18669 2 8 2C6.32263 2.00631 4.71265 2.66082 3.50667 3.82667L2 5.33333" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M1.5 6C1.5 6.89002 1.76392 7.76004 2.25839 8.50007C2.75285 9.24009 3.45566 9.81686 4.27792 10.1575C5.10019 10.4981 6.00499 10.5872 6.87791 10.4135C7.75082 10.2399 8.55264 9.81132 9.18198 9.18198C9.81132 8.55264 10.2399 7.75082 10.4135 6.87791C10.5872 6.00499 10.4981 5.10019 10.1575 4.27792C9.81686 3.45566 9.24009 2.75285 8.50007 2.25839C7.76004 1.76392 6.89002 1.5 6 1.5C4.74198 1.50473 3.53448 1.99561 2.63 2.87L1.5 4" stroke="#919081" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2 2V5.33333H5.33333" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M1.5 1.5V4H4" stroke="#919081" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8 5V8.5L10 9.5" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M6 3.5V6L8 7" stroke="#919081" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 840 B

After

Width:  |  Height:  |  Size: 778 B

View File

@@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13 13L10.4138 10.4138M3 7.31034C3 4.92981 4.92981 3 7.31034 3C9.6909 3 11.6207 4.92981 11.6207 7.31034C11.6207 9.6909 9.6909 11.6207 7.31034 11.6207C4.92981 11.6207 3 9.6909 3 7.31034Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M12 12L9.41379 9.41379M2 6.31034C2 3.92981 3.92981 2 6.31034 2C8.6909 2 10.6207 3.92981 10.6207 6.31034C10.6207 8.6909 8.6909 10.6207 6.31034 10.6207C3.92981 10.6207 2 8.6909 2 6.31034Z" stroke="black" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 383 B

View File

@@ -1,6 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.26659 13.3333C6.53897 13.986 8.00264 14.1628 9.39384 13.8319C10.785 13.5009 12.0123 12.6839 12.8544 11.5281C13.6966 10.3724 14.0982 8.95381 13.987 7.52811C13.8758 6.10241 13.259 4.76332 12.2478 3.75213C11.2366 2.74095 9.89751 2.12417 8.47181 2.01295C7.04611 1.90173 5.62757 2.30337 4.4718 3.1455C3.31603 3.98764 2.49905 5.21488 2.16807 6.60608C1.83709 7.99728 2.01388 9.46095 2.66659 10.7333L1.33325 14.6667L5.26659 13.3333Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M5.46115 8.43419C7.30678 8.43419 8.92229 7.43411 8.92229 5.21171C8.92229 2.98933 7.30678 1.98926 5.46115 1.98926C3.61553 1.98926 2 2.98933 2 5.21171C2 6.028 2.21794 6.67935 2.58519 7.17685C2.7184 7.35732 2.69033 7.77795 2.58387 7.97539C2.32908 8.44793 2.81048 8.9657 3.33372 8.84571C3.72539 8.75597 4.13621 8.63447 4.49574 8.4715C4.62736 8.41181 4.7727 8.38777 4.91631 8.40402C5.09471 8.42416 5.27678 8.43419 5.46115 8.43419Z" fill="black" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M5.33325 8H5.33992" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M11.3385 6.24835C11.7049 6.74561 11.9224 7.39641 11.9224 8.2117C11.9224 9.02799 11.7044 9.67934 11.3372 10.1768C11.204 10.3573 11.232 10.7779 11.3385 10.9754C11.5933 11.4479 11.1119 11.9657 10.5886 11.8457C10.197 11.756 9.78615 11.6345 9.42662 11.4715C9.295 11.4118 9.14966 11.3878 9.00605 11.404C8.82765 11.4242 8.64558 11.4342 8.46121 11.4342C7.61469 11.4342 6.81658 11.2238 6.20055 10.7816" stroke="black" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8 8H8.00667" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10.6667 8H10.6734" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 954 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-message-circle-more"><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/><path d="M8 12h.01"/><path d="M12 12h.01"/><path d="M16 12h.01"/></svg>

Before

Width:  |  Height:  |  Size: 337 B

View File

@@ -1,4 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.6666 14V12.6667C12.6666 11.9594 12.3856 11.2811 11.8855 10.781C11.3854 10.281 10.7072 10 9.99992 10H5.99992C5.29267 10 4.6144 10.281 4.1143 10.781C3.6142 11.2811 3.33325 11.9594 3.33325 12.6667V14" stroke="black" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 0.875C5.49797 0.875 3.875 2.49797 3.875 4.5C3.875 6.15288 4.98124 7.54738 6.49373 7.98351C5.2997 8.12901 4.27557 8.55134 3.50407 9.31167C2.52216 10.2794 2.02502 11.72 2.02502 13.5999C2.02502 13.8623 2.23769 14.0749 2.50002 14.0749C2.76236 14.0749 2.97502 13.8623 2.97502 13.5999C2.97502 11.8799 3.42786 10.7206 4.17091 9.9883C4.91536 9.25463 6.02674 8.87499 7.49995 8.87499C8.97317 8.87499 10.0846 9.25463 10.8291 9.98831C11.5721 10.7206 12.025 11.8799 12.025 13.5999C12.025 13.8623 12.2376 14.0749 12.5 14.0749C12.7623 14.075 12.975 13.8623 12.975 13.6C12.975 11.72 12.4778 10.2794 11.4959 9.31166C10.7244 8.55135 9.70025 8.12903 8.50625 7.98352C10.0187 7.5474 11.125 6.15289 11.125 4.5C11.125 2.49797 9.50203 0.875 7.5 0.875ZM4.825 4.5C4.825 3.02264 6.02264 1.825 7.5 1.825C8.97736 1.825 10.175 3.02264 10.175 4.5C10.175 5.97736 8.97736 7.175 7.5 7.175C6.02264 7.175 4.825 5.97736 4.825 4.5Z" fill="black"/>
<path d="M7.99992 7.33333C9.47268 7.33333 10.6666 6.13943 10.6666 4.66667C10.6666 3.19391 9.47268 2 7.99992 2C6.52716 2 5.33325 3.19391 5.33325 4.66667C5.33325 6.13943 6.52716 7.33333 7.99992 7.33333Z" stroke="black" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 690 B

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-user"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="10" r="3"/><path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662"/></svg>

Before

Width:  |  Height:  |  Size: 345 B

View File

@@ -1,4 +1,8 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.33325 8H12.6666" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path
<path d="M8 3.33333V12.6667" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> fill-rule="evenodd"
clip-rule="evenodd"
d="M8 2.75C8 2.47386 7.77614 2.25 7.5 2.25C7.22386 2.25 7 2.47386 7 2.75V7H2.75C2.47386 7 2.25 7.22386 2.25 7.5C2.25 7.77614 2.47386 8 2.75 8H7V12.25C7 12.5261 7.22386 12.75 7.5 12.75C7.77614 12.75 8 12.5261 8 12.25V8H12.25C12.5261 8 12.75 7.77614 12.75 7.5C12.75 7.22386 12.5261 7 12.25 7H8V2.75Z"
fill="currentColor"
/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 491 B

View File

@@ -1,4 +1 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rotate-cw"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>
<path d="M12 6.5L9.99556 4.21778C9.27778 3.5 8.12 3 7 3C6.20888 3 5.43552 3.2346 4.77772 3.67412C4.11992 4.11365 3.60723 4.73836 3.30448 5.46927C3.00173 6.20017 2.92252 7.00444 3.07686 7.78036C3.2312 8.55628 3.61216 9.26902 4.17157 9.82842C4.73098 10.3878 5.44372 10.7688 6.21964 10.9231C6.99556 11.0775 7.79983 10.9983 8.53073 10.6955C8.88113 10.5504 9.20712 10.357 9.5 10.1225" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M12 4V6.5H9.5" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 303 B

View File

@@ -1,4 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.14667 1.33334H7.85333C7.49971 1.33334 7.16057 1.47382 6.91053 1.72387C6.66048 1.97392 6.52 2.31305 6.52 2.66668V2.78668C6.51976 3.02049 6.45804 3.25014 6.34103 3.45257C6.22401 3.655 6.05583 3.8231 5.85333 3.94001L5.56667 4.10668C5.36398 4.2237 5.13405 4.28531 4.9 4.28531C4.66595 4.28531 4.43603 4.2237 4.23333 4.10668L4.13333 4.05334C3.82738 3.87685 3.46389 3.82897 3.12267 3.92022C2.78145 4.01146 2.49037 4.23437 2.31333 4.54001L2.16667 4.79334C1.99018 5.0993 1.9423 5.46279 2.03354 5.80401C2.12478 6.14523 2.34769 6.43631 2.65333 6.61334L2.75333 6.68001C2.95485 6.79635 3.12241 6.9634 3.23937 7.16456C3.35632 7.36573 3.4186 7.59399 3.42 7.82668V8.16668C3.42093 8.40162 3.35977 8.63265 3.2427 8.83635C3.12563 9.04005 2.95681 9.2092 2.75333 9.32668L2.65333 9.38668C2.34769 9.56371 2.12478 9.85479 2.03354 10.196C1.9423 10.5372 1.99018 10.9007 2.16667 11.2067L2.31333 11.46C2.49037 11.7657 2.78145 11.9886 3.12267 12.0798C3.46389 12.171 3.82738 12.1232 4.13333 11.9467L4.23333 11.8933C4.43603 11.7763 4.66595 11.7147 4.9 11.7147C5.13405 11.7147 5.36398 11.7763 5.56667 11.8933L5.85333 12.06C6.05583 12.1769 6.22401 12.345 6.34103 12.5475C6.45804 12.7499 6.51976 12.9795 6.52 13.2133V13.3333C6.52 13.687 6.66048 14.0261 6.91053 14.2762C7.16057 14.5262 7.49971 14.6667 7.85333 14.6667H8.14667C8.50029 14.6667 8.83943 14.5262 9.08948 14.2762C9.33953 14.0261 9.48 13.687 9.48 13.3333V13.2133C9.48024 12.9795 9.54196 12.7499 9.65898 12.5475C9.77599 12.345 9.94418 12.1769 10.1467 12.06L10.4333 11.8933C10.636 11.7763 10.866 11.7147 11.1 11.7147C11.3341 11.7147 11.564 11.7763 11.7667 11.8933L11.8667 11.9467C12.1726 12.1232 12.5361 12.171 12.8773 12.0798C13.2186 11.9886 13.5096 11.7657 13.6867 11.46L13.8333 11.2C14.0098 10.8941 14.0577 10.5306 13.9665 10.1893C13.8752 9.84812 13.6523 9.55704 13.3467 9.38001L13.2467 9.32668C13.0432 9.2092 12.8744 9.04005 12.7573 8.83635C12.6402 8.63265 12.5791 8.40162 12.58 8.16668V7.83334C12.5791 7.5984 12.6402 7.36738 12.7573 7.16367C12.8744 6.95997 13.0432 6.79082 13.2467 6.67334L13.3467 6.61334C13.6523 6.43631 13.8752 6.14523 13.9665 5.80401C14.0577 5.46279 14.0098 5.0993 13.8333 4.79334L13.6867 4.54001C13.5096 4.23437 13.2186 4.01146 12.8773 3.92022C12.5361 3.82897 12.1726 3.87685 11.8667 4.05334L11.7667 4.10668C11.564 4.2237 11.3341 4.28531 11.1 4.28531C10.866 4.28531 10.636 4.2237 10.4333 4.10668L10.1467 3.94001C9.94418 3.8231 9.77599 3.655 9.65898 3.45257C9.54196 3.25014 9.48024 3.02049 9.48 2.78668V2.66668C9.48 2.31305 9.33953 1.97392 9.08948 1.72387C8.83943 1.47382 8.50029 1.33334 8.14667 1.33334Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M3.16089 10.2476L3.99598 10.3784C4.61244 10.4749 5.05269 11.0395 5.00728 11.6755L4.94576 12.5377C4.92784 12.789 5.06165 13.0255 5.28326 13.1348L5.90091 13.4391C6.12253 13.5485 6.38717 13.5075 6.56817 13.3371L7.1888 12.7505C7.64641 12.3178 8.35245 12.3178 8.81059 12.7505L9.43121 13.3371C9.61222 13.5081 9.87629 13.5485 10.0985 13.4391L10.7173 13.1341C10.9384 13.0255 11.0716 12.7895 11.0537 12.539L10.9921 11.6755C10.9467 11.0395 11.3869 10.4749 12.0033 10.3784L12.8385 10.2476C13.0817 10.2097 13.2776 10.0233 13.3325 9.77768L13.4848 9.09455C13.5398 8.8489 13.4425 8.59408 13.2393 8.45229L12.5422 7.96404C12.0279 7.60355 11.8708 6.89963 12.1814 6.34659L12.6025 5.59745C12.7249 5.3793 12.7047 5.10616 12.5511 4.9094L12.1241 4.36128C11.9706 4.16451 11.7149 4.08325 11.4795 4.15719L10.6719 4.41016C10.0752 4.59714 9.43903 4.28367 9.20962 3.69035L8.90017 2.88803C8.80937 2.65339 8.58777 2.4994 8.34108 2.5L7.65649 2.50184C7.40979 2.50244 7.1888 2.65766 7.09921 2.89291L6.79751 3.68607C6.57053 4.28307 5.93138 4.59898 5.33284 4.41077L4.49178 4.1468C4.25583 4.07225 3.99897 4.15413 3.84545 4.35212L3.42133 4.90084C3.26781 5.09943 3.2493 5.37319 3.37414 5.59133L3.80483 6.34232C4.12201 6.89591 3.96671 7.60659 3.44941 7.96897L2.76065 8.45169C2.55756 8.59408 2.4602 8.84891 2.51516 9.09393L2.66747 9.77708C2.72184 10.0233 2.91777 10.2097 3.16089 10.2476Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8 10C9.10457 10 10 9.10457 10 8C10 6.89543 9.10457 6 8 6C6.89543 6 6 6.89543 6 8C6 9.10457 6.89543 10 8 10Z" fill="black"/> <path d="M9.41432 6.83576C8.63332 6.05481 7.36676 6.05476 6.58575 6.83571C5.8048 7.61672 5.80476 8.88327 6.58571 9.66427C7.36671 10.4452 8.63326 10.4452 9.41426 9.66432C10.1952 8.88332 10.1952 7.61676 9.41432 6.83576Z" fill="black"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,5 +0,0 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.27772 1.38585L4.39187 4.07909C4.34653 4.21692 4.26946 4.34219 4.16685 4.44479C4.06425 4.5474 3.93898 4.62447 3.80115 4.66981L1.10791 5.55566L3.80115 6.44151C3.93898 6.48685 4.06425 6.56392 4.16685 6.66653C4.26946 6.76913 4.34653 6.8944 4.39187 7.03223L5.27772 9.72547L6.16357 7.03223C6.20891 6.8944 6.28598 6.76913 6.38859 6.66653C6.49119 6.56392 6.61646 6.48685 6.7543 6.44151L9.44753 5.55566L6.7543 4.66981C6.61646 4.62447 6.49119 4.5474 6.38859 4.44479C6.28598 4.34219 6.20891 4.21692 6.16357 4.07909L5.27772 1.38585Z" fill="black" fill-opacity="0.15" stroke="black" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8.35938 12.3555C8.35938 12.0664 8.52734 11.8086 9.00781 11.3594L10.2031 10.2344C10.6094 9.85156 10.7891 9.60156 10.7891 9.34375C10.7891 9.05469 10.5781 8.85938 10.2734 8.85938C10.0391 8.85938 9.87109 8.95312 9.66406 9.21094C9.42578 9.50781 9.25391 9.60938 8.99219 9.60938C8.61719 9.60938 8.35156 9.35938 8.35156 9.01172C8.35156 8.25 9.26953 7.57812 10.3594 7.57812C11.4961 7.57812 12.3438 8.26172 12.3438 9.17969C12.3438 9.75391 12.0391 10.3008 11.418 10.8516L10.4961 11.6719V11.7344H11.8047C12.2578 11.7344 12.5391 11.9766 12.5391 12.3711C12.5391 12.7656 12.2656 13 11.8047 13H9.08203C8.65234 13 8.35938 12.7383 8.35938 12.3555Z" fill="black"/>
<path d="M11.0834 1.38585V3.71918M9.91675 2.55248H12.2501" stroke="black" stroke-opacity="0.75" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,5 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 5L14 8L12 11" stroke="black" stroke-width="1.5"/> <path d="M8 8.9V11C5.93097 11 5.06903 11 3 11V10.4L8 5.6V5H3V7.1" stroke="black" stroke-width="1.5"/>
<path d="M10 6.5L11 8L10 9.5" stroke="black" stroke-width="1.5"/> <path d="M11 5L13 8L11 11" stroke="black" stroke-width="1.5"/>
<path d="M7.5 8.9V11C5.43097 11 4.56903 11 2.5 11V10.4L7.5 5.6V5H2.5V7.1" stroke="black" stroke-width="1.5"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 268 B

View File

@@ -1,19 +0,0 @@
<svg width="420" height="128" xmlns="http://www.w3.org/2000/svg">
<defs>
<pattern id="tilePattern" width="22" height="22" patternUnits="userSpaceOnUse">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 5L14 8L12 11" stroke="black" stroke-width="1.5"/>
<path d="M10 6.5L11 8L10 9.5" stroke="black" stroke-width="1.5"/>
<path d="M7.5 8.9V11C5.43097 11 4.56903 11 2.5 11V10.4L7.5 5.6V5H2.5V7.1" stroke="black" stroke-width="1.5"/>
</svg>
</pattern>
<linearGradient id="fade" y2="1" x2="0">
<stop offset="0" stop-color="white" stop-opacity=".24"/>
<stop offset="1" stop-color="white" stop-opacity="0"/>
</linearGradient>
<mask id="fadeMask" maskContentUnits="objectBoundingBox">
<rect width="1" height="1" fill="url(#fade)"/>
</mask>
</defs>
<rect width="100%" height="100%" fill="url(#tilePattern)" mask="url(#fadeMask)"/>
</svg>

Before

Width:  |  Height:  |  Size: 971 B

View File

@@ -2,27 +2,25 @@
// Standard Linux bindings // Standard Linux bindings
{ {
"bindings": { "bindings": {
"home": "menu::SelectFirst",
"shift-pageup": "menu::SelectFirst",
"pageup": "menu::SelectFirst",
"end": "menu::SelectLast",
"shift-pagedown": "menu::SelectLast",
"pagedown": "menu::SelectLast",
"ctrl-n": "menu::SelectNext",
"tab": "menu::SelectNext",
"ctrl-p": "menu::SelectPrev",
"shift-tab": "menu::SelectPrev", "shift-tab": "menu::SelectPrev",
"home": "menu::SelectFirst",
"pageup": "menu::SelectFirst",
"shift-pageup": "menu::SelectFirst",
"ctrl-p": "menu::SelectPrev",
"tab": "menu::SelectNext",
"end": "menu::SelectLast",
"pagedown": "menu::SelectLast",
"shift-pagedown": "menu::SelectFirst",
"ctrl-n": "menu::SelectNext",
"enter": "menu::Confirm", "enter": "menu::Confirm",
"ctrl-enter": "menu::SecondaryConfirm", "ctrl-enter": "menu::SecondaryConfirm",
"escape": "menu::Cancel",
"ctrl-escape": "menu::Cancel", "ctrl-escape": "menu::Cancel",
"ctrl-c": "menu::Cancel", "ctrl-c": "menu::Cancel",
"escape": "menu::Cancel",
"alt-shift-enter": "menu::Restart",
"alt-enter": ["picker::ConfirmInput", { "secondary": false }], "alt-enter": ["picker::ConfirmInput", { "secondary": false }],
"ctrl-alt-enter": ["picker::ConfirmInput", { "secondary": true }], "ctrl-alt-enter": ["picker::ConfirmInput", { "secondary": true }],
"ctrl-shift-w": "workspace::CloseWindow", "ctrl-shift-w": "workspace::CloseWindow",
"shift-escape": "workspace::ToggleZoom", "shift-escape": "workspace::ToggleZoom",
"open": "workspace::Open",
"ctrl-o": "workspace::Open", "ctrl-o": "workspace::Open",
"ctrl-=": "zed::IncreaseBufferFontSize", "ctrl-=": "zed::IncreaseBufferFontSize",
"ctrl-+": "zed::IncreaseBufferFontSize", "ctrl-+": "zed::IncreaseBufferFontSize",
@@ -30,9 +28,7 @@
"ctrl-0": "zed::ResetBufferFontSize", "ctrl-0": "zed::ResetBufferFontSize",
"ctrl-,": "zed::OpenSettings", "ctrl-,": "zed::OpenSettings",
"ctrl-q": "zed::Quit", "ctrl-q": "zed::Quit",
"f11": "zed::ToggleFullScreen", "f11": "zed::ToggleFullScreen"
"ctrl-alt-z": "zeta::RateCompletions",
"ctrl-shift-i": "inline_completion::ToggleMenu"
} }
}, },
{ {
@@ -53,8 +49,8 @@
"context": "Editor", "context": "Editor",
"bindings": { "bindings": {
"escape": "editor::Cancel", "escape": "editor::Cancel",
"shift-backspace": "editor::Backspace",
"backspace": "editor::Backspace", "backspace": "editor::Backspace",
"shift-backspace": "editor::Backspace",
"delete": "editor::Delete", "delete": "editor::Delete",
"tab": "editor::Tab", "tab": "editor::Tab",
"shift-tab": "editor::TabPrev", "shift-tab": "editor::TabPrev",
@@ -64,19 +60,11 @@
"ctrl-k q": "editor::Rewrap", "ctrl-k q": "editor::Rewrap",
"ctrl-backspace": "editor::DeleteToPreviousWordStart", "ctrl-backspace": "editor::DeleteToPreviousWordStart",
"ctrl-delete": "editor::DeleteToNextWordEnd", "ctrl-delete": "editor::DeleteToNextWordEnd",
"cut": "editor::Cut",
"shift-delete": "editor::Cut", "shift-delete": "editor::Cut",
"ctrl-x": "editor::Cut",
"copy": "editor::Copy",
"ctrl-insert": "editor::Copy", "ctrl-insert": "editor::Copy",
"ctrl-c": "editor::Copy",
"paste": "editor::Paste",
"shift-insert": "editor::Paste", "shift-insert": "editor::Paste",
"ctrl-v": "editor::Paste",
"undo": "editor::Undo",
"ctrl-z": "editor::Undo",
"redo": "editor::Redo",
"ctrl-y": "editor::Redo", "ctrl-y": "editor::Redo",
"ctrl-z": "editor::Undo",
"ctrl-shift-z": "editor::Redo", "ctrl-shift-z": "editor::Redo",
"up": "editor::MoveUp", "up": "editor::MoveUp",
"ctrl-up": "editor::LineUp", "ctrl-up": "editor::LineUp",
@@ -108,16 +96,16 @@
"ctrl-l": "editor::SelectLine", "ctrl-l": "editor::SelectLine",
"ctrl-shift-i": "editor::Format", "ctrl-shift-i": "editor::Format",
// "cmd-shift-left": ["editor::SelectToBeginningOfLine", {"stop_at_soft_wraps": true }], // "cmd-shift-left": ["editor::SelectToBeginningOfLine", {"stop_at_soft_wraps": true }],
// "ctrl-shift-a": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": true }],
"shift-home": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": true }], "shift-home": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": true }],
// "ctrl-shift-a": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": true }],
// "cmd-shift-right": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": true }], // "cmd-shift-right": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": true }],
// "ctrl-shift-e": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": true }],
"shift-end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": true }], "shift-end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": true }],
// "ctrl-shift-e": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": true }],
// "alt-v": ["editor::MovePageUp", { "center_cursor": true }], // "alt-v": ["editor::MovePageUp", { "center_cursor": true }],
"ctrl-alt-space": "editor::ShowCharacterPalette", "ctrl-alt-space": "editor::ShowCharacterPalette",
"ctrl-;": "editor::ToggleLineNumbers", "ctrl-;": "editor::ToggleLineNumbers",
"ctrl-k ctrl-r": "editor::RevertSelectedHunks", "ctrl-k ctrl-r": "editor::RevertSelectedHunks",
"ctrl-'": "editor::ToggleSelectedDiffHunks", "ctrl-'": "editor::ToggleHunkDiff",
"ctrl-\"": "editor::ExpandAllHunkDiffs", "ctrl-\"": "editor::ExpandAllHunkDiffs",
"ctrl-i": "editor::ShowSignatureHelp", "ctrl-i": "editor::ShowSignatureHelp",
"alt-g b": "editor::ToggleGitBlame", "alt-g b": "editor::ToggleGitBlame",
@@ -125,23 +113,30 @@
"shift-f10": "editor::OpenContextMenu" "shift-f10": "editor::OpenContextMenu"
} }
}, },
{
// Separate block with same context so these display in context menus
"context": "Editor",
"bindings": {
"ctrl-x": "editor::Cut",
"ctrl-c": "editor::Copy",
"ctrl-v": "editor::Paste"
}
},
{ {
"context": "Editor && mode == full", "context": "Editor && mode == full",
"bindings": { "bindings": {
"shift-enter": "editor::Newline",
"enter": "editor::Newline", "enter": "editor::Newline",
"shift-enter": "editor::Newline",
"ctrl-enter": "editor::NewlineAbove", "ctrl-enter": "editor::NewlineAbove",
"ctrl-shift-enter": "editor::NewlineBelow", "ctrl-shift-enter": "editor::NewlineBelow",
"ctrl-k ctrl-z": "editor::ToggleSoftWrap", "ctrl-k ctrl-z": "editor::ToggleSoftWrap",
"ctrl-k z": "editor::ToggleSoftWrap", "ctrl-k z": "editor::ToggleSoftWrap",
"find": "buffer_search::Deploy",
"ctrl-f": "buffer_search::Deploy", "ctrl-f": "buffer_search::Deploy",
"ctrl-h": "buffer_search::DeployReplace", "ctrl-h": ["buffer_search::Deploy", { "replace_enabled": true }],
// "cmd-e": ["buffer_search::Deploy", { "focus": false }], // "cmd-e": ["buffer_search::Deploy", { "focus": false }],
"ctrl->": "assistant::QuoteSelection", "ctrl->": "assistant::QuoteSelection",
"ctrl-<": "assistant::InsertIntoEditor", "ctrl-<": "assistant::InsertIntoEditor",
"ctrl-alt-e": "editor::SelectEnclosingSymbol", "ctrl-alt-e": "editor::SelectEnclosingSymbol"
"alt-enter": "editor::OpenSelectionsInMultibuffer"
} }
}, },
{ {
@@ -169,7 +164,6 @@
{ {
"context": "Markdown", "context": "Markdown",
"bindings": { "bindings": {
"copy": "markdown::Copy",
"ctrl-c": "markdown::Copy" "ctrl-c": "markdown::Copy"
} }
}, },
@@ -177,20 +171,17 @@
"context": "AssistantPanel", "context": "AssistantPanel",
"bindings": { "bindings": {
"ctrl-k c": "assistant::CopyCode", "ctrl-k c": "assistant::CopyCode",
"ctrl-shift-e": "project_panel::ToggleFocus",
"ctrl-g": "search::SelectNextMatch", "ctrl-g": "search::SelectNextMatch",
"ctrl-shift-g": "search::SelectPrevMatch", "ctrl-shift-g": "search::SelectPrevMatch",
"ctrl-alt-/": "assistant::ToggleModelSelector", "ctrl-shift-m": "assistant::ToggleModelSelector",
"ctrl-k h": "assistant::DeployHistory", "ctrl-k h": "assistant::DeployHistory",
"ctrl-k l": "assistant::DeployPromptLibrary", "ctrl-k l": "assistant::DeployPromptLibrary",
"new": "assistant::NewContext",
"ctrl-n": "assistant::NewContext" "ctrl-n": "assistant::NewContext"
} }
}, },
{ {
"context": "PromptLibrary", "context": "PromptLibrary",
"bindings": { "bindings": {
"new": "prompt_library::NewPrompt",
"ctrl-n": "prompt_library::NewPrompt", "ctrl-n": "prompt_library::NewPrompt",
"ctrl-shift-s": "prompt_library::ToggleDefaultPrompt" "ctrl-shift-s": "prompt_library::ToggleDefaultPrompt"
} }
@@ -204,7 +195,6 @@
"shift-enter": "search::SelectPrevMatch", "shift-enter": "search::SelectPrevMatch",
"alt-enter": "search::SelectAllMatches", "alt-enter": "search::SelectAllMatches",
"ctrl-f": "search::FocusSearch", "ctrl-f": "search::FocusSearch",
"find": "search::FocusSearch",
"ctrl-h": "search::ToggleReplace", "ctrl-h": "search::ToggleReplace",
"ctrl-l": "search::ToggleSelection" "ctrl-l": "search::ToggleSelection"
} }
@@ -227,7 +217,6 @@
"context": "ProjectSearchBar", "context": "ProjectSearchBar",
"bindings": { "bindings": {
"escape": "project_search::ToggleFocus", "escape": "project_search::ToggleFocus",
"shift-find": "search::FocusSearch",
"ctrl-shift-f": "search::FocusSearch", "ctrl-shift-f": "search::FocusSearch",
"ctrl-shift-h": "search::ToggleReplace", "ctrl-shift-h": "search::ToggleReplace",
"alt-ctrl-g": "search::ToggleRegex", "alt-ctrl-g": "search::ToggleRegex",
@@ -260,48 +249,30 @@
{ {
"context": "Pane", "context": "Pane",
"bindings": { "bindings": {
"alt-1": ["pane::ActivateItem", 0],
"alt-2": ["pane::ActivateItem", 1],
"alt-3": ["pane::ActivateItem", 2],
"alt-4": ["pane::ActivateItem", 3],
"alt-5": ["pane::ActivateItem", 4],
"alt-6": ["pane::ActivateItem", 5],
"alt-7": ["pane::ActivateItem", 6],
"alt-8": ["pane::ActivateItem", 7],
"alt-9": ["pane::ActivateItem", 8],
"alt-0": "pane::ActivateLastItem",
"ctrl-pageup": "pane::ActivatePrevItem", "ctrl-pageup": "pane::ActivatePrevItem",
"ctrl-pagedown": "pane::ActivateNextItem", "ctrl-pagedown": "pane::ActivateNextItem",
"ctrl-shift-pageup": "pane::SwapItemLeft", "ctrl-shift-pageup": "pane::SwapItemLeft",
"ctrl-shift-pagedown": "pane::SwapItemRight", "ctrl-shift-pagedown": "pane::SwapItemRight",
"ctrl-f4": "pane::CloseActiveItem", "back": "pane::GoBack",
"forward": "pane::GoForward",
"ctrl-w": "pane::CloseActiveItem", "ctrl-w": "pane::CloseActiveItem",
"ctrl-f4": "pane::CloseActiveItem",
"alt-ctrl-t": ["pane::CloseInactiveItems", { "close_pinned": false }], "alt-ctrl-t": ["pane::CloseInactiveItems", { "close_pinned": false }],
"alt-ctrl-shift-w": "workspace::CloseInactiveTabsAndPanes", "alt-ctrl-shift-w": "workspace::CloseInactiveTabsAndPanes",
"ctrl-k e": ["pane::CloseItemsToTheLeft", { "close_pinned": false }],
"ctrl-k t": ["pane::CloseItemsToTheRight", { "close_pinned": false }],
"ctrl-k u": ["pane::CloseCleanItems", { "close_pinned": false }], "ctrl-k u": ["pane::CloseCleanItems", { "close_pinned": false }],
"ctrl-k w": ["pane::CloseAllItems", { "close_pinned": false }], "ctrl-k w": ["pane::CloseAllItems", { "close_pinned": false }],
"back": "pane::GoBack",
"ctrl-alt--": "pane::GoBack",
"ctrl-alt-_": "pane::GoForward",
"forward": "pane::GoForward",
"ctrl-alt-g": "search::SelectNextMatch",
"f3": "search::SelectNextMatch",
"ctrl-alt-shift-g": "search::SelectPrevMatch",
"shift-f3": "search::SelectPrevMatch",
"ctrl-shift-f": "project_search::ToggleFocus", "ctrl-shift-f": "project_search::ToggleFocus",
"shift-find": "project_search::ToggleFocus", "ctrl-alt-g": "search::SelectNextMatch",
"ctrl-alt-shift-g": "search::SelectPrevMatch",
"ctrl-alt-shift-h": "search::ToggleReplace", "ctrl-alt-shift-h": "search::ToggleReplace",
"ctrl-alt-shift-l": "search::ToggleSelection", "ctrl-alt-shift-l": "search::ToggleSelection",
"alt-enter": "search::SelectAllMatches", "alt-enter": "search::SelectAllMatches",
"alt-c": "search::ToggleCaseSensitive", "alt-c": "search::ToggleCaseSensitive",
"alt-w": "search::ToggleWholeWord", "alt-w": "search::ToggleWholeWord",
"alt-r": "search::ToggleRegex",
"alt-ctrl-f": "project_search::ToggleFilters", "alt-ctrl-f": "project_search::ToggleFilters",
"alt-find": "project_search::ToggleFilters",
"ctrl-alt-shift-r": "search::ToggleRegex", "ctrl-alt-shift-r": "search::ToggleRegex",
"ctrl-alt-shift-x": "search::ToggleRegex", "ctrl-alt-shift-x": "search::ToggleRegex",
"alt-r": "search::ToggleRegex",
"ctrl-k shift-enter": "pane::TogglePinTab" "ctrl-k shift-enter": "pane::TogglePinTab"
} }
}, },
@@ -376,25 +347,39 @@
"ctrl-g": "go_to_line::Toggle" "ctrl-g": "go_to_line::Toggle"
} }
}, },
{
"context": "Pane",
"bindings": {
"alt-1": ["pane::ActivateItem", 0],
"alt-2": ["pane::ActivateItem", 1],
"alt-3": ["pane::ActivateItem", 2],
"alt-4": ["pane::ActivateItem", 3],
"alt-5": ["pane::ActivateItem", 4],
"alt-6": ["pane::ActivateItem", 5],
"alt-7": ["pane::ActivateItem", 6],
"alt-8": ["pane::ActivateItem", 7],
"alt-9": ["pane::ActivateItem", 8],
"alt-0": "pane::ActivateLastItem",
"ctrl-alt--": "pane::GoBack",
"ctrl-alt-_": "pane::GoForward",
"ctrl-shift-t": "pane::ReopenClosedItem",
"f3": "search::SelectNextMatch",
"shift-f3": "search::SelectPrevMatch",
"ctrl-shift-f": "project_search::ToggleFocus"
}
},
{ {
"context": "Workspace", "context": "Workspace",
"bindings": { "bindings": {
// Change the default action on `menu::Confirm` by setting the parameter // Change the default action on `menu::Confirm` by setting the parameter
// "alt-ctrl-o": ["projects::OpenRecent", { "create_new_window": true }], // "alt-ctrl-o": ["projects::OpenRecent", { "create_new_window": true }],
"alt-open": "projects::OpenRecent",
"alt-ctrl-o": "projects::OpenRecent", "alt-ctrl-o": "projects::OpenRecent",
"alt-shift-open": "projects::OpenRemote",
"alt-ctrl-shift-o": "projects::OpenRemote",
"alt-ctrl-shift-b": "branches::OpenRecent", "alt-ctrl-shift-b": "branches::OpenRecent",
"ctrl-~": "workspace::NewTerminal", "ctrl-~": "workspace::NewTerminal",
"save": "workspace::Save",
"ctrl-s": "workspace::Save", "ctrl-s": "workspace::Save",
"ctrl-k s": "workspace::SaveWithoutFormat", "ctrl-k s": "workspace::SaveWithoutFormat",
"shift-save": "workspace::SaveAs",
"ctrl-shift-s": "workspace::SaveAs", "ctrl-shift-s": "workspace::SaveAs",
"new": "workspace::NewFile",
"ctrl-n": "workspace::NewFile", "ctrl-n": "workspace::NewFile",
"shift-new": "workspace::NewWindow",
"ctrl-shift-n": "workspace::NewWindow", "ctrl-shift-n": "workspace::NewWindow",
"ctrl-`": "terminal_panel::ToggleFocus", "ctrl-`": "terminal_panel::ToggleFocus",
"alt-1": ["workspace::ActivatePane", 0], "alt-1": ["workspace::ActivatePane", 0],
@@ -410,10 +395,8 @@
"ctrl-b": "workspace::ToggleLeftDock", "ctrl-b": "workspace::ToggleLeftDock",
"ctrl-j": "workspace::ToggleBottomDock", "ctrl-j": "workspace::ToggleBottomDock",
"ctrl-alt-y": "workspace::CloseAllDocks", "ctrl-alt-y": "workspace::CloseAllDocks",
"shift-find": "pane::DeploySearch",
"ctrl-shift-f": "pane::DeploySearch", "ctrl-shift-f": "pane::DeploySearch",
"ctrl-shift-h": ["pane::DeploySearch", { "replace_enabled": true }], "ctrl-shift-h": ["pane::DeploySearch", { "replace_enabled": true }],
"ctrl-shift-t": "pane::ReopenClosedItem",
"ctrl-k ctrl-s": "zed::OpenKeymap", "ctrl-k ctrl-s": "zed::OpenKeymap",
"ctrl-k ctrl-t": "theme_selector::Toggle", "ctrl-k ctrl-t": "theme_selector::Toggle",
"ctrl-t": "project_symbols::Toggle", "ctrl-t": "project_symbols::Toggle",
@@ -421,14 +404,12 @@
"ctrl-tab": "tab_switcher::Toggle", "ctrl-tab": "tab_switcher::Toggle",
"ctrl-shift-tab": ["tab_switcher::Toggle", { "select_last": true }], "ctrl-shift-tab": ["tab_switcher::Toggle", { "select_last": true }],
"ctrl-e": "file_finder::Toggle", "ctrl-e": "file_finder::Toggle",
"f1": "command_palette::Toggle",
"ctrl-shift-p": "command_palette::Toggle", "ctrl-shift-p": "command_palette::Toggle",
"f1": "command_palette::Toggle",
"ctrl-shift-m": "diagnostics::Deploy", "ctrl-shift-m": "diagnostics::Deploy",
"ctrl-shift-e": "project_panel::ToggleFocus", "ctrl-shift-e": "pane::RevealInProjectPanel",
"ctrl-shift-b": "outline_panel::ToggleFocus", "ctrl-shift-b": "outline_panel::ToggleFocus",
"ctrl-shift-g": "git_panel::ToggleFocus",
"ctrl-?": "assistant::ToggleFocus", "ctrl-?": "assistant::ToggleFocus",
"alt-save": "workspace::SaveAll",
"ctrl-alt-s": "workspace::SaveAll", "ctrl-alt-s": "workspace::SaveAll",
"ctrl-k m": "language_selector::Toggle", "ctrl-k m": "language_selector::Toggle",
"escape": "workspace::Unfollow", "escape": "workspace::Unfollow",
@@ -444,23 +425,14 @@
"ctrl-shift-r": "task::Rerun", "ctrl-shift-r": "task::Rerun",
"ctrl-alt-r": "task::Rerun", "ctrl-alt-r": "task::Rerun",
"alt-t": "task::Rerun", "alt-t": "task::Rerun",
"alt-shift-t": "task::Spawn", "alt-shift-t": "task::Spawn"
"alt-shift-r": ["task::Spawn", { "reveal_target": "center" }]
// also possible to spawn tasks by name:
// "foo-bar": ["task::Spawn", { "task_name": "MyTask", "reveal_target": "dock" }]
}
},
{
"context": "ApplicationMenu",
"bindings": {
"left": ["app_menu::NavigateApplicationMenuInDirection", "Left"],
"right": ["app_menu::NavigateApplicationMenuInDirection", "Right"]
} }
}, },
// Bindings from Sublime Text // Bindings from Sublime Text
{ {
"context": "Editor", "context": "Editor",
"bindings": { "bindings": {
"ctrl-shift-k": "editor::DeleteLine",
"ctrl-shift-d": "editor::DuplicateLineDown", "ctrl-shift-d": "editor::DuplicateLineDown",
"ctrl-shift-j": "editor::JoinLines", "ctrl-shift-j": "editor::JoinLines",
"ctrl-alt-backspace": "editor::DeleteToPreviousSubwordStart", "ctrl-alt-backspace": "editor::DeleteToPreviousSubwordStart",
@@ -498,12 +470,18 @@
"context": "Editor && showing_completions", "context": "Editor && showing_completions",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"enter": "editor::ConfirmCompletion", "enter": "editor::ConfirmCompletion"
}
},
{
"context": "Editor && !inline_completion && showing_completions",
"use_key_equivalents": true,
"bindings": {
"tab": "editor::ComposeCompletion" "tab": "editor::ComposeCompletion"
} }
}, },
{ {
"context": "Editor && inline_completion && !showing_completions", "context": "Editor && inline_completion",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"tab": "editor::AcceptInlineCompletion" "tab": "editor::AcceptInlineCompletion"
@@ -518,10 +496,10 @@
{ {
"context": "Editor && (showing_code_actions || showing_completions)", "context": "Editor && (showing_code_actions || showing_completions)",
"bindings": { "bindings": {
"ctrl-p": "editor::ContextMenuPrev",
"up": "editor::ContextMenuPrev", "up": "editor::ContextMenuPrev",
"ctrl-n": "editor::ContextMenuNext", "ctrl-p": "editor::ContextMenuPrev",
"down": "editor::ContextMenuNext", "down": "editor::ContextMenuNext",
"ctrl-n": "editor::ContextMenuNext",
"pageup": "editor::ContextMenuFirst", "pageup": "editor::ContextMenuFirst",
"pagedown": "editor::ContextMenuLast" "pagedown": "editor::ContextMenuLast"
} }
@@ -545,8 +523,7 @@
"bindings": { "bindings": {
"alt-enter": "editor::OpenExcerpts", "alt-enter": "editor::OpenExcerpts",
"shift-enter": "editor::ExpandExcerpts", "shift-enter": "editor::ExpandExcerpts",
"ctrl-alt-enter": "editor::OpenExcerptsSplit", "ctrl-k enter": "editor::OpenExcerptsSplit",
"ctrl-shift-e": "pane::RevealInProjectPanel",
"ctrl-f8": "editor::GoToHunk", "ctrl-f8": "editor::GoToHunk",
"ctrl-shift-f8": "editor::GoToPrevHunk", "ctrl-shift-f8": "editor::GoToPrevHunk",
"ctrl-enter": "assistant::InlineAssist" "ctrl-enter": "assistant::InlineAssist"
@@ -572,7 +549,6 @@
"ctrl-enter": "assistant::Assist", "ctrl-enter": "assistant::Assist",
"ctrl-shift-enter": "assistant::Edit", "ctrl-shift-enter": "assistant::Edit",
"ctrl-s": "workspace::Save", "ctrl-s": "workspace::Save",
"save": "workspace::Save",
"ctrl->": "assistant::QuoteSelection", "ctrl->": "assistant::QuoteSelection",
"ctrl-<": "assistant::InsertIntoEditor", "ctrl-<": "assistant::InsertIntoEditor",
"shift-enter": "assistant::Split", "shift-enter": "assistant::Split",
@@ -581,49 +557,11 @@
"alt-enter": "editor::Newline" "alt-enter": "editor::Newline"
} }
}, },
{
"context": "AssistantPanel2",
"bindings": {
"ctrl-n": "assistant2::NewThread",
"new": "assistant2::NewThread",
"ctrl-shift-h": "assistant2::OpenHistory",
"ctrl-alt-/": "assistant2::ToggleModelSelector",
"ctrl-shift-a": "assistant2::ToggleContextPicker",
"ctrl-e": "assistant2::ChatMode",
"ctrl-alt-e": "assistant2::RemoveAllContext"
}
},
{
"context": "MessageEditor > Editor",
"use_key_equivalents": true,
"bindings": {
"enter": "assistant2::Chat"
}
},
{
"context": "ContextStrip",
"use_key_equivalents": true,
"bindings": {
"up": "assistant2::FocusUp",
"right": "assistant2::FocusRight",
"left": "assistant2::FocusLeft",
"down": "assistant2::FocusDown",
"backspace": "assistant2::RemoveFocusedContext",
"enter": "assistant2::AcceptSuggestedContext"
}
},
{
"context": "ThreadHistory",
"bindings": {
"backspace": "assistant2::RemoveSelectedThread"
}
},
{ {
"context": "PromptEditor", "context": "PromptEditor",
"bindings": { "bindings": {
"ctrl-[": "assistant::CyclePreviousInlineAssist", "ctrl-[": "assistant::CyclePreviousInlineAssist",
"ctrl-]": "assistant::CycleNextInlineAssist", "ctrl-]": "assistant::CycleNextInlineAssist"
"ctrl-alt-e": "assistant2::RemoveAllContext"
} }
}, },
{ {
@@ -638,16 +576,14 @@
"escape": "menu::Cancel", "escape": "menu::Cancel",
"left": "outline_panel::CollapseSelectedEntry", "left": "outline_panel::CollapseSelectedEntry",
"right": "outline_panel::ExpandSelectedEntry", "right": "outline_panel::ExpandSelectedEntry",
"alt-copy": "outline_panel::CopyPath",
"ctrl-alt-c": "outline_panel::CopyPath", "ctrl-alt-c": "outline_panel::CopyPath",
"alt-shift-copy": "outline_panel::CopyRelativePath",
"alt-ctrl-shift-c": "outline_panel::CopyRelativePath", "alt-ctrl-shift-c": "outline_panel::CopyRelativePath",
"alt-ctrl-r": "outline_panel::RevealInFileManager", "alt-ctrl-r": "outline_panel::RevealInFileManager",
"space": "outline_panel::Open", "space": "outline_panel::Open",
"shift-down": "menu::SelectNext", "shift-down": "menu::SelectNext",
"shift-up": "menu::SelectPrev", "shift-up": "menu::SelectPrev",
"alt-enter": "editor::OpenExcerpts", "alt-enter": "editor::OpenExcerpts",
"ctrl-alt-enter": "editor::OpenExcerptsSplit" "ctrl-k enter": "editor::OpenExcerptsSplit"
} }
}, },
{ {
@@ -655,72 +591,43 @@
"bindings": { "bindings": {
"left": "project_panel::CollapseSelectedEntry", "left": "project_panel::CollapseSelectedEntry",
"right": "project_panel::ExpandSelectedEntry", "right": "project_panel::ExpandSelectedEntry",
"new": "project_panel::NewFile",
"ctrl-n": "project_panel::NewFile", "ctrl-n": "project_panel::NewFile",
"alt-new": "project_panel::NewDirectory",
"alt-ctrl-n": "project_panel::NewDirectory", "alt-ctrl-n": "project_panel::NewDirectory",
"cut": "project_panel::Cut",
"ctrl-x": "project_panel::Cut",
"copy": "project_panel::Copy",
"ctrl-insert": "project_panel::Copy", "ctrl-insert": "project_panel::Copy",
"ctrl-c": "project_panel::Copy",
"paste": "project_panel::Paste",
"shift-insert": "project_panel::Paste", "shift-insert": "project_panel::Paste",
"ctrl-v": "project_panel::Paste",
"alt-copy": "project_panel::CopyPath",
"ctrl-alt-c": "project_panel::CopyPath", "ctrl-alt-c": "project_panel::CopyPath",
"alt-shift-copy": "project_panel::CopyRelativePath",
"alt-ctrl-shift-c": "project_panel::CopyRelativePath", "alt-ctrl-shift-c": "project_panel::CopyRelativePath",
"enter": "project_panel::Rename", "enter": "project_panel::Rename",
"f2": "project_panel::Rename",
"backspace": ["project_panel::Trash", { "skip_prompt": false }], "backspace": ["project_panel::Trash", { "skip_prompt": false }],
"delete": ["project_panel::Trash", { "skip_prompt": false }],
"shift-delete": ["project_panel::Delete", { "skip_prompt": false }], "shift-delete": ["project_panel::Delete", { "skip_prompt": false }],
"ctrl-backspace": ["project_panel::Delete", { "skip_prompt": false }], "ctrl-backspace": ["project_panel::Delete", { "skip_prompt": false }],
"ctrl-delete": ["project_panel::Delete", { "skip_prompt": false }], "ctrl-delete": ["project_panel::Delete", { "skip_prompt": false }],
"alt-ctrl-r": "project_panel::RevealInFileManager", "alt-ctrl-r": "project_panel::RevealInFileManager",
"ctrl-shift-enter": "project_panel::OpenWithSystem", "ctrl-shift-enter": "project_panel::OpenWithSystem",
"ctrl-shift-e": "project_panel::ToggleFocus",
"ctrl-shift-f": "project_panel::NewSearchInDirectory", "ctrl-shift-f": "project_panel::NewSearchInDirectory",
"shift-find": "project_panel::NewSearchInDirectory",
"shift-down": "menu::SelectNext", "shift-down": "menu::SelectNext",
"shift-up": "menu::SelectPrev", "shift-up": "menu::SelectPrev",
"escape": "menu::Cancel" "escape": "menu::Cancel"
} }
}, },
{
// Separate block with same context so these display in context menus
"context": "ProjectPanel",
"bindings": {
"f2": "project_panel::Rename",
"ctrl-c": "project_panel::Copy",
"ctrl-x": "project_panel::Cut",
"ctrl-v": "project_panel::Paste",
"delete": ["project_panel::Trash", { "skip_prompt": false }]
}
},
{ {
"context": "ProjectPanel && not_editing", "context": "ProjectPanel && not_editing",
"bindings": { "bindings": {
"space": "project_panel::Open" "space": "project_panel::Open"
} }
}, },
{
"context": "GitPanel && !CommitEditor",
"use_key_equivalents": true,
"bindings": {
"escape": "git_panel::Close"
}
},
{
"context": "GitPanel && ChangesList",
"use_key_equivalents": true,
"bindings": {
"up": "menu::SelectPrev",
"down": "menu::SelectNext",
"enter": "menu::Confirm",
"space": "git::ToggleStaged",
"ctrl-space": "git::StageAll",
"ctrl-shift-space": "git::UnstageAll"
}
},
{
"context": "GitPanel && CommitEditor > Editor",
"use_key_equivalents": true,
"bindings": {
"escape": "git_panel::FocusChanges",
"ctrl-enter": "git::CommitChanges",
"ctrl-shift-enter": "git::CommitAllChanges"
}
},
{ {
"context": "CollabPanel && not_editing", "context": "CollabPanel && not_editing",
"bindings": { "bindings": {
@@ -781,9 +688,9 @@
{ {
"context": "TabSwitcher", "context": "TabSwitcher",
"bindings": { "bindings": {
"ctrl-shift-tab": "menu::SelectPrev",
"ctrl-up": "menu::SelectPrev", "ctrl-up": "menu::SelectPrev",
"ctrl-down": "menu::SelectNext", "ctrl-down": "menu::SelectNext",
"ctrl-shift-tab": "menu::SelectPrev",
"ctrl-backspace": "tab_switcher::CloseSelectedItem" "ctrl-backspace": "tab_switcher::CloseSelectedItem"
} }
}, },
@@ -791,19 +698,12 @@
"context": "Terminal", "context": "Terminal",
"bindings": { "bindings": {
"ctrl-alt-space": "terminal::ShowCharacterPalette", "ctrl-alt-space": "terminal::ShowCharacterPalette",
"copy": "terminal::Copy",
"ctrl-insert": "terminal::Copy", "ctrl-insert": "terminal::Copy",
"ctrl-shift-c": "terminal::Copy",
"paste": "terminal::Paste",
"shift-insert": "terminal::Paste", "shift-insert": "terminal::Paste",
"ctrl-shift-v": "terminal::Paste",
"ctrl-enter": "assistant::InlineAssist", "ctrl-enter": "assistant::InlineAssist",
"alt-b": ["terminal::SendText", "\u001bb"],
"alt-f": ["terminal::SendText", "\u001bf"],
// Overrides for conflicting keybindings // Overrides for conflicting keybindings
"ctrl-w": ["terminal::SendKeystroke", "ctrl-w"], "ctrl-w": ["terminal::SendKeystroke", "ctrl-w"],
"ctrl-shift-a": "editor::SelectAll", "ctrl-shift-a": "editor::SelectAll",
"find": "buffer_search::Deploy",
"ctrl-shift-f": "buffer_search::Deploy", "ctrl-shift-f": "buffer_search::Deploy",
"ctrl-shift-l": "terminal::Clear", "ctrl-shift-l": "terminal::Clear",
"ctrl-shift-w": "pane::CloseActiveItem", "ctrl-shift-w": "pane::CloseActiveItem",
@@ -825,10 +725,11 @@
} }
}, },
{ {
"context": "ZedPredictModal", // Separate block with same context so these display in context menus
"use_key_equivalents": true, "context": "Terminal",
"bindings": { "bindings": {
"escape": "menu::Cancel" "ctrl-shift-c": "terminal::Copy",
"ctrl-shift-v": "terminal::Paste"
} }
} }
] ]

View File

@@ -3,28 +3,27 @@
{ {
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"home": "menu::SelectFirst",
"shift-pageup": "menu::SelectFirst",
"pageup": "menu::SelectFirst",
"cmd-up": "menu::SelectFirst",
"end": "menu::SelectLast",
"shift-pagedown": "menu::SelectLast",
"pagedown": "menu::SelectLast",
"cmd-down": "menu::SelectLast",
"tab": "menu::SelectNext",
"ctrl-n": "menu::SelectNext",
"down": "menu::SelectNext",
"shift-tab": "menu::SelectPrev",
"ctrl-p": "menu::SelectPrev",
"up": "menu::SelectPrev", "up": "menu::SelectPrev",
"shift-tab": "menu::SelectPrev",
"home": "menu::SelectFirst",
"pageup": "menu::SelectFirst",
"shift-pageup": "menu::SelectFirst",
"ctrl-p": "menu::SelectPrev",
"down": "menu::SelectNext",
"tab": "menu::SelectNext",
"end": "menu::SelectLast",
"pagedown": "menu::SelectLast",
"shift-pagedown": "menu::SelectFirst",
"ctrl-n": "menu::SelectNext",
"cmd-up": "menu::SelectFirst",
"cmd-down": "menu::SelectLast",
"enter": "menu::Confirm", "enter": "menu::Confirm",
"ctrl-enter": "menu::SecondaryConfirm", "ctrl-enter": "menu::SecondaryConfirm",
"cmd-enter": "menu::SecondaryConfirm", "cmd-enter": "menu::SecondaryConfirm",
"ctrl-escape": "menu::Cancel",
"cmd-escape": "menu::Cancel",
"ctrl-c": "menu::Cancel",
"escape": "menu::Cancel", "escape": "menu::Cancel",
"alt-shift-enter": "menu::Restart", "cmd-escape": "menu::Cancel",
"ctrl-escape": "menu::Cancel",
"ctrl-c": "menu::Cancel",
"cmd-shift-w": "workspace::CloseWindow", "cmd-shift-w": "workspace::CloseWindow",
"shift-escape": "workspace::ToggleZoom", "shift-escape": "workspace::ToggleZoom",
"cmd-o": "workspace::Open", "cmd-o": "workspace::Open",
@@ -37,10 +36,7 @@
"cmd-h": "zed::Hide", "cmd-h": "zed::Hide",
"alt-cmd-h": "zed::HideOthers", "alt-cmd-h": "zed::HideOthers",
"cmd-m": "zed::Minimize", "cmd-m": "zed::Minimize",
"fn-f": "zed::ToggleFullScreen", "ctrl-cmd-f": "zed::ToggleFullScreen"
"ctrl-cmd-f": "zed::ToggleFullScreen",
"ctrl-shift-z": "zeta::RateCompletions",
"ctrl-shift-i": "inline_completion::ToggleMenu"
} }
}, },
{ {
@@ -48,18 +44,18 @@
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"escape": "editor::Cancel", "escape": "editor::Cancel",
"backspace": "editor::Backspace",
"shift-backspace": "editor::Backspace", "shift-backspace": "editor::Backspace",
"ctrl-h": "editor::Backspace", "ctrl-h": "editor::Backspace",
"backspace": "editor::Backspace",
"ctrl-d": "editor::Delete",
"delete": "editor::Delete", "delete": "editor::Delete",
"ctrl-d": "editor::Delete",
"tab": "editor::Tab", "tab": "editor::Tab",
"shift-tab": "editor::TabPrev", "shift-tab": "editor::TabPrev",
"ctrl-t": "editor::Transpose", "ctrl-t": "editor::Transpose",
"ctrl-k": "editor::KillRingCut", "ctrl-k": "editor::KillRingCut",
"ctrl-y": "editor::KillRingYank", "ctrl-y": "editor::KillRingYank",
"cmd-k cmd-q": "editor::Rewrap",
"cmd-k q": "editor::Rewrap", "cmd-k q": "editor::Rewrap",
"cmd-k cmd-q": "editor::Rewrap",
"cmd-backspace": "editor::DeleteToBeginningOfLine", "cmd-backspace": "editor::DeleteToBeginningOfLine",
"cmd-delete": "editor::DeleteToEndOfLine", "cmd-delete": "editor::DeleteToEndOfLine",
"alt-backspace": "editor::DeleteToPreviousWordStart", "alt-backspace": "editor::DeleteToPreviousWordStart",
@@ -70,33 +66,34 @@
"cmd-v": "editor::Paste", "cmd-v": "editor::Paste",
"cmd-z": "editor::Undo", "cmd-z": "editor::Undo",
"cmd-shift-z": "editor::Redo", "cmd-shift-z": "editor::Redo",
"ctrl-shift-z": "zeta::RateCompletions",
"up": "editor::MoveUp", "up": "editor::MoveUp",
"ctrl-up": "editor::MoveToStartOfParagraph", "ctrl-up": "editor::MoveToStartOfParagraph",
"pageup": "editor::MovePageUp", "pageup": "editor::MovePageUp",
"shift-pageup": "editor::SelectPageUp", "shift-pageup": "editor::SelectPageUp",
"cmd-pageup": "editor::PageUp", "cmd-pageup": "editor::PageUp",
"ctrl-pageup": "editor::LineUp", "ctrl-pageup": "editor::LineUp",
"home": "editor::MoveToBeginningOfLine",
"down": "editor::MoveDown", "down": "editor::MoveDown",
"ctrl-down": "editor::MoveToEndOfParagraph", "ctrl-down": "editor::MoveToEndOfParagraph",
"pagedown": "editor::MovePageDown", "pagedown": "editor::MovePageDown",
"shift-pagedown": "editor::SelectPageDown", "shift-pagedown": "editor::SelectPageDown",
"cmd-pagedown": "editor::PageDown", "cmd-pagedown": "editor::PageDown",
"ctrl-pagedown": "editor::LineDown", "ctrl-pagedown": "editor::LineDown",
"end": "editor::MoveToEndOfLine",
"left": "editor::MoveLeft",
"right": "editor::MoveRight",
"ctrl-p": "editor::MoveUp", "ctrl-p": "editor::MoveUp",
"ctrl-n": "editor::MoveDown", "ctrl-n": "editor::MoveDown",
"ctrl-b": "editor::MoveLeft", "ctrl-b": "editor::MoveLeft",
"left": "editor::MoveLeft",
"ctrl-f": "editor::MoveRight", "ctrl-f": "editor::MoveRight",
"right": "editor::MoveRight",
"ctrl-l": "editor::ScrollCursorCenter", "ctrl-l": "editor::ScrollCursorCenter",
"alt-left": "editor::MoveToPreviousWordStart", "alt-left": "editor::MoveToPreviousWordStart",
"alt-right": "editor::MoveToNextWordEnd", "alt-right": "editor::MoveToNextWordEnd",
"cmd-left": "editor::MoveToBeginningOfLine", "cmd-left": "editor::MoveToBeginningOfLine",
"ctrl-a": "editor::MoveToBeginningOfLine", "ctrl-a": "editor::MoveToBeginningOfLine",
"home": "editor::MoveToBeginningOfLine",
"cmd-right": "editor::MoveToEndOfLine", "cmd-right": "editor::MoveToEndOfLine",
"ctrl-e": "editor::MoveToEndOfLine", "ctrl-e": "editor::MoveToEndOfLine",
"end": "editor::MoveToEndOfLine",
"cmd-up": "editor::MoveToBeginning", "cmd-up": "editor::MoveToBeginning",
"cmd-down": "editor::MoveToEnd", "cmd-down": "editor::MoveToEnd",
"shift-up": "editor::SelectUp", "shift-up": "editor::SelectUp",
@@ -127,7 +124,7 @@
"ctrl-cmd-space": "editor::ShowCharacterPalette", "ctrl-cmd-space": "editor::ShowCharacterPalette",
"cmd-;": "editor::ToggleLineNumbers", "cmd-;": "editor::ToggleLineNumbers",
"cmd-alt-z": "editor::RevertSelectedHunks", "cmd-alt-z": "editor::RevertSelectedHunks",
"cmd-'": "editor::ToggleSelectedDiffHunks", "cmd-'": "editor::ToggleHunkDiff",
"cmd-\"": "editor::ExpandAllHunkDiffs", "cmd-\"": "editor::ExpandAllHunkDiffs",
"cmd-alt-g b": "editor::ToggleGitBlame", "cmd-alt-g b": "editor::ToggleGitBlame",
"cmd-i": "editor::ShowSignatureHelp", "cmd-i": "editor::ShowSignatureHelp",
@@ -139,19 +136,18 @@
"context": "Editor && mode == full", "context": "Editor && mode == full",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"shift-enter": "editor::Newline",
"enter": "editor::Newline", "enter": "editor::Newline",
"shift-enter": "editor::Newline",
"cmd-enter": "editor::NewlineBelow", "cmd-enter": "editor::NewlineBelow",
"cmd-shift-enter": "editor::NewlineAbove", "cmd-shift-enter": "editor::NewlineAbove",
"cmd-k z": "editor::ToggleSoftWrap", "cmd-k z": "editor::ToggleSoftWrap",
"cmd-f": "buffer_search::Deploy", "cmd-f": "buffer_search::Deploy",
"cmd-alt-f": "buffer_search::DeployReplace", "cmd-alt-f": ["buffer_search::Deploy", { "replace_enabled": true }],
"cmd-alt-l": ["buffer_search::Deploy", { "selection_search_enabled": true }], "cmd-alt-l": ["buffer_search::Deploy", { "selection_search_enabled": true }],
"cmd-e": ["buffer_search::Deploy", { "focus": false }], "cmd-e": ["buffer_search::Deploy", { "focus": false }],
"cmd->": "assistant::QuoteSelection", "cmd->": "assistant::QuoteSelection",
"cmd-<": "assistant::InsertIntoEditor", "cmd-<": "assistant::InsertIntoEditor",
"cmd-alt-e": "editor::SelectEnclosingSymbol", "cmd-alt-e": "editor::SelectEnclosingSymbol"
"alt-enter": "editor::OpenSelectionsInMultibuffer"
} }
}, },
{ {
@@ -160,7 +156,7 @@
"bindings": { "bindings": {
"alt-tab": "editor::NextInlineCompletion", "alt-tab": "editor::NextInlineCompletion",
"alt-shift-tab": "editor::PreviousInlineCompletion", "alt-shift-tab": "editor::PreviousInlineCompletion",
"ctrl-cmd-right": "editor::AcceptPartialInlineCompletion" "ctrl-right": "editor::AcceptPartialInlineCompletion"
} }
}, },
{ {
@@ -199,10 +195,9 @@
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"cmd-k c": "assistant::CopyCode", "cmd-k c": "assistant::CopyCode",
"cmd-shift-e": "project_panel::ToggleFocus",
"cmd-g": "search::SelectNextMatch", "cmd-g": "search::SelectNextMatch",
"cmd-shift-g": "search::SelectPrevMatch", "cmd-shift-g": "search::SelectPrevMatch",
"cmd-alt-/": "assistant::ToggleModelSelector", "cmd-shift-m": "assistant::ToggleModelSelector",
"cmd-k h": "assistant::DeployHistory", "cmd-k h": "assistant::DeployHistory",
"cmd-k l": "assistant::DeployPromptLibrary", "cmd-k l": "assistant::DeployPromptLibrary",
"cmd-n": "assistant::NewContext" "cmd-n": "assistant::NewContext"
@@ -228,12 +223,7 @@
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"cmd-n": "assistant2::NewThread", "cmd-n": "assistant2::NewThread",
"cmd-alt-p": "assistant2::NewPromptEditor", "cmd-shift-h": "assistant2::OpenHistory"
"cmd-shift-h": "assistant2::OpenHistory",
"cmd-alt-/": "assistant2::ToggleModelSelector",
"cmd-shift-a": "assistant2::ToggleContextPicker",
"cmd-e": "assistant2::ChatMode",
"cmd-alt-e": "assistant2::RemoveAllContext"
} }
}, },
{ {
@@ -243,24 +233,6 @@
"enter": "assistant2::Chat" "enter": "assistant2::Chat"
} }
}, },
{
"context": "ContextStrip",
"use_key_equivalents": true,
"bindings": {
"up": "assistant2::FocusUp",
"right": "assistant2::FocusRight",
"left": "assistant2::FocusLeft",
"down": "assistant2::FocusDown",
"backspace": "assistant2::RemoveFocusedContext",
"enter": "assistant2::AcceptSuggestedContext"
}
},
{
"context": "ThreadHistory",
"bindings": {
"backspace": "assistant2::RemoveSelectedThread"
}
},
{ {
"context": "PromptLibrary", "context": "PromptLibrary",
"use_key_equivalents": true, "use_key_equivalents": true,
@@ -343,17 +315,15 @@
"context": "Pane", "context": "Pane",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"alt-cmd-left": "pane::ActivatePrevItem",
"cmd-{": "pane::ActivatePrevItem", "cmd-{": "pane::ActivatePrevItem",
"alt-cmd-right": "pane::ActivateNextItem",
"cmd-}": "pane::ActivateNextItem", "cmd-}": "pane::ActivateNextItem",
"alt-cmd-left": "pane::ActivatePrevItem",
"alt-cmd-right": "pane::ActivateNextItem",
"ctrl-shift-pageup": "pane::SwapItemLeft", "ctrl-shift-pageup": "pane::SwapItemLeft",
"ctrl-shift-pagedown": "pane::SwapItemRight", "ctrl-shift-pagedown": "pane::SwapItemRight",
"cmd-w": "pane::CloseActiveItem", "cmd-w": "pane::CloseActiveItem",
"alt-cmd-t": ["pane::CloseInactiveItems", { "close_pinned": false }], "alt-cmd-t": ["pane::CloseInactiveItems", { "close_pinned": false }],
"ctrl-alt-cmd-w": "workspace::CloseInactiveTabsAndPanes", "ctrl-alt-cmd-w": "workspace::CloseInactiveTabsAndPanes",
"cmd-k e": ["pane::CloseItemsToTheLeft", { "close_pinned": false }],
"cmd-k t": ["pane::CloseItemsToTheRight", { "close_pinned": false }],
"cmd-k u": ["pane::CloseCleanItems", { "close_pinned": false }], "cmd-k u": ["pane::CloseCleanItems", { "close_pinned": false }],
"cmd-k cmd-w": ["pane::CloseAllItems", { "close_pinned": false }], "cmd-k cmd-w": ["pane::CloseAllItems", { "close_pinned": false }],
"cmd-f": "project_search::ToggleFocus", "cmd-f": "project_search::ToggleFocus",
@@ -376,10 +346,10 @@
"bindings": { "bindings": {
"cmd-[": "editor::Outdent", "cmd-[": "editor::Outdent",
"cmd-]": "editor::Indent", "cmd-]": "editor::Indent",
"cmd-ctrl-p": "editor::AddSelectionAbove", // Insert cursor above "cmd-alt-up": "editor::AddSelectionAbove", // Insert cursor above
"cmd-alt-up": "editor::AddSelectionAbove", "cmd-ctrl-p": "editor::AddSelectionAbove",
"cmd-ctrl-n": "editor::AddSelectionBelow", // Insert cursor below "cmd-alt-down": "editor::AddSelectionBelow", // Insert cursor below
"cmd-alt-down": "editor::AddSelectionBelow", "cmd-ctrl-n": "editor::AddSelectionBelow",
"cmd-shift-k": "editor::DeleteLine", "cmd-shift-k": "editor::DeleteLine",
"alt-up": "editor::MoveLineUp", "alt-up": "editor::MoveLineUp",
"alt-down": "editor::MoveLineDown", "alt-down": "editor::MoveLineDown",
@@ -406,8 +376,8 @@
"shift-f12": "editor::GoToImplementation", "shift-f12": "editor::GoToImplementation",
"alt-cmd-f12": "editor::GoToTypeDefinitionSplit", "alt-cmd-f12": "editor::GoToTypeDefinitionSplit",
"alt-shift-f12": "editor::FindAllReferences", "alt-shift-f12": "editor::FindAllReferences",
"cmd-|": "editor::MoveToEnclosingBracket",
"ctrl-m": "editor::MoveToEnclosingBracket", "ctrl-m": "editor::MoveToEnclosingBracket",
"cmd-|": "editor::MoveToEnclosingBracket",
"alt-cmd-[": "editor::Fold", "alt-cmd-[": "editor::Fold",
"alt-cmd-]": "editor::UnfoldLines", "alt-cmd-]": "editor::UnfoldLines",
"cmd-k cmd-l": "editor::ToggleFold", "cmd-k cmd-l": "editor::ToggleFold",
@@ -424,8 +394,6 @@
"cmd-k cmd-9": ["editor::FoldAtLevel", { "level": 9 }], "cmd-k cmd-9": ["editor::FoldAtLevel", { "level": 9 }],
"cmd-k cmd-0": "editor::FoldAll", "cmd-k cmd-0": "editor::FoldAll",
"cmd-k cmd-j": "editor::UnfoldAll", "cmd-k cmd-j": "editor::UnfoldAll",
// Using `ctrl-space` in Zed requires disabling the macOS global shortcut.
// System Preferences->Keyboard->Keyboard Shortcuts->Input Sources->Select the previous input source (uncheck)
"ctrl-space": "editor::ShowCompletions", "ctrl-space": "editor::ShowCompletions",
"cmd-.": "editor::ToggleCodeActions", "cmd-.": "editor::ToggleCodeActions",
"cmd-k r": "editor::RevealInFileManager", "cmd-k r": "editor::RevealInFileManager",
@@ -460,7 +428,8 @@
"ctrl-0": "pane::ActivateLastItem", "ctrl-0": "pane::ActivateLastItem",
"ctrl--": "pane::GoBack", "ctrl--": "pane::GoBack",
"ctrl-shift--": "pane::GoForward", "ctrl-shift--": "pane::GoForward",
"cmd-shift-f": "pane::DeploySearch" "cmd-shift-t": "pane::ReopenClosedItem",
"cmd-shift-f": "project_search::ToggleFocus"
} }
}, },
{ {
@@ -476,6 +445,7 @@
"cmd-s": "workspace::Save", "cmd-s": "workspace::Save",
"cmd-k s": "workspace::SaveWithoutFormat", "cmd-k s": "workspace::SaveWithoutFormat",
"cmd-shift-s": "workspace::SaveAs", "cmd-shift-s": "workspace::SaveAs",
"cmd-n": "workspace::NewFile",
"cmd-shift-n": "workspace::NewWindow", "cmd-shift-n": "workspace::NewWindow",
"ctrl-`": "terminal_panel::ToggleFocus", "ctrl-`": "terminal_panel::ToggleFocus",
"cmd-1": ["workspace::ActivatePane", 0], "cmd-1": ["workspace::ActivatePane", 0],
@@ -493,7 +463,6 @@
"alt-cmd-y": "workspace::CloseAllDocks", "alt-cmd-y": "workspace::CloseAllDocks",
"cmd-shift-f": "pane::DeploySearch", "cmd-shift-f": "pane::DeploySearch",
"cmd-shift-h": ["pane::DeploySearch", { "replace_enabled": true }], "cmd-shift-h": ["pane::DeploySearch", { "replace_enabled": true }],
"cmd-shift-t": "pane::ReopenClosedItem",
"cmd-k cmd-s": "zed::OpenKeymap", "cmd-k cmd-s": "zed::OpenKeymap",
"cmd-k cmd-t": "theme_selector::Toggle", "cmd-k cmd-t": "theme_selector::Toggle",
"cmd-t": "project_symbols::Toggle", "cmd-t": "project_symbols::Toggle",
@@ -502,9 +471,8 @@
"ctrl-shift-tab": ["tab_switcher::Toggle", { "select_last": true }], "ctrl-shift-tab": ["tab_switcher::Toggle", { "select_last": true }],
"cmd-shift-p": "command_palette::Toggle", "cmd-shift-p": "command_palette::Toggle",
"cmd-shift-m": "diagnostics::Deploy", "cmd-shift-m": "diagnostics::Deploy",
"cmd-shift-e": "project_panel::ToggleFocus", "cmd-shift-e": "pane::RevealInProjectPanel",
"cmd-shift-b": "outline_panel::ToggleFocus", "cmd-shift-b": "outline_panel::ToggleFocus",
"ctrl-shift-g": "git_panel::ToggleFocus",
"cmd-?": "assistant::ToggleFocus", "cmd-?": "assistant::ToggleFocus",
"cmd-alt-s": "workspace::SaveAll", "cmd-alt-s": "workspace::SaveAll",
"cmd-k m": "language_selector::Toggle", "cmd-k m": "language_selector::Toggle",
@@ -524,12 +492,10 @@
"context": "Workspace && !Terminal", "context": "Workspace && !Terminal",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"cmd-n": "workspace::NewFile",
"cmd-shift-r": "task::Spawn", "cmd-shift-r": "task::Spawn",
"cmd-alt-r": "task::Rerun", "cmd-alt-r": "task::Rerun",
"ctrl-alt-shift-r": ["task::Spawn", { "reveal_target": "center" }] "alt-t": "task::Spawn",
// also possible to spawn tasks by name: "alt-shift-t": "task::Spawn"
// "foo-bar": ["task::Spawn", { "task_name": "MyTask", "reveal_target": "dock" }]
} }
}, },
// Bindings from Sublime Text // Bindings from Sublime Text
@@ -575,12 +541,18 @@
"context": "Editor && showing_completions", "context": "Editor && showing_completions",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"enter": "editor::ConfirmCompletion", "enter": "editor::ConfirmCompletion"
}
},
{
"context": "Editor && !inline_completion && showing_completions",
"use_key_equivalents": true,
"bindings": {
"tab": "editor::ComposeCompletion" "tab": "editor::ComposeCompletion"
} }
}, },
{ {
"context": "Editor && inline_completion && !showing_completions", "context": "Editor && inline_completion",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"tab": "editor::AcceptInlineCompletion" "tab": "editor::AcceptInlineCompletion"
@@ -622,8 +594,7 @@
"bindings": { "bindings": {
"alt-enter": "editor::OpenExcerpts", "alt-enter": "editor::OpenExcerpts",
"shift-enter": "editor::ExpandExcerpts", "shift-enter": "editor::ExpandExcerpts",
"cmd-alt-enter": "editor::OpenExcerptsSplit", "cmd-k enter": "editor::OpenExcerptsSplit",
"cmd-shift-e": "pane::RevealInProjectPanel",
"cmd-f8": "editor::GoToHunk", "cmd-f8": "editor::GoToHunk",
"cmd-shift-f8": "editor::GoToPrevHunk", "cmd-shift-f8": "editor::GoToPrevHunk",
"ctrl-enter": "assistant::InlineAssist" "ctrl-enter": "assistant::InlineAssist"
@@ -641,9 +612,6 @@
"context": "PromptEditor", "context": "PromptEditor",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"cmd-shift-a": "assistant2::ToggleContextPicker",
"cmd-alt-/": "assistant2::ToggleModelSelector",
"cmd-alt-e": "assistant2::RemoveAllContext",
"ctrl-[": "assistant::CyclePreviousInlineAssist", "ctrl-[": "assistant::CyclePreviousInlineAssist",
"ctrl-]": "assistant::CycleNextInlineAssist" "ctrl-]": "assistant::CycleNextInlineAssist"
} }
@@ -669,7 +637,7 @@
"shift-down": "menu::SelectNext", "shift-down": "menu::SelectNext",
"shift-up": "menu::SelectPrev", "shift-up": "menu::SelectPrev",
"alt-enter": "editor::OpenExcerpts", "alt-enter": "editor::OpenExcerpts",
"cmd-alt-enter": "editor::OpenExcerptsSplit" "cmd-k enter": "editor::OpenExcerptsSplit"
} }
}, },
{ {
@@ -694,6 +662,7 @@
"cmd-delete": ["project_panel::Delete", { "skip_prompt": false }], "cmd-delete": ["project_panel::Delete", { "skip_prompt": false }],
"alt-cmd-r": "project_panel::RevealInFileManager", "alt-cmd-r": "project_panel::RevealInFileManager",
"ctrl-shift-enter": "project_panel::OpenWithSystem", "ctrl-shift-enter": "project_panel::OpenWithSystem",
"cmd-shift-e": "project_panel::ToggleFocus",
"cmd-alt-backspace": ["project_panel::Delete", { "skip_prompt": false }], "cmd-alt-backspace": ["project_panel::Delete", { "skip_prompt": false }],
"cmd-shift-f": "project_panel::NewSearchInDirectory", "cmd-shift-f": "project_panel::NewSearchInDirectory",
"shift-down": "menu::SelectNext", "shift-down": "menu::SelectNext",
@@ -708,38 +677,6 @@
"space": "project_panel::Open" "space": "project_panel::Open"
} }
}, },
{
"context": "GitPanel && !CommitEditor",
"use_key_equivalents": true,
"bindings": {
"escape": "git_panel::Close"
}
},
{
"context": "GitPanel && ChangesList",
"use_key_equivalents": true,
"bindings": {
"up": "menu::SelectPrev",
"down": "menu::SelectNext",
"cmd-up": "menu::SelectFirst",
"cmd-down": "menu::SelectLast",
"enter": "menu::Confirm",
"space": "git::ToggleStaged",
"cmd-shift-space": "git::StageAll",
"ctrl-shift-space": "git::UnstageAll",
"alt-down": "git_panel::FocusEditor"
}
},
{
"context": "GitPanel && CommitEditor > Editor",
"use_key_equivalents": true,
"bindings": {
"alt-up": "git_panel::FocusChanges",
"escape": "git_panel::FocusChanges",
"cmd-enter": "git::CommitChanges",
"cmd-alt-enter": "git::CommitAllChanges"
}
},
{ {
"context": "CollabPanel && not_editing", "context": "CollabPanel && not_editing",
"use_key_equivalents": true, "use_key_equivalents": true,
@@ -810,9 +747,9 @@
"context": "TabSwitcher", "context": "TabSwitcher",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"ctrl-shift-tab": "menu::SelectPrev",
"ctrl-up": "menu::SelectPrev", "ctrl-up": "menu::SelectPrev",
"ctrl-down": "menu::SelectNext", "ctrl-down": "menu::SelectNext",
"ctrl-shift-tab": "menu::SelectPrev",
"ctrl-backspace": "tab_switcher::CloseSelectedItem" "ctrl-backspace": "tab_switcher::CloseSelectedItem"
} }
}, },
@@ -825,7 +762,6 @@
"cmd-v": "terminal::Paste", "cmd-v": "terminal::Paste",
"cmd-a": "editor::SelectAll", "cmd-a": "editor::SelectAll",
"cmd-k": "terminal::Clear", "cmd-k": "terminal::Clear",
"cmd-n": "workspace::NewTerminal",
"ctrl-enter": "assistant::InlineAssist", "ctrl-enter": "assistant::InlineAssist",
// Some nice conveniences // Some nice conveniences
"cmd-backspace": ["terminal::SendText", "\u0015"], "cmd-backspace": ["terminal::SendText", "\u0015"],
@@ -834,8 +770,6 @@
// Terminal.app compatibility // Terminal.app compatibility
"alt-left": ["terminal::SendText", "\u001bb"], "alt-left": ["terminal::SendText", "\u001bb"],
"alt-right": ["terminal::SendText", "\u001bf"], "alt-right": ["terminal::SendText", "\u001bf"],
"alt-b": ["terminal::SendText", "\u001bb"],
"alt-f": ["terminal::SendText", "\u001bf"],
// There are conflicting bindings for these keys in the global context. // There are conflicting bindings for these keys in the global context.
// these bindings override them, remove at your own risk: // these bindings override them, remove at your own risk:
"up": ["terminal::SendKeystroke", "up"], "up": ["terminal::SendKeystroke", "up"],
@@ -845,16 +779,16 @@
"escape": ["terminal::SendKeystroke", "escape"], "escape": ["terminal::SendKeystroke", "escape"],
"enter": ["terminal::SendKeystroke", "enter"], "enter": ["terminal::SendKeystroke", "enter"],
"ctrl-c": ["terminal::SendKeystroke", "ctrl-c"], "ctrl-c": ["terminal::SendKeystroke", "ctrl-c"],
"shift-pageup": "terminal::ScrollPageUp",
"cmd-up": "terminal::ScrollPageUp", "cmd-up": "terminal::ScrollPageUp",
"shift-pagedown": "terminal::ScrollPageDown",
"cmd-down": "terminal::ScrollPageDown", "cmd-down": "terminal::ScrollPageDown",
"shift-pageup": "terminal::ScrollPageUp",
"shift-pagedown": "terminal::ScrollPageDown",
"shift-up": "terminal::ScrollLineUp", "shift-up": "terminal::ScrollLineUp",
"shift-down": "terminal::ScrollLineDown", "shift-down": "terminal::ScrollLineDown",
"shift-home": "terminal::ScrollToTop",
"cmd-home": "terminal::ScrollToTop", "cmd-home": "terminal::ScrollToTop",
"shift-end": "terminal::ScrollToBottom",
"cmd-end": "terminal::ScrollToBottom", "cmd-end": "terminal::ScrollToBottom",
"shift-home": "terminal::ScrollToTop",
"shift-end": "terminal::ScrollToBottom",
"ctrl-shift-space": "terminal::ToggleViMode", "ctrl-shift-space": "terminal::ToggleViMode",
"ctrl-k up": "pane::SplitUp", "ctrl-k up": "pane::SplitUp",
"ctrl-k down": "pane::SplitDown", "ctrl-k down": "pane::SplitDown",
@@ -866,8 +800,7 @@
"context": "RateCompletionModal", "context": "RateCompletionModal",
"use_key_equivalents": true, "use_key_equivalents": true,
"bindings": { "bindings": {
"cmd-shift-enter": "zeta::ThumbsUpActiveCompletion", "cmd-enter": "zeta::ThumbsUp",
"cmd-shift-backspace": "zeta::ThumbsDownActiveCompletion",
"shift-down": "zeta::NextEdit", "shift-down": "zeta::NextEdit",
"shift-up": "zeta::PreviousEdit", "shift-up": "zeta::PreviousEdit",
"right": "zeta::PreviewCompletion" "right": "zeta::PreviewCompletion"
@@ -881,12 +814,5 @@
"cmd-shift-enter": "zeta::ThumbsUpActiveCompletion", "cmd-shift-enter": "zeta::ThumbsUpActiveCompletion",
"cmd-shift-backspace": "zeta::ThumbsDownActiveCompletion" "cmd-shift-backspace": "zeta::ThumbsDownActiveCompletion"
} }
},
{
"context": "ZedPredictModal",
"use_key_equivalents": true,
"bindings": {
"escape": "menu::Cancel"
}
} }
] ]

View File

@@ -3,116 +3,56 @@
// To see the default key bindings run `zed: open default keymap` // To see the default key bindings run `zed: open default keymap`
// from the command palette. // from the command palette.
[ [
{
"bindings": {
"ctrl-g": "menu::Cancel"
}
},
{ {
"context": "Editor", "context": "Editor",
"bindings": { "bindings": {
"ctrl-g": "editor::Cancel", "ctrl-g": "editor::Cancel",
"ctrl-x b": "tab_switcher::Toggle", // switch-to-buffer "ctrl-shift-g": "go_to_line::Toggle",
"alt-g g": "go_to_line::Toggle", // goto-line //"ctrl-space": "editor::SetMark",
"alt-g alt-g": "go_to_line::Toggle", // goto-line "ctrl-x u": "editor::Undo",
"ctrl-space": "editor::SetMark", // set-mark "ctrl-x ctrl-u": "editor::Redo",
"ctrl-@": "editor::SetMark", // set-mark "ctrl-f": "editor::MoveRight",
"ctrl-x ctrl-x": "editor::SwapSelectionEnds", // exchange-point-and-mark "ctrl-b": "editor::MoveLeft",
"ctrl-f": "editor::MoveRight", // forward-char "ctrl-n": "editor::MoveDown",
"ctrl-b": "editor::MoveLeft", // backward-char "ctrl-p": "editor::MoveUp",
"ctrl-n": "editor::MoveDown", // next-line "home": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false }],
"ctrl-p": "editor::MoveUp", // previous-line "end": ["editor::MoveToEndOfLine", { "stop_at_soft_wraps": false }],
"home": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false }], // move-beginning-of-line "ctrl-a": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false }],
"end": ["editor::MoveToEndOfLine", { "stop_at_soft_wraps": false }], // move-end-of-line "ctrl-e": ["editor::MoveToEndOfLine", { "stop_at_soft_wraps": false }],
"ctrl-a": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false }], // move-beginning-of-line "alt-f": "editor::MoveToNextSubwordEnd",
"ctrl-e": ["editor::MoveToEndOfLine", { "stop_at_soft_wraps": false }], // move-end-of-line "alt-b": "editor::MoveToPreviousSubwordStart",
"shift-home": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }], // move-beginning-of-line "ctrl-d": "editor::Delete",
"shift-end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }], // move-end-of-line "alt-d": "editor::DeleteToNextWordEnd",
"alt-f": "editor::MoveToNextSubwordEnd", // forward-word "ctrl-k": "editor::CutToEndOfLine",
"alt-b": "editor::MoveToPreviousSubwordStart", // backward-word "ctrl-w": "editor::Cut",
"alt-u": "editor::ConvertToUpperCase", // upcase-word "alt-w": "editor::Copy",
"alt-l": "editor::ConvertToLowerCase", // downcase-word "ctrl-y": "editor::Paste",
"alt-c": "editor::ConvertToUpperCamelCase", // capitalize-word "ctrl-_": "editor::Undo",
"ctrl-t": "editor::Transpose", // transpose-chars "ctrl-v": "editor::MovePageDown",
"alt-;": ["editor::ToggleComments", { "advance_downwards": false }], "alt-v": "editor::MovePageUp",
"ctrl-x ctrl-;": "editor::ToggleComments", "ctrl-x ]": "editor::MoveToEnd",
"alt-.": "editor::GoToDefinition", // xref-find-definitions "ctrl-x [": "editor::MoveToBeginning",
"alt-,": "pane::GoBack", // xref-pop-marker-stack "ctrl-l": "editor::ScrollCursorCenterTopBottom",
"ctrl-x h": "editor::SelectAll", // mark-whole-buffer "ctrl-s": "buffer_search::Deploy",
"ctrl-d": "editor::Delete", // delete-char "ctrl-x ctrl-f": "file_finder::Toggle",
"alt-d": "editor::DeleteToNextWordEnd", // kill-word "ctrl-shift-r": "editor::Rename"
"ctrl-k": "editor::KillRingCut", // kill-line
"ctrl-w": "editor::Cut", // kill-region
"alt-w": "editor::Copy", // kill-ring-save
"ctrl-y": "editor::KillRingYank", // yank
"ctrl-_": "editor::Undo", // undo
"ctrl-/": "editor::Undo", // undo
"ctrl-x u": "editor::Undo", // undo
"ctrl-v": "editor::MovePageDown", // scroll-up
"alt-v": "editor::MovePageUp", // scroll-down
"ctrl-x [": "editor::MoveToBeginning", // beginning-of-buffer
"ctrl-x ]": "editor::MoveToEnd", // end-of-buffer
"alt-<": "editor::MoveToBeginning", // beginning-of-buffer
"alt->": "editor::MoveToEnd", // end-of-buffer
"ctrl-l": "editor::ScrollCursorCenterTopBottom", // recenter-top-bottom
"ctrl-s": "buffer_search::Deploy", // isearch-forward
"alt-^": "editor::JoinLines" // join-line
}
},
{
"context": "Editor && selection_mode", // region selection
"bindings": {
"right": "editor::SelectRight",
"left": "editor::SelectLeft",
"down": "editor::SelectDown",
"up": "editor::SelectUp",
"alt-left": "editor::SelectToPreviousWordStart",
"alt-right": "editor::SelectToNextWordEnd",
"pagedown": "editor::SelectPageDown",
"pageup": "editor::SelectPageUp",
"ctrl-f": "editor::SelectRight",
"ctrl-b": "editor::SelectLeft",
"ctrl-n": "editor::SelectDown",
"ctrl-p": "editor::SelectUp",
"home": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }],
"end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }],
"ctrl-a": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }],
"ctrl-e": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }],
"alt-f": "editor::SelectToNextWordEnd",
"alt-b": "editor::SelectToPreviousSubwordStart",
"alt-<": "editor::SelectToBeginning",
"alt->": "editor::SelectToEnd",
"ctrl-g": "editor::Cancel"
} }
}, },
{ {
"context": "Workspace", "context": "Workspace",
"bindings": { "bindings": {
"ctrl-x ctrl-c": "zed::Quit", // save-buffers-kill-terminal "ctrl-x k": "pane::CloseActiveItem",
"ctrl-x 5 0": "workspace::CloseWindow", // delete-frame "ctrl-x ctrl-c": "workspace::CloseWindow",
"ctrl-x 5 2": "workspace::NewWindow", // make-frame-command "ctrl-x o": "workspace::ActivateNextPane",
"ctrl-x o": "workspace::ActivateNextPane", // other-window "ctrl-x b": "tab_switcher::Toggle",
"ctrl-x k": "pane::CloseActiveItem", // kill-buffer "ctrl-x 0": "pane::CloseActiveItem",
"ctrl-x 0": "pane::CloseActiveItem", // delete-window "ctrl-x 1": "pane::CloseInactiveItems",
"ctrl-x 1": "pane::CloseInactiveItems", // delete-other-windows "ctrl-x 2": "pane::SplitVertical",
"ctrl-x 2": "pane::SplitDown", // split-window-below "ctrl-x ctrl-f": "file_finder::Toggle",
"ctrl-x 3": "pane::SplitRight", // split-window-right "ctrl-x ctrl-s": "workspace::Save",
"ctrl-x ctrl-f": "file_finder::Toggle", // find-file "ctrl-x ctrl-w": "workspace::SaveAs",
"ctrl-x ctrl-s": "workspace::Save", // save-buffer "ctrl-x s": "workspace::SaveAll",
"ctrl-x ctrl-w": "workspace::SaveAs", // write-file "shift shift": "file_finder::Toggle"
"ctrl-x s": "workspace::SaveAll" // save-some-buffers
}
},
{
// Workaround to enable using emacs in the Zed terminal.
// Unbind so Zed ignores these keys and lets emacs handle them.
"context": "Terminal",
"bindings": {
"ctrl-x ctrl-c": null, // save-buffers-kill-terminal
"ctrl-x ctrl-f": null, // find-file
"ctrl-x ctrl-s": null, // save-buffer
"ctrl-x ctrl-w": null, // write-file
"ctrl-x s": null // save-some-buffers
} }
}, },
{ {

View File

@@ -4,32 +4,12 @@
"ctrl-shift-[": "pane::ActivatePrevItem", "ctrl-shift-[": "pane::ActivatePrevItem",
"ctrl-shift-]": "pane::ActivateNextItem", "ctrl-shift-]": "pane::ActivateNextItem",
"ctrl-pageup": "pane::ActivatePrevItem", "ctrl-pageup": "pane::ActivatePrevItem",
"ctrl-pagedown": "pane::ActivateNextItem", "ctrl-pagedown": "pane::ActivateNextItem"
"ctrl-1": ["workspace::ActivatePane", 0],
"ctrl-2": ["workspace::ActivatePane", 1],
"ctrl-3": ["workspace::ActivatePane", 2],
"ctrl-4": ["workspace::ActivatePane", 3],
"ctrl-5": ["workspace::ActivatePane", 4],
"ctrl-6": ["workspace::ActivatePane", 5],
"ctrl-7": ["workspace::ActivatePane", 6],
"ctrl-8": ["workspace::ActivatePane", 7],
"ctrl-9": ["workspace::ActivatePane", 8],
"ctrl-shift-1": ["workspace::MoveItemToPane", { "destination": 0, "focus": true }],
"ctrl-shift-2": ["workspace::MoveItemToPane", { "destination": 1 }],
"ctrl-shift-3": ["workspace::MoveItemToPane", { "destination": 2 }],
"ctrl-shift-4": ["workspace::MoveItemToPane", { "destination": 3 }],
"ctrl-shift-5": ["workspace::MoveItemToPane", { "destination": 4 }],
"ctrl-shift-6": ["workspace::MoveItemToPane", { "destination": 5 }],
"ctrl-shift-7": ["workspace::MoveItemToPane", { "destination": 6 }],
"ctrl-shift-8": ["workspace::MoveItemToPane", { "destination": 7 }],
"ctrl-shift-9": ["workspace::MoveItemToPane", { "destination": 8 }]
} }
}, },
{ {
"context": "Editor", "context": "Editor",
"bindings": { "bindings": {
"ctrl-alt-up": "editor::AddSelectionAbove",
"ctrl-alt-down": "editor::AddSelectionBelow",
"ctrl-shift-up": "editor::MoveLineUp", "ctrl-shift-up": "editor::MoveLineUp",
"ctrl-shift-down": "editor::MoveLineDown", "ctrl-shift-down": "editor::MoveLineDown",
"ctrl-shift-m": "editor::SelectLargerSyntaxNode", "ctrl-shift-m": "editor::SelectLargerSyntaxNode",
@@ -37,8 +17,6 @@
"ctrl-shift-a": "editor::SelectLargerSyntaxNode", "ctrl-shift-a": "editor::SelectLargerSyntaxNode",
"ctrl-shift-d": "editor::DuplicateSelection", "ctrl-shift-d": "editor::DuplicateSelection",
"alt-f3": "editor::SelectAllMatches", // find_all_under "alt-f3": "editor::SelectAllMatches", // find_all_under
"f9": "editor::SortLinesCaseSensitive",
"ctrl-f9": "editor::SortLinesCaseInsensitive",
"f12": "editor::GoToDefinition", "f12": "editor::GoToDefinition",
"ctrl-f12": "editor::GoToDefinitionSplit", "ctrl-f12": "editor::GoToDefinitionSplit",
"shift-f12": "editor::FindAllReferences", "shift-f12": "editor::FindAllReferences",

View File

@@ -3,116 +3,56 @@
// To see the default key bindings run `zed: open default keymap` // To see the default key bindings run `zed: open default keymap`
// from the command palette. // from the command palette.
[ [
{
"bindings": {
"ctrl-g": "menu::Cancel"
}
},
{ {
"context": "Editor", "context": "Editor",
"bindings": { "bindings": {
"ctrl-g": "editor::Cancel", "ctrl-g": "editor::Cancel",
"ctrl-x b": "tab_switcher::Toggle", // switch-to-buffer "ctrl-shift-g": "go_to_line::Toggle",
"alt-g g": "go_to_line::Toggle", // goto-line //"ctrl-space": "editor::SetMark",
"alt-g alt-g": "go_to_line::Toggle", // goto-line "ctrl-x u": "editor::Undo",
"ctrl-space": "editor::SetMark", // set-mark "ctrl-x ctrl-u": "editor::Redo",
"ctrl-@": "editor::SetMark", // set-mark "ctrl-f": "editor::MoveRight",
"ctrl-x ctrl-x": "editor::SwapSelectionEnds", // exchange-point-and-mark "ctrl-b": "editor::MoveLeft",
"ctrl-f": "editor::MoveRight", // forward-char "ctrl-n": "editor::MoveDown",
"ctrl-b": "editor::MoveLeft", // backward-char "ctrl-p": "editor::MoveUp",
"ctrl-n": "editor::MoveDown", // next-line "home": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false }],
"ctrl-p": "editor::MoveUp", // previous-line "end": ["editor::MoveToEndOfLine", { "stop_at_soft_wraps": false }],
"home": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false }], // move-beginning-of-line "ctrl-a": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false }],
"end": ["editor::MoveToEndOfLine", { "stop_at_soft_wraps": false }], // move-end-of-line "ctrl-e": ["editor::MoveToEndOfLine", { "stop_at_soft_wraps": false }],
"ctrl-a": ["editor::MoveToBeginningOfLine", { "stop_at_soft_wraps": false }], // move-beginning-of-line "alt-f": "editor::MoveToNextSubwordEnd",
"ctrl-e": ["editor::MoveToEndOfLine", { "stop_at_soft_wraps": false }], // move-end-of-line "alt-b": "editor::MoveToPreviousSubwordStart",
"shift-home": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }], // move-beginning-of-line "ctrl-d": "editor::Delete",
"shift-end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }], // move-end-of-line "alt-d": "editor::DeleteToNextWordEnd",
"alt-f": "editor::MoveToNextSubwordEnd", // forward-word "ctrl-k": "editor::CutToEndOfLine",
"alt-b": "editor::MoveToPreviousSubwordStart", // backward-word "ctrl-w": "editor::Cut",
"alt-u": "editor::ConvertToUpperCase", // upcase-word "alt-w": "editor::Copy",
"alt-l": "editor::ConvertToLowerCase", // downcase-word "ctrl-y": "editor::Paste",
"alt-c": "editor::ConvertToUpperCamelCase", // capitalize-word "ctrl-_": "editor::Undo",
"ctrl-t": "editor::Transpose", // transpose-chars "ctrl-v": "editor::MovePageDown",
"alt-;": ["editor::ToggleComments", { "advance_downwards": false }], "alt-v": "editor::MovePageUp",
"ctrl-x ctrl-;": "editor::ToggleComments", "ctrl-x ]": "editor::MoveToEnd",
"alt-.": "editor::GoToDefinition", // xref-find-definitions "ctrl-x [": "editor::MoveToBeginning",
"alt-,": "pane::GoBack", // xref-pop-marker-stack "ctrl-l": "editor::ScrollCursorCenterTopBottom",
"ctrl-x h": "editor::SelectAll", // mark-whole-buffer "ctrl-s": "buffer_search::Deploy",
"ctrl-d": "editor::Delete", // delete-char "ctrl-x ctrl-f": "file_finder::Toggle",
"alt-d": "editor::DeleteToNextWordEnd", // kill-word "ctrl-shift-r": "editor::Rename"
"ctrl-k": "editor::KillRingCut", // kill-line
"ctrl-w": "editor::Cut", // kill-region
"alt-w": "editor::Copy", // kill-ring-save
"ctrl-y": "editor::KillRingYank", // yank
"ctrl-_": "editor::Undo", // undo
"ctrl-/": "editor::Undo", // undo
"ctrl-x u": "editor::Undo", // undo
"ctrl-v": "editor::MovePageDown", // scroll-up
"alt-v": "editor::MovePageUp", // scroll-down
"ctrl-x [": "editor::MoveToBeginning", // beginning-of-buffer
"ctrl-x ]": "editor::MoveToEnd", // end-of-buffer
"alt-<": "editor::MoveToBeginning", // beginning-of-buffer
"alt->": "editor::MoveToEnd", // end-of-buffer
"ctrl-l": "editor::ScrollCursorCenterTopBottom", // recenter-top-bottom
"ctrl-s": "buffer_search::Deploy", // isearch-forward
"alt-^": "editor::JoinLines" // join-line
}
},
{
"context": "Editor && selection_mode", // region selection
"bindings": {
"right": "editor::SelectRight",
"left": "editor::SelectLeft",
"down": "editor::SelectDown",
"up": "editor::SelectUp",
"alt-left": "editor::SelectToPreviousWordStart",
"alt-right": "editor::SelectToNextWordEnd",
"pagedown": "editor::SelectPageDown",
"pageup": "editor::SelectPageUp",
"ctrl-f": "editor::SelectRight",
"ctrl-b": "editor::SelectLeft",
"ctrl-n": "editor::SelectDown",
"ctrl-p": "editor::SelectUp",
"home": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }],
"end": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }],
"ctrl-a": ["editor::SelectToBeginningOfLine", { "stop_at_soft_wraps": false }],
"ctrl-e": ["editor::SelectToEndOfLine", { "stop_at_soft_wraps": false }],
"alt-f": "editor::SelectToNextWordEnd",
"alt-b": "editor::SelectToPreviousSubwordStart",
"alt-<": "editor::SelectToBeginning",
"alt->": "editor::SelectToEnd",
"ctrl-g": "editor::Cancel"
} }
}, },
{ {
"context": "Workspace", "context": "Workspace",
"bindings": { "bindings": {
"ctrl-x ctrl-c": "zed::Quit", // save-buffers-kill-terminal "ctrl-x k": "pane::CloseActiveItem",
"ctrl-x 5 0": "workspace::CloseWindow", // delete-frame "ctrl-x ctrl-c": "workspace::CloseWindow",
"ctrl-x 5 2": "workspace::NewWindow", // make-frame-command "ctrl-x o": "workspace::ActivateNextPane",
"ctrl-x o": "workspace::ActivateNextPane", // other-window "ctrl-x b": "tab_switcher::Toggle",
"ctrl-x k": "pane::CloseActiveItem", // kill-buffer "ctrl-x 0": "pane::CloseActiveItem",
"ctrl-x 0": "pane::CloseActiveItem", // delete-window "ctrl-x 1": "pane::CloseInactiveItems",
"ctrl-x 1": "pane::CloseInactiveItems", // delete-other-windows "ctrl-x 2": "pane::SplitVertical",
"ctrl-x 2": "pane::SplitDown", // split-window-below "ctrl-x ctrl-f": "file_finder::Toggle",
"ctrl-x 3": "pane::SplitRight", // split-window-right "ctrl-x ctrl-s": "workspace::Save",
"ctrl-x ctrl-f": "file_finder::Toggle", // find-file "ctrl-x ctrl-w": "workspace::SaveAs",
"ctrl-x ctrl-s": "workspace::Save", // save-buffer "ctrl-x s": "workspace::SaveAll",
"ctrl-x ctrl-w": "workspace::SaveAs", // write-file "shift shift": "file_finder::Toggle"
"ctrl-x s": "workspace::SaveAll" // save-some-buffers
}
},
{
// Workaround to enable using emacs in the Zed terminal.
// Unbind so Zed ignores these keys and lets emacs handle them.
"context": "Terminal",
"bindings": {
"ctrl-x ctrl-c": null, // save-buffers-kill-terminal
"ctrl-x ctrl-f": null, // find-file
"ctrl-x ctrl-s": null, // save-buffer
"ctrl-x ctrl-w": null, // write-file
"ctrl-x s": null // save-some-buffers
} }
}, },
{ {

View File

@@ -24,8 +24,8 @@
"ctrl-g": ["editor::SelectNext", { "replace_newest": false }], "ctrl-g": ["editor::SelectNext", { "replace_newest": false }],
"ctrl-cmd-g": ["editor::SelectPrevious", { "replace_newest": false }], "ctrl-cmd-g": ["editor::SelectPrevious", { "replace_newest": false }],
"cmd-/": ["editor::ToggleComments", { "advance_downwards": true }], "cmd-/": ["editor::ToggleComments", { "advance_downwards": true }],
"alt-up": "editor::SelectLargerSyntaxNode", "cmd-up": "editor::SelectLargerSyntaxNode",
"alt-down": "editor::SelectSmallerSyntaxNode", "cmd-down": "editor::SelectSmallerSyntaxNode",
"shift-alt-up": "editor::MoveLineUp", "shift-alt-up": "editor::MoveLineUp",
"shift-alt-down": "editor::MoveLineDown", "shift-alt-down": "editor::MoveLineDown",
"cmd-alt-l": "editor::Format", "cmd-alt-l": "editor::Format",

View File

@@ -4,25 +4,7 @@
"cmd-shift-[": "pane::ActivatePrevItem", "cmd-shift-[": "pane::ActivatePrevItem",
"cmd-shift-]": "pane::ActivateNextItem", "cmd-shift-]": "pane::ActivateNextItem",
"ctrl-pageup": "pane::ActivatePrevItem", "ctrl-pageup": "pane::ActivatePrevItem",
"ctrl-pagedown": "pane::ActivateNextItem", "ctrl-pagedown": "pane::ActivateNextItem"
"ctrl-1": ["workspace::ActivatePane", 0],
"ctrl-2": ["workspace::ActivatePane", 1],
"ctrl-3": ["workspace::ActivatePane", 2],
"ctrl-4": ["workspace::ActivatePane", 3],
"ctrl-5": ["workspace::ActivatePane", 4],
"ctrl-6": ["workspace::ActivatePane", 5],
"ctrl-7": ["workspace::ActivatePane", 6],
"ctrl-8": ["workspace::ActivatePane", 7],
"ctrl-9": ["workspace::ActivatePane", 8],
"ctrl-shift-1": ["workspace::MoveItemToPane", { "destination": 0, "focus": true }],
"ctrl-shift-2": ["workspace::MoveItemToPane", { "destination": 1 }],
"ctrl-shift-3": ["workspace::MoveItemToPane", { "destination": 2 }],
"ctrl-shift-4": ["workspace::MoveItemToPane", { "destination": 3 }],
"ctrl-shift-5": ["workspace::MoveItemToPane", { "destination": 4 }],
"ctrl-shift-6": ["workspace::MoveItemToPane", { "destination": 5 }],
"ctrl-shift-7": ["workspace::MoveItemToPane", { "destination": 6 }],
"ctrl-shift-8": ["workspace::MoveItemToPane", { "destination": 7 }],
"ctrl-shift-9": ["workspace::MoveItemToPane", { "destination": 8 }]
} }
}, },
{ {
@@ -38,8 +20,6 @@
"cmd-shift-a": "editor::SelectLargerSyntaxNode", "cmd-shift-a": "editor::SelectLargerSyntaxNode",
"cmd-shift-d": "editor::DuplicateSelection", "cmd-shift-d": "editor::DuplicateSelection",
"ctrl-cmd-g": "editor::SelectAllMatches", // find_all_under "ctrl-cmd-g": "editor::SelectAllMatches", // find_all_under
"f5": "editor::SortLinesCaseSensitive",
"ctrl-f5": "editor::SortLinesCaseInsensitive",
"shift-f12": "editor::FindAllReferences", "shift-f12": "editor::FindAllReferences",
"alt-cmd-down": "editor::GoToDefinition", "alt-cmd-down": "editor::GoToDefinition",
"ctrl-alt-cmd-down": "editor::GoToDefinitionSplit", "ctrl-alt-cmd-down": "editor::GoToDefinitionSplit",

View File

@@ -13,7 +13,7 @@
"cmd-b": "editor::GoToDefinition", "cmd-b": "editor::GoToDefinition",
"cmd-j": "editor::ScrollCursorCenter", "cmd-j": "editor::ScrollCursorCenter",
"cmd-enter": "editor::NewlineBelow", "cmd-enter": "editor::NewlineBelow",
"cmd-alt-enter": "editor::NewlineAbove", "cmd-alt-enter": "editor::NewLineAbove",
"cmd-shift-l": "editor::SelectLine", "cmd-shift-l": "editor::SelectLine",
"cmd-shift-t": "outline::Toggle", "cmd-shift-t": "outline::Toggle",
"alt-backspace": "editor::DeleteToPreviousWordStart", "alt-backspace": "editor::DeleteToPreviousWordStart",
@@ -70,7 +70,7 @@
"bindings": { "bindings": {
"cmd-backspace": ["project_panel::Trash", { "skip_prompt": true }], "cmd-backspace": ["project_panel::Trash", { "skip_prompt": true }],
"cmd-d": "project_panel::Duplicate", "cmd-d": "project_panel::Duplicate",
"cmd-n": "project_panel::NewDirectory", "cmd-n": "project_panel::NewFolder",
"return": "project_panel::Rename", "return": "project_panel::Rename",
"cmd-c": "project_panel::Copy", "cmd-c": "project_panel::Copy",
"cmd-v": "project_panel::Paste", "cmd-v": "project_panel::Paste",

View File

@@ -2,27 +2,21 @@
// Standard macOS bindings // Standard macOS bindings
{ {
"bindings": { "bindings": {
"home": "menu::SelectFirst",
"shift-pageup": "menu::SelectFirst",
"pageup": "menu::SelectFirst",
"cmd-up": "menu::SelectFirst",
"end": "menu::SelectLast",
"shift-pagedown": "menu::SelectLast",
"pagedown": "menu::SelectLast",
"cmd-down": "menu::SelectLast",
"tab": "menu::SelectNext",
"ctrl-n": "menu::SelectNext",
"down": "menu::SelectNext",
"shift-tab": "menu::SelectPrev",
"ctrl-p": "menu::SelectPrev",
"up": "menu::SelectPrev", "up": "menu::SelectPrev",
"pageup": "menu::SelectFirst",
"shift-pageup": "menu::SelectFirst",
"ctrl-p": "menu::SelectPrev",
"down": "menu::SelectNext",
"pagedown": "menu::SelectLast",
"shift-pagedown": "menu::SelectFirst",
"ctrl-n": "menu::SelectNext",
"cmd-up": "menu::SelectFirst",
"cmd-down": "menu::SelectLast",
"enter": "menu::Confirm", "enter": "menu::Confirm",
"ctrl-enter": "menu::SecondaryConfirm", "ctrl-enter": "menu::SecondaryConfirm",
"cmd-enter": "menu::SecondaryConfirm", "cmd-enter": "menu::SecondaryConfirm",
"ctrl-escape": "menu::Cancel",
"cmd-escape": "menu::Cancel",
"ctrl-c": "menu::Cancel",
"escape": "menu::Cancel", "escape": "menu::Cancel",
"ctrl-c": "menu::Cancel",
"cmd-q": "storybook::Quit", "cmd-q": "storybook::Quit",
"backspace": "editor::Backspace", "backspace": "editor::Backspace",
"delete": "editor::Delete", "delete": "editor::Delete",

View File

@@ -4,25 +4,25 @@
"bindings": { "bindings": {
"i": ["vim::PushOperator", { "Object": { "around": false } }], "i": ["vim::PushOperator", { "Object": { "around": false } }],
"a": ["vim::PushOperator", { "Object": { "around": true } }], "a": ["vim::PushOperator", { "Object": { "around": true } }],
"left": "vim::Left",
"h": "vim::Left", "h": "vim::Left",
"left": "vim::Left",
"backspace": "vim::Backspace", "backspace": "vim::Backspace",
"j": "vim::Down",
"down": "vim::Down", "down": "vim::Down",
"ctrl-j": "vim::Down", "ctrl-j": "vim::Down",
"j": "vim::Down", "enter": "vim::NextLineStart",
"ctrl-m": "vim::NextLineStart", "ctrl-m": "vim::NextLineStart",
"+": "vim::NextLineStart", "+": "vim::NextLineStart",
"enter": "vim::NextLineStart",
"-": "vim::PreviousLineStart", "-": "vim::PreviousLineStart",
"shift-tab": "vim::Tab",
"tab": "vim::Tab", "tab": "vim::Tab",
"up": "vim::Up", "shift-tab": "vim::Tab",
"k": "vim::Up", "k": "vim::Up",
"right": "vim::Right", "up": "vim::Up",
"l": "vim::Right", "l": "vim::Right",
"right": "vim::Right",
"space": "vim::Space", "space": "vim::Space",
"end": "vim::EndOfLine",
"$": "vim::EndOfLine", "$": "vim::EndOfLine",
"end": "vim::EndOfLine",
"^": "vim::FirstNonWhitespace", "^": "vim::FirstNonWhitespace",
"_": "vim::StartOfLineDownward", "_": "vim::StartOfLineDownward",
"g _": "vim::EndOfLineDownward", "g _": "vim::EndOfLineDownward",
@@ -86,7 +86,6 @@
"ctrl-[": ["vim::SwitchMode", "Normal"], "ctrl-[": ["vim::SwitchMode", "Normal"],
"v": "vim::ToggleVisual", "v": "vim::ToggleVisual",
"shift-v": "vim::ToggleVisualLine", "shift-v": "vim::ToggleVisualLine",
"ctrl-g": "vim::ShowLocation",
"ctrl-v": "vim::ToggleVisualBlock", "ctrl-v": "vim::ToggleVisualBlock",
"ctrl-q": "vim::ToggleVisualBlock", "ctrl-q": "vim::ToggleVisualBlock",
"shift-k": "editor::Hover", "shift-k": "editor::Hover",
@@ -111,7 +110,7 @@
"g y": "editor::GoToTypeDefinition", "g y": "editor::GoToTypeDefinition",
"g shift-i": "editor::GoToImplementation", "g shift-i": "editor::GoToImplementation",
"g x": "editor::OpenUrl", "g x": "editor::OpenUrl",
"g f": "editor::OpenSelectedFilename", "g f": "editor::OpenFile",
"g n": "vim::SelectNextMatch", "g n": "vim::SelectNextMatch",
"g shift-n": "vim::SelectPreviousMatch", "g shift-n": "vim::SelectPreviousMatch",
"g l": "vim::SelectNext", "g l": "vim::SelectNext",
@@ -189,8 +188,8 @@
{ {
"context": "vim_mode == normal", "context": "vim_mode == normal",
"bindings": { "bindings": {
"ctrl-[": "editor::Cancel",
"escape": "editor::Cancel", "escape": "editor::Cancel",
"ctrl-[": "editor::Cancel",
":": "command_palette::Toggle", ":": "command_palette::Toggle",
".": "vim::Repeat", ".": "vim::Repeat",
"c": ["vim::PushOperator", "Change"], "c": ["vim::PushOperator", "Change"],
@@ -198,7 +197,6 @@
"d": ["vim::PushOperator", "Delete"], "d": ["vim::PushOperator", "Delete"],
"shift-d": "vim::DeleteToEndOfLine", "shift-d": "vim::DeleteToEndOfLine",
"shift-j": "vim::JoinLines", "shift-j": "vim::JoinLines",
"g shift-j": "vim::JoinLinesNoWhitespace",
"y": ["vim::PushOperator", "Yank"], "y": ["vim::PushOperator", "Yank"],
"shift-y": "vim::YankLine", "shift-y": "vim::YankLine",
"i": "vim::InsertBefore", "i": "vim::InsertBefore",
@@ -222,19 +220,18 @@
">": ["vim::PushOperator", "Indent"], ">": ["vim::PushOperator", "Indent"],
"<": ["vim::PushOperator", "Outdent"], "<": ["vim::PushOperator", "Outdent"],
"=": ["vim::PushOperator", "AutoIndent"], "=": ["vim::PushOperator", "AutoIndent"],
"!": ["vim::PushOperator", "ShellCommand"],
"g u": ["vim::PushOperator", "Lowercase"], "g u": ["vim::PushOperator", "Lowercase"],
"g shift-u": ["vim::PushOperator", "Uppercase"], "g shift-u": ["vim::PushOperator", "Uppercase"],
"g ~": ["vim::PushOperator", "OppositeCase"], "g ~": ["vim::PushOperator", "OppositeCase"],
"\"": ["vim::PushOperator", "Register"], "\"": ["vim::PushOperator", "Register"],
"g w": ["vim::PushOperator", "Rewrap"],
"g q": ["vim::PushOperator", "Rewrap"], "g q": ["vim::PushOperator", "Rewrap"],
"g w": ["vim::PushOperator", "Rewrap"],
"ctrl-pagedown": "pane::ActivateNextItem", "ctrl-pagedown": "pane::ActivateNextItem",
"ctrl-pageup": "pane::ActivatePrevItem", "ctrl-pageup": "pane::ActivatePrevItem",
"insert": "vim::InsertBefore", "insert": "vim::InsertBefore",
// tree-sitter related commands // tree-sitter related commands
"[ x": "vim::SelectLargerSyntaxNode", "[ x": "editor::SelectLargerSyntaxNode",
"] x": "vim::SelectSmallerSyntaxNode", "] x": "editor::SelectSmallerSyntaxNode",
"] d": "editor::GoToDiagnostic", "] d": "editor::GoToDiagnostic",
"[ d": "editor::GoToPrevDiagnostic", "[ d": "editor::GoToPrevDiagnostic",
"] c": "editor::GoToHunk", "] c": "editor::GoToHunk",
@@ -255,20 +252,20 @@
":": "vim::VisualCommand", ":": "vim::VisualCommand",
"u": "vim::ConvertToLowerCase", "u": "vim::ConvertToLowerCase",
"shift-u": "vim::ConvertToUpperCase", "shift-u": "vim::ConvertToUpperCase",
"shift-o": "vim::OtherEnd",
"o": "vim::OtherEnd", "o": "vim::OtherEnd",
"shift-o": "vim::OtherEnd",
"d": "vim::VisualDelete", "d": "vim::VisualDelete",
"x": "vim::VisualDelete", "x": "vim::VisualDelete",
"shift-d": "vim::VisualDeleteLine", "shift-d": "vim::VisualDeleteLine",
"shift-x": "vim::VisualDeleteLine", "shift-x": "vim::VisualDeleteLine",
"y": "vim::VisualYank", "y": "vim::VisualYank",
"shift-y": "vim::VisualYankLine", "shift-y": "vim::VisualYank",
"p": "vim::Paste", "p": "vim::Paste",
"shift-p": ["vim::Paste", { "preserveClipboard": true }], "shift-p": ["vim::Paste", { "preserveClipboard": true }],
"c": "vim::Substitute",
"s": "vim::Substitute", "s": "vim::Substitute",
"shift-r": "vim::SubstituteLine",
"shift-s": "vim::SubstituteLine", "shift-s": "vim::SubstituteLine",
"shift-r": "vim::SubstituteLine",
"c": "vim::Substitute",
"~": "vim::ChangeCase", "~": "vim::ChangeCase",
"*": ["vim::MoveToNext", { "partialWord": true }], "*": ["vim::MoveToNext", { "partialWord": true }],
"#": ["vim::MoveToPrev", { "partialWord": true }], "#": ["vim::MoveToPrev", { "partialWord": true }],
@@ -281,15 +278,13 @@
"g shift-i": "vim::VisualInsertFirstNonWhiteSpace", "g shift-i": "vim::VisualInsertFirstNonWhiteSpace",
"g shift-a": "vim::VisualInsertEndOfLine", "g shift-a": "vim::VisualInsertEndOfLine",
"shift-j": "vim::JoinLines", "shift-j": "vim::JoinLines",
"g shift-j": "vim::JoinLinesNoWhitespace",
"r": ["vim::PushOperator", "Replace"], "r": ["vim::PushOperator", "Replace"],
"ctrl-c": ["vim::SwitchMode", "Normal"], "ctrl-c": ["vim::SwitchMode", "Normal"],
"ctrl-[": ["vim::SwitchMode", "Normal"],
"escape": ["vim::SwitchMode", "Normal"], "escape": ["vim::SwitchMode", "Normal"],
"ctrl-[": ["vim::SwitchMode", "Normal"],
">": "vim::Indent", ">": "vim::Indent",
"<": "vim::Outdent", "<": "vim::Outdent",
"=": "vim::AutoIndent", "=": "vim::AutoIndent",
"!": "vim::ShellCommand",
"i": ["vim::PushOperator", { "Object": { "around": false } }], "i": ["vim::PushOperator", { "Object": { "around": false } }],
"a": ["vim::PushOperator", { "Object": { "around": true } }], "a": ["vim::PushOperator", { "Object": { "around": true } }],
"g c": "vim::ToggleComments", "g c": "vim::ToggleComments",
@@ -303,9 +298,9 @@
{ {
"context": "vim_mode == insert", "context": "vim_mode == insert",
"bindings": { "bindings": {
"escape": "vim::NormalBefore",
"ctrl-c": "vim::NormalBefore", "ctrl-c": "vim::NormalBefore",
"ctrl-[": "vim::NormalBefore", "ctrl-[": "vim::NormalBefore",
"escape": "vim::NormalBefore",
"ctrl-x": null, "ctrl-x": null,
"ctrl-x ctrl-o": "editor::ShowCompletions", "ctrl-x ctrl-o": "editor::ShowCompletions",
"ctrl-x ctrl-a": "assistant::InlineAssist", // zed specific "ctrl-x ctrl-a": "assistant::InlineAssist", // zed specific
@@ -353,9 +348,9 @@
{ {
"context": "vim_mode == replace", "context": "vim_mode == replace",
"bindings": { "bindings": {
"escape": "vim::NormalBefore",
"ctrl-c": "vim::NormalBefore", "ctrl-c": "vim::NormalBefore",
"ctrl-[": "vim::NormalBefore", "ctrl-[": "vim::NormalBefore",
"escape": "vim::NormalBefore",
"ctrl-k": ["vim::PushOperator", { "Digraph": {} }], "ctrl-k": ["vim::PushOperator", { "Digraph": {} }],
"ctrl-v": ["vim::PushOperator", { "Literal": {} }], "ctrl-v": ["vim::PushOperator", { "Literal": {} }],
"ctrl-shift-v": "editor::Paste", // note: this is *very* similar to ctrl-v in vim, but ctrl-shift-v on linux is the typical shortcut for paste when ctrl-v is already in use. "ctrl-shift-v": "editor::Paste", // note: this is *very* similar to ctrl-v in vim, but ctrl-shift-v on linux is the typical shortcut for paste when ctrl-v is already in use.
@@ -372,9 +367,9 @@
"bindings": { "bindings": {
"tab": "vim::Tab", "tab": "vim::Tab",
"enter": "vim::Enter", "enter": "vim::Enter",
"escape": "vim::ClearOperators",
"ctrl-c": "vim::ClearOperators", "ctrl-c": "vim::ClearOperators",
"ctrl-[": "vim::ClearOperators", "ctrl-[": "vim::ClearOperators",
"escape": "vim::ClearOperators",
"ctrl-k": ["vim::PushOperator", { "Digraph": {} }], "ctrl-k": ["vim::PushOperator", { "Digraph": {} }],
"ctrl-v": ["vim::PushOperator", { "Literal": {} }], "ctrl-v": ["vim::PushOperator", { "Literal": {} }],
"ctrl-q": ["vim::PushOperator", { "Literal": {} }] "ctrl-q": ["vim::PushOperator", { "Literal": {} }]
@@ -383,9 +378,9 @@
{ {
"context": "vim_mode == operator", "context": "vim_mode == operator",
"bindings": { "bindings": {
"escape": "vim::ClearOperators",
"ctrl-c": "vim::ClearOperators", "ctrl-c": "vim::ClearOperators",
"ctrl-[": "vim::ClearOperators", "ctrl-[": "vim::ClearOperators",
"escape": "vim::ClearOperators",
"g c": "vim::Comment" "g c": "vim::Comment"
} }
}, },
@@ -394,21 +389,16 @@
"bindings": { "bindings": {
"w": "vim::Word", "w": "vim::Word",
"shift-w": ["vim::Word", { "ignorePunctuation": true }], "shift-w": ["vim::Word", { "ignorePunctuation": true }],
// Subword TextObject
// "w": "vim::Subword",
// "shift-w": ["vim::Subword", { "ignorePunctuation": true }],
"t": "vim::Tag", "t": "vim::Tag",
"s": "vim::Sentence", "s": "vim::Sentence",
"p": "vim::Paragraph", "p": "vim::Paragraph",
"'": "vim::Quotes", "'": "vim::Quotes",
"`": "vim::BackQuotes", "`": "vim::BackQuotes",
"\"": "vim::DoubleQuotes", "\"": "vim::DoubleQuotes",
"q": "vim::AnyQuotes",
"|": "vim::VerticalBars", "|": "vim::VerticalBars",
"(": "vim::Parentheses", "(": "vim::Parentheses",
")": "vim::Parentheses", ")": "vim::Parentheses",
"b": "vim::Parentheses", "b": "vim::Parentheses",
// "b": "vim::AnyBrackets",
"[": "vim::SquareBrackets", "[": "vim::SquareBrackets",
"]": "vim::SquareBrackets", "]": "vim::SquareBrackets",
"r": "vim::SquareBrackets", "r": "vim::SquareBrackets",
@@ -437,7 +427,7 @@
"bindings": { "bindings": {
"d": "vim::CurrentLine", "d": "vim::CurrentLine",
"s": ["vim::PushOperator", "DeleteSurrounds"], "s": ["vim::PushOperator", "DeleteSurrounds"],
"o": "editor::ToggleSelectedDiffHunks", // "d o" "o": "editor::ToggleHunkDiff", // "d o"
"p": "editor::RevertSelectedHunks" // "d p" "p": "editor::RevertSelectedHunks" // "d p"
} }
}, },
@@ -502,12 +492,6 @@
"=": "vim::CurrentLine" "=": "vim::CurrentLine"
} }
}, },
{
"context": "vim_operator == sh",
"bindings": {
"!": "vim::CurrentLine"
}
},
{ {
"context": "vim_operator == gc", "context": "vim_operator == gc",
"bindings": { "bindings": {
@@ -573,14 +557,14 @@
"ctrl-w right": ["workspace::ActivatePaneInDirection", "Right"], "ctrl-w right": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-w up": ["workspace::ActivatePaneInDirection", "Up"], "ctrl-w up": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-w down": ["workspace::ActivatePaneInDirection", "Down"], "ctrl-w down": ["workspace::ActivatePaneInDirection", "Down"],
"ctrl-w ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-w ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-w ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-w ctrl-j": ["workspace::ActivatePaneInDirection", "Down"],
"ctrl-w h": ["workspace::ActivatePaneInDirection", "Left"], "ctrl-w h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-w l": ["workspace::ActivatePaneInDirection", "Right"], "ctrl-w l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-w k": ["workspace::ActivatePaneInDirection", "Up"], "ctrl-w k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-w j": ["workspace::ActivatePaneInDirection", "Down"], "ctrl-w j": ["workspace::ActivatePaneInDirection", "Down"],
"ctrl-w ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-w ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-w ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-w ctrl-j": ["workspace::ActivatePaneInDirection", "Down"],
"ctrl-w shift-left": ["workspace::SwapPaneInDirection", "Left"], "ctrl-w shift-left": ["workspace::SwapPaneInDirection", "Left"],
"ctrl-w shift-right": ["workspace::SwapPaneInDirection", "Right"], "ctrl-w shift-right": ["workspace::SwapPaneInDirection", "Right"],
"ctrl-w shift-up": ["workspace::SwapPaneInDirection", "Up"], "ctrl-w shift-up": ["workspace::SwapPaneInDirection", "Up"],
@@ -605,19 +589,19 @@
"ctrl-w ctrl-p": "workspace::ActivatePreviousPane", "ctrl-w ctrl-p": "workspace::ActivatePreviousPane",
"ctrl-w shift-w": "workspace::ActivatePreviousPane", "ctrl-w shift-w": "workspace::ActivatePreviousPane",
"ctrl-w ctrl-shift-w": "workspace::ActivatePreviousPane", "ctrl-w ctrl-shift-w": "workspace::ActivatePreviousPane",
"ctrl-w ctrl-v": "pane::SplitVertical",
"ctrl-w v": "pane::SplitVertical", "ctrl-w v": "pane::SplitVertical",
"ctrl-w ctrl-v": "pane::SplitVertical",
"ctrl-w s": "pane::SplitHorizontal",
"ctrl-w shift-s": "pane::SplitHorizontal", "ctrl-w shift-s": "pane::SplitHorizontal",
"ctrl-w ctrl-s": "pane::SplitHorizontal", "ctrl-w ctrl-s": "pane::SplitHorizontal",
"ctrl-w s": "pane::SplitHorizontal",
"ctrl-w ctrl-c": "pane::CloseAllItems",
"ctrl-w c": "pane::CloseAllItems", "ctrl-w c": "pane::CloseAllItems",
"ctrl-w ctrl-q": "pane::CloseAllItems", "ctrl-w ctrl-c": "pane::CloseAllItems",
"ctrl-w q": "pane::CloseAllItems", "ctrl-w q": "pane::CloseAllItems",
"ctrl-w ctrl-o": "workspace::CloseInactiveTabsAndPanes", "ctrl-w ctrl-q": "pane::CloseAllItems",
"ctrl-w o": "workspace::CloseInactiveTabsAndPanes", "ctrl-w o": "workspace::CloseInactiveTabsAndPanes",
"ctrl-w ctrl-n": "workspace::NewFileSplitHorizontal", "ctrl-w ctrl-o": "workspace::CloseInactiveTabsAndPanes",
"ctrl-w n": "workspace::NewFileSplitHorizontal" "ctrl-w n": "workspace::NewFileSplitHorizontal",
"ctrl-w ctrl-n": "workspace::NewFileSplitHorizontal"
} }
}, },
{ {
@@ -669,20 +653,5 @@
"shift-g": "menu::SelectLast", "shift-g": "menu::SelectLast",
"g g": "menu::SelectFirst" "g g": "menu::SelectFirst"
} }
},
{
"context": "GitPanel && ChangesList",
"use_key_equivalents": true,
"bindings": {
"k": "menu::SelectPrev",
"j": "menu::SelectNext",
"g g": "menu::SelectFirst",
"shift-g": "menu::SelectLast",
"g f": "menu::Confirm",
"i": "git_panel::FocusEditor",
"x": "git::ToggleStaged",
"shift-x": "git::StageAll",
"shift-u": "git::UnstageAll"
}
} }
] ]

View File

@@ -13,15 +13,15 @@ You must describe the change using the following XML structure:
- <description> (optional) - An arbitrarily-long comment that describes the purpose - <description> (optional) - An arbitrarily-long comment that describes the purpose
of this edit. of this edit.
- <old_text> (optional) - An excerpt from the file's current contents that uniquely - <old_text> (optional) - An excerpt from the file's current contents that uniquely
identifies a range within the file where the edit should occur. Required for all operations identifies a range within the file where the edit should occur. If this tag is not
except `create`. specified, then the entire file will be used as the range.
- <new_text> (required) - The new text to insert into the file. - <new_text> (required) - The new text to insert into the file.
- <operation> (required) - The type of change that should occur at the given range - <operation> (required) - The type of change that should occur at the given range
of the file. Must be one of the following values: of the file. Must be one of the following values:
- `update`: Replaces the entire range with the new text. - `update`: Replaces the entire range with the new text.
- `insert_before`: Inserts the new text before the range. - `insert_before`: Inserts the new text before the range.
- `insert_after`: Inserts new text after the range. - `insert_after`: Inserts new text after the range.
- `create`: Creates or overwrites a file with the given path and the new text. - `create`: Creates a new file with the given path and the new text.
- `delete`: Deletes the specified range from the file. - `delete`: Deletes the specified range from the file.
<guidelines> <guidelines>

View File

@@ -10,9 +10,8 @@
"light": "One Light", "light": "One Light",
"dark": "One Dark" "dark": "One Dark"
}, },
"icon_theme": "Zed (Default)",
// The name of a base set of key bindings to use. // The name of a base set of key bindings to use.
// This setting can take six values, each named after another // This setting can take four values, each named after another
// text editor: // text editor:
// //
// 1. "VSCode" // 1. "VSCode"
@@ -102,8 +101,6 @@
// Whether to show the informational hover box when moving the mouse // Whether to show the informational hover box when moving the mouse
// over symbols in the editor. // over symbols in the editor.
"hover_popover_enabled": true, "hover_popover_enabled": true,
// Time to wait before showing the informational hover box
"hover_popover_delay": 350,
// Whether to confirm before quitting Zed. // Whether to confirm before quitting Zed.
"confirm_quit": false, "confirm_quit": false,
// Whether to restore last closed project when fresh Zed instance is opened. // Whether to restore last closed project when fresh Zed instance is opened.
@@ -161,9 +158,6 @@
/// Whether to show the signature help after completion or a bracket pair inserted. /// Whether to show the signature help after completion or a bracket pair inserted.
/// If `auto_signature_help` is enabled, this setting will be treated as enabled also. /// If `auto_signature_help` is enabled, this setting will be treated as enabled also.
"show_signature_help_after_edits": false, "show_signature_help_after_edits": false,
/// Whether to show the inline completions next to the completions provided by a language server.
/// Only has an effect if inline completion provider supports it.
"show_inline_completions_in_menu": true,
// Whether to show wrap guides (vertical rulers) in the editor. // Whether to show wrap guides (vertical rulers) in the editor.
// Setting this to true will show a guide at the 'preferred_line_length' value // Setting this to true will show a guide at the 'preferred_line_length' value
// if 'soft_wrap' is set to 'preferred_line_length', and will show any // if 'soft_wrap' is set to 'preferred_line_length', and will show any
@@ -203,7 +197,7 @@
// Example: ["string", "comment"] // Example: ["string", "comment"]
"inline_completions_disabled_in": [], "inline_completions_disabled_in": [],
// Whether to show tabs and spaces in the editor. // Whether to show tabs and spaces in the editor.
// This setting can take four values: // This setting can take three values:
// //
// 1. Draw tabs and spaces only for the selected text (default): // 1. Draw tabs and spaces only for the selected text (default):
// "selection" // "selection"
@@ -257,20 +251,8 @@
"search_results": true, "search_results": true,
// Whether to show selected symbol occurrences in the scrollbar. // Whether to show selected symbol occurrences in the scrollbar.
"selected_symbol": true, "selected_symbol": true,
// Which diagnostic indicators to show in the scrollbar: // Whether to show diagnostic indicators in the scrollbar.
// - "none" or false: do not show diagnostics "diagnostics": true
// - "error": show only errors
// - "warning": show only errors and warnings
// - "information": show only errors, warnings, and information
// - "all" or true: show all diagnostics
"diagnostics": "all",
/// Forcefully enable or disable the scrollbar for each axis
"axes": {
/// When false, forcefully disables the horizontal scrollbar. Otherwise, obey other settings.
"horizontal": true,
/// When false, forcefully disables the vertical scrollbar. Otherwise, obey other settings.
"vertical": true
}
}, },
// Enable middle-click paste on Linux. // Enable middle-click paste on Linux.
"middle_click_paste": true, "middle_click_paste": true,
@@ -320,8 +302,6 @@
"vertical_scroll_margin": 3, "vertical_scroll_margin": 3,
// Whether to scroll when clicking near the edge of the visible text area. // Whether to scroll when clicking near the edge of the visible text area.
"autoscroll_on_clicks": false, "autoscroll_on_clicks": false,
// The number of characters to keep on either side when scrolling with the mouse
"horizontal_scroll_margin": 5,
// Scroll sensitivity multiplier. This multiplier is applied // Scroll sensitivity multiplier. This multiplier is applied
// to both the horizontal and vertical delta values while scrolling. // to both the horizontal and vertical delta values while scrolling.
"scroll_sensitivity": 1.0, "scroll_sensitivity": 1.0,
@@ -373,8 +353,6 @@
"default_width": 240, "default_width": 240,
// Where to dock the project panel. Can be 'left' or 'right'. // Where to dock the project panel. Can be 'left' or 'right'.
"dock": "left", "dock": "left",
// Spacing between worktree entries in the project panel. Can be 'comfortable' or 'standard'.
"entry_spacing": "comfortable",
// Whether to show file icons in the project panel. // Whether to show file icons in the project panel.
"file_icons": true, "file_icons": true,
// Whether to show folder icons or chevrons for directories in the project panel. // Whether to show folder icons or chevrons for directories in the project panel.
@@ -393,7 +371,7 @@
/// Scrollbar-related settings /// Scrollbar-related settings
"scrollbar": { "scrollbar": {
/// When to show the scrollbar in the project panel. /// When to show the scrollbar in the project panel.
/// This setting can take five values: /// This setting can take four values:
/// ///
/// 1. null (default): Inherit editor settings /// 1. null (default): Inherit editor settings
/// 2. Show the scrollbar if there's important information or /// 2. Show the scrollbar if there's important information or
@@ -465,7 +443,7 @@
/// Scrollbar-related settings /// Scrollbar-related settings
"scrollbar": { "scrollbar": {
/// When to show the scrollbar in the project panel. /// When to show the scrollbar in the project panel.
/// This setting can take five values: /// This setting can take four values:
/// ///
/// 1. null (default): Inherit editor settings /// 1. null (default): Inherit editor settings
/// 2. Show the scrollbar if there's important information or /// 2. Show the scrollbar if there's important information or
@@ -489,10 +467,8 @@
"default_width": 240 "default_width": 240
}, },
"chat_panel": { "chat_panel": {
// When to show the chat panel button in the status bar. // Whether to show the chat panel button in the status bar.
// Can be 'never', 'always', or 'when_in_call', "button": true,
// or a boolean (interpreted as 'never'/'always').
"button": "when_in_call",
// Where to the chat panel. Can be 'left' or 'right'. // Where to the chat panel. Can be 'left' or 'right'.
"dock": "right", "dock": "right",
// Default width of the chat panel. // Default width of the chat panel.
@@ -504,17 +480,7 @@
// Where to the git panel. Can be 'left' or 'right'. // Where to the git panel. Can be 'left' or 'right'.
"dock": "left", "dock": "left",
// Default width of the git panel. // Default width of the git panel.
"default_width": 360, "default_width": 360
// Style of the git status indicator in the panel.
//
// Default: icon
"status_style": "icon",
"scrollbar": {
// When to show the scrollbar in the git panel.
//
// Default: inherits editor scrollbar settings
"show": null
}
}, },
"message_editor": { "message_editor": {
// Whether to automatically replace emoji shortcodes with emoji characters. // Whether to automatically replace emoji shortcodes with emoji characters.
@@ -586,16 +552,12 @@
// 4. Save when idle for a certain amount of time: // 4. Save when idle for a certain amount of time:
// "autosave": { "after_delay": {"milliseconds": 500} }, // "autosave": { "after_delay": {"milliseconds": 500} },
"autosave": "off", "autosave": "off",
// Maximum number of tabs per pane. Unset for unlimited.
"max_tabs": null,
// Settings related to the editor's tab bar. // Settings related to the editor's tab bar.
"tab_bar": { "tab_bar": {
// Whether or not to show the tab bar in the editor // Whether or not to show the tab bar in the editor
"show": true, "show": true,
// Whether or not to show the navigation history buttons. // Whether or not to show the navigation history buttons.
"show_nav_history_buttons": true, "show_nav_history_buttons": true
/// Whether or not to show the tab bar buttons.
"show_tab_bar_buttons": true
}, },
// Settings related to the editor's tabs // Settings related to the editor's tabs
"tabs": { "tabs": {
@@ -761,7 +723,7 @@
// Delay is restarted with every cursor movement. // Delay is restarted with every cursor movement.
// "delay_ms": 600 // "delay_ms": 600
// //
// Whether or not to display the git commit summary on the same line. // Whether or not do display the git commit summary on the same line.
// "show_commit_summary": false // "show_commit_summary": false
// //
// The minimum column number to show the inline blame information at // The minimum column number to show the inline blame information at
@@ -911,23 +873,6 @@
// The shell running in the terminal needs to be configured to emit the title. // The shell running in the terminal needs to be configured to emit the title.
// Example: `echo -e "\e]2;New Title\007";` // Example: `echo -e "\e]2;New Title\007";`
"breadcrumbs": true "breadcrumbs": true
},
/// Scrollbar-related settings
"scrollbar": {
/// When to show the scrollbar in the terminal.
/// This setting can take five values:
///
/// 1. null (default): Inherit editor settings
/// 2. Show the scrollbar if there's important information or
/// follow the system's configured behavior (default):
/// "auto"
/// 3. Match the system's configured behavior:
/// "system"
/// 4. Always show the scrollbar:
/// "always"
/// 5. Never show the scrollbar:
/// "never"
"show": null
} }
// Set the terminal's font size. If this option is not included, // Set the terminal's font size. If this option is not included,
// the terminal will default to matching the buffer's font size. // the terminal will default to matching the buffer's font size.
@@ -1004,17 +949,11 @@
}, },
"C": { "C": {
"format_on_save": "off", "format_on_save": "off",
"use_on_type_format": false, "use_on_type_format": false
"prettier": {
"allowed": false
}
}, },
"C++": { "C++": {
"format_on_save": "off", "format_on_save": "off",
"use_on_type_format": false, "use_on_type_format": false
"prettier": {
"allowed": false
}
}, },
"CSS": { "CSS": {
"prettier": { "prettier": {
@@ -1146,9 +1085,6 @@
"prettier": { "prettier": {
"allowed": true "allowed": true
} }
},
"Zig": {
"language_servers": ["zls", "..."]
} }
}, },
// Different settings for specific language models. // Different settings for specific language models.
@@ -1166,12 +1102,6 @@
"openai": { "openai": {
"version": "1", "version": "1",
"api_url": "https://api.openai.com/v1" "api_url": "https://api.openai.com/v1"
},
"lmstudio": {
"api_url": "http://localhost:1234/api/v0"
},
"deepseek": {
"api_url": "https://api.deepseek.com"
} }
}, },
// Zed's Prettier integration settings. // Zed's Prettier integration settings.

View File

@@ -15,14 +15,10 @@
// Whether to allow multiple instances of the same task to be run, or rather wait for the existing ones to finish, defaults to `false`. // Whether to allow multiple instances of the same task to be run, or rather wait for the existing ones to finish, defaults to `false`.
"allow_concurrent_runs": false, "allow_concurrent_runs": false,
// What to do with the terminal pane and tab, after the command was started: // What to do with the terminal pane and tab, after the command was started:
// * `always` — always show the task's pane, and focus the corresponding tab in it (default) // * `always` — always show the terminal pane, add and focus the corresponding task's tab in it (default)
// * `no_focus` — always show the task's pane, add the task's tab in it, but don't focus it // * `no_focus` — always show the terminal pane, add/reuse the task's tab there, but don't focus it
// * `never` — do not alter focus, but still add/reuse the task's tab in its pane // * `never` — avoid changing current terminal pane focus, but still add/reuse the task's tab there
"reveal": "always", "reveal": "always",
// Where to place the task's terminal item after starting the task:
// * `dock` — in the terminal dock, "regular" terminal items' place (default)
// * `center` — in the central pane group, "main" editor area
"reveal_target": "dock",
// What to do with the terminal pane and tab, after the command had finished: // What to do with the terminal pane and tab, after the command had finished:
// * `never` — Do nothing when the command finishes (default) // * `never` — Do nothing when the command finishes (default)
// * `always` — always hide the terminal tab, hide the pane also if it was the last tab in it // * `always` — always hide the terminal tab, hide the pane also if it was the last tab in it

View File

@@ -59,9 +59,8 @@
"editor.subheader.background": "#21242bff", "editor.subheader.background": "#21242bff",
"editor.active_line.background": "#21242bbf", "editor.active_line.background": "#21242bbf",
"editor.highlighted_line.background": "#21242bff", "editor.highlighted_line.background": "#21242bff",
"editor.line_number": "#565960", "editor.line_number": "#f7f7f859",
"editor.active_line_number": "#f8f8f9", "editor.active_line_number": "#f7f7f8ff",
"editor.hover_line_number": "#cbcdd0",
"editor.invisible": "#64646dff", "editor.invisible": "#64646dff",
"editor.wrap_guide": "#f7f7f80d", "editor.wrap_guide": "#f7f7f80d",
"editor.active_wrap_guide": "#f7f7f81a", "editor.active_wrap_guide": "#f7f7f81a",

View File

@@ -59,9 +59,8 @@
"editor.subheader.background": "#221f26ff", "editor.subheader.background": "#221f26ff",
"editor.active_line.background": "#221f26bf", "editor.active_line.background": "#221f26bf",
"editor.highlighted_line.background": "#221f26ff", "editor.highlighted_line.background": "#221f26ff",
"editor.line_number": "#656369", "editor.line_number": "#efecf459",
"editor.active_line_number": "#d8d8da", "editor.active_line_number": "#efecf4ff",
"editor.hover_line_number": "#b7b5ba",
"editor.invisible": "#726c7aff", "editor.invisible": "#726c7aff",
"editor.wrap_guide": "#efecf40d", "editor.wrap_guide": "#efecf40d",
"editor.active_wrap_guide": "#efecf41a", "editor.active_wrap_guide": "#efecf41a",
@@ -445,9 +444,8 @@
"editor.subheader.background": "#e6e3ebff", "editor.subheader.background": "#e6e3ebff",
"editor.active_line.background": "#e6e3ebbf", "editor.active_line.background": "#e6e3ebbf",
"editor.highlighted_line.background": "#e6e3ebff", "editor.highlighted_line.background": "#e6e3ebff",
"editor.line_number": "#a4a2a8", "editor.line_number": "#19171c59",
"editor.active_line_number": "#323135", "editor.active_line_number": "#19171cff",
"editor.hover_line_number": "#58565c",
"editor.invisible": "#726c7aff", "editor.invisible": "#726c7aff",
"editor.wrap_guide": "#19171c0d", "editor.wrap_guide": "#19171c0d",
"editor.active_wrap_guide": "#19171c1a", "editor.active_wrap_guide": "#19171c1a",
@@ -831,9 +829,8 @@
"editor.subheader.background": "#262622ff", "editor.subheader.background": "#262622ff",
"editor.active_line.background": "#262622bf", "editor.active_line.background": "#262622bf",
"editor.highlighted_line.background": "#262622ff", "editor.highlighted_line.background": "#262622ff",
"editor.line_number": "#6d6c66", "editor.line_number": "#fefbec59",
"editor.active_line_number": "#dadad7", "editor.active_line_number": "#fefbecff",
"editor.hover_line_number": "#bab9b5",
"editor.invisible": "#8b8773ff", "editor.invisible": "#8b8773ff",
"editor.wrap_guide": "#fefbec0d", "editor.wrap_guide": "#fefbec0d",
"editor.active_wrap_guide": "#fefbec1a", "editor.active_wrap_guide": "#fefbec1a",
@@ -1217,9 +1214,8 @@
"editor.subheader.background": "#eeebd7ff", "editor.subheader.background": "#eeebd7ff",
"editor.active_line.background": "#eeebd7bf", "editor.active_line.background": "#eeebd7bf",
"editor.highlighted_line.background": "#eeebd7ff", "editor.highlighted_line.background": "#eeebd7ff",
"editor.line_number": "#b1afa5", "editor.line_number": "#20201d59",
"editor.active_line_number": "#292824", "editor.active_line_number": "#20201dff",
"editor.hover_line_number": "#44433b",
"editor.invisible": "#8b8773ff", "editor.invisible": "#8b8773ff",
"editor.wrap_guide": "#20201d0d", "editor.wrap_guide": "#20201d0d",
"editor.active_wrap_guide": "#20201d1a", "editor.active_wrap_guide": "#20201d1a",
@@ -1603,9 +1599,8 @@
"editor.subheader.background": "#2c2b23ff", "editor.subheader.background": "#2c2b23ff",
"editor.active_line.background": "#2c2b23bf", "editor.active_line.background": "#2c2b23bf",
"editor.highlighted_line.background": "#2c2b23ff", "editor.highlighted_line.background": "#2c2b23ff",
"editor.line_number": "#6b6b65", "editor.line_number": "#f4f3ec59",
"editor.active_line_number": "#e6e6e5", "editor.active_line_number": "#f4f3ecff",
"editor.hover_line_number": "#babab6",
"editor.invisible": "#7a7867ff", "editor.invisible": "#7a7867ff",
"editor.wrap_guide": "#f4f3ec0d", "editor.wrap_guide": "#f4f3ec0d",
"editor.active_wrap_guide": "#f4f3ec1a", "editor.active_wrap_guide": "#f4f3ec1a",
@@ -1989,9 +1984,8 @@
"editor.subheader.background": "#ebeae3ff", "editor.subheader.background": "#ebeae3ff",
"editor.active_line.background": "#ebeae3bf", "editor.active_line.background": "#ebeae3bf",
"editor.highlighted_line.background": "#ebeae3ff", "editor.highlighted_line.background": "#ebeae3ff",
"editor.line_number": "#abaaa4", "editor.line_number": "#22221b59",
"editor.active_line_number": "#282725", "editor.active_line_number": "#22221bff",
"editor.hover_line_number": "#42423d",
"editor.invisible": "#7a7867ff", "editor.invisible": "#7a7867ff",
"editor.wrap_guide": "#22221b0d", "editor.wrap_guide": "#22221b0d",
"editor.active_wrap_guide": "#22221b1a", "editor.active_wrap_guide": "#22221b1a",
@@ -2375,9 +2369,8 @@
"editor.subheader.background": "#27211eff", "editor.subheader.background": "#27211eff",
"editor.active_line.background": "#27211ebf", "editor.active_line.background": "#27211ebf",
"editor.highlighted_line.background": "#27211eff", "editor.highlighted_line.background": "#27211eff",
"editor.line_number": "#656362k", "editor.line_number": "#f0eeed59",
"editor.active_line_number": "#e6e5e5", "editor.active_line_number": "#f0eeedff",
"editor.hover_line_number": "#b9b7b7",
"editor.invisible": "#89817dff", "editor.invisible": "#89817dff",
"editor.wrap_guide": "#f0eeed0d", "editor.wrap_guide": "#f0eeed0d",
"editor.active_wrap_guide": "#f0eeed1a", "editor.active_wrap_guide": "#f0eeed1a",
@@ -2761,9 +2754,8 @@
"editor.subheader.background": "#e9e6e4ff", "editor.subheader.background": "#e9e6e4ff",
"editor.active_line.background": "#e9e6e4bf", "editor.active_line.background": "#e9e6e4bf",
"editor.highlighted_line.background": "#e9e6e4ff", "editor.highlighted_line.background": "#e9e6e4ff",
"editor.line_number": "#a3a19f", "editor.line_number": "#1b191859",
"editor.active_line_number": "#272625", "editor.active_line_number": "#1b1918ff",
"editor.hover_line_number": "#4e4d4b",
"editor.invisible": "#89817dff", "editor.invisible": "#89817dff",
"editor.wrap_guide": "#1b19180d", "editor.wrap_guide": "#1b19180d",
"editor.active_wrap_guide": "#1b19181a", "editor.active_wrap_guide": "#1b19181a",
@@ -3147,9 +3139,8 @@
"editor.subheader.background": "#252025ff", "editor.subheader.background": "#252025ff",
"editor.active_line.background": "#252025bf", "editor.active_line.background": "#252025bf",
"editor.highlighted_line.background": "#252025ff", "editor.highlighted_line.background": "#252025ff",
"editor.line_number": "#555256", "editor.line_number": "#f7f3f759",
"editor.active_line_number": "#e6e5e6", "editor.active_line_number": "#f7f3f7ff",
"editor.hover_line_number": "#c0bec1",
"editor.invisible": "#8b7b8bff", "editor.invisible": "#8b7b8bff",
"editor.wrap_guide": "#f7f3f70d", "editor.wrap_guide": "#f7f3f70d",
"editor.active_wrap_guide": "#f7f3f71a", "editor.active_wrap_guide": "#f7f3f71a",
@@ -3533,9 +3524,8 @@
"editor.subheader.background": "#e0d5e0ff", "editor.subheader.background": "#e0d5e0ff",
"editor.active_line.background": "#e0d5e0bf", "editor.active_line.background": "#e0d5e0bf",
"editor.highlighted_line.background": "#e0d5e0ff", "editor.highlighted_line.background": "#e0d5e0ff",
"editor.line_number": "#a9a7aa", "editor.line_number": "#1b181b59",
"editor.active_line_number": "#262627", "editor.active_line_number": "#1b181bff",
"editor.hover_line_number": "#403f41",
"editor.invisible": "#8b7b8bff", "editor.invisible": "#8b7b8bff",
"editor.wrap_guide": "#1b181b0d", "editor.wrap_guide": "#1b181b0d",
"editor.active_wrap_guide": "#1b181b1a", "editor.active_wrap_guide": "#1b181b1a",
@@ -3919,9 +3909,8 @@
"editor.subheader.background": "#1c2529ff", "editor.subheader.background": "#1c2529ff",
"editor.active_line.background": "#1c2529bf", "editor.active_line.background": "#1c2529bf",
"editor.highlighted_line.background": "#1c2529ff", "editor.highlighted_line.background": "#1c2529ff",
"editor.line_number": "#61686ck", "editor.line_number": "#ebf8ff59",
"editor.active_line_number": "#eaebec", "editor.active_line_number": "#ebf8ffff",
"editor.hover_line_number": "#bcc0c3",
"editor.invisible": "#66889aff", "editor.invisible": "#66889aff",
"editor.wrap_guide": "#ebf8ff0d", "editor.wrap_guide": "#ebf8ff0d",
"editor.active_wrap_guide": "#ebf8ff1a", "editor.active_wrap_guide": "#ebf8ff1a",
@@ -4305,9 +4294,8 @@
"editor.subheader.background": "#cdeaf9ff", "editor.subheader.background": "#cdeaf9ff",
"editor.active_line.background": "#cdeaf9bf", "editor.active_line.background": "#cdeaf9bf",
"editor.highlighted_line.background": "#cdeaf9ff", "editor.highlighted_line.background": "#cdeaf9ff",
"editor.line_number": "#a3abafk", "editor.line_number": "#161b1d59",
"editor.active_line_number": "#242729", "editor.active_line_number": "#161b1dff",
"editor.hover_line_number": "#3b4144",
"editor.invisible": "#66889aff", "editor.invisible": "#66889aff",
"editor.wrap_guide": "#161b1d0d", "editor.wrap_guide": "#161b1d0d",
"editor.active_wrap_guide": "#161b1d1a", "editor.active_wrap_guide": "#161b1d1a",
@@ -4691,9 +4679,8 @@
"editor.subheader.background": "#252020ff", "editor.subheader.background": "#252020ff",
"editor.active_line.background": "#252020bf", "editor.active_line.background": "#252020bf",
"editor.highlighted_line.background": "#252020ff", "editor.highlighted_line.background": "#252020ff",
"editor.line_number": "#666262", "editor.line_number": "#f4ecec59",
"editor.active_line_number": "#e6e5e5", "editor.active_line_number": "#f4ececff",
"editor.hover_line_number": "#b9b6b6",
"editor.invisible": "#726a6aff", "editor.invisible": "#726a6aff",
"editor.wrap_guide": "#f4ecec0d", "editor.wrap_guide": "#f4ecec0d",
"editor.active_wrap_guide": "#f4ecec1a", "editor.active_wrap_guide": "#f4ecec1a",
@@ -5077,9 +5064,8 @@
"editor.subheader.background": "#ebe3e3ff", "editor.subheader.background": "#ebe3e3ff",
"editor.active_line.background": "#ebe3e3bf", "editor.active_line.background": "#ebe3e3bf",
"editor.highlighted_line.background": "#ebe3e3ff", "editor.highlighted_line.background": "#ebe3e3ff",
"editor.line_number": "#a7a2a2", "editor.line_number": "#1b181859",
"editor.active_line_number": "#272525", "editor.active_line_number": "#1b1818ff",
"editor.hover_line_number": "#3f3c3c",
"editor.invisible": "#726a6aff", "editor.invisible": "#726a6aff",
"editor.wrap_guide": "#1b18180d", "editor.wrap_guide": "#1b18180d",
"editor.active_wrap_guide": "#1b18181a", "editor.active_wrap_guide": "#1b18181a",
@@ -5463,9 +5449,8 @@
"editor.subheader.background": "#1f2621ff", "editor.subheader.background": "#1f2621ff",
"editor.active_line.background": "#1f2621bf", "editor.active_line.background": "#1f2621bf",
"editor.highlighted_line.background": "#1f2621ff", "editor.highlighted_line.background": "#1f2621ff",
"editor.line_number": "#626763", "editor.line_number": "#ecf4ee59",
"editor.active_line_number": "#e5e6e5", "editor.active_line_number": "#ecf4eeff",
"editor.hover_line_number": "#b6b9b7",
"editor.invisible": "#6c7a71ff", "editor.invisible": "#6c7a71ff",
"editor.wrap_guide": "#ecf4ee0d", "editor.wrap_guide": "#ecf4ee0d",
"editor.active_wrap_guide": "#ecf4ee1a", "editor.active_wrap_guide": "#ecf4ee1a",
@@ -5849,9 +5834,8 @@
"editor.subheader.background": "#e3ebe6ff", "editor.subheader.background": "#e3ebe6ff",
"editor.active_line.background": "#e3ebe6bf", "editor.active_line.background": "#e3ebe6bf",
"editor.highlighted_line.background": "#e3ebe6ff", "editor.highlighted_line.background": "#e3ebe6ff",
"editor.line_number": "#a3a9a4", "editor.line_number": "#171c1959",
"editor.active_line_number": "#252825", "editor.active_line_number": "#171c19ff",
"editor.hover_line_number": "#313532",
"editor.invisible": "#6c7a71ff", "editor.invisible": "#6c7a71ff",
"editor.wrap_guide": "#171c190d", "editor.wrap_guide": "#171c190d",
"editor.active_wrap_guide": "#171c191a", "editor.active_wrap_guide": "#171c191a",
@@ -6235,9 +6219,8 @@
"editor.subheader.background": "#1f231fff", "editor.subheader.background": "#1f231fff",
"editor.active_line.background": "#1f231fbf", "editor.active_line.background": "#1f231fbf",
"editor.highlighted_line.background": "#1f231fff", "editor.highlighted_line.background": "#1f231fff",
"editor.line_number": "#626561", "editor.line_number": "#f3faf359",
"editor.active_line_number": "#e5e6e5", "editor.active_line_number": "#f3faf3ff",
"editor.hover_line_number": "#b7b9b6",
"editor.invisible": "#738b73ff", "editor.invisible": "#738b73ff",
"editor.wrap_guide": "#f3faf30d", "editor.wrap_guide": "#f3faf30d",
"editor.active_wrap_guide": "#f3faf31a", "editor.active_wrap_guide": "#f3faf31a",
@@ -6621,9 +6604,8 @@
"editor.subheader.background": "#daeedaff", "editor.subheader.background": "#daeedaff",
"editor.active_line.background": "#daeedabf", "editor.active_line.background": "#daeedabf",
"editor.highlighted_line.background": "#daeedaff", "editor.highlighted_line.background": "#daeedaff",
"editor.line_number": "#a6aaa5", "editor.line_number": "#13151359",
"editor.active_line_number": "#262725", "editor.active_line_number": "#131513ff",
"editor.hover_line_number": "#3f423e",
"editor.invisible": "#738b73ff", "editor.invisible": "#738b73ff",
"editor.wrap_guide": "#1315130d", "editor.wrap_guide": "#1315130d",
"editor.active_wrap_guide": "#1315131a", "editor.active_wrap_guide": "#1315131a",
@@ -7007,9 +6989,8 @@
"editor.subheader.background": "#262f51ff", "editor.subheader.background": "#262f51ff",
"editor.active_line.background": "#262f51bf", "editor.active_line.background": "#262f51bf",
"editor.highlighted_line.background": "#262f51ff", "editor.highlighted_line.background": "#262f51ff",
"editor.line_number": "#6b6f85", "editor.line_number": "#f5f7ff59",
"editor.active_line_number": "#e3e4e8", "editor.active_line_number": "#f5f7ffff",
"editor.hover_line_number": "#b8bac6",
"editor.invisible": "#7a819cff", "editor.invisible": "#7a819cff",
"editor.wrap_guide": "#f5f7ff0d", "editor.wrap_guide": "#f5f7ff0d",
"editor.active_wrap_guide": "#f5f7ff1a", "editor.active_wrap_guide": "#f5f7ff1a",
@@ -7393,9 +7374,8 @@
"editor.subheader.background": "#e5e8f5ff", "editor.subheader.background": "#e5e8f5ff",
"editor.active_line.background": "#e5e8f5bf", "editor.active_line.background": "#e5e8f5bf",
"editor.highlighted_line.background": "#e5e8f5ff", "editor.highlighted_line.background": "#e5e8f5ff",
"editor.line_number": "#abaebd", "editor.line_number": "#20264659",
"editor.active_line_number": "#22232b", "editor.active_line_number": "#202646ff",
"editor.hover_line_number": "#434656",
"editor.invisible": "#7a819cff", "editor.invisible": "#7a819cff",
"editor.wrap_guide": "#2026460d", "editor.wrap_guide": "#2026460d",
"editor.active_wrap_guide": "#2026461a", "editor.active_wrap_guide": "#2026461a",

View File

@@ -59,9 +59,8 @@
"editor.subheader.background": "#1f2127ff", "editor.subheader.background": "#1f2127ff",
"editor.active_line.background": "#1f2127bf", "editor.active_line.background": "#1f2127bf",
"editor.highlighted_line.background": "#1f2127ff", "editor.highlighted_line.background": "#1f2127ff",
"editor.line_number": "#4b4c4e", "editor.line_number": "#bfbdb659",
"editor.active_line_number": "#cbcccd", "editor.active_line_number": "#bfbdb6ff",
"editor.hover_line_number": "#a1a2a5",
"editor.invisible": "#666767ff", "editor.invisible": "#666767ff",
"editor.wrap_guide": "#bfbdb60d", "editor.wrap_guide": "#bfbdb60d",
"editor.active_wrap_guide": "#bfbdb61a", "editor.active_wrap_guide": "#bfbdb61a",
@@ -430,9 +429,8 @@
"editor.subheader.background": "#ececedff", "editor.subheader.background": "#ececedff",
"editor.active_line.background": "#ececedbf", "editor.active_line.background": "#ececedbf",
"editor.highlighted_line.background": "#ececedff", "editor.highlighted_line.background": "#ececedff",
"editor.line_number": "#b0b3b5", "editor.line_number": "#5c616659",
"editor.active_line_number": "#313435", "editor.active_line_number": "#5c6166ff",
"editor.hover_line_number": "#62686a",
"editor.invisible": "#acafb1ff", "editor.invisible": "#acafb1ff",
"editor.wrap_guide": "#5c61660d", "editor.wrap_guide": "#5c61660d",
"editor.active_wrap_guide": "#5c61661a", "editor.active_wrap_guide": "#5c61661a",
@@ -801,9 +799,8 @@
"editor.subheader.background": "#353944ff", "editor.subheader.background": "#353944ff",
"editor.active_line.background": "#353944bf", "editor.active_line.background": "#353944bf",
"editor.highlighted_line.background": "#353944ff", "editor.highlighted_line.background": "#353944ff",
"editor.line_number": "#575c6b", "editor.line_number": "#cccac259",
"editor.active_line_number": "#e1e3ea", "editor.active_line_number": "#cccac2ff",
"editor.hover_line_number": "#b2b6c8",
"editor.invisible": "#787a7cff", "editor.invisible": "#787a7cff",
"editor.wrap_guide": "#cccac20d", "editor.wrap_guide": "#cccac20d",
"editor.active_wrap_guide": "#cccac21a", "editor.active_wrap_guide": "#cccac21a",

View File

@@ -68,9 +68,8 @@
"editor.subheader.background": "#3a3735ff", "editor.subheader.background": "#3a3735ff",
"editor.active_line.background": "#3a3735bf", "editor.active_line.background": "#3a3735bf",
"editor.highlighted_line.background": "#3a3735ff", "editor.highlighted_line.background": "#3a3735ff",
"editor.line_number": "#6e6b5e", "editor.line_number": "#fbf1c759",
"editor.active_line_number": "#dedcd3", "editor.active_line_number": "#fbf1c7ff",
"editor.hover_line_number": "#c9c5b6",
"editor.invisible": "#928474ff", "editor.invisible": "#928474ff",
"editor.wrap_guide": "#fbf1c70d", "editor.wrap_guide": "#fbf1c70d",
"editor.active_wrap_guide": "#fbf1c71a", "editor.active_wrap_guide": "#fbf1c71a",
@@ -453,9 +452,8 @@
"editor.subheader.background": "#393634ff", "editor.subheader.background": "#393634ff",
"editor.active_line.background": "#393634bf", "editor.active_line.background": "#393634bf",
"editor.highlighted_line.background": "#393634ff", "editor.highlighted_line.background": "#393634ff",
"editor.line_number": "#6e6b5e", "editor.line_number": "#fbf1c759",
"editor.active_line_number": "#dedcd3", "editor.active_line_number": "#fbf1c7ff",
"editor.hover_line_number": "#c9c5b6",
"editor.invisible": "#928474ff", "editor.invisible": "#928474ff",
"editor.wrap_guide": "#fbf1c70d", "editor.wrap_guide": "#fbf1c70d",
"editor.active_wrap_guide": "#fbf1c71a", "editor.active_wrap_guide": "#fbf1c71a",
@@ -838,9 +836,8 @@
"editor.subheader.background": "#3b3735ff", "editor.subheader.background": "#3b3735ff",
"editor.active_line.background": "#3b3735bf", "editor.active_line.background": "#3b3735bf",
"editor.highlighted_line.background": "#3b3735ff", "editor.highlighted_line.background": "#3b3735ff",
"editor.line_number": "#6e6b5e", "editor.line_number": "#fbf1c759",
"editor.active_line_number": "#dedcd3", "editor.active_line_number": "#fbf1c7ff",
"editor.hover_line_number": "#c9c5b6",
"editor.invisible": "#928474ff", "editor.invisible": "#928474ff",
"editor.wrap_guide": "#fbf1c70d", "editor.wrap_guide": "#fbf1c70d",
"editor.active_wrap_guide": "#fbf1c71a", "editor.active_wrap_guide": "#fbf1c71a",
@@ -1223,9 +1220,8 @@
"editor.subheader.background": "#ecddb4ff", "editor.subheader.background": "#ecddb4ff",
"editor.active_line.background": "#ecddb4bf", "editor.active_line.background": "#ecddb4bf",
"editor.highlighted_line.background": "#ecddb4ff", "editor.highlighted_line.background": "#ecddb4ff",
"editor.line_number": "#a9a389", "editor.line_number": "#28282859",
"editor.active_line_number": "#3b382b", "editor.active_line_number": "#282828ff",
"editor.hover_line_number": "#5e5a45",
"editor.invisible": "#928474ff", "editor.invisible": "#928474ff",
"editor.wrap_guide": "#2828280d", "editor.wrap_guide": "#2828280d",
"editor.active_wrap_guide": "#2828281a", "editor.active_wrap_guide": "#2828281a",
@@ -1608,9 +1604,8 @@
"editor.subheader.background": "#ecddb5ff", "editor.subheader.background": "#ecddb5ff",
"editor.active_line.background": "#ecddb5bf", "editor.active_line.background": "#ecddb5bf",
"editor.highlighted_line.background": "#ecddb5ff", "editor.highlighted_line.background": "#ecddb5ff",
"editor.line_number": "#a9a389", "editor.line_number": "#28282859",
"editor.active_line_number": "#3b382b", "editor.active_line_number": "#282828ff",
"editor.hover_line_number": "#5e5a45",
"editor.invisible": "#928474ff", "editor.invisible": "#928474ff",
"editor.wrap_guide": "#2828280d", "editor.wrap_guide": "#2828280d",
"editor.active_wrap_guide": "#2828281a", "editor.active_wrap_guide": "#2828281a",
@@ -1993,9 +1988,8 @@
"editor.subheader.background": "#ecdcb3ff", "editor.subheader.background": "#ecdcb3ff",
"editor.active_line.background": "#ecdcb3bf", "editor.active_line.background": "#ecdcb3bf",
"editor.highlighted_line.background": "#ecdcb3ff", "editor.highlighted_line.background": "#ecdcb3ff",
"editor.line_number": "#a9a389", "editor.line_number": "#28282859",
"editor.active_line_number": "#3b382b", "editor.active_line_number": "#282828ff",
"editor.hover_line_number": "#5e5a45",
"editor.invisible": "#928474ff", "editor.invisible": "#928474ff",
"editor.wrap_guide": "#2828280d", "editor.wrap_guide": "#2828280d",
"editor.active_wrap_guide": "#2828281a", "editor.active_wrap_guide": "#2828281a",

View File

@@ -9,7 +9,7 @@
"style": { "style": {
"border": "#464b57ff", "border": "#464b57ff",
"border.variant": "#363c46ff", "border.variant": "#363c46ff",
"border.focused": "#47679eff", "border.focused": "#293b5bff",
"border.selected": "#293b5bff", "border.selected": "#293b5bff",
"border.transparent": "#00000000", "border.transparent": "#00000000",
"border.disabled": "#414754ff", "border.disabled": "#414754ff",
@@ -59,9 +59,8 @@
"editor.subheader.background": "#2f343eff", "editor.subheader.background": "#2f343eff",
"editor.active_line.background": "#2f343ebf", "editor.active_line.background": "#2f343ebf",
"editor.highlighted_line.background": "#2f343eff", "editor.highlighted_line.background": "#2f343eff",
"editor.line_number": "#4e5a5f", "editor.line_number": "#c8ccd459",
"editor.active_line_number": "#d0d4da", "editor.active_line_number": "#dce0e5ff",
"editor.hover_line_number": "#acb0b4",
"editor.invisible": "#878a98ff", "editor.invisible": "#878a98ff",
"editor.wrap_guide": "#c8ccd40d", "editor.wrap_guide": "#c8ccd40d",
"editor.active_wrap_guide": "#c8ccd41a", "editor.active_wrap_guide": "#c8ccd41a",
@@ -385,7 +384,7 @@
"style": { "style": {
"border": "#c9c9caff", "border": "#c9c9caff",
"border.variant": "#dfdfe0ff", "border.variant": "#dfdfe0ff",
"border.focused": "#7d82e8ff", "border.focused": "#cbcdf6ff",
"border.selected": "#cbcdf6ff", "border.selected": "#cbcdf6ff",
"border.transparent": "#00000000", "border.transparent": "#00000000",
"border.disabled": "#d3d3d4ff", "border.disabled": "#d3d3d4ff",
@@ -435,9 +434,8 @@
"editor.subheader.background": "#ebebecff", "editor.subheader.background": "#ebebecff",
"editor.active_line.background": "#ebebecbf", "editor.active_line.background": "#ebebecbf",
"editor.highlighted_line.background": "#ebebecff", "editor.highlighted_line.background": "#ebebecff",
"editor.line_number": "#b4b4bb", "editor.line_number": "#383a4159",
"editor.active_line_number": "#44454b", "editor.active_line_number": "#242529ff",
"editor.hover_line_number": "#61616b",
"editor.invisible": "#a3a3a4ff", "editor.invisible": "#a3a3a4ff",
"editor.wrap_guide": "#383a410d", "editor.wrap_guide": "#383a410d",
"editor.active_wrap_guide": "#383a411a", "editor.active_wrap_guide": "#383a411a",

View File

@@ -59,9 +59,8 @@
"editor.subheader.background": "#1c1b2aff", "editor.subheader.background": "#1c1b2aff",
"editor.active_line.background": "#1c1b2abf", "editor.active_line.background": "#1c1b2abf",
"editor.highlighted_line.background": "#1c1b2aff", "editor.highlighted_line.background": "#1c1b2aff",
"editor.line_number": "#605e6e", "editor.line_number": "#e0def459",
"editor.active_line_number": "#c9c8d0", "editor.active_line_number": "#e0def4ff",
"editor.hover_line_number": "#aeadb8",
"editor.invisible": "#28253cff", "editor.invisible": "#28253cff",
"editor.wrap_guide": "#e0def40d", "editor.wrap_guide": "#e0def40d",
"editor.active_wrap_guide": "#e0def41a", "editor.active_wrap_guide": "#e0def41a",
@@ -440,9 +439,8 @@
"editor.subheader.background": "#fef9f2ff", "editor.subheader.background": "#fef9f2ff",
"editor.active_line.background": "#fef9f2bf", "editor.active_line.background": "#fef9f2bf",
"editor.highlighted_line.background": "#fef9f2ff", "editor.highlighted_line.background": "#fef9f2ff",
"editor.line_number": "#b4adb8", "editor.line_number": "#57527959",
"editor.active_line_number": "#4e4752", "editor.active_line_number": "#575279ff",
"editor.hover_line_number": "#685f6d",
"editor.invisible": "#9691a4ff", "editor.invisible": "#9691a4ff",
"editor.wrap_guide": "#5752790d", "editor.wrap_guide": "#5752790d",
"editor.active_wrap_guide": "#5752791a", "editor.active_wrap_guide": "#5752791a",
@@ -821,9 +819,8 @@
"editor.subheader.background": "#28253cff", "editor.subheader.background": "#28253cff",
"editor.active_line.background": "#28253cbf", "editor.active_line.background": "#28253cbf",
"editor.highlighted_line.background": "#28253cff", "editor.highlighted_line.background": "#28253cff",
"editor.line_number": "#6b697d", "editor.line_number": "#e0def459",
"editor.active_line_number": "#d6d5dc", "editor.active_line_number": "#e0def4ff",
"editor.hover_line_number": "#bbbac5",
"editor.invisible": "#595571ff", "editor.invisible": "#595571ff",
"editor.wrap_guide": "#e0def40d", "editor.wrap_guide": "#e0def40d",
"editor.active_wrap_guide": "#e0def41a", "editor.active_wrap_guide": "#e0def41a",

View File

@@ -59,9 +59,8 @@
"editor.subheader.background": "#2b3038ff", "editor.subheader.background": "#2b3038ff",
"editor.active_line.background": "#2b3038bf", "editor.active_line.background": "#2b3038bf",
"editor.highlighted_line.background": "#2b3038ff", "editor.highlighted_line.background": "#2b3038ff",
"editor.line_number": "#6b6b61", "editor.line_number": "#fdf4c159",
"editor.active_line_number": "#dbdbd7", "editor.active_line_number": "#fdf4c1ff",
"editor.hover_line_number": "#b6b6af",
"editor.invisible": "#7c6f64ff", "editor.invisible": "#7c6f64ff",
"editor.wrap_guide": "#fdf4c10d", "editor.wrap_guide": "#fdf4c10d",
"editor.active_wrap_guide": "#fdf4c11a", "editor.active_wrap_guide": "#fdf4c11a",

View File

@@ -59,9 +59,8 @@
"editor.subheader.background": "#04313bff", "editor.subheader.background": "#04313bff",
"editor.active_line.background": "#04313bbf", "editor.active_line.background": "#04313bbf",
"editor.highlighted_line.background": "#04313bff", "editor.highlighted_line.background": "#04313bff",
"editor.line_number": "#5a6d6f", "editor.line_number": "#fdf6e359",
"editor.active_line_number": "#e3e8e8", "editor.active_line_number": "#fdf6e3ff",
"editor.hover_line_number": "#abb9ba",
"editor.invisible": "#6c8287ff", "editor.invisible": "#6c8287ff",
"editor.wrap_guide": "#fdf6e30d", "editor.wrap_guide": "#fdf6e30d",
"editor.active_wrap_guide": "#fdf6e31a", "editor.active_wrap_guide": "#fdf6e31a",
@@ -430,9 +429,8 @@
"editor.subheader.background": "#f3eddaff", "editor.subheader.background": "#f3eddaff",
"editor.active_line.background": "#f3eddabf", "editor.active_line.background": "#f3eddabf",
"editor.highlighted_line.background": "#f3eddaff", "editor.highlighted_line.background": "#f3eddaff",
"editor.line_number": "#a8ad9f", "editor.line_number": "#002a3559",
"editor.active_line_number": "#272923", "editor.active_line_number": "#002a35ff",
"editor.hover_line_number": "#42453b",
"editor.invisible": "#6c8287ff", "editor.invisible": "#6c8287ff",
"editor.wrap_guide": "#002a350d", "editor.wrap_guide": "#002a350d",
"editor.active_wrap_guide": "#002a351a", "editor.active_wrap_guide": "#002a351a",

View File

@@ -59,9 +59,8 @@
"editor.subheader.background": "#231f16ff", "editor.subheader.background": "#231f16ff",
"editor.active_line.background": "#231f16bf", "editor.active_line.background": "#231f16bf",
"editor.highlighted_line.background": "#231f16ff", "editor.highlighted_line.background": "#231f16ff",
"editor.line_number": "#676559", "editor.line_number": "#f8f5de59",
"editor.active_line_number": "#e3e2de", "editor.active_line_number": "#f8f5deff",
"editor.hover_line_number": "#b8b6ad",
"editor.invisible": "#494433ff", "editor.invisible": "#494433ff",
"editor.wrap_guide": "#f8f5de0d", "editor.wrap_guide": "#f8f5de0d",
"editor.active_wrap_guide": "#f8f5de1a", "editor.active_wrap_guide": "#f8f5de1a",

View File

@@ -1,8 +1,8 @@
[package] [package]
name = "activity_indicator" name = "activity_indicator"
version = "0.1.0" version = "0.1.0"
edition.workspace = true edition = "2021"
publish.workspace = true publish = false
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
[lints] [lints]

View File

@@ -3,9 +3,9 @@ use editor::Editor;
use extension_host::ExtensionStore; use extension_host::ExtensionStore;
use futures::StreamExt; use futures::StreamExt;
use gpui::{ use gpui::{
actions, percentage, Animation, AnimationExt as _, App, Context, CursorStyle, Entity, actions, percentage, Animation, AnimationExt as _, AppContext, CursorStyle, EventEmitter,
EventEmitter, InteractiveElement as _, ParentElement as _, Render, SharedString, InteractiveElement as _, Model, ParentElement as _, Render, SharedString,
StatefulInteractiveElement, Styled, Transformation, Window, StatefulInteractiveElement, Styled, Transformation, View, ViewContext, VisualContext as _,
}; };
use language::{LanguageRegistry, LanguageServerBinaryStatus, LanguageServerId}; use language::{LanguageRegistry, LanguageServerBinaryStatus, LanguageServerId};
use lsp::LanguageServerName; use lsp::LanguageServerName;
@@ -27,8 +27,8 @@ pub enum Event {
pub struct ActivityIndicator { pub struct ActivityIndicator {
statuses: Vec<LspStatus>, statuses: Vec<LspStatus>,
project: Entity<Project>, project: Model<Project>,
auto_updater: Option<Entity<AutoUpdater>>, auto_updater: Option<Model<AutoUpdater>>,
context_menu_handle: PopoverMenuHandle<ContextMenu>, context_menu_handle: PopoverMenuHandle<ContextMenu>,
} }
@@ -46,24 +46,22 @@ struct PendingWork<'a> {
struct Content { struct Content {
icon: Option<gpui::AnyElement>, icon: Option<gpui::AnyElement>,
message: String, message: String,
on_click: on_click: Option<Arc<dyn Fn(&mut ActivityIndicator, &mut ViewContext<ActivityIndicator>)>>,
Option<Arc<dyn Fn(&mut ActivityIndicator, &mut Window, &mut Context<ActivityIndicator>)>>,
} }
impl ActivityIndicator { impl ActivityIndicator {
pub fn new( pub fn new(
workspace: &mut Workspace, workspace: &mut Workspace,
languages: Arc<LanguageRegistry>, languages: Arc<LanguageRegistry>,
window: &mut Window, cx: &mut ViewContext<Workspace>,
cx: &mut Context<Workspace>, ) -> View<ActivityIndicator> {
) -> Entity<ActivityIndicator> {
let project = workspace.project().clone(); let project = workspace.project().clone();
let auto_updater = AutoUpdater::get(cx); let auto_updater = AutoUpdater::get(cx);
let this = cx.new(|cx| { let this = cx.new_view(|cx: &mut ViewContext<Self>| {
let mut status_events = languages.language_server_binary_statuses(); let mut status_events = languages.language_server_binary_statuses();
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
while let Some((name, status)) = status_events.next().await { while let Some((name, status)) = status_events.next().await {
this.update(&mut cx, |this: &mut ActivityIndicator, cx| { this.update(&mut cx, |this, cx| {
this.statuses.retain(|s| s.name != name); this.statuses.retain(|s| s.name != name);
this.statuses.push(LspStatus { name, status }); this.statuses.push(LspStatus { name, status });
cx.notify(); cx.notify();
@@ -72,7 +70,6 @@ impl ActivityIndicator {
anyhow::Ok(()) anyhow::Ok(())
}) })
.detach(); .detach();
cx.observe(&project, |_, _, cx| cx.notify()).detach(); cx.observe(&project, |_, _, cx| cx.notify()).detach();
if let Some(auto_updater) = auto_updater.as_ref() { if let Some(auto_updater) = auto_updater.as_ref() {
@@ -87,13 +84,13 @@ impl ActivityIndicator {
} }
}); });
cx.subscribe_in(&this, window, move |_, _, event, window, cx| match event { cx.subscribe(&this, move |_, _, event, cx| match event {
Event::ShowError { lsp_name, error } => { Event::ShowError { lsp_name, error } => {
let create_buffer = project.update(cx, |project, cx| project.create_buffer(cx)); let create_buffer = project.update(cx, |project, cx| project.create_buffer(cx));
let project = project.clone(); let project = project.clone();
let error = error.clone(); let error = error.clone();
let lsp_name = lsp_name.clone(); let lsp_name = lsp_name.clone();
cx.spawn_in(window, |workspace, mut cx| async move { cx.spawn(|workspace, mut cx| async move {
let buffer = create_buffer.await?; let buffer = create_buffer.await?;
buffer.update(&mut cx, |buffer, cx| { buffer.update(&mut cx, |buffer, cx| {
buffer.edit( buffer.edit(
@@ -106,14 +103,13 @@ impl ActivityIndicator {
); );
buffer.set_capability(language::Capability::ReadOnly, cx); buffer.set_capability(language::Capability::ReadOnly, cx);
})?; })?;
workspace.update_in(&mut cx, |workspace, window, cx| { workspace.update(&mut cx, |workspace, cx| {
workspace.add_item_to_active_pane( workspace.add_item_to_active_pane(
Box::new(cx.new(|cx| { Box::new(cx.new_view(|cx| {
Editor::for_buffer(buffer, Some(project.clone()), window, cx) Editor::for_buffer(buffer, Some(project.clone()), cx)
})), })),
None, None,
true, true,
window,
cx, cx,
); );
})?; })?;
@@ -127,7 +123,7 @@ impl ActivityIndicator {
this this
} }
fn show_error_message(&mut self, _: &ShowErrorMessage, _: &mut Window, cx: &mut Context<Self>) { fn show_error_message(&mut self, _: &ShowErrorMessage, cx: &mut ViewContext<Self>) {
self.statuses.retain(|status| { self.statuses.retain(|status| {
if let LanguageServerBinaryStatus::Failed { error } = &status.status { if let LanguageServerBinaryStatus::Failed { error } = &status.status {
cx.emit(Event::ShowError { cx.emit(Event::ShowError {
@@ -143,12 +139,7 @@ impl ActivityIndicator {
cx.notify(); cx.notify();
} }
fn dismiss_error_message( fn dismiss_error_message(&mut self, _: &DismissErrorMessage, cx: &mut ViewContext<Self>) {
&mut self,
_: &DismissErrorMessage,
_: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(updater) = &self.auto_updater { if let Some(updater) = &self.auto_updater {
updater.update(cx, |updater, cx| { updater.update(cx, |updater, cx| {
updater.dismiss_error(cx); updater.dismiss_error(cx);
@@ -159,7 +150,7 @@ impl ActivityIndicator {
fn pending_language_server_work<'a>( fn pending_language_server_work<'a>(
&self, &self,
cx: &'a App, cx: &'a AppContext,
) -> impl Iterator<Item = PendingWork<'a>> { ) -> impl Iterator<Item = PendingWork<'a>> {
self.project self.project
.read(cx) .read(cx)
@@ -187,12 +178,12 @@ impl ActivityIndicator {
fn pending_environment_errors<'a>( fn pending_environment_errors<'a>(
&'a self, &'a self,
cx: &'a App, cx: &'a AppContext,
) -> impl Iterator<Item = (&'a WorktreeId, &'a EnvironmentErrorMessage)> { ) -> impl Iterator<Item = (&'a WorktreeId, &'a EnvironmentErrorMessage)> {
self.project.read(cx).shell_environment_errors(cx) self.project.read(cx).shell_environment_errors(cx)
} }
fn content_to_render(&mut self, cx: &mut Context<Self>) -> Option<Content> { fn content_to_render(&mut self, cx: &mut ViewContext<Self>) -> Option<Content> {
// Show if any direnv calls failed // Show if any direnv calls failed
if let Some((&worktree_id, error)) = self.pending_environment_errors(cx).next() { if let Some((&worktree_id, error)) = self.pending_environment_errors(cx).next() {
return Some(Content { return Some(Content {
@@ -202,11 +193,11 @@ impl ActivityIndicator {
.into_any_element(), .into_any_element(),
), ),
message: error.0.clone(), message: error.0.clone(),
on_click: Some(Arc::new(move |this, window, cx| { on_click: Some(Arc::new(move |this, cx| {
this.project.update(cx, |project, cx| { this.project.update(cx, |project, cx| {
project.remove_environment_error(cx, worktree_id); project.remove_environment_error(cx, worktree_id);
}); });
window.dispatch_action(Box::new(workspace::OpenLog), cx); cx.dispatch_action(Box::new(workspace::OpenLog));
})), })),
}); });
} }
@@ -289,10 +280,10 @@ impl ActivityIndicator {
} }
) )
), ),
on_click: Some(Arc::new(move |this, window, cx| { on_click: Some(Arc::new(move |this, cx| {
this.statuses this.statuses
.retain(|status| !downloading.contains(&status.name)); .retain(|status| !downloading.contains(&status.name));
this.dismiss_error_message(&DismissErrorMessage, window, cx) this.dismiss_error_message(&DismissErrorMessage, cx)
})), })),
}); });
} }
@@ -317,10 +308,10 @@ impl ActivityIndicator {
} }
), ),
), ),
on_click: Some(Arc::new(move |this, window, cx| { on_click: Some(Arc::new(move |this, cx| {
this.statuses this.statuses
.retain(|status| !checking_for_update.contains(&status.name)); .retain(|status| !checking_for_update.contains(&status.name));
this.dismiss_error_message(&DismissErrorMessage, window, cx) this.dismiss_error_message(&DismissErrorMessage, cx)
})), })),
}); });
} }
@@ -345,8 +336,8 @@ impl ActivityIndicator {
acc acc
}), }),
), ),
on_click: Some(Arc::new(|this, window, cx| { on_click: Some(Arc::new(|this, cx| {
this.show_error_message(&Default::default(), window, cx) this.show_error_message(&Default::default(), cx)
})), })),
}); });
} }
@@ -360,11 +351,11 @@ impl ActivityIndicator {
.into_any_element(), .into_any_element(),
), ),
message: format!("Formatting failed: {}. Click to see logs.", failure), message: format!("Formatting failed: {}. Click to see logs.", failure),
on_click: Some(Arc::new(|indicator, window, cx| { on_click: Some(Arc::new(|indicator, cx| {
indicator.project.update(cx, |project, cx| { indicator.project.update(cx, |project, cx| {
project.reset_last_formatting_failure(cx); project.reset_last_formatting_failure(cx);
}); });
window.dispatch_action(Box::new(workspace::OpenLog), cx); cx.dispatch_action(Box::new(workspace::OpenLog));
})), })),
}); });
} }
@@ -379,8 +370,8 @@ impl ActivityIndicator {
.into_any_element(), .into_any_element(),
), ),
message: "Checking for Zed updates…".to_string(), message: "Checking for Zed updates…".to_string(),
on_click: Some(Arc::new(|this, window, cx| { on_click: Some(Arc::new(|this, cx| {
this.dismiss_error_message(&DismissErrorMessage, window, cx) this.dismiss_error_message(&DismissErrorMessage, cx)
})), })),
}), }),
AutoUpdateStatus::Downloading => Some(Content { AutoUpdateStatus::Downloading => Some(Content {
@@ -390,8 +381,8 @@ impl ActivityIndicator {
.into_any_element(), .into_any_element(),
), ),
message: "Downloading Zed update…".to_string(), message: "Downloading Zed update…".to_string(),
on_click: Some(Arc::new(|this, window, cx| { on_click: Some(Arc::new(|this, cx| {
this.dismiss_error_message(&DismissErrorMessage, window, cx) this.dismiss_error_message(&DismissErrorMessage, cx)
})), })),
}), }),
AutoUpdateStatus::Installing => Some(Content { AutoUpdateStatus::Installing => Some(Content {
@@ -401,8 +392,8 @@ impl ActivityIndicator {
.into_any_element(), .into_any_element(),
), ),
message: "Installing Zed update…".to_string(), message: "Installing Zed update…".to_string(),
on_click: Some(Arc::new(|this, window, cx| { on_click: Some(Arc::new(|this, cx| {
this.dismiss_error_message(&DismissErrorMessage, window, cx) this.dismiss_error_message(&DismissErrorMessage, cx)
})), })),
}), }),
AutoUpdateStatus::Updated { binary_path } => Some(Content { AutoUpdateStatus::Updated { binary_path } => Some(Content {
@@ -412,7 +403,7 @@ impl ActivityIndicator {
let reload = workspace::Reload { let reload = workspace::Reload {
binary_path: Some(binary_path.clone()), binary_path: Some(binary_path.clone()),
}; };
move |_, _, cx| workspace::reload(&reload, cx) move |_, cx| workspace::reload(&reload, cx)
})), })),
}), }),
AutoUpdateStatus::Errored => Some(Content { AutoUpdateStatus::Errored => Some(Content {
@@ -422,8 +413,8 @@ impl ActivityIndicator {
.into_any_element(), .into_any_element(),
), ),
message: "Auto update failed".to_string(), message: "Auto update failed".to_string(),
on_click: Some(Arc::new(|this, window, cx| { on_click: Some(Arc::new(|this, cx| {
this.dismiss_error_message(&DismissErrorMessage, window, cx) this.dismiss_error_message(&DismissErrorMessage, cx)
})), })),
}), }),
AutoUpdateStatus::Idle => None, AutoUpdateStatus::Idle => None,
@@ -441,8 +432,8 @@ impl ActivityIndicator {
.into_any_element(), .into_any_element(),
), ),
message: format!("Updating {extension_id} extension…"), message: format!("Updating {extension_id} extension…"),
on_click: Some(Arc::new(|this, window, cx| { on_click: Some(Arc::new(|this, cx| {
this.dismiss_error_message(&DismissErrorMessage, window, cx) this.dismiss_error_message(&DismissErrorMessage, cx)
})), })),
}); });
} }
@@ -451,12 +442,8 @@ impl ActivityIndicator {
None None
} }
fn toggle_language_server_work_context_menu( fn toggle_language_server_work_context_menu(&mut self, cx: &mut ViewContext<Self>) {
&mut self, self.context_menu_handle.toggle(cx);
window: &mut Window,
cx: &mut Context<Self>,
) {
self.context_menu_handle.toggle(window, cx);
} }
} }
@@ -465,7 +452,7 @@ impl EventEmitter<Event> for ActivityIndicator {}
const MAX_MESSAGE_LEN: usize = 50; const MAX_MESSAGE_LEN: usize = 50;
impl Render for ActivityIndicator { impl Render for ActivityIndicator {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement { fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let result = h_flex() let result = h_flex()
.id("activity-indicator") .id("activity-indicator")
.on_action(cx.listener(Self::show_error_message)) .on_action(cx.listener(Self::show_error_message))
@@ -473,7 +460,7 @@ impl Render for ActivityIndicator {
let Some(content) = self.content_to_render(cx) else { let Some(content) = self.content_to_render(cx) else {
return result; return result;
}; };
let this = cx.entity().downgrade(); let this = cx.view().downgrade();
let truncate_content = content.message.len() > MAX_MESSAGE_LEN; let truncate_content = content.message.len() > MAX_MESSAGE_LEN;
result.gap_2().child( result.gap_2().child(
PopoverMenu::new("activity-indicator-popover") PopoverMenu::new("activity-indicator-popover")
@@ -493,24 +480,24 @@ impl Render for ActivityIndicator {
)) ))
.size(LabelSize::Small), .size(LabelSize::Small),
) )
.tooltip(Tooltip::text(content.message)) .tooltip(move |cx| Tooltip::text(&content.message, cx))
} else { } else {
button.child(Label::new(content.message).size(LabelSize::Small)) button.child(Label::new(content.message).size(LabelSize::Small))
} }
}) })
.when_some(content.on_click, |this, handler| { .when_some(content.on_click, |this, handler| {
this.on_click(cx.listener(move |this, _, window, cx| { this.on_click(cx.listener(move |this, _, cx| {
handler(this, window, cx); handler(this, cx);
})) }))
.cursor(CursorStyle::PointingHand) .cursor(CursorStyle::PointingHand)
}), }),
), ),
) )
.anchor(gpui::Corner::BottomLeft) .anchor(gpui::AnchorCorner::BottomLeft)
.menu(move |window, cx| { .menu(move |cx| {
let strong_this = this.upgrade()?; let strong_this = this.upgrade()?;
let mut has_work = false; let mut has_work = false;
let menu = ContextMenu::build(window, cx, |mut menu, _, cx| { let menu = ContextMenu::build(cx, |mut menu, cx| {
for work in strong_this.read(cx).pending_language_server_work(cx) { for work in strong_this.read(cx).pending_language_server_work(cx) {
has_work = true; has_work = true;
let this = this.clone(); let this = this.clone();
@@ -526,7 +513,7 @@ impl Render for ActivityIndicator {
let token = work.progress_token.to_string(); let token = work.progress_token.to_string();
let title = SharedString::from(title); let title = SharedString::from(title);
menu = menu.custom_entry( menu = menu.custom_entry(
move |_, _| { move |_| {
h_flex() h_flex()
.w_full() .w_full()
.justify_between() .justify_between()
@@ -534,7 +521,7 @@ impl Render for ActivityIndicator {
.child(Icon::new(IconName::XCircle)) .child(Icon::new(IconName::XCircle))
.into_any_element() .into_any_element()
}, },
move |_, cx| { move |cx| {
this.update(cx, |this, cx| { this.update(cx, |this, cx| {
this.project.update(cx, |project, cx| { this.project.update(cx, |project, cx| {
project.cancel_language_server_work( project.cancel_language_server_work(
@@ -567,11 +554,5 @@ impl Render for ActivityIndicator {
} }
impl StatusItemView for ActivityIndicator { impl StatusItemView for ActivityIndicator {
fn set_active_pane_item( fn set_active_pane_item(&mut self, _: Option<&dyn ItemHandle>, _: &mut ViewContext<Self>) {}
&mut self,
_: Option<&dyn ItemHandle>,
_window: &mut Window,
_: &mut Context<Self>,
) {
}
} }

View File

@@ -1,9 +1,9 @@
[package] [package]
name = "anthropic" name = "anthropic"
version = "0.1.0" version = "0.1.0"
edition.workspace = true edition = "2021"
publish.workspace = true publish = false
license = "GPL-3.0-or-later" license = "AGPL-3.0-or-later"
[features] [features]
default = [] default = []

View File

@@ -0,0 +1 @@
../../LICENSE-AGPL

View File

@@ -1 +0,0 @@
../../LICENSE-GPL

View File

@@ -2,7 +2,7 @@ mod supported_countries;
use std::{pin::Pin, str::FromStr}; use std::{pin::Pin, str::FromStr};
use anyhow::{anyhow, Context as _, Result}; use anyhow::{anyhow, Context, Result};
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, Stream, StreamExt}; use futures::{io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, Stream, StreamExt};
use http_client::http::{HeaderMap, HeaderValue}; use http_client::http::{HeaderMap, HeaderValue};
@@ -30,8 +30,6 @@ pub enum Model {
#[default] #[default]
#[serde(rename = "claude-3-5-sonnet", alias = "claude-3-5-sonnet-latest")] #[serde(rename = "claude-3-5-sonnet", alias = "claude-3-5-sonnet-latest")]
Claude3_5Sonnet, Claude3_5Sonnet,
#[serde(rename = "claude-3-5-haiku", alias = "claude-3-5-haiku-latest")]
Claude3_5Haiku,
#[serde(rename = "claude-3-opus", alias = "claude-3-opus-latest")] #[serde(rename = "claude-3-opus", alias = "claude-3-opus-latest")]
Claude3Opus, Claude3Opus,
#[serde(rename = "claude-3-sonnet", alias = "claude-3-sonnet-latest")] #[serde(rename = "claude-3-sonnet", alias = "claude-3-sonnet-latest")]
@@ -50,8 +48,6 @@ pub enum Model {
cache_configuration: Option<AnthropicModelCacheConfiguration>, cache_configuration: Option<AnthropicModelCacheConfiguration>,
max_output_tokens: Option<u32>, max_output_tokens: Option<u32>,
default_temperature: Option<f32>, default_temperature: Option<f32>,
#[serde(default)]
extra_beta_headers: Vec<String>,
}, },
} }
@@ -59,8 +55,6 @@ impl Model {
pub fn from_id(id: &str) -> Result<Self> { pub fn from_id(id: &str) -> Result<Self> {
if id.starts_with("claude-3-5-sonnet") { if id.starts_with("claude-3-5-sonnet") {
Ok(Self::Claude3_5Sonnet) Ok(Self::Claude3_5Sonnet)
} else if id.starts_with("claude-3-5-haiku") {
Ok(Self::Claude3_5Haiku)
} else if id.starts_with("claude-3-opus") { } else if id.starts_with("claude-3-opus") {
Ok(Self::Claude3Opus) Ok(Self::Claude3Opus)
} else if id.starts_with("claude-3-sonnet") { } else if id.starts_with("claude-3-sonnet") {
@@ -75,10 +69,9 @@ impl Model {
pub fn id(&self) -> &str { pub fn id(&self) -> &str {
match self { match self {
Model::Claude3_5Sonnet => "claude-3-5-sonnet-latest", Model::Claude3_5Sonnet => "claude-3-5-sonnet-latest",
Model::Claude3_5Haiku => "claude-3-5-haiku-latest",
Model::Claude3Opus => "claude-3-opus-latest", Model::Claude3Opus => "claude-3-opus-latest",
Model::Claude3Sonnet => "claude-3-sonnet-20240229", Model::Claude3Sonnet => "claude-3-sonnet-latest",
Model::Claude3Haiku => "claude-3-haiku-20240307", Model::Claude3Haiku => "claude-3-haiku-latest",
Self::Custom { name, .. } => name, Self::Custom { name, .. } => name,
} }
} }
@@ -86,7 +79,6 @@ impl Model {
pub fn display_name(&self) -> &str { pub fn display_name(&self) -> &str {
match self { match self {
Self::Claude3_5Sonnet => "Claude 3.5 Sonnet", Self::Claude3_5Sonnet => "Claude 3.5 Sonnet",
Self::Claude3_5Haiku => "Claude 3.5 Haiku",
Self::Claude3Opus => "Claude 3 Opus", Self::Claude3Opus => "Claude 3 Opus",
Self::Claude3Sonnet => "Claude 3 Sonnet", Self::Claude3Sonnet => "Claude 3 Sonnet",
Self::Claude3Haiku => "Claude 3 Haiku", Self::Claude3Haiku => "Claude 3 Haiku",
@@ -98,13 +90,11 @@ impl Model {
pub fn cache_configuration(&self) -> Option<AnthropicModelCacheConfiguration> { pub fn cache_configuration(&self) -> Option<AnthropicModelCacheConfiguration> {
match self { match self {
Self::Claude3_5Sonnet | Self::Claude3_5Haiku | Self::Claude3Haiku => { Self::Claude3_5Sonnet | Self::Claude3Haiku => Some(AnthropicModelCacheConfiguration {
Some(AnthropicModelCacheConfiguration { min_total_token: 2_048,
min_total_token: 2_048, should_speculate: true,
should_speculate: true, max_cache_anchors: 4,
max_cache_anchors: 4, }),
})
}
Self::Custom { Self::Custom {
cache_configuration, cache_configuration,
.. ..
@@ -116,7 +106,6 @@ impl Model {
pub fn max_token_count(&self) -> usize { pub fn max_token_count(&self) -> usize {
match self { match self {
Self::Claude3_5Sonnet Self::Claude3_5Sonnet
| Self::Claude3_5Haiku
| Self::Claude3Opus | Self::Claude3Opus
| Self::Claude3Sonnet | Self::Claude3Sonnet
| Self::Claude3Haiku => 200_000, | Self::Claude3Haiku => 200_000,
@@ -127,7 +116,7 @@ impl Model {
pub fn max_output_tokens(&self) -> u32 { pub fn max_output_tokens(&self) -> u32 {
match self { match self {
Self::Claude3Opus | Self::Claude3Sonnet | Self::Claude3Haiku => 4_096, Self::Claude3Opus | Self::Claude3Sonnet | Self::Claude3Haiku => 4_096,
Self::Claude3_5Sonnet | Self::Claude3_5Haiku => 8_192, Self::Claude3_5Sonnet => 8_192,
Self::Custom { Self::Custom {
max_output_tokens, .. max_output_tokens, ..
} => max_output_tokens.unwrap_or(4_096), } => max_output_tokens.unwrap_or(4_096),
@@ -137,7 +126,6 @@ impl Model {
pub fn default_temperature(&self) -> f32 { pub fn default_temperature(&self) -> f32 {
match self { match self {
Self::Claude3_5Sonnet Self::Claude3_5Sonnet
| Self::Claude3_5Haiku
| Self::Claude3Opus | Self::Claude3Opus
| Self::Claude3Sonnet | Self::Claude3Sonnet
| Self::Claude3Haiku => 1.0, | Self::Claude3Haiku => 1.0,
@@ -148,29 +136,6 @@ impl Model {
} }
} }
pub const DEFAULT_BETA_HEADERS: &[&str] = &["prompt-caching-2024-07-31"];
pub fn beta_headers(&self) -> String {
let mut headers = Self::DEFAULT_BETA_HEADERS
.into_iter()
.map(|header| header.to_string())
.collect::<Vec<_>>();
if let Self::Custom {
extra_beta_headers, ..
} = self
{
headers.extend(
extra_beta_headers
.iter()
.filter(|header| !header.trim().is_empty())
.cloned(),
);
}
headers.join(",")
}
pub fn tool_model_id(&self) -> &str { pub fn tool_model_id(&self) -> &str {
if let Self::Custom { if let Self::Custom {
tool_override: Some(tool_override), tool_override: Some(tool_override),
@@ -191,14 +156,11 @@ pub async fn complete(
request: Request, request: Request,
) -> Result<Response, AnthropicError> { ) -> Result<Response, AnthropicError> {
let uri = format!("{api_url}/v1/messages"); let uri = format!("{api_url}/v1/messages");
let beta_headers = Model::from_id(&request.model)
.map(|model| model.beta_headers())
.unwrap_or_else(|_err| Model::DEFAULT_BETA_HEADERS.join(","));
let request_builder = HttpRequest::builder() let request_builder = HttpRequest::builder()
.method(Method::POST) .method(Method::POST)
.uri(uri) .uri(uri)
.header("Anthropic-Version", "2023-06-01") .header("Anthropic-Version", "2023-06-01")
.header("Anthropic-Beta", beta_headers) .header("Anthropic-Beta", "prompt-caching-2024-07-31")
.header("X-Api-Key", api_key) .header("X-Api-Key", api_key)
.header("Content-Type", "application/json"); .header("Content-Type", "application/json");
@@ -309,14 +271,14 @@ pub async fn stream_completion_with_rate_limit_info(
stream: true, stream: true,
}; };
let uri = format!("{api_url}/v1/messages"); let uri = format!("{api_url}/v1/messages");
let beta_headers = Model::from_id(&request.base.model)
.map(|model| model.beta_headers())
.unwrap_or_else(|_err| Model::DEFAULT_BETA_HEADERS.join(","));
let request_builder = HttpRequest::builder() let request_builder = HttpRequest::builder()
.method(Method::POST) .method(Method::POST)
.uri(uri) .uri(uri)
.header("Anthropic-Version", "2023-06-01") .header("Anthropic-Version", "2023-06-01")
.header("Anthropic-Beta", beta_headers) .header(
"Anthropic-Beta",
"tools-2024-04-04,prompt-caching-2024-07-31,max-tokens-3-5-sonnet-2024-07-15",
)
.header("X-Api-Key", api_key) .header("X-Api-Key", api_key)
.header("Content-Type", "application/json"); .header("Content-Type", "application/json");
let serialized_request = let serialized_request =

View File

@@ -1,8 +1,8 @@
[package] [package]
name = "assets" name = "assets"
version = "0.1.0" version = "0.1.0"
edition.workspace = true edition = "2021"
publish.workspace = true publish = false
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
[lib] [lib]

View File

@@ -1,7 +1,7 @@
// This crate was essentially pulled out verbatim from main `zed` crate to avoid having to run RustEmbed macro whenever zed has to be rebuilt. It saves a second or two on an incremental build. // This crate was essentially pulled out verbatim from main `zed` crate to avoid having to run RustEmbed macro whenever zed has to be rebuilt. It saves a second or two on an incremental build.
use anyhow::anyhow; use anyhow::anyhow;
use gpui::{App, AssetSource, Result, SharedString}; use gpui::{AppContext, AssetSource, Result, SharedString};
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
#[derive(RustEmbed)] #[derive(RustEmbed)]
@@ -39,7 +39,7 @@ impl AssetSource for Assets {
impl Assets { impl Assets {
/// Populate the [`TextSystem`] of the given [`AppContext`] with all `.ttf` fonts in the `fonts` directory. /// Populate the [`TextSystem`] of the given [`AppContext`] with all `.ttf` fonts in the `fonts` directory.
pub fn load_fonts(&self, cx: &App) -> gpui::Result<()> { pub fn load_fonts(&self, cx: &AppContext) -> gpui::Result<()> {
let font_paths = self.list("fonts")?; let font_paths = self.list("fonts")?;
let mut embedded_fonts = Vec::new(); let mut embedded_fonts = Vec::new();
for font_path in font_paths { for font_path in font_paths {
@@ -55,7 +55,7 @@ impl Assets {
cx.text_system().add_fonts(embedded_fonts) cx.text_system().add_fonts(embedded_fonts)
} }
pub fn load_test_fonts(&self, cx: &App) { pub fn load_test_fonts(&self, cx: &AppContext) {
cx.text_system() cx.text_system()
.add_fonts(vec![self .add_fonts(vec![self
.load("fonts/plex-mono/ZedPlexMono-Regular.ttf") .load("fonts/plex-mono/ZedPlexMono-Regular.ttf")

View File

@@ -1,8 +1,8 @@
[package] [package]
name = "assistant" name = "assistant"
version = "0.1.0" version = "0.1.0"
edition.workspace = true edition = "2021"
publish.workspace = true publish = false
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"
[lints] [lints]
@@ -21,14 +21,16 @@ test-support = [
] ]
[dependencies] [dependencies]
anthropic = { workspace = true, features = ["schemars"] }
anyhow.workspace = true anyhow.workspace = true
assistant_context_editor.workspace = true assets.workspace = true
assistant_settings.workspace = true
assistant_slash_command.workspace = true assistant_slash_command.workspace = true
assistant_slash_commands.workspace = true
assistant_tool.workspace = true assistant_tool.workspace = true
async-watch.workspace = true async-watch.workspace = true
cargo_toml.workspace = true
chrono.workspace = true
client.workspace = true client.workspace = true
clock.workspace = true
collections.workspace = true collections.workspace = true
command_palette_hooks.workspace = true command_palette_hooks.workspace = true
context_server.workspace = true context_server.workspace = true
@@ -37,7 +39,13 @@ editor.workspace = true
feature_flags.workspace = true feature_flags.workspace = true
fs.workspace = true fs.workspace = true
futures.workspace = true futures.workspace = true
fuzzy.workspace = true
globset.workspace = true
gpui.workspace = true gpui.workspace = true
handlebars.workspace = true
heed.workspace = true
html_to_markdown.workspace = true
http_client.workspace = true
indexed_docs.workspace = true indexed_docs.workspace = true
indoc.workspace = true indoc.workspace = true
language.workspace = true language.workspace = true
@@ -46,30 +54,40 @@ language_model_selector.workspace = true
language_models.workspace = true language_models.workspace = true
log.workspace = true log.workspace = true
lsp.workspace = true lsp.workspace = true
markdown.workspace = true
menu.workspace = true menu.workspace = true
multi_buffer.workspace = true multi_buffer.workspace = true
ollama = { workspace = true, features = ["schemars"] }
open_ai = { workspace = true, features = ["schemars"] }
ordered-float.workspace = true
parking_lot.workspace = true parking_lot.workspace = true
paths.workspace = true paths.workspace = true
picker.workspace = true
project.workspace = true project.workspace = true
prompt_library.workspace = true
proto.workspace = true proto.workspace = true
regex.workspace = true
release_channel.workspace = true
rope.workspace = true rope.workspace = true
rpc.workspace = true
schemars.workspace = true schemars.workspace = true
search.workspace = true search.workspace = true
semantic_index.workspace = true semantic_index.workspace = true
serde.workspace = true serde.workspace = true
serde_json.workspace = true
settings.workspace = true settings.workspace = true
similar.workspace = true similar.workspace = true
smallvec.workspace = true
smol.workspace = true smol.workspace = true
streaming_diff.workspace = true strum.workspace = true
telemetry.workspace = true
telemetry_events.workspace = true telemetry_events.workspace = true
terminal.workspace = true terminal.workspace = true
terminal_view.workspace = true terminal_view.workspace = true
text.workspace = true text.workspace = true
theme.workspace = true theme.workspace = true
toml.workspace = true
ui.workspace = true ui.workspace = true
util.workspace = true util.workspace = true
uuid.workspace = true
workspace.workspace = true workspace.workspace = true
zed_actions.workspace = true zed_actions.workspace = true
@@ -85,7 +103,6 @@ pretty_assertions.workspace = true
project = { workspace = true, features = ["test-support"] } project = { workspace = true, features = ["test-support"] }
rand.workspace = true rand.workspace = true
serde_json_lenient.workspace = true serde_json_lenient.workspace = true
terminal_view = { workspace = true, features = ["test-support"] }
text = { workspace = true, features = ["test-support"] } text = { workspace = true, features = ["test-support"] }
tree-sitter-md.workspace = true tree-sitter-md.workspace = true
unindent.workspace = true unindent.workspace = true

View File

@@ -1,46 +1,98 @@
#![cfg_attr(target_os = "windows", allow(unused, dead_code))] #![cfg_attr(target_os = "windows", allow(unused, dead_code))]
mod assistant_configuration;
pub mod assistant_panel; pub mod assistant_panel;
pub mod assistant_settings;
mod context;
pub mod context_store;
mod inline_assistant; mod inline_assistant;
mod patch;
mod prompt_library;
mod prompts;
mod slash_command;
pub(crate) mod slash_command_picker;
pub mod slash_command_settings; pub mod slash_command_settings;
mod slash_command_working_set;
mod streaming_diff;
mod terminal_inline_assistant; mod terminal_inline_assistant;
use std::sync::Arc; use crate::slash_command::project_command::ProjectSlashCommandFeatureFlag;
pub use crate::slash_command_working_set::{SlashCommandId, SlashCommandWorkingSet};
pub use assistant_panel::{AssistantPanel, AssistantPanelEvent};
use assistant_settings::AssistantSettings; use assistant_settings::AssistantSettings;
use assistant_slash_command::SlashCommandRegistry; use assistant_slash_command::SlashCommandRegistry;
use assistant_slash_commands::{ProjectSlashCommandFeatureFlag, SearchSlashCommandFeatureFlag}; use client::{proto, Client};
use client::Client;
use command_palette_hooks::CommandPaletteFilter; use command_palette_hooks::CommandPaletteFilter;
pub use context::*;
pub use context_store::*;
use feature_flags::FeatureFlagAppExt; use feature_flags::FeatureFlagAppExt;
use fs::Fs; use fs::Fs;
use gpui::{actions, App, Global, UpdateGlobal}; use gpui::impl_actions;
use gpui::{actions, AppContext, Global, SharedString, UpdateGlobal};
pub(crate) use inline_assistant::*;
use language_model::{ use language_model::{
LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage, LanguageModelId, LanguageModelProviderId, LanguageModelRegistry, LanguageModelResponseMessage,
}; };
use prompt_library::PromptBuilder; pub use patch::*;
pub use prompts::PromptBuilder;
use prompts::PromptLoadingParams;
use semantic_index::{CloudEmbeddingProvider, SemanticDb}; use semantic_index::{CloudEmbeddingProvider, SemanticDb};
use serde::Deserialize; use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsStore}; use settings::{update_settings_file, Settings, SettingsStore};
use slash_command::search_command::SearchSlashCommandFeatureFlag;
use slash_command::{
auto_command, cargo_workspace_command, default_command, delta_command, diagnostics_command,
docs_command, fetch_command, file_command, now_command, project_command, prompt_command,
search_command, selection_command, symbols_command, tab_command, terminal_command,
};
use std::path::PathBuf;
use std::sync::Arc;
pub(crate) use streaming_diff::*;
use util::ResultExt;
pub use crate::assistant_panel::{AssistantPanel, AssistantPanelEvent}; use crate::slash_command::streaming_example_command;
pub(crate) use crate::inline_assistant::*;
use crate::slash_command_settings::SlashCommandSettings; use crate::slash_command_settings::SlashCommandSettings;
actions!( actions!(
assistant, assistant,
[ [
Assist,
Edit,
Split,
CopyCode,
CycleMessageRole,
QuoteSelection,
InsertIntoEditor,
ToggleFocus,
InsertActivePrompt, InsertActivePrompt,
DeployHistory, DeployHistory,
DeployPromptLibrary,
ConfirmCommand,
NewContext, NewContext,
ToggleModelSelector,
CycleNextInlineAssist, CycleNextInlineAssist,
CyclePreviousInlineAssist CyclePreviousInlineAssist
] ]
); );
#[derive(PartialEq, Clone, Deserialize)]
pub enum InsertDraggedFiles {
ProjectPaths(Vec<PathBuf>),
ExternalFiles(Vec<PathBuf>),
}
impl_actions!(assistant, [InsertDraggedFiles]);
const DEFAULT_CONTEXT_LINES: usize = 50; const DEFAULT_CONTEXT_LINES: usize = 50;
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct MessageId(clock::Lamport);
impl MessageId {
pub fn as_u64(self) -> u64 {
self.0.as_u64()
}
}
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct LanguageModelUsage { pub struct LanguageModelUsage {
pub prompt_tokens: u32, pub prompt_tokens: u32,
@@ -55,6 +107,55 @@ pub struct LanguageModelChoiceDelta {
pub finish_reason: Option<String>, pub finish_reason: Option<String>,
} }
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum MessageStatus {
Pending,
Done,
Error(SharedString),
Canceled,
}
impl MessageStatus {
pub fn from_proto(status: proto::ContextMessageStatus) -> MessageStatus {
match status.variant {
Some(proto::context_message_status::Variant::Pending(_)) => MessageStatus::Pending,
Some(proto::context_message_status::Variant::Done(_)) => MessageStatus::Done,
Some(proto::context_message_status::Variant::Error(error)) => {
MessageStatus::Error(error.message.into())
}
Some(proto::context_message_status::Variant::Canceled(_)) => MessageStatus::Canceled,
None => MessageStatus::Pending,
}
}
pub fn to_proto(&self) -> proto::ContextMessageStatus {
match self {
MessageStatus::Pending => proto::ContextMessageStatus {
variant: Some(proto::context_message_status::Variant::Pending(
proto::context_message_status::Pending {},
)),
},
MessageStatus::Done => proto::ContextMessageStatus {
variant: Some(proto::context_message_status::Variant::Done(
proto::context_message_status::Done {},
)),
},
MessageStatus::Error(message) => proto::ContextMessageStatus {
variant: Some(proto::context_message_status::Variant::Error(
proto::context_message_status::Error {
message: message.to_string(),
},
)),
},
MessageStatus::Canceled => proto::ContextMessageStatus {
variant: Some(proto::context_message_status::Variant::Canceled(
proto::context_message_status::Canceled {},
)),
},
}
}
}
/// The state pertaining to the Assistant. /// The state pertaining to the Assistant.
#[derive(Default)] #[derive(Default)]
struct Assistant { struct Assistant {
@@ -67,7 +168,7 @@ impl Global for Assistant {}
impl Assistant { impl Assistant {
const NAMESPACE: &'static str = "assistant"; const NAMESPACE: &'static str = "assistant";
fn set_enabled(&mut self, enabled: bool, cx: &mut App) { fn set_enabled(&mut self, enabled: bool, cx: &mut AppContext) {
if self.enabled == enabled { if self.enabled == enabled {
return; return;
} }
@@ -91,13 +192,23 @@ impl Assistant {
pub fn init( pub fn init(
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
client: Arc<Client>, client: Arc<Client>,
prompt_builder: Arc<PromptBuilder>, stdout_is_a_pty: bool,
cx: &mut App, cx: &mut AppContext,
) { ) -> Arc<PromptBuilder> {
cx.set_global(Assistant::default()); cx.set_global(Assistant::default());
AssistantSettings::register(cx); AssistantSettings::register(cx);
SlashCommandSettings::register(cx); SlashCommandSettings::register(cx);
// TODO: remove this when 0.148.0 is released.
if AssistantSettings::get_global(cx).using_outdated_settings_version {
update_settings_file::<AssistantSettings>(fs.clone(), cx, {
let fs = fs.clone();
|content, cx| {
content.update_file(fs, cx);
}
});
}
cx.spawn(|mut cx| { cx.spawn(|mut cx| {
let client = client.clone(); let client = client.clone();
async move { async move {
@@ -125,7 +236,7 @@ pub fn init(
}) })
.detach(); .detach();
assistant_context_editor::init(client.clone(), cx); context_store::init(&client.clone().into());
prompt_library::init(cx); prompt_library::init(cx);
init_language_model_settings(cx); init_language_model_settings(cx);
assistant_slash_command::init(cx); assistant_slash_command::init(cx);
@@ -133,6 +244,16 @@ pub fn init(
assistant_panel::init(cx); assistant_panel::init(cx);
context_server::init(cx); context_server::init(cx);
let prompt_builder = prompts::PromptBuilder::new(Some(PromptLoadingParams {
fs: fs.clone(),
repo_path: stdout_is_a_pty
.then(|| std::env::current_dir().log_err())
.flatten(),
cx,
}))
.log_err()
.map(Arc::new)
.unwrap_or_else(|| Arc::new(prompts::PromptBuilder::new(None).unwrap()));
register_slash_commands(Some(prompt_builder.clone()), cx); register_slash_commands(Some(prompt_builder.clone()), cx);
inline_assistant::init( inline_assistant::init(
fs.clone(), fs.clone(),
@@ -163,9 +284,11 @@ pub fn init(
}); });
}) })
.detach(); .detach();
prompt_builder
} }
fn init_language_model_settings(cx: &mut App) { fn init_language_model_settings(cx: &mut AppContext) {
update_active_language_model_from_settings(cx); update_active_language_model_from_settings(cx);
cx.observe_global::<SettingsStore>(update_active_language_model_from_settings) cx.observe_global::<SettingsStore>(update_active_language_model_from_settings)
@@ -184,7 +307,7 @@ fn init_language_model_settings(cx: &mut App) {
.detach(); .detach();
} }
fn update_active_language_model_from_settings(cx: &mut App) { fn update_active_language_model_from_settings(cx: &mut AppContext) {
let settings = AssistantSettings::get_global(cx); let settings = AssistantSettings::get_global(cx);
let provider_name = LanguageModelProviderId::from(settings.default_model.provider.clone()); let provider_name = LanguageModelProviderId::from(settings.default_model.provider.clone());
let model_id = LanguageModelId::from(settings.default_model.model.clone()); let model_id = LanguageModelId::from(settings.default_model.model.clone());
@@ -204,31 +327,30 @@ fn update_active_language_model_from_settings(cx: &mut App) {
}); });
} }
fn register_slash_commands(prompt_builder: Option<Arc<PromptBuilder>>, cx: &mut App) { fn register_slash_commands(prompt_builder: Option<Arc<PromptBuilder>>, cx: &mut AppContext) {
let slash_command_registry = SlashCommandRegistry::global(cx); let slash_command_registry = SlashCommandRegistry::global(cx);
slash_command_registry.register_command(assistant_slash_commands::FileSlashCommand, true); slash_command_registry.register_command(file_command::FileSlashCommand, true);
slash_command_registry.register_command(assistant_slash_commands::DeltaSlashCommand, true); slash_command_registry.register_command(delta_command::DeltaSlashCommand, true);
slash_command_registry.register_command(assistant_slash_commands::OutlineSlashCommand, true); slash_command_registry.register_command(symbols_command::OutlineSlashCommand, true);
slash_command_registry.register_command(assistant_slash_commands::TabSlashCommand, true); slash_command_registry.register_command(tab_command::TabSlashCommand, true);
slash_command_registry slash_command_registry
.register_command(assistant_slash_commands::CargoWorkspaceSlashCommand, true); .register_command(cargo_workspace_command::CargoWorkspaceSlashCommand, true);
slash_command_registry.register_command(assistant_slash_commands::PromptSlashCommand, true); slash_command_registry.register_command(prompt_command::PromptSlashCommand, true);
slash_command_registry.register_command(assistant_slash_commands::SelectionCommand, true); slash_command_registry.register_command(selection_command::SelectionCommand, true);
slash_command_registry.register_command(assistant_slash_commands::DefaultSlashCommand, false); slash_command_registry.register_command(default_command::DefaultSlashCommand, false);
slash_command_registry.register_command(assistant_slash_commands::TerminalSlashCommand, true); slash_command_registry.register_command(terminal_command::TerminalSlashCommand, true);
slash_command_registry.register_command(assistant_slash_commands::NowSlashCommand, false); slash_command_registry.register_command(now_command::NowSlashCommand, false);
slash_command_registry slash_command_registry.register_command(diagnostics_command::DiagnosticsSlashCommand, true);
.register_command(assistant_slash_commands::DiagnosticsSlashCommand, true); slash_command_registry.register_command(fetch_command::FetchSlashCommand, true);
slash_command_registry.register_command(assistant_slash_commands::FetchSlashCommand, true);
if let Some(prompt_builder) = prompt_builder { if let Some(prompt_builder) = prompt_builder {
cx.observe_flag::<assistant_slash_commands::ProjectSlashCommandFeatureFlag, _>({ cx.observe_flag::<project_command::ProjectSlashCommandFeatureFlag, _>({
let slash_command_registry = slash_command_registry.clone(); let slash_command_registry = slash_command_registry.clone();
move |is_enabled, _cx| { move |is_enabled, _cx| {
if is_enabled { if is_enabled {
slash_command_registry.register_command( slash_command_registry.register_command(
assistant_slash_commands::ProjectSlashCommand::new(prompt_builder.clone()), project_command::ProjectSlashCommand::new(prompt_builder.clone()),
true, true,
); );
} }
@@ -237,24 +359,23 @@ fn register_slash_commands(prompt_builder: Option<Arc<PromptBuilder>>, cx: &mut
.detach(); .detach();
} }
cx.observe_flag::<assistant_slash_commands::AutoSlashCommandFeatureFlag, _>({ cx.observe_flag::<auto_command::AutoSlashCommandFeatureFlag, _>({
let slash_command_registry = slash_command_registry.clone(); let slash_command_registry = slash_command_registry.clone();
move |is_enabled, _cx| { move |is_enabled, _cx| {
if is_enabled { if is_enabled {
// [#auto-staff-ship] TODO remove this when /auto is no longer staff-shipped // [#auto-staff-ship] TODO remove this when /auto is no longer staff-shipped
slash_command_registry slash_command_registry.register_command(auto_command::AutoCommand, true);
.register_command(assistant_slash_commands::AutoCommand, true);
} }
} }
}) })
.detach(); .detach();
cx.observe_flag::<assistant_slash_commands::StreamingExampleSlashCommandFeatureFlag, _>({ cx.observe_flag::<streaming_example_command::StreamingExampleSlashCommandFeatureFlag, _>({
let slash_command_registry = slash_command_registry.clone(); let slash_command_registry = slash_command_registry.clone();
move |is_enabled, _cx| { move |is_enabled, _cx| {
if is_enabled { if is_enabled {
slash_command_registry.register_command( slash_command_registry.register_command(
assistant_slash_commands::StreamingExampleSlashCommand, streaming_example_command::StreamingExampleSlashCommand,
false, false,
); );
} }
@@ -266,34 +387,51 @@ fn register_slash_commands(prompt_builder: Option<Arc<PromptBuilder>>, cx: &mut
cx.observe_global::<SettingsStore>(update_slash_commands_from_settings) cx.observe_global::<SettingsStore>(update_slash_commands_from_settings)
.detach(); .detach();
cx.observe_flag::<assistant_slash_commands::SearchSlashCommandFeatureFlag, _>({ cx.observe_flag::<search_command::SearchSlashCommandFeatureFlag, _>({
let slash_command_registry = slash_command_registry.clone(); let slash_command_registry = slash_command_registry.clone();
move |is_enabled, _cx| { move |is_enabled, _cx| {
if is_enabled { if is_enabled {
slash_command_registry slash_command_registry.register_command(search_command::SearchSlashCommand, true);
.register_command(assistant_slash_commands::SearchSlashCommand, true);
} }
} }
}) })
.detach(); .detach();
} }
fn update_slash_commands_from_settings(cx: &mut App) { fn update_slash_commands_from_settings(cx: &mut AppContext) {
let slash_command_registry = SlashCommandRegistry::global(cx); let slash_command_registry = SlashCommandRegistry::global(cx);
let settings = SlashCommandSettings::get_global(cx); let settings = SlashCommandSettings::get_global(cx);
if settings.docs.enabled { if settings.docs.enabled {
slash_command_registry.register_command(assistant_slash_commands::DocsSlashCommand, true); slash_command_registry.register_command(docs_command::DocsSlashCommand, true);
} else { } else {
slash_command_registry.unregister_command(assistant_slash_commands::DocsSlashCommand); slash_command_registry.unregister_command(docs_command::DocsSlashCommand);
} }
if settings.cargo_workspace.enabled { if settings.cargo_workspace.enabled {
slash_command_registry slash_command_registry
.register_command(assistant_slash_commands::CargoWorkspaceSlashCommand, true); .register_command(cargo_workspace_command::CargoWorkspaceSlashCommand, true);
} else { } else {
slash_command_registry slash_command_registry
.unregister_command(assistant_slash_commands::CargoWorkspaceSlashCommand); .unregister_command(cargo_workspace_command::CargoWorkspaceSlashCommand);
}
}
pub fn humanize_token_count(count: usize) -> String {
match count {
0..=999 => count.to_string(),
1000..=9999 => {
let thousands = count / 1000;
let hundreds = (count % 1000 + 50) / 100;
if hundreds == 0 {
format!("{}k", thousands)
} else if hundreds == 10 {
format!("{}k", thousands + 1)
} else {
format!("{}.{}k", thousands, hundreds)
}
}
_ => format!("{}k", (count + 500) / 1000),
} }
} }

View File

@@ -1,199 +0,0 @@
use std::sync::Arc;
use collections::HashMap;
use gpui::{canvas, AnyView, App, EventEmitter, FocusHandle, Focusable, Subscription};
use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry};
use ui::{prelude::*, ElevationIndex};
use workspace::Item;
pub struct ConfigurationView {
focus_handle: FocusHandle,
configuration_views: HashMap<LanguageModelProviderId, AnyView>,
_registry_subscription: Subscription,
}
impl ConfigurationView {
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
let focus_handle = cx.focus_handle();
let registry_subscription = cx.subscribe_in(
&LanguageModelRegistry::global(cx),
window,
|this, _, event: &language_model::Event, window, cx| match event {
language_model::Event::AddedProvider(provider_id) => {
let provider = LanguageModelRegistry::read_global(cx).provider(provider_id);
if let Some(provider) = provider {
this.add_configuration_view(&provider, window, cx);
}
}
language_model::Event::RemovedProvider(provider_id) => {
this.remove_configuration_view(provider_id);
}
_ => {}
},
);
let mut this = Self {
focus_handle,
configuration_views: HashMap::default(),
_registry_subscription: registry_subscription,
};
this.build_configuration_views(window, cx);
this
}
fn build_configuration_views(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let providers = LanguageModelRegistry::read_global(cx).providers();
for provider in providers {
self.add_configuration_view(&provider, window, cx);
}
}
fn remove_configuration_view(&mut self, provider_id: &LanguageModelProviderId) {
self.configuration_views.remove(provider_id);
}
fn add_configuration_view(
&mut self,
provider: &Arc<dyn LanguageModelProvider>,
window: &mut Window,
cx: &mut Context<Self>,
) {
let configuration_view = provider.configuration_view(window, cx);
self.configuration_views
.insert(provider.id(), configuration_view);
}
fn render_provider_view(
&mut self,
provider: &Arc<dyn LanguageModelProvider>,
cx: &mut Context<Self>,
) -> Div {
let provider_id = provider.id().0.clone();
let provider_name = provider.name().0.clone();
let configuration_view = self.configuration_views.get(&provider.id()).cloned();
let open_new_context = cx.listener({
let provider = provider.clone();
move |_, _, _window, cx| {
cx.emit(ConfigurationViewEvent::NewProviderContextEditor(
provider.clone(),
))
}
});
v_flex()
.gap_2()
.child(
h_flex()
.justify_between()
.child(Headline::new(provider_name.clone()).size(HeadlineSize::Small))
.when(provider.is_authenticated(cx), move |this| {
this.child(
h_flex().justify_end().child(
Button::new(
SharedString::from(format!("new-context-{provider_id}")),
"Open New Chat",
)
.icon_position(IconPosition::Start)
.icon(IconName::Plus)
.style(ButtonStyle::Filled)
.layer(ElevationIndex::ModalSurface)
.on_click(open_new_context),
),
)
}),
)
.child(
div()
.p(DynamicSpacing::Base08.rems(cx))
.bg(cx.theme().colors().surface_background)
.border_1()
.border_color(cx.theme().colors().border_variant)
.rounded_md()
.when(configuration_view.is_none(), |this| {
this.child(div().child(Label::new(format!(
"No configuration view for {}",
provider_name
))))
})
.when_some(configuration_view, |this, configuration_view| {
this.child(configuration_view)
}),
)
}
}
impl Render for ConfigurationView {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let providers = LanguageModelRegistry::read_global(cx).providers();
let provider_views = providers
.into_iter()
.map(|provider| self.render_provider_view(&provider, cx))
.collect::<Vec<_>>();
let mut element = v_flex()
.id("assistant-configuration-view")
.track_focus(&self.focus_handle(cx))
.bg(cx.theme().colors().editor_background)
.size_full()
.overflow_y_scroll()
.child(
v_flex()
.p(DynamicSpacing::Base16.rems(cx))
.border_b_1()
.border_color(cx.theme().colors().border)
.gap_1()
.child(Headline::new("Configure your Assistant").size(HeadlineSize::Medium))
.child(
Label::new(
"At least one LLM provider must be configured to use the Assistant.",
)
.color(Color::Muted),
),
)
.child(
v_flex()
.p(DynamicSpacing::Base16.rems(cx))
.mt_1()
.gap_6()
.flex_1()
.children(provider_views),
)
.into_any();
// We use a canvas here to get scrolling to work in the ConfigurationView. It's a workaround
// because we couldn't the element to take up the size of the parent.
canvas(
move |bounds, window, cx| {
element.prepaint_as_root(bounds.origin, bounds.size.into(), window, cx);
element
},
|_, mut element, window, cx| {
element.paint(window, cx);
},
)
.flex_1()
.w_full()
}
}
pub enum ConfigurationViewEvent {
NewProviderContextEditor(Arc<dyn LanguageModelProvider>),
}
impl EventEmitter<ConfigurationViewEvent> for ConfigurationView {}
impl Focusable for ConfigurationView {
fn focus_handle(&self, _: &App) -> FocusHandle {
self.focus_handle.clone()
}
}
impl Item for ConfigurationView {
type Event = ConfigurationViewEvent;
fn tab_content_text(&self, _window: &Window, _cx: &App) -> Option<SharedString> {
Some("Configuration".into())
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,603 @@
use std::sync::Arc;
use ::open_ai::Model as OpenAiModel;
use anthropic::Model as AnthropicModel;
use feature_flags::FeatureFlagAppExt;
use fs::Fs;
use gpui::{AppContext, Pixels};
use language_model::{CloudModel, LanguageModel};
use language_models::{
provider::open_ai, AllLanguageModelSettings, AnthropicSettingsContent,
AnthropicSettingsContentV1, OllamaSettingsContent, OpenAiSettingsContent,
OpenAiSettingsContentV1, VersionedAnthropicSettingsContent, VersionedOpenAiSettingsContent,
};
use ollama::Model as OllamaModel;
use schemars::{schema::Schema, JsonSchema};
use serde::{Deserialize, Serialize};
use settings::{update_settings_file, Settings, SettingsSources};
#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum AssistantDockPosition {
Left,
#[default]
Right,
Bottom,
}
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
#[serde(tag = "name", rename_all = "snake_case")]
pub enum AssistantProviderContentV1 {
#[serde(rename = "zed.dev")]
ZedDotDev { default_model: Option<CloudModel> },
#[serde(rename = "openai")]
OpenAi {
default_model: Option<OpenAiModel>,
api_url: Option<String>,
available_models: Option<Vec<OpenAiModel>>,
},
#[serde(rename = "anthropic")]
Anthropic {
default_model: Option<AnthropicModel>,
api_url: Option<String>,
},
#[serde(rename = "ollama")]
Ollama {
default_model: Option<OllamaModel>,
api_url: Option<String>,
},
}
#[derive(Debug, Default)]
pub struct AssistantSettings {
pub enabled: bool,
pub button: bool,
pub dock: AssistantDockPosition,
pub default_width: Pixels,
pub default_height: Pixels,
pub default_model: LanguageModelSelection,
pub inline_alternatives: Vec<LanguageModelSelection>,
pub using_outdated_settings_version: bool,
pub enable_experimental_live_diffs: bool,
}
impl AssistantSettings {
pub fn are_live_diffs_enabled(&self, cx: &AppContext) -> bool {
cx.is_staff() || self.enable_experimental_live_diffs
}
}
/// Assistant panel settings
#[derive(Clone, Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum AssistantSettingsContent {
Versioned(VersionedAssistantSettingsContent),
Legacy(LegacyAssistantSettingsContent),
}
impl JsonSchema for AssistantSettingsContent {
fn schema_name() -> String {
VersionedAssistantSettingsContent::schema_name()
}
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> Schema {
VersionedAssistantSettingsContent::json_schema(gen)
}
fn is_referenceable() -> bool {
VersionedAssistantSettingsContent::is_referenceable()
}
}
impl Default for AssistantSettingsContent {
fn default() -> Self {
Self::Versioned(VersionedAssistantSettingsContent::default())
}
}
impl AssistantSettingsContent {
pub fn is_version_outdated(&self) -> bool {
match self {
AssistantSettingsContent::Versioned(settings) => match settings {
VersionedAssistantSettingsContent::V1(_) => true,
VersionedAssistantSettingsContent::V2(_) => false,
},
AssistantSettingsContent::Legacy(_) => true,
}
}
pub fn update_file(&mut self, fs: Arc<dyn Fs>, cx: &AppContext) {
if let AssistantSettingsContent::Versioned(settings) = self {
if let VersionedAssistantSettingsContent::V1(settings) = settings {
if let Some(provider) = settings.provider.clone() {
match provider {
AssistantProviderContentV1::Anthropic { api_url, .. } => {
update_settings_file::<AllLanguageModelSettings>(
fs,
cx,
move |content, _| {
if content.anthropic.is_none() {
content.anthropic =
Some(AnthropicSettingsContent::Versioned(
VersionedAnthropicSettingsContent::V1(
AnthropicSettingsContentV1 {
api_url,
available_models: None,
},
),
));
}
},
)
}
AssistantProviderContentV1::Ollama { api_url, .. } => {
update_settings_file::<AllLanguageModelSettings>(
fs,
cx,
move |content, _| {
if content.ollama.is_none() {
content.ollama = Some(OllamaSettingsContent {
api_url,
available_models: None,
});
}
},
)
}
AssistantProviderContentV1::OpenAi {
api_url,
available_models,
..
} => update_settings_file::<AllLanguageModelSettings>(
fs,
cx,
move |content, _| {
if content.openai.is_none() {
let available_models = available_models.map(|models| {
models
.into_iter()
.filter_map(|model| match model {
OpenAiModel::Custom {
name,
display_name,
max_tokens,
max_output_tokens,
max_completion_tokens: None,
} => Some(open_ai::AvailableModel {
name,
display_name,
max_tokens,
max_output_tokens,
max_completion_tokens: None,
}),
_ => None,
})
.collect::<Vec<_>>()
});
content.openai = Some(OpenAiSettingsContent::Versioned(
VersionedOpenAiSettingsContent::V1(
OpenAiSettingsContentV1 {
api_url,
available_models,
},
),
));
}
},
),
_ => {}
}
}
}
}
*self = AssistantSettingsContent::Versioned(VersionedAssistantSettingsContent::V2(
self.upgrade(),
));
}
fn upgrade(&self) -> AssistantSettingsContentV2 {
match self {
AssistantSettingsContent::Versioned(settings) => match settings {
VersionedAssistantSettingsContent::V1(settings) => AssistantSettingsContentV2 {
enabled: settings.enabled,
button: settings.button,
dock: settings.dock,
default_width: settings.default_width,
default_height: settings.default_width,
default_model: settings
.provider
.clone()
.and_then(|provider| match provider {
AssistantProviderContentV1::ZedDotDev { default_model } => {
default_model.map(|model| LanguageModelSelection {
provider: "zed.dev".to_string(),
model: model.id().to_string(),
})
}
AssistantProviderContentV1::OpenAi { default_model, .. } => {
default_model.map(|model| LanguageModelSelection {
provider: "openai".to_string(),
model: model.id().to_string(),
})
}
AssistantProviderContentV1::Anthropic { default_model, .. } => {
default_model.map(|model| LanguageModelSelection {
provider: "anthropic".to_string(),
model: model.id().to_string(),
})
}
AssistantProviderContentV1::Ollama { default_model, .. } => {
default_model.map(|model| LanguageModelSelection {
provider: "ollama".to_string(),
model: model.id().to_string(),
})
}
}),
inline_alternatives: None,
enable_experimental_live_diffs: None,
},
VersionedAssistantSettingsContent::V2(settings) => settings.clone(),
},
AssistantSettingsContent::Legacy(settings) => AssistantSettingsContentV2 {
enabled: None,
button: settings.button,
dock: settings.dock,
default_width: settings.default_width,
default_height: settings.default_height,
default_model: Some(LanguageModelSelection {
provider: "openai".to_string(),
model: settings
.default_open_ai_model
.clone()
.unwrap_or_default()
.id()
.to_string(),
}),
inline_alternatives: None,
enable_experimental_live_diffs: None,
},
}
}
pub fn set_dock(&mut self, dock: AssistantDockPosition) {
match self {
AssistantSettingsContent::Versioned(settings) => match settings {
VersionedAssistantSettingsContent::V1(settings) => {
settings.dock = Some(dock);
}
VersionedAssistantSettingsContent::V2(settings) => {
settings.dock = Some(dock);
}
},
AssistantSettingsContent::Legacy(settings) => {
settings.dock = Some(dock);
}
}
}
pub fn set_model(&mut self, language_model: Arc<dyn LanguageModel>) {
let model = language_model.id().0.to_string();
let provider = language_model.provider_id().0.to_string();
match self {
AssistantSettingsContent::Versioned(settings) => match settings {
VersionedAssistantSettingsContent::V1(settings) => match provider.as_ref() {
"zed.dev" => {
log::warn!("attempted to set zed.dev model on outdated settings");
}
"anthropic" => {
let api_url = match &settings.provider {
Some(AssistantProviderContentV1::Anthropic { api_url, .. }) => {
api_url.clone()
}
_ => None,
};
settings.provider = Some(AssistantProviderContentV1::Anthropic {
default_model: AnthropicModel::from_id(&model).ok(),
api_url,
});
}
"ollama" => {
let api_url = match &settings.provider {
Some(AssistantProviderContentV1::Ollama { api_url, .. }) => {
api_url.clone()
}
_ => None,
};
settings.provider = Some(AssistantProviderContentV1::Ollama {
default_model: Some(ollama::Model::new(&model, None, None)),
api_url,
});
}
"openai" => {
let (api_url, available_models) = match &settings.provider {
Some(AssistantProviderContentV1::OpenAi {
api_url,
available_models,
..
}) => (api_url.clone(), available_models.clone()),
_ => (None, None),
};
settings.provider = Some(AssistantProviderContentV1::OpenAi {
default_model: OpenAiModel::from_id(&model).ok(),
api_url,
available_models,
});
}
_ => {}
},
VersionedAssistantSettingsContent::V2(settings) => {
settings.default_model = Some(LanguageModelSelection { provider, model });
}
},
AssistantSettingsContent::Legacy(settings) => {
if let Ok(model) = OpenAiModel::from_id(&language_model.id().0) {
settings.default_open_ai_model = Some(model);
}
}
}
}
}
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)]
#[serde(tag = "version")]
pub enum VersionedAssistantSettingsContent {
#[serde(rename = "1")]
V1(AssistantSettingsContentV1),
#[serde(rename = "2")]
V2(AssistantSettingsContentV2),
}
impl Default for VersionedAssistantSettingsContent {
fn default() -> Self {
Self::V2(AssistantSettingsContentV2 {
enabled: None,
button: None,
dock: None,
default_width: None,
default_height: None,
default_model: None,
inline_alternatives: None,
enable_experimental_live_diffs: None,
})
}
}
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)]
pub struct AssistantSettingsContentV2 {
/// Whether the Assistant is enabled.
///
/// Default: true
enabled: Option<bool>,
/// Whether to show the assistant panel button in the status bar.
///
/// Default: true
button: Option<bool>,
/// Where to dock the assistant.
///
/// Default: right
dock: Option<AssistantDockPosition>,
/// Default width in pixels when the assistant is docked to the left or right.
///
/// Default: 640
default_width: Option<f32>,
/// Default height in pixels when the assistant is docked to the bottom.
///
/// Default: 320
default_height: Option<f32>,
/// The default model to use when creating new chats.
default_model: Option<LanguageModelSelection>,
/// Additional models with which to generate alternatives when performing inline assists.
inline_alternatives: Option<Vec<LanguageModelSelection>>,
/// Enable experimental live diffs in the assistant panel.
///
/// Default: false
enable_experimental_live_diffs: Option<bool>,
}
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
pub struct LanguageModelSelection {
#[schemars(schema_with = "providers_schema")]
pub provider: String,
pub model: String,
}
fn providers_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
schemars::schema::SchemaObject {
enum_values: Some(vec![
"anthropic".into(),
"google".into(),
"ollama".into(),
"openai".into(),
"zed.dev".into(),
"copilot_chat".into(),
]),
..Default::default()
}
.into()
}
impl Default for LanguageModelSelection {
fn default() -> Self {
Self {
provider: "openai".to_string(),
model: "gpt-4".to_string(),
}
}
}
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)]
pub struct AssistantSettingsContentV1 {
/// Whether the Assistant is enabled.
///
/// Default: true
enabled: Option<bool>,
/// Whether to show the assistant panel button in the status bar.
///
/// Default: true
button: Option<bool>,
/// Where to dock the assistant.
///
/// Default: right
dock: Option<AssistantDockPosition>,
/// Default width in pixels when the assistant is docked to the left or right.
///
/// Default: 640
default_width: Option<f32>,
/// Default height in pixels when the assistant is docked to the bottom.
///
/// Default: 320
default_height: Option<f32>,
/// The provider of the assistant service.
///
/// This can be "openai", "anthropic", "ollama", "zed.dev"
/// each with their respective default models and configurations.
provider: Option<AssistantProviderContentV1>,
}
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)]
pub struct LegacyAssistantSettingsContent {
/// Whether to show the assistant panel button in the status bar.
///
/// Default: true
pub button: Option<bool>,
/// Where to dock the assistant.
///
/// Default: right
pub dock: Option<AssistantDockPosition>,
/// Default width in pixels when the assistant is docked to the left or right.
///
/// Default: 640
pub default_width: Option<f32>,
/// Default height in pixels when the assistant is docked to the bottom.
///
/// Default: 320
pub default_height: Option<f32>,
/// The default OpenAI model to use when creating new chats.
///
/// Default: gpt-4-1106-preview
pub default_open_ai_model: Option<OpenAiModel>,
/// OpenAI API base URL to use when creating new chats.
///
/// Default: https://api.openai.com/v1
pub openai_api_url: Option<String>,
}
impl Settings for AssistantSettings {
const KEY: Option<&'static str> = Some("assistant");
const PRESERVED_KEYS: Option<&'static [&'static str]> = Some(&["version"]);
type FileContent = AssistantSettingsContent;
fn load(
sources: SettingsSources<Self::FileContent>,
_: &mut gpui::AppContext,
) -> anyhow::Result<Self> {
let mut settings = AssistantSettings::default();
for value in sources.defaults_and_customizations() {
if value.is_version_outdated() {
settings.using_outdated_settings_version = true;
}
let value = value.upgrade();
merge(&mut settings.enabled, value.enabled);
merge(&mut settings.button, value.button);
merge(&mut settings.dock, value.dock);
merge(
&mut settings.default_width,
value.default_width.map(Into::into),
);
merge(
&mut settings.default_height,
value.default_height.map(Into::into),
);
merge(&mut settings.default_model, value.default_model);
merge(&mut settings.inline_alternatives, value.inline_alternatives);
merge(
&mut settings.enable_experimental_live_diffs,
value.enable_experimental_live_diffs,
);
}
Ok(settings)
}
}
fn merge<T>(target: &mut T, value: Option<T>) {
if let Some(value) = value {
*target = value;
}
}
#[cfg(test)]
mod tests {
use gpui::{ReadGlobal, TestAppContext};
use super::*;
#[gpui::test]
async fn test_deserialize_assistant_settings_with_version(cx: &mut TestAppContext) {
let fs = fs::FakeFs::new(cx.executor().clone());
fs.create_dir(paths::settings_file().parent().unwrap())
.await
.unwrap();
cx.update(|cx| {
let test_settings = settings::SettingsStore::test(cx);
cx.set_global(test_settings);
AssistantSettings::register(cx);
});
cx.update(|cx| {
assert!(!AssistantSettings::get_global(cx).using_outdated_settings_version);
assert_eq!(
AssistantSettings::get_global(cx).default_model,
LanguageModelSelection {
provider: "zed.dev".into(),
model: "claude-3-5-sonnet".into(),
}
);
});
cx.update(|cx| {
settings::SettingsStore::global(cx).update_settings_file::<AssistantSettings>(
fs.clone(),
|settings, _| {
*settings = AssistantSettingsContent::Versioned(
VersionedAssistantSettingsContent::V2(AssistantSettingsContentV2 {
default_model: Some(LanguageModelSelection {
provider: "test-provider".into(),
model: "gpt-99".into(),
}),
inline_alternatives: None,
enabled: None,
button: None,
dock: None,
default_width: None,
default_height: None,
enable_experimental_live_diffs: None,
}),
)
},
);
});
cx.run_until_parked();
let raw_settings_value = fs.load(paths::settings_file()).await.unwrap();
assert!(raw_settings_value.contains(r#""version": "2""#));
#[derive(Debug, Deserialize)]
struct AssistantSettingsTest {
assistant: AssistantSettingsContent,
}
let assistant_settings: AssistantSettingsTest =
serde_json_lenient::from_str(&raw_settings_value).unwrap();
assert!(!assistant_settings.assistant.is_version_outdated());
}
}

View File

@@ -1,26 +1,33 @@
#[cfg(test)] #[cfg(test)]
mod context_tests; mod context_tests;
use crate::patch::{AssistantEdit, AssistantPatch, AssistantPatchStatus}; use crate::slash_command_working_set::SlashCommandWorkingSet;
use crate::{
prompts::PromptBuilder,
slash_command::{file_command::FileCommandMetadata, SlashCommandLine},
AssistantEdit, AssistantPatch, AssistantPatchStatus, MessageId, MessageStatus,
};
use anyhow::{anyhow, Context as _, Result}; use anyhow::{anyhow, Context as _, Result};
use assistant_slash_command::{ use assistant_slash_command::{
SlashCommandContent, SlashCommandEvent, SlashCommandLine, SlashCommandOutputSection, SlashCommandContent, SlashCommandEvent, SlashCommandOutputSection, SlashCommandResult,
SlashCommandResult, SlashCommandWorkingSet,
}; };
use assistant_slash_commands::FileCommandMetadata; use assistant_tool::ToolWorkingSet;
use client::{self, proto, telemetry::Telemetry}; use client::{self, proto, telemetry::Telemetry};
use clock::ReplicaId; use clock::ReplicaId;
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use feature_flags::{FeatureFlagAppExt, ToolUseFeatureFlag};
use fs::{Fs, RemoveOptions}; use fs::{Fs, RemoveOptions};
use futures::{future::Shared, FutureExt, StreamExt}; use futures::{future::Shared, FutureExt, StreamExt};
use gpui::{ use gpui::{
App, AppContext as _, Context, Entity, EventEmitter, RenderImage, SharedString, Subscription, AppContext, Context as _, EventEmitter, Model, ModelContext, RenderImage, SharedString,
Task, Subscription, Task,
}; };
use language::{AnchorRangeExt, Bias, Buffer, LanguageRegistry, OffsetRangeExt, Point, ToOffset}; use language::{AnchorRangeExt, Bias, Buffer, LanguageRegistry, OffsetRangeExt, Point, ToOffset};
use language_model::{ use language_model::{
LanguageModel, LanguageModelCacheConfiguration, LanguageModelCompletionEvent, LanguageModel, LanguageModelCacheConfiguration, LanguageModelCompletionEvent,
LanguageModelImage, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, LanguageModelImage, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage,
LanguageModelRequestTool, LanguageModelToolResult, LanguageModelToolUse,
LanguageModelToolUseId, MessageContent, Role, StopReason, LanguageModelToolUseId, MessageContent, Role, StopReason,
}; };
use language_models::{ use language_models::{
@@ -30,7 +37,6 @@ use language_models::{
use open_ai::Model as OpenAiModel; use open_ai::Model as OpenAiModel;
use paths::contexts_dir; use paths::contexts_dir;
use project::Project; use project::Project;
use prompt_library::PromptBuilder;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use smallvec::SmallVec; use smallvec::SmallVec;
use std::{ use std::{
@@ -45,9 +51,9 @@ use std::{
}; };
use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase}; use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase};
use text::{BufferSnapshot, ToPoint}; use text::{BufferSnapshot, ToPoint};
use ui::IconName;
use util::{post_inc, ResultExt, TryFutureExt}; use util::{post_inc, ResultExt, TryFutureExt};
use uuid::Uuid; use uuid::Uuid;
use workspace::ui::IconName;
#[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)] #[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
pub struct ContextId(String); pub struct ContextId(String);
@@ -66,64 +72,6 @@ impl ContextId {
} }
} }
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct MessageId(pub clock::Lamport);
impl MessageId {
pub fn as_u64(self) -> u64 {
self.0.as_u64()
}
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub enum MessageStatus {
Pending,
Done,
Error(SharedString),
Canceled,
}
impl MessageStatus {
pub fn from_proto(status: proto::ContextMessageStatus) -> MessageStatus {
match status.variant {
Some(proto::context_message_status::Variant::Pending(_)) => MessageStatus::Pending,
Some(proto::context_message_status::Variant::Done(_)) => MessageStatus::Done,
Some(proto::context_message_status::Variant::Error(error)) => {
MessageStatus::Error(error.message.into())
}
Some(proto::context_message_status::Variant::Canceled(_)) => MessageStatus::Canceled,
None => MessageStatus::Pending,
}
}
pub fn to_proto(&self) -> proto::ContextMessageStatus {
match self {
MessageStatus::Pending => proto::ContextMessageStatus {
variant: Some(proto::context_message_status::Variant::Pending(
proto::context_message_status::Pending {},
)),
},
MessageStatus::Done => proto::ContextMessageStatus {
variant: Some(proto::context_message_status::Variant::Done(
proto::context_message_status::Done {},
)),
},
MessageStatus::Error(message) => proto::ContextMessageStatus {
variant: Some(proto::context_message_status::Variant::Error(
proto::context_message_status::Error {
message: message.to_string(),
},
)),
},
MessageStatus::Canceled => proto::ContextMessageStatus {
variant: Some(proto::context_message_status::Variant::Canceled(
proto::context_message_status::Canceled {},
)),
},
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RequestType { pub enum RequestType {
/// Request a normal chat response from the model. /// Request a normal chat response from the model.
@@ -435,6 +383,11 @@ pub enum ContextEvent {
SlashCommandOutputSectionAdded { SlashCommandOutputSectionAdded {
section: SlashCommandOutputSection<language::Anchor>, section: SlashCommandOutputSection<language::Anchor>,
}, },
UsePendingTools,
ToolFinished {
tool_use_id: LanguageModelToolUseId,
output_range: Range<language::Anchor>,
},
Operation(ContextOperation), Operation(ContextOperation),
} }
@@ -469,7 +422,7 @@ pub struct MessageCacheMetadata {
pub struct MessageMetadata { pub struct MessageMetadata {
pub role: Role, pub role: Role,
pub status: MessageStatus, pub status: MessageStatus,
pub timestamp: clock::Lamport, pub(crate) timestamp: clock::Lamport,
#[serde(skip)] #[serde(skip)]
pub cache: Option<MessageCacheMetadata>, pub cache: Option<MessageCacheMetadata>,
} }
@@ -520,12 +473,21 @@ pub enum Content {
render_image: Arc<RenderImage>, render_image: Arc<RenderImage>,
image: Shared<Task<Option<LanguageModelImage>>>, image: Shared<Task<Option<LanguageModelImage>>>,
}, },
ToolUse {
range: Range<language::Anchor>,
tool_use: LanguageModelToolUse,
},
ToolResult {
range: Range<language::Anchor>,
tool_use_id: LanguageModelToolUseId,
},
} }
impl Content { impl Content {
fn range(&self) -> Range<language::Anchor> { fn range(&self) -> Range<language::Anchor> {
match self { match self {
Self::Image { anchor, .. } => *anchor..*anchor, Self::Image { anchor, .. } => *anchor..*anchor,
Self::ToolUse { range, .. } | Self::ToolResult { range, .. } => range.clone(),
} }
} }
@@ -571,18 +533,20 @@ pub enum XmlTagKind {
Operation, Operation,
} }
pub struct AssistantContext { pub struct Context {
id: ContextId, id: ContextId,
timestamp: clock::Lamport, timestamp: clock::Lamport,
version: clock::Global, version: clock::Global,
pending_ops: Vec<ContextOperation>, pending_ops: Vec<ContextOperation>,
operations: Vec<ContextOperation>, operations: Vec<ContextOperation>,
buffer: Entity<Buffer>, buffer: Model<Buffer>,
parsed_slash_commands: Vec<ParsedSlashCommand>, parsed_slash_commands: Vec<ParsedSlashCommand>,
invoked_slash_commands: HashMap<InvokedSlashCommandId, InvokedSlashCommand>, invoked_slash_commands: HashMap<InvokedSlashCommandId, InvokedSlashCommand>,
edits_since_last_parse: language::Subscription, edits_since_last_parse: language::Subscription,
slash_commands: Arc<SlashCommandWorkingSet>, pub(crate) slash_commands: Arc<SlashCommandWorkingSet>,
pub(crate) tools: Arc<ToolWorkingSet>,
slash_command_output_sections: Vec<SlashCommandOutputSection<language::Anchor>>, slash_command_output_sections: Vec<SlashCommandOutputSection<language::Anchor>>,
pending_tool_uses_by_id: HashMap<LanguageModelToolUseId, PendingToolUse>,
message_anchors: Vec<MessageAnchor>, message_anchors: Vec<MessageAnchor>,
contents: Vec<Content>, contents: Vec<Content>,
messages_metadata: HashMap<MessageId, MessageMetadata>, messages_metadata: HashMap<MessageId, MessageMetadata>,
@@ -600,7 +564,7 @@ pub struct AssistantContext {
language_registry: Arc<LanguageRegistry>, language_registry: Arc<LanguageRegistry>,
patches: Vec<AssistantPatch>, patches: Vec<AssistantPatch>,
xml_tags: Vec<XmlTag>, xml_tags: Vec<XmlTag>,
project: Option<Entity<Project>>, project: Option<Model<Project>>,
prompt_builder: Arc<PromptBuilder>, prompt_builder: Arc<PromptBuilder>,
} }
@@ -626,16 +590,17 @@ impl ContextAnnotation for XmlTag {
} }
} }
impl EventEmitter<ContextEvent> for AssistantContext {} impl EventEmitter<ContextEvent> for Context {}
impl AssistantContext { impl Context {
pub fn local( pub fn local(
language_registry: Arc<LanguageRegistry>, language_registry: Arc<LanguageRegistry>,
project: Option<Entity<Project>>, project: Option<Model<Project>>,
telemetry: Option<Arc<Telemetry>>, telemetry: Option<Arc<Telemetry>>,
prompt_builder: Arc<PromptBuilder>, prompt_builder: Arc<PromptBuilder>,
slash_commands: Arc<SlashCommandWorkingSet>, slash_commands: Arc<SlashCommandWorkingSet>,
cx: &mut Context<Self>, tools: Arc<ToolWorkingSet>,
cx: &mut ModelContext<Self>,
) -> Self { ) -> Self {
Self::new( Self::new(
ContextId::new(), ContextId::new(),
@@ -644,6 +609,7 @@ impl AssistantContext {
language_registry, language_registry,
prompt_builder, prompt_builder,
slash_commands, slash_commands,
tools,
project, project,
telemetry, telemetry,
cx, cx,
@@ -658,11 +624,12 @@ impl AssistantContext {
language_registry: Arc<LanguageRegistry>, language_registry: Arc<LanguageRegistry>,
prompt_builder: Arc<PromptBuilder>, prompt_builder: Arc<PromptBuilder>,
slash_commands: Arc<SlashCommandWorkingSet>, slash_commands: Arc<SlashCommandWorkingSet>,
project: Option<Entity<Project>>, tools: Arc<ToolWorkingSet>,
project: Option<Model<Project>>,
telemetry: Option<Arc<Telemetry>>, telemetry: Option<Arc<Telemetry>>,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> Self { ) -> Self {
let buffer = cx.new(|_cx| { let buffer = cx.new_model(|_cx| {
let buffer = Buffer::remote( let buffer = Buffer::remote(
language::BufferId::new(1).unwrap(), language::BufferId::new(1).unwrap(),
replica_id, replica_id,
@@ -685,6 +652,7 @@ impl AssistantContext {
messages_metadata: Default::default(), messages_metadata: Default::default(),
parsed_slash_commands: Vec::new(), parsed_slash_commands: Vec::new(),
invoked_slash_commands: HashMap::default(), invoked_slash_commands: HashMap::default(),
pending_tool_uses_by_id: HashMap::default(),
slash_command_output_sections: Vec::new(), slash_command_output_sections: Vec::new(),
edits_since_last_parse: edits_since_last_slash_command_parse, edits_since_last_parse: edits_since_last_slash_command_parse,
summary: None, summary: None,
@@ -702,6 +670,7 @@ impl AssistantContext {
project, project,
language_registry, language_registry,
slash_commands, slash_commands,
tools,
patches: Vec::new(), patches: Vec::new(),
xml_tags: Vec::new(), xml_tags: Vec::new(),
prompt_builder, prompt_builder,
@@ -731,7 +700,7 @@ impl AssistantContext {
this this
} }
pub(crate) fn serialize(&self, cx: &App) -> SavedContext { pub(crate) fn serialize(&self, cx: &AppContext) -> SavedContext {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
SavedContext { SavedContext {
id: Some(self.id.clone()), id: Some(self.id.clone()),
@@ -778,9 +747,10 @@ impl AssistantContext {
language_registry: Arc<LanguageRegistry>, language_registry: Arc<LanguageRegistry>,
prompt_builder: Arc<PromptBuilder>, prompt_builder: Arc<PromptBuilder>,
slash_commands: Arc<SlashCommandWorkingSet>, slash_commands: Arc<SlashCommandWorkingSet>,
project: Option<Entity<Project>>, tools: Arc<ToolWorkingSet>,
project: Option<Model<Project>>,
telemetry: Option<Arc<Telemetry>>, telemetry: Option<Arc<Telemetry>>,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> Self { ) -> Self {
let id = saved_context.id.clone().unwrap_or_else(ContextId::new); let id = saved_context.id.clone().unwrap_or_else(ContextId::new);
let mut this = Self::new( let mut this = Self::new(
@@ -790,6 +760,7 @@ impl AssistantContext {
language_registry, language_registry,
prompt_builder, prompt_builder,
slash_commands, slash_commands,
tools,
project, project,
telemetry, telemetry,
cx, cx,
@@ -811,18 +782,18 @@ impl AssistantContext {
self.timestamp.replica_id self.timestamp.replica_id
} }
pub fn version(&self, cx: &App) -> ContextVersion { pub fn version(&self, cx: &AppContext) -> ContextVersion {
ContextVersion { ContextVersion {
context: self.version.clone(), context: self.version.clone(),
buffer: self.buffer.read(cx).version(), buffer: self.buffer.read(cx).version(),
} }
} }
pub fn slash_commands(&self) -> &Arc<SlashCommandWorkingSet> { pub fn set_capability(
&self.slash_commands &mut self,
} capability: language::Capability,
cx: &mut ModelContext<Self>,
pub fn set_capability(&mut self, capability: language::Capability, cx: &mut Context<Self>) { ) {
self.buffer self.buffer
.update(cx, |buffer, cx| buffer.set_capability(capability, cx)); .update(cx, |buffer, cx| buffer.set_capability(capability, cx));
} }
@@ -836,7 +807,7 @@ impl AssistantContext {
pub fn serialize_ops( pub fn serialize_ops(
&self, &self,
since: &ContextVersion, since: &ContextVersion,
cx: &App, cx: &AppContext,
) -> Task<Vec<proto::ContextOperation>> { ) -> Task<Vec<proto::ContextOperation>> {
let buffer_ops = self let buffer_ops = self
.buffer .buffer
@@ -871,7 +842,7 @@ impl AssistantContext {
pub fn apply_ops( pub fn apply_ops(
&mut self, &mut self,
ops: impl IntoIterator<Item = ContextOperation>, ops: impl IntoIterator<Item = ContextOperation>,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
let mut buffer_ops = Vec::new(); let mut buffer_ops = Vec::new();
for op in ops { for op in ops {
@@ -885,7 +856,7 @@ impl AssistantContext {
self.flush_ops(cx); self.flush_ops(cx);
} }
fn flush_ops(&mut self, cx: &mut Context<AssistantContext>) { fn flush_ops(&mut self, cx: &mut ModelContext<Context>) {
let mut changed_messages = HashSet::default(); let mut changed_messages = HashSet::default();
let mut summary_changed = false; let mut summary_changed = false;
@@ -1004,7 +975,7 @@ impl AssistantContext {
} }
} }
fn can_apply_op(&self, op: &ContextOperation, cx: &App) -> bool { fn can_apply_op(&self, op: &ContextOperation, cx: &AppContext) -> bool {
if !self.version.observed_all(op.version()) { if !self.version.observed_all(op.version()) {
return false; return false;
} }
@@ -1035,7 +1006,7 @@ impl AssistantContext {
fn has_received_operations_for_anchor_range( fn has_received_operations_for_anchor_range(
&self, &self,
range: Range<text::Anchor>, range: Range<text::Anchor>,
cx: &App, cx: &AppContext,
) -> bool { ) -> bool {
let version = &self.buffer.read(cx).version; let version = &self.buffer.read(cx).version;
let observed_start = range.start == language::Anchor::MIN let observed_start = range.start == language::Anchor::MIN
@@ -1047,12 +1018,12 @@ impl AssistantContext {
observed_start && observed_end observed_start && observed_end
} }
fn push_op(&mut self, op: ContextOperation, cx: &mut Context<Self>) { fn push_op(&mut self, op: ContextOperation, cx: &mut ModelContext<Self>) {
self.operations.push(op.clone()); self.operations.push(op.clone());
cx.emit(ContextEvent::Operation(op)); cx.emit(ContextEvent::Operation(op));
} }
pub fn buffer(&self) -> &Entity<Buffer> { pub fn buffer(&self) -> &Model<Buffer> {
&self.buffer &self.buffer
} }
@@ -1060,7 +1031,7 @@ impl AssistantContext {
self.language_registry.clone() self.language_registry.clone()
} }
pub fn project(&self) -> Option<Entity<Project>> { pub fn project(&self) -> Option<Model<Project>> {
self.project.clone() self.project.clone()
} }
@@ -1076,7 +1047,11 @@ impl AssistantContext {
self.summary.as_ref() self.summary.as_ref()
} }
pub fn patch_containing(&self, position: Point, cx: &App) -> Option<&AssistantPatch> { pub(crate) fn patch_containing(
&self,
position: Point,
cx: &AppContext,
) -> Option<&AssistantPatch> {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
let index = self.patches.binary_search_by(|patch| { let index = self.patches.binary_search_by(|patch| {
let patch_range = patch.range.to_point(&buffer); let patch_range = patch.range.to_point(&buffer);
@@ -1099,10 +1074,10 @@ impl AssistantContext {
self.patches.iter().map(|patch| patch.range.clone()) self.patches.iter().map(|patch| patch.range.clone())
} }
pub fn patch_for_range( pub(crate) fn patch_for_range(
&self, &self,
range: &Range<language::Anchor>, range: &Range<language::Anchor>,
cx: &App, cx: &AppContext,
) -> Option<&AssistantPatch> { ) -> Option<&AssistantPatch> {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
let index = self.patch_index_for_range(range, buffer).ok()?; let index = self.patch_index_for_range(range, buffer).ok()?;
@@ -1133,7 +1108,7 @@ impl AssistantContext {
&self.slash_command_output_sections &self.slash_command_output_sections
} }
pub fn contains_files(&self, cx: &App) -> bool { pub fn contains_files(&self, cx: &AppContext) -> bool {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
self.slash_command_output_sections.iter().any(|section| { self.slash_command_output_sections.iter().any(|section| {
section.is_valid(buffer) section.is_valid(buffer)
@@ -1147,7 +1122,15 @@ impl AssistantContext {
}) })
} }
fn set_language(&mut self, cx: &mut Context<Self>) { pub fn pending_tool_uses(&self) -> Vec<&PendingToolUse> {
self.pending_tool_uses_by_id.values().collect()
}
pub fn get_tool_use_by_id(&self, id: &LanguageModelToolUseId) -> Option<&PendingToolUse> {
self.pending_tool_uses_by_id.get(id)
}
fn set_language(&mut self, cx: &mut ModelContext<Self>) {
let markdown = self.language_registry.language_for_name("Markdown"); let markdown = self.language_registry.language_for_name("Markdown");
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
let markdown = markdown.await?; let markdown = markdown.await?;
@@ -1161,9 +1144,9 @@ impl AssistantContext {
fn handle_buffer_event( fn handle_buffer_event(
&mut self, &mut self,
_: Entity<Buffer>, _: Model<Buffer>,
event: &language::BufferEvent, event: &language::BufferEvent,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
match event { match event {
language::BufferEvent::Operation { language::BufferEvent::Operation {
@@ -1181,11 +1164,11 @@ impl AssistantContext {
} }
} }
pub fn token_count(&self) -> Option<usize> { pub(crate) fn token_count(&self) -> Option<usize> {
self.token_count self.token_count
} }
pub(crate) fn count_remaining_tokens(&mut self, cx: &mut Context<Self>) { pub(crate) fn count_remaining_tokens(&mut self, cx: &mut ModelContext<Self>) {
// Assume it will be a Chat request, even though that takes fewer tokens (and risks going over the limit), // Assume it will be a Chat request, even though that takes fewer tokens (and risks going over the limit),
// because otherwise you see in the UI that your empty message has a bunch of tokens already used. // because otherwise you see in the UI that your empty message has a bunch of tokens already used.
let request = self.to_completion_request(RequestType::Chat, cx); let request = self.to_completion_request(RequestType::Chat, cx);
@@ -1213,7 +1196,7 @@ impl AssistantContext {
&mut self, &mut self,
cache_configuration: &Option<LanguageModelCacheConfiguration>, cache_configuration: &Option<LanguageModelCacheConfiguration>,
speculative: bool, speculative: bool,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> bool { ) -> bool {
let cache_configuration = let cache_configuration =
cache_configuration cache_configuration
@@ -1315,7 +1298,7 @@ impl AssistantContext {
new_anchor_needs_caching new_anchor_needs_caching
} }
fn start_cache_warming(&mut self, model: &Arc<dyn LanguageModel>, cx: &mut Context<Self>) { fn start_cache_warming(&mut self, model: &Arc<dyn LanguageModel>, cx: &mut ModelContext<Self>) {
let cache_configuration = model.cache_configuration(); let cache_configuration = model.cache_configuration();
if !self.mark_cache_anchors(&cache_configuration, true, cx) { if !self.mark_cache_anchors(&cache_configuration, true, cx) {
@@ -1365,7 +1348,7 @@ impl AssistantContext {
}); });
} }
pub fn update_cache_status_for_completion(&mut self, cx: &mut Context<Self>) { pub fn update_cache_status_for_completion(&mut self, cx: &mut ModelContext<Self>) {
let cached_message_ids: Vec<MessageId> = self let cached_message_ids: Vec<MessageId> = self
.messages_metadata .messages_metadata
.iter() .iter()
@@ -1390,7 +1373,7 @@ impl AssistantContext {
cx.notify(); cx.notify();
} }
pub fn reparse(&mut self, cx: &mut Context<Self>) { pub fn reparse(&mut self, cx: &mut ModelContext<Self>) {
let buffer = self.buffer.read(cx).text_snapshot(); let buffer = self.buffer.read(cx).text_snapshot();
let mut row_ranges = self let mut row_ranges = self
.edits_since_last_parse .edits_since_last_parse
@@ -1463,7 +1446,7 @@ impl AssistantContext {
buffer: &BufferSnapshot, buffer: &BufferSnapshot,
updated: &mut Vec<ParsedSlashCommand>, updated: &mut Vec<ParsedSlashCommand>,
removed: &mut Vec<Range<text::Anchor>>, removed: &mut Vec<Range<text::Anchor>>,
cx: &App, cx: &AppContext,
) { ) {
let old_range = self.pending_command_indices_for_range(range.clone(), cx); let old_range = self.pending_command_indices_for_range(range.clone(), cx);
@@ -1517,7 +1500,7 @@ impl AssistantContext {
fn invalidate_pending_slash_commands( fn invalidate_pending_slash_commands(
&mut self, &mut self,
buffer: &BufferSnapshot, buffer: &BufferSnapshot,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
let mut invalidated_command_ids = Vec::new(); let mut invalidated_command_ids = Vec::new();
for (&command_id, command) in self.invoked_slash_commands.iter_mut() { for (&command_id, command) in self.invoked_slash_commands.iter_mut() {
@@ -1551,7 +1534,7 @@ impl AssistantContext {
buffer: &BufferSnapshot, buffer: &BufferSnapshot,
updated: &mut Vec<Range<text::Anchor>>, updated: &mut Vec<Range<text::Anchor>>,
removed: &mut Vec<Range<text::Anchor>>, removed: &mut Vec<Range<text::Anchor>>,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
// Rebuild the XML tags in the edited range. // Rebuild the XML tags in the edited range.
let intersecting_tags_range = let intersecting_tags_range =
@@ -1594,7 +1577,7 @@ impl AssistantContext {
&self, &self,
buffer: &BufferSnapshot, buffer: &BufferSnapshot,
range: Range<text::Anchor>, range: Range<text::Anchor>,
cx: &App, cx: &AppContext,
) -> Vec<XmlTag> { ) -> Vec<XmlTag> {
let mut messages = self.messages(cx).peekable(); let mut messages = self.messages(cx).peekable();
@@ -1651,7 +1634,7 @@ impl AssistantContext {
tags_start_ix: usize, tags_start_ix: usize,
buffer_end: text::Anchor, buffer_end: text::Anchor,
buffer: &BufferSnapshot, buffer: &BufferSnapshot,
cx: &App, cx: &AppContext,
) -> Vec<AssistantPatch> { ) -> Vec<AssistantPatch> {
let mut new_patches = Vec::new(); let mut new_patches = Vec::new();
let mut pending_patch = None; let mut pending_patch = None;
@@ -1809,7 +1792,7 @@ impl AssistantContext {
pub fn pending_command_for_position( pub fn pending_command_for_position(
&mut self, &mut self,
position: language::Anchor, position: language::Anchor,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> Option<&mut ParsedSlashCommand> { ) -> Option<&mut ParsedSlashCommand> {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
match self match self
@@ -1833,7 +1816,7 @@ impl AssistantContext {
pub fn pending_commands_for_range( pub fn pending_commands_for_range(
&self, &self,
range: Range<language::Anchor>, range: Range<language::Anchor>,
cx: &App, cx: &AppContext,
) -> &[ParsedSlashCommand] { ) -> &[ParsedSlashCommand] {
let range = self.pending_command_indices_for_range(range, cx); let range = self.pending_command_indices_for_range(range, cx);
&self.parsed_slash_commands[range] &self.parsed_slash_commands[range]
@@ -1842,7 +1825,7 @@ impl AssistantContext {
fn pending_command_indices_for_range( fn pending_command_indices_for_range(
&self, &self,
range: Range<language::Anchor>, range: Range<language::Anchor>,
cx: &App, cx: &AppContext,
) -> Range<usize> { ) -> Range<usize> {
self.indices_intersecting_buffer_range(&self.parsed_slash_commands, range, cx) self.indices_intersecting_buffer_range(&self.parsed_slash_commands, range, cx)
} }
@@ -1851,7 +1834,7 @@ impl AssistantContext {
&self, &self,
all_annotations: &[T], all_annotations: &[T],
range: Range<language::Anchor>, range: Range<language::Anchor>,
cx: &App, cx: &AppContext,
) -> Range<usize> { ) -> Range<usize> {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
let start_ix = match all_annotations let start_ix = match all_annotations
@@ -1874,7 +1857,7 @@ impl AssistantContext {
name: &str, name: &str,
output: Task<SlashCommandResult>, output: Task<SlashCommandResult>,
ensure_trailing_newline: bool, ensure_trailing_newline: bool,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
let version = self.version.clone(); let version = self.version.clone();
let command_id = InvokedSlashCommandId(self.next_timestamp()); let command_id = InvokedSlashCommandId(self.next_timestamp());
@@ -2142,7 +2125,7 @@ impl AssistantContext {
fn insert_slash_command_output_section( fn insert_slash_command_output_section(
&mut self, &mut self,
section: SlashCommandOutputSection<language::Anchor>, section: SlashCommandOutputSection<language::Anchor>,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
let insertion_ix = match self let insertion_ix = match self
@@ -2168,11 +2151,73 @@ impl AssistantContext {
); );
} }
pub fn completion_provider_changed(&mut self, cx: &mut Context<Self>) { pub fn insert_tool_output(
&mut self,
tool_use_id: LanguageModelToolUseId,
output: Task<Result<String>>,
cx: &mut ModelContext<Self>,
) {
let insert_output_task = cx.spawn(|this, mut cx| {
let tool_use_id = tool_use_id.clone();
async move {
let output = output.await;
this.update(&mut cx, |this, cx| match output {
Ok(mut output) => {
const NEWLINE: char = '\n';
if !output.ends_with(NEWLINE) {
output.push(NEWLINE);
}
let anchor_range = this.buffer.update(cx, |buffer, cx| {
let insert_start = buffer.len().to_offset(buffer);
let insert_end = insert_start;
let start = insert_start;
let end = start + output.len() - NEWLINE.len_utf8();
buffer.edit([(insert_start..insert_end, output)], None, cx);
let output_range = buffer.anchor_after(start)..buffer.anchor_after(end);
output_range
});
this.insert_content(
Content::ToolResult {
range: anchor_range.clone(),
tool_use_id: tool_use_id.clone(),
},
cx,
);
cx.emit(ContextEvent::ToolFinished {
tool_use_id,
output_range: anchor_range,
});
}
Err(err) => {
if let Some(tool_use) = this.pending_tool_uses_by_id.get_mut(&tool_use_id) {
tool_use.status = PendingToolUseStatus::Error(err.to_string());
}
}
})
.ok();
}
});
if let Some(tool_use) = self.pending_tool_uses_by_id.get_mut(&tool_use_id) {
tool_use.status = PendingToolUseStatus::Running {
_task: insert_output_task.shared(),
};
}
}
pub fn completion_provider_changed(&mut self, cx: &mut ModelContext<Self>) {
self.count_remaining_tokens(cx); self.count_remaining_tokens(cx);
} }
fn get_last_valid_message_id(&self, cx: &Context<Self>) -> Option<MessageId> { fn get_last_valid_message_id(&self, cx: &ModelContext<Self>) -> Option<MessageId> {
self.message_anchors.iter().rev().find_map(|message| { self.message_anchors.iter().rev().find_map(|message| {
message message
.start .start
@@ -2184,7 +2229,7 @@ impl AssistantContext {
pub fn assist( pub fn assist(
&mut self, &mut self,
request_type: RequestType, request_type: RequestType,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> Option<MessageAnchor> { ) -> Option<MessageAnchor> {
let model_registry = LanguageModelRegistry::read_global(cx); let model_registry = LanguageModelRegistry::read_global(cx);
let provider = model_registry.active_provider()?; let provider = model_registry.active_provider()?;
@@ -2198,7 +2243,20 @@ impl AssistantContext {
// Compute which messages to cache, including the last one. // Compute which messages to cache, including the last one.
self.mark_cache_anchors(&model.cache_configuration(), false, cx); self.mark_cache_anchors(&model.cache_configuration(), false, cx);
let request = self.to_completion_request(request_type, cx); let mut request = self.to_completion_request(request_type, cx);
if cx.has_flag::<ToolUseFeatureFlag>() {
request.tools = self
.tools
.tools(cx)
.into_iter()
.map(|tool| LanguageModelRequestTool {
name: tool.name(),
description: tool.description(),
input_schema: tool.input_schema(),
})
.collect();
}
let assistant_message = self let assistant_message = self
.insert_message_after(last_message_id, Role::Assistant, MessageStatus::Pending, cx) .insert_message_after(last_message_id, Role::Assistant, MessageStatus::Pending, cx)
@@ -2255,7 +2313,44 @@ impl AssistantContext {
cx, cx,
); );
} }
LanguageModelCompletionEvent::ToolUse(_) => {} LanguageModelCompletionEvent::ToolUse(tool_use) => {
const NEWLINE: char = '\n';
let mut text = String::new();
text.push(NEWLINE);
text.push_str(
&serde_json::to_string_pretty(&tool_use)
.expect("failed to serialize tool use to JSON"),
);
text.push(NEWLINE);
let text_len = text.len();
buffer.edit(
[(
message_old_end_offset..message_old_end_offset,
text,
)],
None,
cx,
);
let start_ix = message_old_end_offset + NEWLINE.len_utf8();
let end_ix =
message_old_end_offset + text_len - NEWLINE.len_utf8();
let source_range = buffer.anchor_after(start_ix)
..buffer.anchor_after(end_ix);
this.pending_tool_uses_by_id.insert(
tool_use.id.clone(),
PendingToolUse {
id: tool_use.id,
name: tool_use.name,
input: tool_use.input,
status: PendingToolUseStatus::Idle,
source_range,
},
);
}
} }
}); });
@@ -2338,7 +2433,9 @@ impl AssistantContext {
if let Ok(stop_reason) = result { if let Ok(stop_reason) = result {
match stop_reason { match stop_reason {
StopReason::ToolUse => {} StopReason::ToolUse => {
cx.emit(ContextEvent::UsePendingTools);
}
StopReason::EndTurn => {} StopReason::EndTurn => {}
StopReason::MaxTokens => {} StopReason::MaxTokens => {}
} }
@@ -2360,7 +2457,7 @@ impl AssistantContext {
pub fn to_completion_request( pub fn to_completion_request(
&self, &self,
request_type: RequestType, request_type: RequestType,
cx: &App, cx: &AppContext,
) -> LanguageModelRequest { ) -> LanguageModelRequest {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
@@ -2417,6 +2514,23 @@ impl AssistantContext {
.push(language_model::MessageContent::Image(image)); .push(language_model::MessageContent::Image(image));
} }
} }
Content::ToolUse { tool_use, .. } => {
request_message
.content
.push(language_model::MessageContent::ToolUse(tool_use.clone()));
}
Content::ToolResult { tool_use_id, .. } => {
request_message.content.push(
language_model::MessageContent::ToolResult(
LanguageModelToolResult {
tool_use_id: tool_use_id.to_string(),
is_error: false,
content: collect_text_content(buffer, range.clone())
.unwrap_or_default(),
},
),
);
}
} }
offset = range.end; offset = range.end;
@@ -2455,7 +2569,7 @@ impl AssistantContext {
completion_request completion_request
} }
pub fn cancel_last_assist(&mut self, cx: &mut Context<Self>) -> bool { pub fn cancel_last_assist(&mut self, cx: &mut ModelContext<Self>) -> bool {
if let Some(pending_completion) = self.pending_completions.pop() { if let Some(pending_completion) = self.pending_completions.pop() {
self.update_metadata(pending_completion.assistant_message_id, cx, |metadata| { self.update_metadata(pending_completion.assistant_message_id, cx, |metadata| {
if metadata.status == MessageStatus::Pending { if metadata.status == MessageStatus::Pending {
@@ -2468,7 +2582,7 @@ impl AssistantContext {
} }
} }
pub fn cycle_message_roles(&mut self, ids: HashSet<MessageId>, cx: &mut Context<Self>) { pub fn cycle_message_roles(&mut self, ids: HashSet<MessageId>, cx: &mut ModelContext<Self>) {
for id in &ids { for id in &ids {
if let Some(metadata) = self.messages_metadata.get(id) { if let Some(metadata) = self.messages_metadata.get(id) {
let role = metadata.role.cycle(); let role = metadata.role.cycle();
@@ -2479,7 +2593,7 @@ impl AssistantContext {
self.message_roles_updated(ids, cx); self.message_roles_updated(ids, cx);
} }
fn message_roles_updated(&mut self, ids: HashSet<MessageId>, cx: &mut Context<Self>) { fn message_roles_updated(&mut self, ids: HashSet<MessageId>, cx: &mut ModelContext<Self>) {
let mut ranges = Vec::new(); let mut ranges = Vec::new();
for message in self.messages(cx) { for message in self.messages(cx) {
if ids.contains(&message.id) { if ids.contains(&message.id) {
@@ -2502,7 +2616,7 @@ impl AssistantContext {
pub fn update_metadata( pub fn update_metadata(
&mut self, &mut self,
id: MessageId, id: MessageId,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
f: impl FnOnce(&mut MessageMetadata), f: impl FnOnce(&mut MessageMetadata),
) { ) {
let version = self.version.clone(); let version = self.version.clone();
@@ -2526,7 +2640,7 @@ impl AssistantContext {
message_id: MessageId, message_id: MessageId,
role: Role, role: Role,
status: MessageStatus, status: MessageStatus,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> Option<MessageAnchor> { ) -> Option<MessageAnchor> {
if let Some(prev_message_ix) = self if let Some(prev_message_ix) = self
.message_anchors .message_anchors
@@ -2560,7 +2674,7 @@ impl AssistantContext {
offset: usize, offset: usize,
role: Role, role: Role,
status: MessageStatus, status: MessageStatus,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> MessageAnchor { ) -> MessageAnchor {
let start = self.buffer.update(cx, |buffer, cx| { let start = self.buffer.update(cx, |buffer, cx| {
buffer.edit([(offset..offset, "\n")], None, cx); buffer.edit([(offset..offset, "\n")], None, cx);
@@ -2590,7 +2704,7 @@ impl AssistantContext {
anchor anchor
} }
pub fn insert_content(&mut self, content: Content, cx: &mut Context<Self>) { pub fn insert_content(&mut self, content: Content, cx: &mut ModelContext<Self>) {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
let insertion_ix = match self let insertion_ix = match self
.contents .contents
@@ -2606,7 +2720,7 @@ impl AssistantContext {
cx.emit(ContextEvent::MessagesEdited); cx.emit(ContextEvent::MessagesEdited);
} }
pub fn contents<'a>(&'a self, cx: &'a App) -> impl 'a + Iterator<Item = Content> { pub fn contents<'a>(&'a self, cx: &'a AppContext) -> impl 'a + Iterator<Item = Content> {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
self.contents self.contents
.iter() .iter()
@@ -2620,7 +2734,7 @@ impl AssistantContext {
pub fn split_message( pub fn split_message(
&mut self, &mut self,
range: Range<usize>, range: Range<usize>,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> (Option<MessageAnchor>, Option<MessageAnchor>) { ) -> (Option<MessageAnchor>, Option<MessageAnchor>) {
let start_message = self.message_for_offset(range.start, cx); let start_message = self.message_for_offset(range.start, cx);
let end_message = self.message_for_offset(range.end, cx); let end_message = self.message_for_offset(range.end, cx);
@@ -2746,7 +2860,7 @@ impl AssistantContext {
&mut self, &mut self,
new_anchor: MessageAnchor, new_anchor: MessageAnchor,
new_metadata: MessageMetadata, new_metadata: MessageMetadata,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
cx.emit(ContextEvent::MessagesEdited); cx.emit(ContextEvent::MessagesEdited);
@@ -2764,7 +2878,7 @@ impl AssistantContext {
self.message_anchors.insert(insertion_ix, new_anchor); self.message_anchors.insert(insertion_ix, new_anchor);
} }
pub fn summarize(&mut self, replace_old: bool, cx: &mut Context<Self>) { pub(super) fn summarize(&mut self, replace_old: bool, cx: &mut ModelContext<Self>) {
let Some(provider) = LanguageModelRegistry::read_global(cx).active_provider() else { let Some(provider) = LanguageModelRegistry::read_global(cx).active_provider() else {
return; return;
}; };
@@ -2842,14 +2956,14 @@ impl AssistantContext {
} }
} }
fn message_for_offset(&self, offset: usize, cx: &App) -> Option<Message> { fn message_for_offset(&self, offset: usize, cx: &AppContext) -> Option<Message> {
self.messages_for_offsets([offset], cx).pop() self.messages_for_offsets([offset], cx).pop()
} }
pub fn messages_for_offsets( pub fn messages_for_offsets(
&self, &self,
offsets: impl IntoIterator<Item = usize>, offsets: impl IntoIterator<Item = usize>,
cx: &App, cx: &AppContext,
) -> Vec<Message> { ) -> Vec<Message> {
let mut result = Vec::new(); let mut result = Vec::new();
@@ -2882,14 +2996,14 @@ impl AssistantContext {
fn messages_from_anchors<'a>( fn messages_from_anchors<'a>(
&'a self, &'a self,
message_anchors: impl Iterator<Item = &'a MessageAnchor> + 'a, message_anchors: impl Iterator<Item = &'a MessageAnchor> + 'a,
cx: &'a App, cx: &'a AppContext,
) -> impl 'a + Iterator<Item = Message> { ) -> impl 'a + Iterator<Item = Message> {
let buffer = self.buffer.read(cx); let buffer = self.buffer.read(cx);
Self::messages_from_iters(buffer, &self.messages_metadata, message_anchors.enumerate()) Self::messages_from_iters(buffer, &self.messages_metadata, message_anchors.enumerate())
} }
pub fn messages<'a>(&'a self, cx: &'a App) -> impl 'a + Iterator<Item = Message> { pub fn messages<'a>(&'a self, cx: &'a AppContext) -> impl 'a + Iterator<Item = Message> {
self.messages_from_anchors(self.message_anchors.iter(), cx) self.messages_from_anchors(self.message_anchors.iter(), cx)
} }
@@ -2937,7 +3051,7 @@ impl AssistantContext {
&mut self, &mut self,
debounce: Option<Duration>, debounce: Option<Duration>,
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
cx: &mut Context<AssistantContext>, cx: &mut ModelContext<Context>,
) { ) {
if self.replica_id() != ReplicaId::default() { if self.replica_id() != ReplicaId::default() {
// Prevent saving a remote context for now. // Prevent saving a remote context for now.
@@ -3003,7 +3117,7 @@ impl AssistantContext {
}); });
} }
pub fn custom_summary(&mut self, custom_summary: String, cx: &mut Context<Self>) { pub(crate) fn custom_summary(&mut self, custom_summary: String, cx: &mut ModelContext<Self>) {
let timestamp = self.next_timestamp(); let timestamp = self.next_timestamp();
let summary = self.summary.get_or_insert(ContextSummary::default()); let summary = self.summary.get_or_insert(ContextSummary::default());
summary.timestamp = timestamp; summary.timestamp = timestamp;
@@ -3163,8 +3277,8 @@ impl SavedContext {
fn into_ops( fn into_ops(
self, self,
buffer: &Entity<Buffer>, buffer: &Model<Buffer>,
cx: &mut Context<AssistantContext>, cx: &mut ModelContext<Context>,
) -> Vec<ContextOperation> { ) -> Vec<ContextOperation> {
let mut operations = Vec::new(); let mut operations = Vec::new();
let mut version = clock::Global::new(); let mut version = clock::Global::new();

View File

@@ -1,26 +1,28 @@
use super::{AssistantEdit, MessageCacheMetadata};
use crate::slash_command_working_set::SlashCommandWorkingSet;
use crate::{ use crate::{
AssistantContext, AssistantEdit, AssistantEditKind, CacheStatus, ContextEvent, ContextId, assistant_panel, prompt_library, slash_command::file_command, AssistantEditKind, CacheStatus,
ContextOperation, InvokedSlashCommandId, MessageCacheMetadata, MessageId, MessageStatus, Context, ContextEvent, ContextId, ContextOperation, InvokedSlashCommandId, MessageId,
MessageStatus, PromptBuilder,
}; };
use anyhow::Result; use anyhow::Result;
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent, SlashCommandOutput, ArgumentCompletion, SlashCommand, SlashCommandContent, SlashCommandEvent, SlashCommandOutput,
SlashCommandOutputSection, SlashCommandRegistry, SlashCommandResult, SlashCommandWorkingSet, SlashCommandOutputSection, SlashCommandRegistry, SlashCommandResult,
}; };
use assistant_slash_commands::FileSlashCommand; use assistant_tool::ToolWorkingSet;
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use fs::FakeFs; use fs::FakeFs;
use futures::{ use futures::{
channel::mpsc, channel::mpsc,
stream::{self, StreamExt}, stream::{self, StreamExt},
}; };
use gpui::{prelude::*, App, Entity, SharedString, Task, TestAppContext, WeakEntity}; use gpui::{prelude::*, AppContext, Model, SharedString, Task, TestAppContext, WeakView};
use language::{Buffer, BufferSnapshot, LanguageRegistry, LspAdapterDelegate}; use language::{Buffer, BufferSnapshot, LanguageRegistry, LspAdapterDelegate};
use language_model::{LanguageModelCacheConfiguration, LanguageModelRegistry, Role}; use language_model::{LanguageModelCacheConfiguration, LanguageModelRegistry, Role};
use parking_lot::Mutex; use parking_lot::Mutex;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use project::Project; use project::Project;
use prompt_library::PromptBuilder;
use rand::prelude::*; use rand::prelude::*;
use serde_json::json; use serde_json::json;
use settings::SettingsStore; use settings::SettingsStore;
@@ -33,7 +35,7 @@ use std::{
sync::{atomic::AtomicBool, Arc}, sync::{atomic::AtomicBool, Arc},
}; };
use text::{network::Network, OffsetRangeExt as _, ReplicaId, ToOffset}; use text::{network::Network, OffsetRangeExt as _, ReplicaId, ToOffset};
use ui::{IconName, Window}; use ui::{IconName, WindowContext};
use unindent::Unindent; use unindent::Unindent;
use util::{ use util::{
test::{generate_marked_text, marked_text_ranges}, test::{generate_marked_text, marked_text_ranges},
@@ -42,19 +44,21 @@ use util::{
use workspace::Workspace; use workspace::Workspace;
#[gpui::test] #[gpui::test]
fn test_inserting_and_removing_messages(cx: &mut App) { fn test_inserting_and_removing_messages(cx: &mut AppContext) {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);
LanguageModelRegistry::test(cx); LanguageModelRegistry::test(cx);
cx.set_global(settings_store); cx.set_global(settings_store);
assistant_panel::init(cx);
let registry = Arc::new(LanguageRegistry::test(cx.background_executor().clone())); let registry = Arc::new(LanguageRegistry::test(cx.background_executor().clone()));
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap()); let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::local( Context::local(
registry, registry,
None, None,
None, None,
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
cx, cx,
) )
}); });
@@ -181,20 +185,22 @@ fn test_inserting_and_removing_messages(cx: &mut App) {
} }
#[gpui::test] #[gpui::test]
fn test_message_splitting(cx: &mut App) { fn test_message_splitting(cx: &mut AppContext) {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);
cx.set_global(settings_store); cx.set_global(settings_store);
LanguageModelRegistry::test(cx); LanguageModelRegistry::test(cx);
assistant_panel::init(cx);
let registry = Arc::new(LanguageRegistry::test(cx.background_executor().clone())); let registry = Arc::new(LanguageRegistry::test(cx.background_executor().clone()));
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap()); let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::local( Context::local(
registry.clone(), registry.clone(),
None, None,
None, None,
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
cx, cx,
) )
}); });
@@ -284,19 +290,21 @@ fn test_message_splitting(cx: &mut App) {
} }
#[gpui::test] #[gpui::test]
fn test_messages_for_offsets(cx: &mut App) { fn test_messages_for_offsets(cx: &mut AppContext) {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);
LanguageModelRegistry::test(cx); LanguageModelRegistry::test(cx);
cx.set_global(settings_store); cx.set_global(settings_store);
assistant_panel::init(cx);
let registry = Arc::new(LanguageRegistry::test(cx.background_executor().clone())); let registry = Arc::new(LanguageRegistry::test(cx.background_executor().clone()));
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap()); let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::local( Context::local(
registry, registry,
None, None,
None, None,
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
cx, cx,
) )
}); });
@@ -363,9 +371,9 @@ fn test_messages_for_offsets(cx: &mut App) {
); );
fn message_ids_for_offsets( fn message_ids_for_offsets(
context: &Entity<AssistantContext>, context: &Model<Context>,
offsets: &[usize], offsets: &[usize],
cx: &App, cx: &AppContext,
) -> Vec<MessageId> { ) -> Vec<MessageId> {
context context
.read(cx) .read(cx)
@@ -382,6 +390,7 @@ async fn test_slash_commands(cx: &mut TestAppContext) {
cx.set_global(settings_store); cx.set_global(settings_store);
cx.update(LanguageModelRegistry::test); cx.update(LanguageModelRegistry::test);
cx.update(Project::init_settings); cx.update(Project::init_settings);
cx.update(assistant_panel::init);
let fs = FakeFs::new(cx.background_executor.clone()); let fs = FakeFs::new(cx.background_executor.clone());
fs.insert_tree( fs.insert_tree(
@@ -399,17 +408,18 @@ async fn test_slash_commands(cx: &mut TestAppContext) {
.await; .await;
let slash_command_registry = cx.update(SlashCommandRegistry::default_global); let slash_command_registry = cx.update(SlashCommandRegistry::default_global);
slash_command_registry.register_command(FileSlashCommand, false); slash_command_registry.register_command(file_command::FileSlashCommand, false);
let registry = Arc::new(LanguageRegistry::test(cx.executor())); let registry = Arc::new(LanguageRegistry::test(cx.executor()));
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap()); let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::local( Context::local(
registry.clone(), registry.clone(),
None, None,
None, None,
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
cx, cx,
) )
}); });
@@ -603,7 +613,7 @@ async fn test_slash_commands(cx: &mut TestAppContext) {
#[track_caller] #[track_caller]
fn assert_text_and_context_ranges( fn assert_text_and_context_ranges(
buffer: &Entity<Buffer>, buffer: &Model<Buffer>,
ranges: &RefCell<ContextRanges>, ranges: &RefCell<ContextRanges>,
expected_marked_text: &str, expected_marked_text: &str,
cx: &mut TestAppContext, cx: &mut TestAppContext,
@@ -688,17 +698,19 @@ async fn test_workflow_step_parsing(cx: &mut TestAppContext) {
let project = Project::test(fs, [Path::new("/root")], cx).await; let project = Project::test(fs, [Path::new("/root")], cx).await;
cx.update(LanguageModelRegistry::test); cx.update(LanguageModelRegistry::test);
cx.update(assistant_panel::init);
let registry = Arc::new(LanguageRegistry::test(cx.executor())); let registry = Arc::new(LanguageRegistry::test(cx.executor()));
// Create a new context // Create a new context
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap()); let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::local( Context::local(
registry.clone(), registry.clone(),
Some(project), Some(project),
None, None,
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
cx, cx,
) )
}); });
@@ -956,13 +968,14 @@ async fn test_workflow_step_parsing(cx: &mut TestAppContext) {
// Ensure steps are re-parsed when deserializing. // Ensure steps are re-parsed when deserializing.
let serialized_context = context.read_with(cx, |context, cx| context.serialize(cx)); let serialized_context = context.read_with(cx, |context, cx| context.serialize(cx));
let deserialized_context = cx.new(|cx| { let deserialized_context = cx.new_model(|cx| {
AssistantContext::deserialize( Context::deserialize(
serialized_context, serialized_context,
Default::default(), Default::default(),
registry.clone(), registry.clone(),
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
None, None,
None, None,
cx, cx,
@@ -999,11 +1012,7 @@ async fn test_workflow_step_parsing(cx: &mut TestAppContext) {
cx, cx,
); );
fn edit( fn edit(context: &Model<Context>, new_text_marked_with_edits: &str, cx: &mut TestAppContext) {
context: &Entity<AssistantContext>,
new_text_marked_with_edits: &str,
cx: &mut TestAppContext,
) {
context.update(cx, |context, cx| { context.update(cx, |context, cx| {
context.buffer.update(cx, |buffer, cx| { context.buffer.update(cx, |buffer, cx| {
buffer.edit_via_marked_text(&new_text_marked_with_edits.unindent(), None, cx); buffer.edit_via_marked_text(&new_text_marked_with_edits.unindent(), None, cx);
@@ -1014,7 +1023,7 @@ async fn test_workflow_step_parsing(cx: &mut TestAppContext) {
#[track_caller] #[track_caller]
fn expect_patches( fn expect_patches(
context: &Entity<AssistantContext>, context: &Model<Context>,
expected_marked_text: &str, expected_marked_text: &str,
expected_suggestions: &[&[AssistantEdit]], expected_suggestions: &[&[AssistantEdit]],
cx: &mut TestAppContext, cx: &mut TestAppContext,
@@ -1072,15 +1081,17 @@ async fn test_serialization(cx: &mut TestAppContext) {
let settings_store = cx.update(SettingsStore::test); let settings_store = cx.update(SettingsStore::test);
cx.set_global(settings_store); cx.set_global(settings_store);
cx.update(LanguageModelRegistry::test); cx.update(LanguageModelRegistry::test);
cx.update(assistant_panel::init);
let registry = Arc::new(LanguageRegistry::test(cx.executor())); let registry = Arc::new(LanguageRegistry::test(cx.executor()));
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap()); let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::local( Context::local(
registry.clone(), registry.clone(),
None, None,
None, None,
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
cx, cx,
) )
}); });
@@ -1117,13 +1128,14 @@ async fn test_serialization(cx: &mut TestAppContext) {
); );
let serialized_context = context.read_with(cx, |context, cx| context.serialize(cx)); let serialized_context = context.read_with(cx, |context, cx| context.serialize(cx));
let deserialized_context = cx.new(|cx| { let deserialized_context = cx.new_model(|cx| {
AssistantContext::deserialize( Context::deserialize(
serialized_context, serialized_context,
Default::default(), Default::default(),
registry.clone(), registry.clone(),
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
None, None,
None, None,
cx, cx,
@@ -1161,6 +1173,7 @@ async fn test_random_context_collaboration(cx: &mut TestAppContext, mut rng: Std
cx.set_global(settings_store); cx.set_global(settings_store);
cx.update(LanguageModelRegistry::test); cx.update(LanguageModelRegistry::test);
cx.update(assistant_panel::init);
let slash_commands = cx.update(SlashCommandRegistry::default_global); let slash_commands = cx.update(SlashCommandRegistry::default_global);
slash_commands.register_command(FakeSlashCommand("cmd-1".into()), false); slash_commands.register_command(FakeSlashCommand("cmd-1".into()), false);
slash_commands.register_command(FakeSlashCommand("cmd-2".into()), false); slash_commands.register_command(FakeSlashCommand("cmd-2".into()), false);
@@ -1174,14 +1187,15 @@ async fn test_random_context_collaboration(cx: &mut TestAppContext, mut rng: Std
let context_id = ContextId::new(); let context_id = ContextId::new();
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap()); let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
for i in 0..num_peers { for i in 0..num_peers {
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::new( Context::new(
context_id.clone(), context_id.clone(),
i as ReplicaId, i as ReplicaId,
language::Capability::ReadWrite, language::Capability::ReadWrite,
registry.clone(), registry.clone(),
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
None, None,
None, None,
cx, cx,
@@ -1428,19 +1442,21 @@ async fn test_random_context_collaboration(cx: &mut TestAppContext, mut rng: Std
} }
#[gpui::test] #[gpui::test]
fn test_mark_cache_anchors(cx: &mut App) { fn test_mark_cache_anchors(cx: &mut AppContext) {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);
LanguageModelRegistry::test(cx); LanguageModelRegistry::test(cx);
cx.set_global(settings_store); cx.set_global(settings_store);
assistant_panel::init(cx);
let registry = Arc::new(LanguageRegistry::test(cx.background_executor().clone())); let registry = Arc::new(LanguageRegistry::test(cx.background_executor().clone()));
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap()); let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::local( Context::local(
registry, registry,
None, None,
None, None,
prompt_builder.clone(), prompt_builder.clone(),
Arc::new(SlashCommandWorkingSet::default()), Arc::new(SlashCommandWorkingSet::default()),
Arc::new(ToolWorkingSet::default()),
cx, cx,
) )
}); });
@@ -1587,7 +1603,7 @@ fn test_mark_cache_anchors(cx: &mut App) {
); );
} }
fn messages(context: &Entity<AssistantContext>, cx: &App) -> Vec<(MessageId, Role, Range<usize>)> { fn messages(context: &Model<Context>, cx: &AppContext) -> Vec<(MessageId, Role, Range<usize>)> {
context context
.read(cx) .read(cx)
.messages(cx) .messages(cx)
@@ -1596,8 +1612,8 @@ fn messages(context: &Entity<AssistantContext>, cx: &App) -> Vec<(MessageId, Rol
} }
fn messages_cache( fn messages_cache(
context: &Entity<AssistantContext>, context: &Model<Context>,
cx: &App, cx: &AppContext,
) -> Vec<(MessageId, Option<MessageCacheMetadata>)> { ) -> Vec<(MessageId, Option<MessageCacheMetadata>)> {
context context
.read(cx) .read(cx)
@@ -1626,9 +1642,8 @@ impl SlashCommand for FakeSlashCommand {
self: Arc<Self>, self: Arc<Self>,
_arguments: &[String], _arguments: &[String],
_cancel: Arc<AtomicBool>, _cancel: Arc<AtomicBool>,
_workspace: Option<WeakEntity<Workspace>>, _workspace: Option<WeakView<Workspace>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
Task::ready(Ok(vec![])) Task::ready(Ok(vec![]))
} }
@@ -1642,10 +1657,9 @@ impl SlashCommand for FakeSlashCommand {
_arguments: &[String], _arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
_workspace: WeakEntity<Workspace>, _workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
Task::ready(Ok(SlashCommandOutput { Task::ready(Ok(SlashCommandOutput {
text: format!("Executed fake command: {}", self.0), text: format!("Executed fake command: {}", self.0),

View File

@@ -1,25 +1,27 @@
use crate::slash_command::context_server_command;
use crate::SlashCommandId;
use crate::{ use crate::{
AssistantContext, ContextEvent, ContextId, ContextOperation, ContextVersion, SavedContext, prompts::PromptBuilder, slash_command_working_set::SlashCommandWorkingSet, Context,
SavedContextMetadata, ContextEvent, ContextId, ContextOperation, ContextVersion, SavedContext, SavedContextMetadata,
}; };
use anyhow::{anyhow, Context as _, Result}; use anyhow::{anyhow, Context as _, Result};
use assistant_slash_command::{SlashCommandId, SlashCommandWorkingSet}; use assistant_tool::{ToolId, ToolWorkingSet};
use client::{proto, telemetry::Telemetry, Client, TypedEnvelope}; use client::{proto, telemetry::Telemetry, Client, TypedEnvelope};
use clock::ReplicaId; use clock::ReplicaId;
use collections::HashMap; use collections::HashMap;
use context_server::manager::ContextServerManager; use context_server::manager::ContextServerManager;
use context_server::ContextServerFactoryRegistry; use context_server::{ContextServerFactoryRegistry, ContextServerTool};
use fs::Fs; use fs::Fs;
use futures::StreamExt; use futures::StreamExt;
use fuzzy::StringMatchCandidate; use fuzzy::StringMatchCandidate;
use gpui::{App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity}; use gpui::{
AppContext, AsyncAppContext, Context as _, EventEmitter, Model, ModelContext, Task, WeakModel,
};
use language::LanguageRegistry; use language::LanguageRegistry;
use paths::contexts_dir; use paths::contexts_dir;
use project::Project; use project::Project;
use prompt_library::PromptBuilder;
use regex::Regex; use regex::Regex;
use rpc::AnyProtoClient; use rpc::AnyProtoClient;
use std::sync::LazyLock;
use std::{ use std::{
cmp::Reverse, cmp::Reverse,
ffi::OsStr, ffi::OsStr,
@@ -30,7 +32,7 @@ use std::{
}; };
use util::{ResultExt, TryFutureExt}; use util::{ResultExt, TryFutureExt};
pub(crate) fn init(client: &AnyProtoClient) { pub fn init(client: &AnyProtoClient) {
client.add_model_message_handler(ContextStore::handle_advertise_contexts); client.add_model_message_handler(ContextStore::handle_advertise_contexts);
client.add_model_request_handler(ContextStore::handle_open_context); client.add_model_request_handler(ContextStore::handle_open_context);
client.add_model_request_handler(ContextStore::handle_create_context); client.add_model_request_handler(ContextStore::handle_create_context);
@@ -47,16 +49,18 @@ pub struct RemoteContextMetadata {
pub struct ContextStore { pub struct ContextStore {
contexts: Vec<ContextHandle>, contexts: Vec<ContextHandle>,
contexts_metadata: Vec<SavedContextMetadata>, contexts_metadata: Vec<SavedContextMetadata>,
context_server_manager: Entity<ContextServerManager>, context_server_manager: Model<ContextServerManager>,
context_server_slash_command_ids: HashMap<Arc<str>, Vec<SlashCommandId>>, context_server_slash_command_ids: HashMap<Arc<str>, Vec<SlashCommandId>>,
context_server_tool_ids: HashMap<Arc<str>, Vec<ToolId>>,
host_contexts: Vec<RemoteContextMetadata>, host_contexts: Vec<RemoteContextMetadata>,
fs: Arc<dyn Fs>, fs: Arc<dyn Fs>,
languages: Arc<LanguageRegistry>, languages: Arc<LanguageRegistry>,
slash_commands: Arc<SlashCommandWorkingSet>, slash_commands: Arc<SlashCommandWorkingSet>,
tools: Arc<ToolWorkingSet>,
telemetry: Arc<Telemetry>, telemetry: Arc<Telemetry>,
_watch_updates: Task<Option<()>>, _watch_updates: Task<Option<()>>,
client: Arc<Client>, client: Arc<Client>,
project: Entity<Project>, project: Model<Project>,
project_is_shared: bool, project_is_shared: bool,
client_subscription: Option<client::Subscription>, client_subscription: Option<client::Subscription>,
_project_subscriptions: Vec<gpui::Subscription>, _project_subscriptions: Vec<gpui::Subscription>,
@@ -70,19 +74,19 @@ pub enum ContextStoreEvent {
impl EventEmitter<ContextStoreEvent> for ContextStore {} impl EventEmitter<ContextStoreEvent> for ContextStore {}
enum ContextHandle { enum ContextHandle {
Weak(WeakEntity<AssistantContext>), Weak(WeakModel<Context>),
Strong(Entity<AssistantContext>), Strong(Model<Context>),
} }
impl ContextHandle { impl ContextHandle {
fn upgrade(&self) -> Option<Entity<AssistantContext>> { fn upgrade(&self) -> Option<Model<Context>> {
match self { match self {
ContextHandle::Weak(weak) => weak.upgrade(), ContextHandle::Weak(weak) => weak.upgrade(),
ContextHandle::Strong(strong) => Some(strong.clone()), ContextHandle::Strong(strong) => Some(strong.clone()),
} }
} }
fn downgrade(&self) -> WeakEntity<AssistantContext> { fn downgrade(&self) -> WeakModel<Context> {
match self { match self {
ContextHandle::Weak(weak) => weak.clone(), ContextHandle::Weak(weak) => weak.clone(),
ContextHandle::Strong(strong) => strong.downgrade(), ContextHandle::Strong(strong) => strong.downgrade(),
@@ -92,11 +96,12 @@ impl ContextHandle {
impl ContextStore { impl ContextStore {
pub fn new( pub fn new(
project: Entity<Project>, project: Model<Project>,
prompt_builder: Arc<PromptBuilder>, prompt_builder: Arc<PromptBuilder>,
slash_commands: Arc<SlashCommandWorkingSet>, slash_commands: Arc<SlashCommandWorkingSet>,
cx: &mut App, tools: Arc<ToolWorkingSet>,
) -> Task<Result<Entity<Self>>> { cx: &mut AppContext,
) -> Task<Result<Model<Self>>> {
let fs = project.read(cx).fs().clone(); let fs = project.read(cx).fs().clone();
let languages = project.read(cx).languages().clone(); let languages = project.read(cx).languages().clone();
let telemetry = project.read(cx).client().telemetry().clone(); let telemetry = project.read(cx).client().telemetry().clone();
@@ -104,10 +109,10 @@ impl ContextStore {
const CONTEXT_WATCH_DURATION: Duration = Duration::from_millis(100); const CONTEXT_WATCH_DURATION: Duration = Duration::from_millis(100);
let (mut events, _) = fs.watch(contexts_dir(), CONTEXT_WATCH_DURATION).await; let (mut events, _) = fs.watch(contexts_dir(), CONTEXT_WATCH_DURATION).await;
let this = cx.new(|cx: &mut Context<Self>| { let this = cx.new_model(|cx: &mut ModelContext<Self>| {
let context_server_factory_registry = let context_server_factory_registry =
ContextServerFactoryRegistry::default_global(cx); ContextServerFactoryRegistry::default_global(cx);
let context_server_manager = cx.new(|cx| { let context_server_manager = cx.new_model(|cx| {
ContextServerManager::new(context_server_factory_registry, project.clone(), cx) ContextServerManager::new(context_server_factory_registry, project.clone(), cx)
}); });
let mut this = Self { let mut this = Self {
@@ -115,10 +120,12 @@ impl ContextStore {
contexts_metadata: Vec::new(), contexts_metadata: Vec::new(),
context_server_manager, context_server_manager,
context_server_slash_command_ids: HashMap::default(), context_server_slash_command_ids: HashMap::default(),
context_server_tool_ids: HashMap::default(),
host_contexts: Vec::new(), host_contexts: Vec::new(),
fs, fs,
languages, languages,
slash_commands, slash_commands,
tools,
telemetry, telemetry,
_watch_updates: cx.spawn(|this, mut cx| { _watch_updates: cx.spawn(|this, mut cx| {
async move { async move {
@@ -155,9 +162,9 @@ impl ContextStore {
} }
async fn handle_advertise_contexts( async fn handle_advertise_contexts(
this: Entity<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::AdvertiseContexts>, envelope: TypedEnvelope<proto::AdvertiseContexts>,
mut cx: AsyncApp, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
this.host_contexts = envelope this.host_contexts = envelope
@@ -174,9 +181,9 @@ impl ContextStore {
} }
async fn handle_open_context( async fn handle_open_context(
this: Entity<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::OpenContext>, envelope: TypedEnvelope<proto::OpenContext>,
mut cx: AsyncApp, mut cx: AsyncAppContext,
) -> Result<proto::OpenContextResponse> { ) -> Result<proto::OpenContextResponse> {
let context_id = ContextId::from_proto(envelope.payload.context_id); let context_id = ContextId::from_proto(envelope.payload.context_id);
let operations = this.update(&mut cx, |this, cx| { let operations = this.update(&mut cx, |this, cx| {
@@ -204,9 +211,9 @@ impl ContextStore {
} }
async fn handle_create_context( async fn handle_create_context(
this: Entity<Self>, this: Model<Self>,
_: TypedEnvelope<proto::CreateContext>, _: TypedEnvelope<proto::CreateContext>,
mut cx: AsyncApp, mut cx: AsyncAppContext,
) -> Result<proto::CreateContextResponse> { ) -> Result<proto::CreateContextResponse> {
let (context_id, operations) = this.update(&mut cx, |this, cx| { let (context_id, operations) = this.update(&mut cx, |this, cx| {
if this.project.read(cx).is_via_collab() { if this.project.read(cx).is_via_collab() {
@@ -232,9 +239,9 @@ impl ContextStore {
} }
async fn handle_update_context( async fn handle_update_context(
this: Entity<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::UpdateContext>, envelope: TypedEnvelope<proto::UpdateContext>,
mut cx: AsyncApp, mut cx: AsyncAppContext,
) -> Result<()> { ) -> Result<()> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
let context_id = ContextId::from_proto(envelope.payload.context_id); let context_id = ContextId::from_proto(envelope.payload.context_id);
@@ -248,9 +255,9 @@ impl ContextStore {
} }
async fn handle_synchronize_contexts( async fn handle_synchronize_contexts(
this: Entity<Self>, this: Model<Self>,
envelope: TypedEnvelope<proto::SynchronizeContexts>, envelope: TypedEnvelope<proto::SynchronizeContexts>,
mut cx: AsyncApp, mut cx: AsyncAppContext,
) -> Result<proto::SynchronizeContextsResponse> { ) -> Result<proto::SynchronizeContextsResponse> {
this.update(&mut cx, |this, cx| { this.update(&mut cx, |this, cx| {
if this.project.read(cx).is_via_collab() { if this.project.read(cx).is_via_collab() {
@@ -291,7 +298,7 @@ impl ContextStore {
})? })?
} }
fn handle_project_changed(&mut self, _: Entity<Project>, cx: &mut Context<Self>) { fn handle_project_changed(&mut self, _: Model<Project>, cx: &mut ModelContext<Self>) {
let is_shared = self.project.read(cx).is_shared(); let is_shared = self.project.read(cx).is_shared();
let was_shared = mem::replace(&mut self.project_is_shared, is_shared); let was_shared = mem::replace(&mut self.project_is_shared, is_shared);
if is_shared == was_shared { if is_shared == was_shared {
@@ -312,7 +319,7 @@ impl ContextStore {
.client .client
.subscribe_to_entity(remote_id) .subscribe_to_entity(remote_id)
.log_err() .log_err()
.map(|subscription| subscription.set_model(&cx.entity(), &mut cx.to_async())); .map(|subscription| subscription.set_model(&cx.handle(), &mut cx.to_async()));
self.advertise_contexts(cx); self.advertise_contexts(cx);
} else { } else {
self.client_subscription = None; self.client_subscription = None;
@@ -321,9 +328,9 @@ impl ContextStore {
fn handle_project_event( fn handle_project_event(
&mut self, &mut self,
_: Entity<Project>, _: Model<Project>,
event: &project::Event, event: &project::Event,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
match event { match event {
project::Event::Reshared => { project::Event::Reshared => {
@@ -353,14 +360,15 @@ impl ContextStore {
} }
} }
pub fn create(&mut self, cx: &mut Context<Self>) -> Entity<AssistantContext> { pub fn create(&mut self, cx: &mut ModelContext<Self>) -> Model<Context> {
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::local( Context::local(
self.languages.clone(), self.languages.clone(),
Some(self.project.clone()), Some(self.project.clone()),
Some(self.telemetry.clone()), Some(self.telemetry.clone()),
self.prompt_builder.clone(), self.prompt_builder.clone(),
self.slash_commands.clone(), self.slash_commands.clone(),
self.tools.clone(),
cx, cx,
) )
}); });
@@ -370,8 +378,8 @@ impl ContextStore {
pub fn create_remote_context( pub fn create_remote_context(
&mut self, &mut self,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> Task<Result<Entity<AssistantContext>>> { ) -> Task<Result<Model<Context>>> {
let project = self.project.read(cx); let project = self.project.read(cx);
let Some(project_id) = project.remote_id() else { let Some(project_id) = project.remote_id() else {
return Task::ready(Err(anyhow!("project was not remote"))); return Task::ready(Err(anyhow!("project was not remote")));
@@ -384,19 +392,21 @@ impl ContextStore {
let telemetry = self.telemetry.clone(); let telemetry = self.telemetry.clone();
let prompt_builder = self.prompt_builder.clone(); let prompt_builder = self.prompt_builder.clone();
let slash_commands = self.slash_commands.clone(); let slash_commands = self.slash_commands.clone();
let tools = self.tools.clone();
let request = self.client.request(proto::CreateContext { project_id }); let request = self.client.request(proto::CreateContext { project_id });
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
let response = request.await?; let response = request.await?;
let context_id = ContextId::from_proto(response.context_id); let context_id = ContextId::from_proto(response.context_id);
let context_proto = response.context.context("invalid context")?; let context_proto = response.context.context("invalid context")?;
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::new( Context::new(
context_id.clone(), context_id.clone(),
replica_id, replica_id,
capability, capability,
language_registry, language_registry,
prompt_builder, prompt_builder,
slash_commands, slash_commands,
tools,
Some(project), Some(project),
Some(telemetry), Some(telemetry),
cx, cx,
@@ -428,8 +438,8 @@ impl ContextStore {
pub fn open_local_context( pub fn open_local_context(
&mut self, &mut self,
path: PathBuf, path: PathBuf,
cx: &Context<Self>, cx: &ModelContext<Self>,
) -> Task<Result<Entity<AssistantContext>>> { ) -> Task<Result<Model<Context>>> {
if let Some(existing_context) = self.loaded_context_for_path(&path, cx) { if let Some(existing_context) = self.loaded_context_for_path(&path, cx) {
return Task::ready(Ok(existing_context)); return Task::ready(Ok(existing_context));
} }
@@ -447,16 +457,18 @@ impl ContextStore {
}); });
let prompt_builder = self.prompt_builder.clone(); let prompt_builder = self.prompt_builder.clone();
let slash_commands = self.slash_commands.clone(); let slash_commands = self.slash_commands.clone();
let tools = self.tools.clone();
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
let saved_context = load.await?; let saved_context = load.await?;
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::deserialize( Context::deserialize(
saved_context, saved_context,
path.clone(), path.clone(),
languages, languages,
prompt_builder, prompt_builder,
slash_commands, slash_commands,
tools,
Some(project), Some(project),
Some(telemetry), Some(telemetry),
cx, cx,
@@ -473,7 +485,7 @@ impl ContextStore {
}) })
} }
fn loaded_context_for_path(&self, path: &Path, cx: &App) -> Option<Entity<AssistantContext>> { fn loaded_context_for_path(&self, path: &Path, cx: &AppContext) -> Option<Model<Context>> {
self.contexts.iter().find_map(|context| { self.contexts.iter().find_map(|context| {
let context = context.upgrade()?; let context = context.upgrade()?;
if context.read(cx).path() == Some(path) { if context.read(cx).path() == Some(path) {
@@ -484,11 +496,11 @@ impl ContextStore {
}) })
} }
pub fn loaded_context_for_id( pub(super) fn loaded_context_for_id(
&self, &self,
id: &ContextId, id: &ContextId,
cx: &App, cx: &AppContext,
) -> Option<Entity<AssistantContext>> { ) -> Option<Model<Context>> {
self.contexts.iter().find_map(|context| { self.contexts.iter().find_map(|context| {
let context = context.upgrade()?; let context = context.upgrade()?;
if context.read(cx).id() == id { if context.read(cx).id() == id {
@@ -502,8 +514,8 @@ impl ContextStore {
pub fn open_remote_context( pub fn open_remote_context(
&mut self, &mut self,
context_id: ContextId, context_id: ContextId,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) -> Task<Result<Entity<AssistantContext>>> { ) -> Task<Result<Model<Context>>> {
let project = self.project.read(cx); let project = self.project.read(cx);
let Some(project_id) = project.remote_id() else { let Some(project_id) = project.remote_id() else {
return Task::ready(Err(anyhow!("project was not remote"))); return Task::ready(Err(anyhow!("project was not remote")));
@@ -524,17 +536,19 @@ impl ContextStore {
}); });
let prompt_builder = self.prompt_builder.clone(); let prompt_builder = self.prompt_builder.clone();
let slash_commands = self.slash_commands.clone(); let slash_commands = self.slash_commands.clone();
let tools = self.tools.clone();
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
let response = request.await?; let response = request.await?;
let context_proto = response.context.context("invalid context")?; let context_proto = response.context.context("invalid context")?;
let context = cx.new(|cx| { let context = cx.new_model(|cx| {
AssistantContext::new( Context::new(
context_id.clone(), context_id.clone(),
replica_id, replica_id,
capability, capability,
language_registry, language_registry,
prompt_builder, prompt_builder,
slash_commands, slash_commands,
tools,
Some(project), Some(project),
Some(telemetry), Some(telemetry),
cx, cx,
@@ -563,7 +577,7 @@ impl ContextStore {
}) })
} }
fn register_context(&mut self, context: &Entity<AssistantContext>, cx: &mut Context<Self>) { fn register_context(&mut self, context: &Model<Context>, cx: &mut ModelContext<Self>) {
let handle = if self.project_is_shared { let handle = if self.project_is_shared {
ContextHandle::Strong(context.clone()) ContextHandle::Strong(context.clone())
} else { } else {
@@ -576,9 +590,9 @@ impl ContextStore {
fn handle_context_event( fn handle_context_event(
&mut self, &mut self,
context: Entity<AssistantContext>, context: Model<Context>,
event: &ContextEvent, event: &ContextEvent,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
let Some(project_id) = self.project.read(cx).remote_id() else { let Some(project_id) = self.project.read(cx).remote_id() else {
return; return;
@@ -603,7 +617,7 @@ impl ContextStore {
} }
} }
fn advertise_contexts(&self, cx: &App) { fn advertise_contexts(&self, cx: &AppContext) {
let Some(project_id) = self.project.read(cx).remote_id() else { let Some(project_id) = self.project.read(cx).remote_id() else {
return; return;
}; };
@@ -637,7 +651,7 @@ impl ContextStore {
.ok(); .ok();
} }
fn synchronize_contexts(&mut self, cx: &mut Context<Self>) { fn synchronize_contexts(&mut self, cx: &mut ModelContext<Self>) {
let Some(project_id) = self.project.read(cx).remote_id() else { let Some(project_id) = self.project.read(cx).remote_id() else {
return; return;
}; };
@@ -692,7 +706,7 @@ impl ContextStore {
.detach_and_log_err(cx); .detach_and_log_err(cx);
} }
pub fn search(&self, query: String, cx: &App) -> Task<Vec<SavedContextMetadata>> { pub fn search(&self, query: String, cx: &AppContext) -> Task<Vec<SavedContextMetadata>> {
let metadata = self.contexts_metadata.clone(); let metadata = self.contexts_metadata.clone();
let executor = cx.background_executor().clone(); let executor = cx.background_executor().clone();
cx.background_executor().spawn(async move { cx.background_executor().spawn(async move {
@@ -702,7 +716,7 @@ impl ContextStore {
let candidates = metadata let candidates = metadata
.iter() .iter()
.enumerate() .enumerate()
.map(|(id, metadata)| StringMatchCandidate::new(id, &metadata.title)) .map(|(id, metadata)| StringMatchCandidate::new(id, metadata.title.clone()))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let matches = fuzzy::match_strings( let matches = fuzzy::match_strings(
&candidates, &candidates,
@@ -726,7 +740,7 @@ impl ContextStore {
&self.host_contexts &self.host_contexts
} }
fn reload(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> { fn reload(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
let fs = self.fs.clone(); let fs = self.fs.clone();
cx.spawn(|this, mut cx| async move { cx.spawn(|this, mut cx| async move {
fs.create_dir(contexts_dir()).await?; fs.create_dir(contexts_dir()).await?;
@@ -739,8 +753,8 @@ impl ContextStore {
continue; continue;
} }
static ASSISTANT_CONTEXT_REGEX: LazyLock<Regex> = let pattern = r" - \d+.zed.json$";
LazyLock::new(|| Regex::new(r" - \d+.zed.json$").unwrap()); let re = Regex::new(pattern).unwrap();
let metadata = fs.metadata(&path).await?; let metadata = fs.metadata(&path).await?;
if let Some((file_name, metadata)) = path if let Some((file_name, metadata)) = path
@@ -749,15 +763,11 @@ impl ContextStore {
.zip(metadata) .zip(metadata)
{ {
// This is used to filter out contexts saved by the new assistant. // This is used to filter out contexts saved by the new assistant.
if !ASSISTANT_CONTEXT_REGEX.is_match(file_name) { if !re.is_match(file_name) {
continue; continue;
} }
if let Some(title) = ASSISTANT_CONTEXT_REGEX if let Some(title) = re.replace(file_name, "").lines().next() {
.replace(file_name, "")
.lines()
.next()
{
contexts.push(SavedContextMetadata { contexts.push(SavedContextMetadata {
title: title.to_string(), title: title.to_string(),
path, path,
@@ -775,8 +785,8 @@ impl ContextStore {
}) })
} }
pub fn restart_context_servers(&mut self, cx: &mut Context<Self>) { pub fn restart_context_servers(&mut self, cx: &mut ModelContext<Self>) {
cx.update_entity( cx.update_model(
&self.context_server_manager, &self.context_server_manager,
|context_server_manager, cx| { |context_server_manager, cx| {
for server in context_server_manager.servers() { for server in context_server_manager.servers() {
@@ -788,7 +798,7 @@ impl ContextStore {
); );
} }
fn register_context_server_handlers(&self, cx: &mut Context<Self>) { fn register_context_server_handlers(&self, cx: &mut ModelContext<Self>) {
cx.subscribe( cx.subscribe(
&self.context_server_manager.clone(), &self.context_server_manager.clone(),
Self::handle_context_server_event, Self::handle_context_server_event,
@@ -798,11 +808,12 @@ impl ContextStore {
fn handle_context_server_event( fn handle_context_server_event(
&mut self, &mut self,
context_server_manager: Entity<ContextServerManager>, context_server_manager: Model<ContextServerManager>,
event: &context_server::manager::Event, event: &context_server::manager::Event,
cx: &mut Context<Self>, cx: &mut ModelContext<Self>,
) { ) {
let slash_command_working_set = self.slash_commands.clone(); let slash_command_working_set = self.slash_commands.clone();
let tool_working_set = self.tools.clone();
match event { match event {
context_server::manager::Event::ServerStarted { server_id } => { context_server::manager::Event::ServerStarted { server_id } => {
if let Some(server) = context_server_manager.read(cx).get_server(server_id) { if let Some(server) = context_server_manager.read(cx).get_server(server_id) {
@@ -819,14 +830,14 @@ impl ContextStore {
if let Some(prompts) = protocol.list_prompts().await.log_err() { if let Some(prompts) = protocol.list_prompts().await.log_err() {
let slash_command_ids = prompts let slash_command_ids = prompts
.into_iter() .into_iter()
.filter(assistant_slash_commands::acceptable_prompt) .filter(context_server_command::acceptable_prompt)
.map(|prompt| { .map(|prompt| {
log::info!( log::info!(
"registering context server command: {:?}", "registering context server command: {:?}",
prompt.name prompt.name
); );
slash_command_working_set.insert(Arc::new( slash_command_working_set.insert(Arc::new(
assistant_slash_commands::ContextServerSlashCommand::new( context_server_command::ContextServerSlashCommand::new(
context_server_manager.clone(), context_server_manager.clone(),
&server, &server,
prompt, prompt,
@@ -842,6 +853,29 @@ impl ContextStore {
.log_err(); .log_err();
} }
} }
if protocol.capable(context_server::protocol::ServerCapability::Tools) {
if let Some(tools) = protocol.list_tools().await.log_err() {
let tool_ids = tools.tools.into_iter().map(|tool| {
log::info!("registering context server tool: {:?}", tool.name);
tool_working_set.insert(
Arc::new(ContextServerTool::new(
context_server_manager.clone(),
server.id(),
tool,
)),
)
}).collect::<Vec<_>>();
this.update(&mut cx, |this, _cx| {
this.context_server_tool_ids
.insert(server_id, tool_ids);
})
.log_err();
}
}
} }
}) })
.detach(); .detach();
@@ -853,6 +887,10 @@ impl ContextStore {
{ {
slash_command_working_set.remove(&slash_command_ids); slash_command_working_set.remove(&slash_command_ids);
} }
if let Some(tool_ids) = self.context_server_tool_ids.remove(server_id) {
tool_working_set.remove(&tool_ids);
}
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -2,14 +2,14 @@ use anyhow::{anyhow, Context as _, Result};
use collections::HashMap; use collections::HashMap;
use editor::ProposedChangesEditor; use editor::ProposedChangesEditor;
use futures::{future, TryFutureExt as _}; use futures::{future, TryFutureExt as _};
use gpui::{App, AsyncApp, Entity, SharedString}; use gpui::{AppContext, AsyncAppContext, Model, SharedString};
use language::{AutoindentMode, Buffer, BufferSnapshot}; use language::{AutoindentMode, Buffer, BufferSnapshot};
use project::{Project, ProjectPath}; use project::{Project, ProjectPath};
use std::{cmp, ops::Range, path::Path, sync::Arc}; use std::{cmp, ops::Range, path::Path, sync::Arc};
use text::{AnchorRangeExt as _, Bias, OffsetRangeExt as _, Point}; use text::{AnchorRangeExt as _, Bias, OffsetRangeExt as _, Point};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct AssistantPatch { pub(crate) struct AssistantPatch {
pub range: Range<language::Anchor>, pub range: Range<language::Anchor>,
pub title: SharedString, pub title: SharedString,
pub edits: Arc<[Result<AssistantEdit>]>, pub edits: Arc<[Result<AssistantEdit>]>,
@@ -17,13 +17,13 @@ pub struct AssistantPatch {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum AssistantPatchStatus { pub(crate) enum AssistantPatchStatus {
Pending, Pending,
Ready, Ready,
} }
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct AssistantEdit { pub(crate) struct AssistantEdit {
pub path: String, pub path: String,
pub kind: AssistantEditKind, pub kind: AssistantEditKind,
} }
@@ -55,8 +55,8 @@ pub enum AssistantEditKind {
} }
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, PartialEq)]
pub struct ResolvedPatch { pub(crate) struct ResolvedPatch {
pub edit_groups: HashMap<Entity<Buffer>, Vec<ResolvedEditGroup>>, pub edit_groups: HashMap<Model<Buffer>, Vec<ResolvedEditGroup>>,
pub errors: Vec<AssistantPatchResolutionError>, pub errors: Vec<AssistantPatchResolutionError>,
} }
@@ -74,7 +74,7 @@ pub struct ResolvedEdit {
} }
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, PartialEq)]
pub struct AssistantPatchResolutionError { pub(crate) struct AssistantPatchResolutionError {
pub edit_ix: usize, pub edit_ix: usize,
pub message: String, pub message: String,
} }
@@ -121,7 +121,7 @@ impl SearchMatrix {
} }
impl ResolvedPatch { impl ResolvedPatch {
pub fn apply(&self, editor: &ProposedChangesEditor, cx: &mut App) { pub fn apply(&self, editor: &ProposedChangesEditor, cx: &mut AppContext) {
for (buffer, groups) in &self.edit_groups { for (buffer, groups) in &self.edit_groups {
let branch = editor.branch_buffer_for_base(buffer).unwrap(); let branch = editor.branch_buffer_for_base(buffer).unwrap();
Self::apply_edit_groups(groups, &branch, cx); Self::apply_edit_groups(groups, &branch, cx);
@@ -129,7 +129,11 @@ impl ResolvedPatch {
editor.recalculate_all_buffer_diffs(); editor.recalculate_all_buffer_diffs();
} }
fn apply_edit_groups(groups: &Vec<ResolvedEditGroup>, buffer: &Entity<Buffer>, cx: &mut App) { fn apply_edit_groups(
groups: &Vec<ResolvedEditGroup>,
buffer: &Model<Buffer>,
cx: &mut AppContext,
) {
let mut edits = Vec::new(); let mut edits = Vec::new();
for group in groups { for group in groups {
for suggestion in &group.edits { for suggestion in &group.edits {
@@ -228,9 +232,9 @@ impl AssistantEdit {
pub async fn resolve( pub async fn resolve(
&self, &self,
project: Entity<Project>, project: Model<Project>,
mut cx: AsyncApp, mut cx: AsyncAppContext,
) -> Result<(Entity<Buffer>, ResolvedEdit)> { ) -> Result<(Model<Buffer>, ResolvedEdit)> {
let path = self.path.clone(); let path = self.path.clone();
let kind = self.kind.clone(); let kind = self.kind.clone();
let buffer = project let buffer = project
@@ -421,7 +425,11 @@ impl AssistantEditKind {
} }
impl AssistantPatch { impl AssistantPatch {
pub async fn resolve(&self, project: Entity<Project>, cx: &mut AsyncApp) -> ResolvedPatch { pub(crate) async fn resolve(
&self,
project: Model<Project>,
cx: &mut AsyncAppContext,
) -> ResolvedPatch {
let mut resolve_tasks = Vec::new(); let mut resolve_tasks = Vec::new();
for (ix, edit) in self.edits.iter().enumerate() { for (ix, edit) in self.edits.iter().enumerate() {
if let Ok(edit) = edit.as_ref() { if let Ok(edit) = edit.as_ref() {
@@ -547,7 +555,7 @@ impl Eq for AssistantPatch {}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use gpui::{App, AppContext as _}; use gpui::{AppContext, Context};
use language::{ use language::{
language_settings::AllLanguageSettings, Language, LanguageConfig, LanguageMatcher, language_settings::AllLanguageSettings, Language, LanguageConfig, LanguageMatcher,
}; };
@@ -557,7 +565,7 @@ mod tests {
use util::test::{generate_marked_text, marked_text_ranges}; use util::test::{generate_marked_text, marked_text_ranges};
#[gpui::test] #[gpui::test]
fn test_resolve_location(cx: &mut App) { fn test_resolve_location(cx: &mut AppContext) {
assert_location_resolution( assert_location_resolution(
concat!( concat!(
" Lorem\n", " Lorem\n",
@@ -628,7 +636,7 @@ mod tests {
} }
#[gpui::test] #[gpui::test]
fn test_resolve_edits(cx: &mut App) { fn test_resolve_edits(cx: &mut AppContext) {
init_test(cx); init_test(cx);
assert_edits( assert_edits(
@@ -894,7 +902,7 @@ mod tests {
); );
} }
fn init_test(cx: &mut App) { fn init_test(cx: &mut AppContext) {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);
cx.set_global(settings_store); cx.set_global(settings_store);
language::init(cx); language::init(cx);
@@ -904,9 +912,13 @@ mod tests {
} }
#[track_caller] #[track_caller]
fn assert_location_resolution(text_with_expected_range: &str, query: &str, cx: &mut App) { fn assert_location_resolution(
text_with_expected_range: &str,
query: &str,
cx: &mut AppContext,
) {
let (text, _) = marked_text_ranges(text_with_expected_range, false); let (text, _) = marked_text_ranges(text_with_expected_range, false);
let buffer = cx.new(|cx| Buffer::local(text.clone(), cx)); let buffer = cx.new_model(|cx| Buffer::local(text.clone(), cx));
let snapshot = buffer.read(cx).snapshot(); let snapshot = buffer.read(cx).snapshot();
let range = AssistantEditKind::resolve_location(&snapshot, query).to_offset(&snapshot); let range = AssistantEditKind::resolve_location(&snapshot, query).to_offset(&snapshot);
let text_with_actual_range = generate_marked_text(&text, &[range], false); let text_with_actual_range = generate_marked_text(&text, &[range], false);
@@ -918,10 +930,10 @@ mod tests {
old_text: String, old_text: String,
edits: Vec<AssistantEditKind>, edits: Vec<AssistantEditKind>,
new_text: String, new_text: String,
cx: &mut App, cx: &mut AppContext,
) { ) {
let buffer = let buffer =
cx.new(|cx| Buffer::local(old_text, cx).with_language(Arc::new(rust_lang()), cx)); cx.new_model(|cx| Buffer::local(old_text, cx).with_language(Arc::new(rust_lang()), cx));
let snapshot = buffer.read(cx).snapshot(); let snapshot = buffer.read(cx).snapshot();
let resolved_edits = edits let resolved_edits = edits
.into_iter() .into_iter()

View File

@@ -2,7 +2,7 @@ use anyhow::Result;
use assets::Assets; use assets::Assets;
use fs::Fs; use fs::Fs;
use futures::StreamExt; use futures::StreamExt;
use gpui::{App, AssetSource}; use gpui::AssetSource;
use handlebars::{Handlebars, RenderError}; use handlebars::{Handlebars, RenderError};
use language::{BufferSnapshot, LanguageName, Point}; use language::{BufferSnapshot, LanguageName, Point};
use parking_lot::Mutex; use parking_lot::Mutex;
@@ -48,7 +48,7 @@ pub struct ProjectSlashCommandPromptContext {
pub struct PromptLoadingParams<'a> { pub struct PromptLoadingParams<'a> {
pub fs: Arc<dyn Fs>, pub fs: Arc<dyn Fs>,
pub repo_path: Option<PathBuf>, pub repo_path: Option<PathBuf>,
pub cx: &'a gpui::App, pub cx: &'a gpui::AppContext,
} }
pub struct PromptBuilder { pub struct PromptBuilder {
@@ -56,19 +56,6 @@ pub struct PromptBuilder {
} }
impl PromptBuilder { impl PromptBuilder {
pub fn load(fs: Arc<dyn Fs>, stdout_is_a_pty: bool, cx: &mut App) -> Arc<Self> {
Self::new(Some(PromptLoadingParams {
fs: fs.clone(),
repo_path: stdout_is_a_pty
.then(|| std::env::current_dir().log_err())
.flatten(),
cx,
}))
.log_err()
.map(Arc::new)
.unwrap_or_else(|| Arc::new(Self::new(None).unwrap()))
}
pub fn new(loading_params: Option<PromptLoadingParams>) -> Result<Self> { pub fn new(loading_params: Option<PromptLoadingParams>) -> Result<Self> {
let mut handlebars = Handlebars::new(); let mut handlebars = Handlebars::new();
Self::register_built_in_templates(&mut handlebars)?; Self::register_built_in_templates(&mut handlebars)?;
@@ -224,7 +211,7 @@ impl PromptBuilder {
buffer: BufferSnapshot, buffer: BufferSnapshot,
range: Range<usize>, range: Range<usize>,
) -> Result<String, RenderError> { ) -> Result<String, RenderError> {
let content_type = match language_name.as_ref().map(|l| l.as_ref()) { let content_type = match language_name.as_ref().map(|l| l.0.as_ref()) {
None | Some("Markdown" | "Plain Text") => "text", None | Some("Markdown" | "Plain Text") => "text",
Some(_) => "code", Some(_) => "code",
}; };

View File

@@ -1,37 +1,62 @@
use crate::context_editor::ContextEditor; use crate::assistant_panel::ContextEditor;
use crate::SlashCommandWorkingSet;
use anyhow::Result; use anyhow::Result;
pub use assistant_slash_command::SlashCommand; use assistant_slash_command::AfterCompletion;
use assistant_slash_command::{AfterCompletion, SlashCommandLine, SlashCommandWorkingSet}; pub use assistant_slash_command::{SlashCommand, SlashCommandOutput};
use editor::{CompletionProvider, Editor}; use editor::{CompletionProvider, Editor};
use fuzzy::{match_strings, StringMatchCandidate}; use fuzzy::{match_strings, StringMatchCandidate};
use gpui::{App, Context, Entity, Task, WeakEntity, Window}; use gpui::{AppContext, Model, Task, ViewContext, WeakView, WindowContext};
use language::{Anchor, Buffer, Documentation, LanguageServerId, ToPoint}; use language::{Anchor, Buffer, CodeLabel, Documentation, HighlightId, LanguageServerId, ToPoint};
use parking_lot::Mutex; use parking_lot::{Mutex, RwLock};
use project::CompletionIntent; use project::CompletionIntent;
use rope::Point; use rope::Point;
use std::{ use std::{
cell::RefCell,
ops::Range, ops::Range,
rc::Rc,
sync::{ sync::{
atomic::{AtomicBool, Ordering::SeqCst}, atomic::{AtomicBool, Ordering::SeqCst},
Arc, Arc,
}, },
}; };
use ui::ActiveTheme;
use workspace::Workspace; use workspace::Workspace;
pub mod auto_command;
pub mod cargo_workspace_command;
pub mod context_server_command;
pub mod default_command;
pub mod delta_command;
pub mod diagnostics_command;
pub mod docs_command;
pub mod fetch_command;
pub mod file_command;
pub mod now_command;
pub mod project_command;
pub mod prompt_command;
pub mod search_command;
pub mod selection_command;
pub mod streaming_example_command;
pub mod symbols_command;
pub mod tab_command;
pub mod terminal_command;
pub struct SlashCommandCompletionProvider { pub(crate) struct SlashCommandCompletionProvider {
cancel_flag: Mutex<Arc<AtomicBool>>, cancel_flag: Mutex<Arc<AtomicBool>>,
slash_commands: Arc<SlashCommandWorkingSet>, slash_commands: Arc<SlashCommandWorkingSet>,
editor: Option<WeakEntity<ContextEditor>>, editor: Option<WeakView<ContextEditor>>,
workspace: Option<WeakEntity<Workspace>>, workspace: Option<WeakView<Workspace>>,
}
pub(crate) struct SlashCommandLine {
/// The range within the line containing the command name.
pub name: Range<usize>,
/// Ranges within the line containing the command arguments.
pub arguments: Vec<Range<usize>>,
} }
impl SlashCommandCompletionProvider { impl SlashCommandCompletionProvider {
pub fn new( pub fn new(
slash_commands: Arc<SlashCommandWorkingSet>, slash_commands: Arc<SlashCommandWorkingSet>,
editor: Option<WeakEntity<ContextEditor>>, editor: Option<WeakView<ContextEditor>>,
workspace: Option<WeakEntity<Workspace>>, workspace: Option<WeakView<Workspace>>,
) -> Self { ) -> Self {
Self { Self {
cancel_flag: Mutex::new(Arc::new(AtomicBool::new(false))), cancel_flag: Mutex::new(Arc::new(AtomicBool::new(false))),
@@ -46,20 +71,23 @@ impl SlashCommandCompletionProvider {
command_name: &str, command_name: &str,
command_range: Range<Anchor>, command_range: Range<Anchor>,
name_range: Range<Anchor>, name_range: Range<Anchor>,
window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<Result<Vec<project::Completion>>> { ) -> Task<Result<Vec<project::Completion>>> {
let slash_commands = self.slash_commands.clone(); let slash_commands = self.slash_commands.clone();
let candidates = slash_commands let candidates = slash_commands
.command_names(cx) .command_names(cx)
.into_iter() .into_iter()
.enumerate() .enumerate()
.map(|(ix, def)| StringMatchCandidate::new(ix, &def)) .map(|(ix, def)| StringMatchCandidate {
id: ix,
string: def.to_string(),
char_bag: def.as_ref().into(),
})
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let command_name = command_name.to_string(); let command_name = command_name.to_string();
let editor = self.editor.clone(); let editor = self.editor.clone();
let workspace = self.workspace.clone(); let workspace = self.workspace.clone();
window.spawn(cx, |mut cx| async move { cx.spawn(|mut cx| async move {
let matches = match_strings( let matches = match_strings(
&candidates, &candidates,
&command_name, &command_name,
@@ -70,7 +98,7 @@ impl SlashCommandCompletionProvider {
) )
.await; .await;
cx.update(|_, cx| { cx.update(|cx| {
matches matches
.into_iter() .into_iter()
.filter_map(|mat| { .filter_map(|mat| {
@@ -92,31 +120,28 @@ impl SlashCommandCompletionProvider {
let editor = editor.clone(); let editor = editor.clone();
let workspace = workspace.clone(); let workspace = workspace.clone();
Arc::new( Arc::new(
move |intent: CompletionIntent, move |intent: CompletionIntent, cx: &mut WindowContext| {
window: &mut Window, if !requires_argument
cx: &mut App| { && (!accepts_arguments || intent.is_complete())
if !requires_argument {
&& (!accepts_arguments || intent.is_complete()) editor
{ .update(cx, |editor, cx| {
editor editor.run_command(
.update(cx, |editor, cx| { command_range.clone(),
editor.run_command( &command_name,
command_range.clone(), &[],
&command_name, true,
&[], workspace.clone(),
true, cx,
workspace.clone(), );
window, })
cx, .ok();
); false
}) } else {
.ok(); requires_argument || accepts_arguments
false }
} else { },
requires_argument || accepts_arguments ) as Arc<_>
}
},
) as Arc<_>
}); });
Some(project::Completion { Some(project::Completion {
old_range: name_range.clone(), old_range: name_range.clone(),
@@ -126,7 +151,6 @@ impl SlashCommandCompletionProvider {
server_id: LanguageServerId(0), server_id: LanguageServerId(0),
lsp_completion: Default::default(), lsp_completion: Default::default(),
confirm, confirm,
resolved: true,
}) })
}) })
.collect() .collect()
@@ -134,7 +158,6 @@ impl SlashCommandCompletionProvider {
}) })
} }
#[allow(clippy::too_many_arguments)]
fn complete_command_argument( fn complete_command_argument(
&self, &self,
command_name: &str, command_name: &str,
@@ -142,8 +165,7 @@ impl SlashCommandCompletionProvider {
command_range: Range<Anchor>, command_range: Range<Anchor>,
argument_range: Range<Anchor>, argument_range: Range<Anchor>,
last_argument_range: Range<Anchor>, last_argument_range: Range<Anchor>,
window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<Result<Vec<project::Completion>>> { ) -> Task<Result<Vec<project::Completion>>> {
let new_cancel_flag = Arc::new(AtomicBool::new(false)); let new_cancel_flag = Arc::new(AtomicBool::new(false));
let mut flag = self.cancel_flag.lock(); let mut flag = self.cancel_flag.lock();
@@ -154,7 +176,6 @@ impl SlashCommandCompletionProvider {
arguments, arguments,
new_cancel_flag.clone(), new_cancel_flag.clone(),
self.workspace.clone(), self.workspace.clone(),
window,
cx, cx,
); );
let command_name: Arc<str> = command_name.into(); let command_name: Arc<str> = command_name.into();
@@ -182,9 +203,7 @@ impl SlashCommandCompletionProvider {
let command_range = command_range.clone(); let command_range = command_range.clone();
let command_name = command_name.clone(); let command_name = command_name.clone();
move |intent: CompletionIntent, move |intent: CompletionIntent, cx: &mut WindowContext| {
window: &mut Window,
cx: &mut App| {
if new_argument.after_completion.run() if new_argument.after_completion.run()
|| intent.is_complete() || intent.is_complete()
{ {
@@ -196,7 +215,6 @@ impl SlashCommandCompletionProvider {
&completed_arguments, &completed_arguments,
true, true,
workspace.clone(), workspace.clone(),
window,
cx, cx,
); );
}) })
@@ -226,7 +244,6 @@ impl SlashCommandCompletionProvider {
server_id: LanguageServerId(0), server_id: LanguageServerId(0),
lsp_completion: Default::default(), lsp_completion: Default::default(),
confirm, confirm,
resolved: true,
} }
}) })
.collect()) .collect())
@@ -240,11 +257,10 @@ impl SlashCommandCompletionProvider {
impl CompletionProvider for SlashCommandCompletionProvider { impl CompletionProvider for SlashCommandCompletionProvider {
fn completions( fn completions(
&self, &self,
buffer: &Entity<Buffer>, buffer: &Model<Buffer>,
buffer_position: Anchor, buffer_position: Anchor,
_: editor::CompletionContext, _: editor::CompletionContext,
window: &mut Window, cx: &mut ViewContext<Editor>,
cx: &mut Context<Editor>,
) -> Task<Result<Vec<project::Completion>>> { ) -> Task<Result<Vec<project::Completion>>> {
let Some((name, arguments, command_range, last_argument_range)) = let Some((name, arguments, command_range, last_argument_range)) =
buffer.update(cx, |buffer, _cx| { buffer.update(cx, |buffer, _cx| {
@@ -299,31 +315,40 @@ impl CompletionProvider for SlashCommandCompletionProvider {
command_range, command_range,
argument_range, argument_range,
last_argument_range, last_argument_range,
window,
cx, cx,
) )
} else { } else {
self.complete_command_name(&name, command_range, last_argument_range, window, cx) self.complete_command_name(&name, command_range, last_argument_range, cx)
} }
} }
fn resolve_completions( fn resolve_completions(
&self, &self,
_: Entity<Buffer>, _: Model<Buffer>,
_: Vec<usize>, _: Vec<usize>,
_: Rc<RefCell<Box<[project::Completion]>>>, _: Arc<RwLock<Box<[project::Completion]>>>,
_: &mut Context<Editor>, _: &mut ViewContext<Editor>,
) -> Task<Result<bool>> { ) -> Task<Result<bool>> {
Task::ready(Ok(true)) Task::ready(Ok(true))
} }
fn apply_additional_edits_for_completion(
&self,
_: Model<Buffer>,
_: project::Completion,
_: bool,
_: &mut ViewContext<Editor>,
) -> Task<Result<Option<language::Transaction>>> {
Task::ready(Ok(None))
}
fn is_completion_trigger( fn is_completion_trigger(
&self, &self,
buffer: &Entity<Buffer>, buffer: &Model<Buffer>,
position: language::Anchor, position: language::Anchor,
_text: &str, _text: &str,
_trigger_in_words: bool, _trigger_in_words: bool,
cx: &mut Context<Editor>, cx: &mut ViewContext<Editor>,
) -> bool { ) -> bool {
let buffer = buffer.read(cx); let buffer = buffer.read(cx);
let position = position.to_point(buffer); let position = position.to_point(buffer);
@@ -340,3 +365,73 @@ impl CompletionProvider for SlashCommandCompletionProvider {
false false
} }
} }
impl SlashCommandLine {
pub(crate) fn parse(line: &str) -> Option<Self> {
let mut call: Option<Self> = None;
let mut ix = 0;
for c in line.chars() {
let next_ix = ix + c.len_utf8();
if let Some(call) = &mut call {
// The command arguments start at the first non-whitespace character
// after the command name, and continue until the end of the line.
if let Some(argument) = call.arguments.last_mut() {
if c.is_whitespace() {
if (*argument).is_empty() {
argument.start = next_ix;
argument.end = next_ix;
} else {
argument.end = ix;
call.arguments.push(next_ix..next_ix);
}
} else {
argument.end = next_ix;
}
}
// The command name ends at the first whitespace character.
else if !call.name.is_empty() {
if c.is_whitespace() {
call.arguments = vec![next_ix..next_ix];
} else {
call.name.end = next_ix;
}
}
// The command name must begin with a letter.
else if c.is_alphabetic() {
call.name.end = next_ix;
} else {
return None;
}
}
// Commands start with a slash.
else if c == '/' {
call = Some(SlashCommandLine {
name: next_ix..next_ix,
arguments: Vec::new(),
});
}
// The line can't contain anything before the slash except for whitespace.
else if !c.is_whitespace() {
return None;
}
ix = next_ix;
}
call
}
}
pub fn create_label_for_command(
command_name: &str,
arguments: &[&str],
cx: &AppContext,
) -> CodeLabel {
let mut label = CodeLabel::default();
label.push_str(command_name, None);
label.push_str(" ", None);
label.push_str(
&arguments.join(" "),
cx.theme().syntax().highlight_id("comment").map(HighlightId),
);
label.filter_range = 0..command_name.len();
label
}

View File

@@ -5,7 +5,7 @@ use assistant_slash_command::{
}; };
use feature_flags::FeatureFlag; use feature_flags::FeatureFlag;
use futures::StreamExt; use futures::StreamExt;
use gpui::{App, AsyncApp, Task, WeakEntity, Window}; use gpui::{AppContext, AsyncAppContext, Task, WeakView};
use language::{CodeLabel, LspAdapterDelegate}; use language::{CodeLabel, LspAdapterDelegate};
use language_model::{ use language_model::{
LanguageModelCompletionEvent, LanguageModelRegistry, LanguageModelRequest, LanguageModelCompletionEvent, LanguageModelRegistry, LanguageModelRequest,
@@ -14,11 +14,11 @@ use language_model::{
use semantic_index::{FileSummary, SemanticDb}; use semantic_index::{FileSummary, SemanticDb};
use smol::channel; use smol::channel;
use std::sync::{atomic::AtomicBool, Arc}; use std::sync::{atomic::AtomicBool, Arc};
use ui::{prelude::*, BorrowAppContext}; use ui::{prelude::*, BorrowAppContext, WindowContext};
use util::ResultExt; use util::ResultExt;
use workspace::Workspace; use workspace::Workspace;
use crate::create_label_for_command; use crate::slash_command::create_label_for_command;
pub struct AutoSlashCommandFeatureFlag; pub struct AutoSlashCommandFeatureFlag;
@@ -26,7 +26,7 @@ impl FeatureFlag for AutoSlashCommandFeatureFlag {
const NAME: &'static str = "auto-slash-command"; const NAME: &'static str = "auto-slash-command";
} }
pub struct AutoCommand; pub(crate) struct AutoCommand;
impl SlashCommand for AutoCommand { impl SlashCommand for AutoCommand {
fn name(&self) -> String { fn name(&self) -> String {
@@ -45,7 +45,7 @@ impl SlashCommand for AutoCommand {
self.description() self.description()
} }
fn label(&self, cx: &App) -> CodeLabel { fn label(&self, cx: &AppContext) -> CodeLabel {
create_label_for_command("auto", &["--prompt"], cx) create_label_for_command("auto", &["--prompt"], cx)
} }
@@ -53,9 +53,8 @@ impl SlashCommand for AutoCommand {
self: Arc<Self>, self: Arc<Self>,
_arguments: &[String], _arguments: &[String],
_cancel: Arc<AtomicBool>, _cancel: Arc<AtomicBool>,
workspace: Option<WeakEntity<Workspace>>, workspace: Option<WeakView<Workspace>>,
_window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
// There's no autocomplete for a prompt, since it's arbitrary text. // There's no autocomplete for a prompt, since it's arbitrary text.
// However, we can use this opportunity to kick off a drain of the backlog. // However, we can use this opportunity to kick off a drain of the backlog.
@@ -75,9 +74,9 @@ impl SlashCommand for AutoCommand {
return Task::ready(Err(anyhow!("No project indexer, cannot use /auto"))); return Task::ready(Err(anyhow!("No project indexer, cannot use /auto")));
}; };
let cx: &mut App = cx; let cx: &mut AppContext = cx;
cx.spawn(|cx: gpui::AsyncApp| async move { cx.spawn(|cx: gpui::AsyncAppContext| async move {
let task = project_index.read_with(&cx, |project_index, cx| { let task = project_index.read_with(&cx, |project_index, cx| {
project_index.flush_summary_backlogs(cx) project_index.flush_summary_backlogs(cx)
})?; })?;
@@ -97,10 +96,9 @@ impl SlashCommand for AutoCommand {
arguments: &[String], arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: language::BufferSnapshot, _context_buffer: language::BufferSnapshot,
workspace: WeakEntity<Workspace>, workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let Some(workspace) = workspace.upgrade() else { let Some(workspace) = workspace.upgrade() else {
return Task::ready(Err(anyhow::anyhow!("workspace was dropped"))); return Task::ready(Err(anyhow::anyhow!("workspace was dropped")));
@@ -117,7 +115,7 @@ impl SlashCommand for AutoCommand {
return Task::ready(Err(anyhow!("no project indexer"))); return Task::ready(Err(anyhow!("no project indexer")));
}; };
let task = window.spawn(cx, |cx| async move { let task = cx.spawn(|cx: gpui::AsyncWindowContext| async move {
let summaries = project_index let summaries = project_index
.read_with(&cx, |project_index, cx| project_index.all_summaries(cx))? .read_with(&cx, |project_index, cx| project_index.all_summaries(cx))?
.await?; .await?;
@@ -189,7 +187,7 @@ struct CommandToRun {
async fn commands_for_summaries( async fn commands_for_summaries(
summaries: &[FileSummary], summaries: &[FileSummary],
original_prompt: &str, original_prompt: &str,
cx: &AsyncApp, cx: &AsyncAppContext,
) -> Result<Vec<CommandToRun>> { ) -> Result<Vec<CommandToRun>> {
if summaries.is_empty() { if summaries.is_empty() {
log::warn!("Inferring no context because there were no summaries available."); log::warn!("Inferring no context because there were no summaries available.");

View File

@@ -1,10 +1,10 @@
use anyhow::{anyhow, Context as _, Result}; use anyhow::{anyhow, Context, Result};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
}; };
use fs::Fs; use fs::Fs;
use gpui::{App, Entity, Task, WeakEntity}; use gpui::{AppContext, Model, Task, WeakView};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use project::{Project, ProjectPath}; use project::{Project, ProjectPath};
use std::{ use std::{
@@ -15,7 +15,7 @@ use std::{
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;
pub struct CargoWorkspaceSlashCommand; pub(crate) struct CargoWorkspaceSlashCommand;
impl CargoWorkspaceSlashCommand { impl CargoWorkspaceSlashCommand {
async fn build_message(fs: Arc<dyn Fs>, path_to_cargo_toml: &Path) -> Result<String> { async fn build_message(fs: Arc<dyn Fs>, path_to_cargo_toml: &Path) -> Result<String> {
@@ -76,7 +76,7 @@ impl CargoWorkspaceSlashCommand {
Ok(message) Ok(message)
} }
fn path_to_cargo_toml(project: Entity<Project>, cx: &mut App) -> Option<Arc<Path>> { fn path_to_cargo_toml(project: Model<Project>, cx: &mut AppContext) -> Option<Arc<Path>> {
let worktree = project.read(cx).worktrees(cx).next()?; let worktree = project.read(cx).worktrees(cx).next()?;
let worktree = worktree.read(cx); let worktree = worktree.read(cx);
let entry = worktree.entry_for_path("Cargo.toml")?; let entry = worktree.entry_for_path("Cargo.toml")?;
@@ -107,9 +107,8 @@ impl SlashCommand for CargoWorkspaceSlashCommand {
self: Arc<Self>, self: Arc<Self>,
_arguments: &[String], _arguments: &[String],
_cancel: Arc<AtomicBool>, _cancel: Arc<AtomicBool>,
_workspace: Option<WeakEntity<Workspace>>, _workspace: Option<WeakView<Workspace>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
Task::ready(Err(anyhow!("this command does not require argument"))) Task::ready(Err(anyhow!("this command does not require argument")))
} }
@@ -123,10 +122,9 @@ impl SlashCommand for CargoWorkspaceSlashCommand {
_arguments: &[String], _arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
workspace: WeakEntity<Workspace>, workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
_window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let output = workspace.update(cx, |workspace, cx| { let output = workspace.update(cx, |workspace, cx| {
let project = workspace.project().clone(); let project = workspace.project().clone();

View File

@@ -8,7 +8,7 @@ use context_server::{
manager::{ContextServer, ContextServerManager}, manager::{ContextServer, ContextServerManager},
types::Prompt, types::Prompt,
}; };
use gpui::{App, Entity, Task, WeakEntity, Window}; use gpui::{AppContext, Model, Task, WeakView, WindowContext};
use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate}; use language::{BufferSnapshot, CodeLabel, LspAdapterDelegate};
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
use std::sync::Arc; use std::sync::Arc;
@@ -16,17 +16,17 @@ use text::LineEnding;
use ui::{IconName, SharedString}; use ui::{IconName, SharedString};
use workspace::Workspace; use workspace::Workspace;
use crate::create_label_for_command; use crate::slash_command::create_label_for_command;
pub struct ContextServerSlashCommand { pub struct ContextServerSlashCommand {
server_manager: Entity<ContextServerManager>, server_manager: Model<ContextServerManager>,
server_id: Arc<str>, server_id: Arc<str>,
prompt: Prompt, prompt: Prompt,
} }
impl ContextServerSlashCommand { impl ContextServerSlashCommand {
pub fn new( pub fn new(
server_manager: Entity<ContextServerManager>, server_manager: Model<ContextServerManager>,
server: &Arc<ContextServer>, server: &Arc<ContextServer>,
prompt: Prompt, prompt: Prompt,
) -> Self { ) -> Self {
@@ -43,7 +43,7 @@ impl SlashCommand for ContextServerSlashCommand {
self.prompt.name.clone() self.prompt.name.clone()
} }
fn label(&self, cx: &App) -> language::CodeLabel { fn label(&self, cx: &AppContext) -> language::CodeLabel {
let mut parts = vec![self.prompt.name.as_str()]; let mut parts = vec![self.prompt.name.as_str()];
if let Some(args) = &self.prompt.arguments { if let Some(args) = &self.prompt.arguments {
if let Some(arg) = args.first() { if let Some(arg) = args.first() {
@@ -77,9 +77,8 @@ impl SlashCommand for ContextServerSlashCommand {
self: Arc<Self>, self: Arc<Self>,
arguments: &[String], arguments: &[String],
_cancel: Arc<AtomicBool>, _cancel: Arc<AtomicBool>,
_workspace: Option<WeakEntity<Workspace>>, _workspace: Option<WeakView<Workspace>>,
_window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
let Ok((arg_name, arg_value)) = completion_argument(&self.prompt, arguments) else { let Ok((arg_name, arg_value)) = completion_argument(&self.prompt, arguments) else {
return Task::ready(Err(anyhow!("Failed to complete argument"))); return Task::ready(Err(anyhow!("Failed to complete argument")));
@@ -129,10 +128,9 @@ impl SlashCommand for ContextServerSlashCommand {
arguments: &[String], arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
_workspace: WeakEntity<Workspace>, _workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
_window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let server_id = self.server_id.clone(); let server_id = self.server_id.clone();
let prompt_name = self.prompt.name.clone(); let prompt_name = self.prompt.name.clone();

View File

@@ -1,11 +1,11 @@
use crate::prompt_library::PromptStore;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
}; };
use gpui::{Task, WeakEntity}; use gpui::{Task, WeakView};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use prompt_library::PromptStore;
use std::{ use std::{
fmt::Write, fmt::Write,
sync::{atomic::AtomicBool, Arc}, sync::{atomic::AtomicBool, Arc},
@@ -13,7 +13,7 @@ use std::{
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;
pub struct DefaultSlashCommand; pub(crate) struct DefaultSlashCommand;
impl SlashCommand for DefaultSlashCommand { impl SlashCommand for DefaultSlashCommand {
fn name(&self) -> String { fn name(&self) -> String {
@@ -36,9 +36,8 @@ impl SlashCommand for DefaultSlashCommand {
self: Arc<Self>, self: Arc<Self>,
_arguments: &[String], _arguments: &[String],
_cancellation_flag: Arc<AtomicBool>, _cancellation_flag: Arc<AtomicBool>,
_workspace: Option<WeakEntity<Workspace>>, _workspace: Option<WeakView<Workspace>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
Task::ready(Err(anyhow!("this command does not require argument"))) Task::ready(Err(anyhow!("this command does not require argument")))
} }
@@ -48,10 +47,9 @@ impl SlashCommand for DefaultSlashCommand {
_arguments: &[String], _arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
_workspace: WeakEntity<Workspace>, _workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
_window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let store = PromptStore::global(cx); let store = PromptStore::global(cx);
cx.background_executor().spawn(async move { cx.background_executor().spawn(async move {

View File

@@ -1,4 +1,4 @@
use crate::file_command::{FileCommandMetadata, FileSlashCommand}; use crate::slash_command::file_command::{FileCommandMetadata, FileSlashCommand};
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use assistant_slash_command::{ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
@@ -6,14 +6,14 @@ use assistant_slash_command::{
}; };
use collections::HashSet; use collections::HashSet;
use futures::future; use futures::future;
use gpui::{App, Task, WeakEntity, Window}; use gpui::{Task, WeakView, WindowContext};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use std::sync::{atomic::AtomicBool, Arc}; use std::sync::{atomic::AtomicBool, Arc};
use text::OffsetRangeExt; use text::OffsetRangeExt;
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;
pub struct DeltaSlashCommand; pub(crate) struct DeltaSlashCommand;
impl SlashCommand for DeltaSlashCommand { impl SlashCommand for DeltaSlashCommand {
fn name(&self) -> String { fn name(&self) -> String {
@@ -40,9 +40,8 @@ impl SlashCommand for DeltaSlashCommand {
self: Arc<Self>, self: Arc<Self>,
_arguments: &[String], _arguments: &[String],
_cancellation_flag: Arc<AtomicBool>, _cancellation_flag: Arc<AtomicBool>,
_workspace: Option<WeakEntity<Workspace>>, _workspace: Option<WeakView<Workspace>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
Task::ready(Err(anyhow!("this command does not require argument"))) Task::ready(Err(anyhow!("this command does not require argument")))
} }
@@ -52,10 +51,9 @@ impl SlashCommand for DeltaSlashCommand {
_arguments: &[String], _arguments: &[String],
context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
context_buffer: BufferSnapshot, context_buffer: BufferSnapshot,
workspace: WeakEntity<Workspace>, workspace: WeakView<Workspace>,
delegate: Option<Arc<dyn LspAdapterDelegate>>, delegate: Option<Arc<dyn LspAdapterDelegate>>,
window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let mut paths = HashSet::default(); let mut paths = HashSet::default();
let mut file_command_old_outputs = Vec::new(); let mut file_command_old_outputs = Vec::new();
@@ -79,7 +77,6 @@ impl SlashCommand for DeltaSlashCommand {
context_buffer.clone(), context_buffer.clone(),
workspace.clone(), workspace.clone(),
delegate.clone(), delegate.clone(),
window,
cx, cx,
)); ));
} }

View File

@@ -4,7 +4,7 @@ use assistant_slash_command::{
SlashCommandResult, SlashCommandResult,
}; };
use fuzzy::{PathMatch, StringMatchCandidate}; use fuzzy::{PathMatch, StringMatchCandidate};
use gpui::{App, Entity, Task, WeakEntity}; use gpui::{AppContext, Model, Task, View, WeakView};
use language::{ use language::{
Anchor, BufferSnapshot, DiagnosticEntry, DiagnosticSeverity, LspAdapterDelegate, Anchor, BufferSnapshot, DiagnosticEntry, DiagnosticSeverity, LspAdapterDelegate,
OffsetRangeExt, ToOffset, OffsetRangeExt, ToOffset,
@@ -21,17 +21,17 @@ use util::paths::PathMatcher;
use util::ResultExt; use util::ResultExt;
use workspace::Workspace; use workspace::Workspace;
use crate::create_label_for_command; use crate::slash_command::create_label_for_command;
pub struct DiagnosticsSlashCommand; pub(crate) struct DiagnosticsSlashCommand;
impl DiagnosticsSlashCommand { impl DiagnosticsSlashCommand {
fn search_paths( fn search_paths(
&self, &self,
query: String, query: String,
cancellation_flag: Arc<AtomicBool>, cancellation_flag: Arc<AtomicBool>,
workspace: &Entity<Workspace>, workspace: &View<Workspace>,
cx: &mut App, cx: &mut AppContext,
) -> Task<Vec<PathMatch>> { ) -> Task<Vec<PathMatch>> {
if query.is_empty() { if query.is_empty() {
let workspace = workspace.read(cx); let workspace = workspace.read(cx);
@@ -90,7 +90,7 @@ impl SlashCommand for DiagnosticsSlashCommand {
"diagnostics".into() "diagnostics".into()
} }
fn label(&self, cx: &App) -> language::CodeLabel { fn label(&self, cx: &AppContext) -> language::CodeLabel {
create_label_for_command("diagnostics", &[INCLUDE_WARNINGS_ARGUMENT], cx) create_label_for_command("diagnostics", &[INCLUDE_WARNINGS_ARGUMENT], cx)
} }
@@ -118,9 +118,8 @@ impl SlashCommand for DiagnosticsSlashCommand {
self: Arc<Self>, self: Arc<Self>,
arguments: &[String], arguments: &[String],
cancellation_flag: Arc<AtomicBool>, cancellation_flag: Arc<AtomicBool>,
workspace: Option<WeakEntity<Workspace>>, workspace: Option<WeakView<Workspace>>,
_: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
let Some(workspace) = workspace.and_then(|workspace| workspace.upgrade()) else { let Some(workspace) = workspace.and_then(|workspace| workspace.upgrade()) else {
return Task::ready(Err(anyhow!("workspace was dropped"))); return Task::ready(Err(anyhow!("workspace was dropped")));
@@ -173,10 +172,9 @@ impl SlashCommand for DiagnosticsSlashCommand {
arguments: &[String], arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
workspace: WeakEntity<Workspace>, workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let Some(workspace) = workspace.upgrade() else { let Some(workspace) = workspace.upgrade() else {
return Task::ready(Err(anyhow!("workspace was dropped"))); return Task::ready(Err(anyhow!("workspace was dropped")));
@@ -186,7 +184,7 @@ impl SlashCommand for DiagnosticsSlashCommand {
let task = collect_diagnostics(workspace.read(cx).project().clone(), options, cx); let task = collect_diagnostics(workspace.read(cx).project().clone(), options, cx);
window.spawn(cx, move |_| async move { cx.spawn(move |_| async move {
task.await? task.await?
.map(|output| output.to_event_stream()) .map(|output| output.to_event_stream())
.ok_or_else(|| anyhow!("No diagnostics found")) .ok_or_else(|| anyhow!("No diagnostics found"))
@@ -220,14 +218,17 @@ impl Options {
} }
fn match_candidates_for_args() -> [StringMatchCandidate; 1] { fn match_candidates_for_args() -> [StringMatchCandidate; 1] {
[StringMatchCandidate::new(0, INCLUDE_WARNINGS_ARGUMENT)] [StringMatchCandidate::new(
0,
INCLUDE_WARNINGS_ARGUMENT.to_string(),
)]
} }
} }
fn collect_diagnostics( fn collect_diagnostics(
project: Entity<Project>, project: Model<Project>,
options: Options, options: Options,
cx: &mut App, cx: &mut AppContext,
) -> Task<Result<Option<SlashCommandOutput>>> { ) -> Task<Result<Option<SlashCommandOutput>>> {
let error_source = if let Some(path_matcher) = &options.path_matcher { let error_source = if let Some(path_matcher) = &options.path_matcher {
debug_assert_eq!(path_matcher.sources().len(), 1); debug_assert_eq!(path_matcher.sources().len(), 1);
@@ -303,7 +304,7 @@ fn collect_diagnostics(
.await .await
.log_err() .log_err()
{ {
let snapshot = cx.read_entity(&buffer, |buffer, _| buffer.snapshot())?; let snapshot = cx.read_model(&buffer, |buffer, _| buffer.snapshot())?;
collect_buffer_diagnostics(&mut output, &snapshot, options.include_warnings); collect_buffer_diagnostics(&mut output, &snapshot, options.include_warnings);
} }

View File

@@ -8,7 +8,7 @@ use assistant_slash_command::{
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection, ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult, SlashCommandResult,
}; };
use gpui::{App, BackgroundExecutor, Entity, Task, WeakEntity}; use gpui::{AppContext, BackgroundExecutor, Model, Task, WeakView};
use indexed_docs::{ use indexed_docs::{
DocsDotRsProvider, IndexedDocsRegistry, IndexedDocsStore, LocalRustdocProvider, PackageName, DocsDotRsProvider, IndexedDocsRegistry, IndexedDocsStore, LocalRustdocProvider, PackageName,
ProviderId, ProviderId,
@@ -19,12 +19,12 @@ use ui::prelude::*;
use util::{maybe, ResultExt}; use util::{maybe, ResultExt};
use workspace::Workspace; use workspace::Workspace;
pub struct DocsSlashCommand; pub(crate) struct DocsSlashCommand;
impl DocsSlashCommand { impl DocsSlashCommand {
pub const NAME: &'static str = "docs"; pub const NAME: &'static str = "docs";
fn path_to_cargo_toml(project: Entity<Project>, cx: &mut App) -> Option<Arc<Path>> { fn path_to_cargo_toml(project: Model<Project>, cx: &mut AppContext) -> Option<Arc<Path>> {
let worktree = project.read(cx).worktrees(cx).next()?; let worktree = project.read(cx).worktrees(cx).next()?;
let worktree = worktree.read(cx); let worktree = worktree.read(cx);
let entry = worktree.entry_for_path("Cargo.toml")?; let entry = worktree.entry_for_path("Cargo.toml")?;
@@ -43,8 +43,8 @@ impl DocsSlashCommand {
/// access the workspace so we can read the project. /// access the workspace so we can read the project.
fn ensure_rust_doc_providers_are_registered( fn ensure_rust_doc_providers_are_registered(
&self, &self,
workspace: Option<WeakEntity<Workspace>>, workspace: Option<WeakView<Workspace>>,
cx: &mut App, cx: &mut AppContext,
) { ) {
let indexed_docs_registry = IndexedDocsRegistry::global(cx); let indexed_docs_registry = IndexedDocsRegistry::global(cx);
if indexed_docs_registry if indexed_docs_registry
@@ -164,9 +164,8 @@ impl SlashCommand for DocsSlashCommand {
self: Arc<Self>, self: Arc<Self>,
arguments: &[String], arguments: &[String],
_cancel: Arc<AtomicBool>, _cancel: Arc<AtomicBool>,
workspace: Option<WeakEntity<Workspace>>, workspace: Option<WeakView<Workspace>>,
_: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
self.ensure_rust_doc_providers_are_registered(workspace, cx); self.ensure_rust_doc_providers_are_registered(workspace, cx);
@@ -273,10 +272,9 @@ impl SlashCommand for DocsSlashCommand {
arguments: &[String], arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
_workspace: WeakEntity<Workspace>, _workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
_: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
if arguments.is_empty() { if arguments.is_empty() {
return Task::ready(Err(anyhow!("missing an argument"))); return Task::ready(Err(anyhow!("missing an argument")));
@@ -369,7 +367,7 @@ fn is_item_path_delimiter(char: char) -> bool {
} }
#[derive(Debug, PartialEq, Clone)] #[derive(Debug, PartialEq, Clone)]
pub enum DocsSlashCommandArgs { pub(crate) enum DocsSlashCommandArgs {
NoProvider, NoProvider,
SearchPackageDocs { SearchPackageDocs {
provider: ProviderId, provider: ProviderId,

View File

@@ -9,7 +9,7 @@ use assistant_slash_command::{
SlashCommandResult, SlashCommandResult,
}; };
use futures::AsyncReadExt; use futures::AsyncReadExt;
use gpui::{Task, WeakEntity}; use gpui::{Task, WeakView};
use html_to_markdown::{convert_html_to_markdown, markdown, TagHandler}; use html_to_markdown::{convert_html_to_markdown, markdown, TagHandler};
use http_client::{AsyncBody, HttpClient, HttpClientWithUrl}; use http_client::{AsyncBody, HttpClient, HttpClientWithUrl};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
@@ -23,7 +23,7 @@ enum ContentType {
Json, Json,
} }
pub struct FetchSlashCommand; pub(crate) struct FetchSlashCommand;
impl FetchSlashCommand { impl FetchSlashCommand {
async fn build_message(http_client: Arc<HttpClientWithUrl>, url: &str) -> Result<String> { async fn build_message(http_client: Arc<HttpClientWithUrl>, url: &str) -> Result<String> {
@@ -124,9 +124,8 @@ impl SlashCommand for FetchSlashCommand {
self: Arc<Self>, self: Arc<Self>,
_arguments: &[String], _arguments: &[String],
_cancel: Arc<AtomicBool>, _cancel: Arc<AtomicBool>,
_workspace: Option<WeakEntity<Workspace>>, _workspace: Option<WeakView<Workspace>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
Task::ready(Ok(Vec::new())) Task::ready(Ok(Vec::new()))
} }
@@ -136,10 +135,9 @@ impl SlashCommand for FetchSlashCommand {
arguments: &[String], arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
workspace: WeakEntity<Workspace>, workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
_: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let Some(argument) = arguments.first() else { let Some(argument) = arguments.first() else {
return Task::ready(Err(anyhow!("missing URL"))); return Task::ready(Err(anyhow!("missing URL")));

View File

@@ -6,7 +6,7 @@ use assistant_slash_command::{
use futures::channel::mpsc; use futures::channel::mpsc;
use futures::Stream; use futures::Stream;
use fuzzy::PathMatch; use fuzzy::PathMatch;
use gpui::{App, Entity, Task, WeakEntity}; use gpui::{AppContext, Model, Task, View, WeakView};
use language::{BufferSnapshot, CodeLabel, HighlightId, LineEnding, LspAdapterDelegate}; use language::{BufferSnapshot, CodeLabel, HighlightId, LineEnding, LspAdapterDelegate};
use project::{PathMatchCandidateSet, Project}; use project::{PathMatchCandidateSet, Project};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@@ -20,17 +20,16 @@ use std::{
use ui::prelude::*; use ui::prelude::*;
use util::ResultExt; use util::ResultExt;
use workspace::Workspace; use workspace::Workspace;
use worktree::ChildEntriesOptions;
pub struct FileSlashCommand; pub(crate) struct FileSlashCommand;
impl FileSlashCommand { impl FileSlashCommand {
fn search_paths( fn search_paths(
&self, &self,
query: String, query: String,
cancellation_flag: Arc<AtomicBool>, cancellation_flag: Arc<AtomicBool>,
workspace: &Entity<Workspace>, workspace: &View<Workspace>,
cx: &mut App, cx: &mut AppContext,
) -> Task<Vec<PathMatch>> { ) -> Task<Vec<PathMatch>> {
if query.is_empty() { if query.is_empty() {
let workspace = workspace.read(cx); let workspace = workspace.read(cx);
@@ -43,13 +42,7 @@ impl FileSlashCommand {
.chain(project.worktrees(cx).flat_map(|worktree| { .chain(project.worktrees(cx).flat_map(|worktree| {
let worktree = worktree.read(cx); let worktree = worktree.read(cx);
let id = worktree.id(); let id = worktree.id();
let options = ChildEntriesOptions { worktree.child_entries(Path::new("")).map(move |entry| {
include_files: true,
include_dirs: true,
include_ignored: false,
};
let entries = worktree.child_entries_with_options(Path::new(""), options);
entries.map(move |entry| {
( (
project::ProjectPath { project::ProjectPath {
worktree_id: id, worktree_id: id,
@@ -141,9 +134,8 @@ impl SlashCommand for FileSlashCommand {
self: Arc<Self>, self: Arc<Self>,
arguments: &[String], arguments: &[String],
cancellation_flag: Arc<AtomicBool>, cancellation_flag: Arc<AtomicBool>,
workspace: Option<WeakEntity<Workspace>>, workspace: Option<WeakView<Workspace>>,
_: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
let Some(workspace) = workspace.and_then(|workspace| workspace.upgrade()) else { let Some(workspace) = workspace.and_then(|workspace| workspace.upgrade()) else {
return Task::ready(Err(anyhow!("workspace was dropped"))); return Task::ready(Err(anyhow!("workspace was dropped")));
@@ -195,10 +187,9 @@ impl SlashCommand for FileSlashCommand {
arguments: &[String], arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
workspace: WeakEntity<Workspace>, workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
_: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let Some(workspace) = workspace.upgrade() else { let Some(workspace) = workspace.upgrade() else {
return Task::ready(Err(anyhow!("workspace was dropped"))); return Task::ready(Err(anyhow!("workspace was dropped")));
@@ -218,9 +209,9 @@ impl SlashCommand for FileSlashCommand {
} }
fn collect_files( fn collect_files(
project: Entity<Project>, project: Model<Project>,
glob_inputs: &[String], glob_inputs: &[String],
cx: &mut App, cx: &mut AppContext,
) -> impl Stream<Item = Result<SlashCommandEvent>> { ) -> impl Stream<Item = Result<SlashCommandEvent>> {
let Ok(matchers) = glob_inputs let Ok(matchers) = glob_inputs
.into_iter() .into_iter()
@@ -570,7 +561,7 @@ mod test {
use settings::SettingsStore; use settings::SettingsStore;
use smol::stream::StreamExt; use smol::stream::StreamExt;
use super::collect_files; use crate::slash_command::file_command::collect_files;
pub fn init_test(cx: &mut gpui::TestAppContext) { pub fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { if std::env::var("RUST_LOG").is_ok() {

View File

@@ -7,12 +7,12 @@ use assistant_slash_command::{
SlashCommandResult, SlashCommandResult,
}; };
use chrono::Local; use chrono::Local;
use gpui::{Task, WeakEntity}; use gpui::{Task, WeakView};
use language::{BufferSnapshot, LspAdapterDelegate}; use language::{BufferSnapshot, LspAdapterDelegate};
use ui::prelude::*; use ui::prelude::*;
use workspace::Workspace; use workspace::Workspace;
pub struct NowSlashCommand; pub(crate) struct NowSlashCommand;
impl SlashCommand for NowSlashCommand { impl SlashCommand for NowSlashCommand {
fn name(&self) -> String { fn name(&self) -> String {
@@ -35,9 +35,8 @@ impl SlashCommand for NowSlashCommand {
self: Arc<Self>, self: Arc<Self>,
_arguments: &[String], _arguments: &[String],
_cancel: Arc<AtomicBool>, _cancel: Arc<AtomicBool>,
_workspace: Option<WeakEntity<Workspace>>, _workspace: Option<WeakView<Workspace>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
Task::ready(Ok(Vec::new())) Task::ready(Ok(Vec::new()))
} }
@@ -47,10 +46,9 @@ impl SlashCommand for NowSlashCommand {
_arguments: &[String], _arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<language::Anchor>],
_context_buffer: BufferSnapshot, _context_buffer: BufferSnapshot,
_workspace: WeakEntity<Workspace>, _workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let now = Local::now(); let now = Local::now();
let text = format!("Today is {now}.", now = now.to_rfc2822()); let text = format!("Today is {now}.", now = now.to_rfc2822());

View File

@@ -1,26 +1,17 @@
use std::{ use super::{
fmt::Write as _, create_label_for_command, search_command::add_search_result_section, SlashCommand,
ops::DerefMut, SlashCommandOutput,
sync::{atomic::AtomicBool, Arc},
}; };
use crate::PromptBuilder;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use assistant_slash_command::{ use assistant_slash_command::{ArgumentCompletion, SlashCommandOutputSection, SlashCommandResult};
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
SlashCommandResult,
};
use feature_flags::FeatureFlag; use feature_flags::FeatureFlag;
use gpui::{App, Task, WeakEntity}; use gpui::{AppContext, Task, WeakView, WindowContext};
use language::{Anchor, CodeLabel, LspAdapterDelegate}; use language::{Anchor, CodeLabel, LspAdapterDelegate};
use language_model::{LanguageModelRegistry, LanguageModelTool}; use language_model::{LanguageModelRegistry, LanguageModelTool};
use prompt_library::PromptBuilder;
use schemars::JsonSchema; use schemars::JsonSchema;
use semantic_index::SemanticDb; use semantic_index::SemanticDb;
use serde::Deserialize; use serde::Deserialize;
use ui::prelude::*;
use workspace::Workspace;
use super::{create_label_for_command, search_command::add_search_result_section};
pub struct ProjectSlashCommandFeatureFlag; pub struct ProjectSlashCommandFeatureFlag;
@@ -28,6 +19,15 @@ impl FeatureFlag for ProjectSlashCommandFeatureFlag {
const NAME: &'static str = "project-slash-command"; const NAME: &'static str = "project-slash-command";
} }
use std::{
fmt::Write as _,
ops::DerefMut,
sync::{atomic::AtomicBool, Arc},
};
use ui::prelude::*;
use workspace::Workspace;
pub struct ProjectSlashCommand { pub struct ProjectSlashCommand {
prompt_builder: Arc<PromptBuilder>, prompt_builder: Arc<PromptBuilder>,
} }
@@ -43,7 +43,7 @@ impl SlashCommand for ProjectSlashCommand {
"project".into() "project".into()
} }
fn label(&self, cx: &App) -> CodeLabel { fn label(&self, cx: &AppContext) -> CodeLabel {
create_label_for_command("project", &[], cx) create_label_for_command("project", &[], cx)
} }
@@ -67,9 +67,8 @@ impl SlashCommand for ProjectSlashCommand {
self: Arc<Self>, self: Arc<Self>,
_arguments: &[String], _arguments: &[String],
_cancel: Arc<AtomicBool>, _cancel: Arc<AtomicBool>,
_workspace: Option<WeakEntity<Workspace>>, _workspace: Option<WeakView<Workspace>>,
_window: &mut Window, _cx: &mut WindowContext,
_cx: &mut App,
) -> Task<Result<Vec<ArgumentCompletion>>> { ) -> Task<Result<Vec<ArgumentCompletion>>> {
Task::ready(Ok(Vec::new())) Task::ready(Ok(Vec::new()))
} }
@@ -79,10 +78,9 @@ impl SlashCommand for ProjectSlashCommand {
_arguments: &[String], _arguments: &[String],
_context_slash_command_output_sections: &[SlashCommandOutputSection<Anchor>], _context_slash_command_output_sections: &[SlashCommandOutputSection<Anchor>],
context_buffer: language::BufferSnapshot, context_buffer: language::BufferSnapshot,
workspace: WeakEntity<Workspace>, workspace: WeakView<Workspace>,
_delegate: Option<Arc<dyn LspAdapterDelegate>>, _delegate: Option<Arc<dyn LspAdapterDelegate>>,
window: &mut Window, cx: &mut WindowContext,
cx: &mut App,
) -> Task<SlashCommandResult> { ) -> Task<SlashCommandResult> {
let model_registry = LanguageModelRegistry::read_global(cx); let model_registry = LanguageModelRegistry::read_global(cx);
let current_model = model_registry.active_model(); let current_model = model_registry.active_model();
@@ -99,7 +97,7 @@ impl SlashCommand for ProjectSlashCommand {
return Task::ready(Err(anyhow::anyhow!("no project indexer"))); return Task::ready(Err(anyhow::anyhow!("no project indexer")));
}; };
window.spawn(cx, |mut cx| async move { cx.spawn(|mut cx| async move {
let current_model = current_model.ok_or_else(|| anyhow!("no model selected"))?; let current_model = current_model.ok_or_else(|| anyhow!("no model selected"))?;
let prompt = let prompt =

Some files were not shown because too many files have changed in this diff Show More