дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-29 13:52:36 +02:00
Порівняти коміти
108
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
2c6696dd3a | ||
|
|
09d8e92e2c | ||
|
|
221b6c3098 | ||
|
|
d154dce4f7 | ||
|
|
83364c5423 | ||
|
|
fa33819afb | ||
|
|
5e6a59eae8 | ||
|
|
a9971905dc | ||
|
|
7e6296f0c6 | ||
|
|
31c169c889 | ||
|
|
13103fd5af | ||
|
|
50340219ac | ||
|
|
71000e15f2 | ||
|
|
042008f681 | ||
|
|
942e6cb237 | ||
|
|
674cdd3925 | ||
|
|
04666f5980 | ||
|
|
d335ba5fdd | ||
|
|
33d2f34e58 | ||
|
|
7646bc4746 | ||
|
|
2c161812a0 | ||
|
|
1778bf1ef3 | ||
|
|
1e7fe7605b | ||
|
|
67dcf5c978 | ||
|
|
20404d2f44 | ||
|
|
b44e552628 | ||
|
|
bc4e8e9655 | ||
|
|
c12799c973 | ||
|
|
0d4bd4a69a | ||
|
|
bf2f44d523 | ||
|
|
2b6fab3c1c | ||
|
|
37df909358 | ||
|
|
b51054daca | ||
|
|
57856f2d54 | ||
|
|
e06c16f547 | ||
|
|
7b893d2982 | ||
|
|
1cc8a361b8 | ||
|
|
a28f6ce331 | ||
|
|
5d27b4254b | ||
|
|
45d85f5721 | ||
|
|
fa7fcd0d90 | ||
|
|
6b2b4a96e7 | ||
|
|
d507e67123 | ||
|
|
5563345a8f | ||
|
|
bff0761c48 | ||
|
|
2811a438a0 | ||
|
|
d34252c80a | ||
|
|
a60a36f052 | ||
|
|
939222cdfb | ||
|
|
ec0370ec23 | ||
|
|
9243ff2eac | ||
|
|
143281d67e | ||
|
|
e1f25d2747 | ||
|
|
26fce11f94 | ||
|
|
c5c2fb7c98 | ||
|
|
31ca9daa61 | ||
|
|
d89991168e | ||
|
|
16496f8001 | ||
|
|
ce58c873da | ||
|
|
d069c3daff | ||
|
|
95b71e1ffc | ||
|
|
732cfd6002 | ||
|
|
189879f0fa | ||
|
|
f0a412f3e2 | ||
|
|
1a470e2a23 | ||
|
|
793c720f7f | ||
|
|
93c7f8b7fd | ||
|
|
3e37b60505 | ||
|
|
a5c8fe17fd | ||
|
|
0684795334 | ||
|
|
30cbb80f22 | ||
|
|
5cfb0d3311 | ||
|
|
bccf1bd7d6 | ||
|
|
3d79454be8 | ||
|
|
46e4af2b32 | ||
|
|
067edb7d60 | ||
|
|
0a4abf1705 | ||
|
|
d31699c86a | ||
|
|
9467c4ea1b | ||
|
|
7c12c58874 | ||
|
|
9f47ef0991 | ||
|
|
3b614dda7a | ||
|
|
5acd778340 | ||
|
|
7c682a580f | ||
|
|
dc07691279 | ||
|
|
2d04a3d9bc | ||
|
|
8f9b9b1016 | ||
|
|
096964c798 | ||
|
|
f1bfd5db52 | ||
|
|
a17af582f3 | ||
|
|
47f018d8b5 | ||
|
|
94aa62430c | ||
|
|
4242c94bfc | ||
|
|
8864ff595d | ||
|
|
0a08d9f4ce | ||
|
|
7dbfe8852e | ||
|
|
ae97d5f1c2 | ||
|
|
4340a96c59 | ||
|
|
0af7bcc7cf | ||
|
|
4f52f5ebfa | ||
|
|
f284633162 | ||
|
|
0ceda2c385 | ||
|
|
8b3f55dfb4 | ||
|
|
c0e888dd2f | ||
|
|
04bed01942 | ||
|
|
dfafe6c767 | ||
|
|
461c71a50b | ||
|
|
82085a227e |
No files matched your search
@@ -65,8 +65,9 @@ jobs:
|
||||
plugin_web='^plugins/official/[^/]+/web-src/'
|
||||
# Paths the frontend checks never read...
|
||||
backend='^(crates/|src-tauri/|sdk/|wit/|java/|fixtures/|Cargo\.(toml|lock)$|deny\.toml$|rustfmt\.toml$|rust-toolchain(\.toml)?$|\.cargo/)'
|
||||
# ...except these, which frontend tests and e2e fixtures load.
|
||||
read_by_web='^(fixtures/(folding|django-app)/|crates/ide-plugin/tests/fixtures/|crates/ide-db/(src|tests/fixtures)/snowflake/|src-tauri/(icons|capabilities)/|src-tauri/tauri\.conf\.json$)'
|
||||
# ...except these, which frontend tests and e2e fixtures load (the crate manifests:
|
||||
# scripts/smoke-paths.test.ts, through cargo metadata).
|
||||
read_by_web='^(fixtures/(folding|django-app)/|(crates/[^/]+/)?Cargo\.toml$|crates/ide-plugin/tests/fixtures/|crates/ide-db/(src|tests/fixtures)/snowflake/|src-tauri/(icons|capabilities)/|src-tauri/tauri\.conf\.json$)'
|
||||
# What the browser app and its e2e tests are built from.
|
||||
app='^(src/|e2e/|public/|index\.html$|vite\.config\.ts$|tsconfig\.json$|playwright\.config\.ts$|package\.json$|pnpm-(lock|workspace)\.yaml$|crates/ide-plugin/tests/fixtures/|src-tauri/(icons|capabilities)/|src-tauri/tauri\.conf\.json$)'
|
||||
# The plugin workspaces: the SDK, the plugins, their interface and the host's fixture plugins.
|
||||
|
||||
@@ -8,6 +8,9 @@ name: Language smoke
|
||||
# (Run, Run tests, the test tree, Rerun Failed Tests): smoke/run.test.ts; and debugging its
|
||||
# entry point with the debugger the IDE installs (breakpoint, frames, variables, evaluate,
|
||||
# Step Over, Resume): smoke/debug.test.ts.
|
||||
# The paths below and the Changes step's patterns must cover every file the smoke loads and
|
||||
# every crate it runs: scripts/smoke-paths.test.ts checks them (`node scripts/smoke-paths.ts
|
||||
# [file…]` lists what they miss, or the languages a change runs).
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
@@ -20,10 +23,30 @@ on:
|
||||
- "Cargo.lock"
|
||||
- "src/features/run/**"
|
||||
- "src/features/debugger/**"
|
||||
- "src/features/build-tools/**"
|
||||
- "src/platform/**"
|
||||
- "src/workbench/**"
|
||||
- "src/ui/**"
|
||||
- "src/editor/api.ts"
|
||||
- "src/editor/core/cm/cornerInset.ts"
|
||||
- "src/editor/core/cm/iconArea.ts"
|
||||
- "src/editor/lsp/availability.ts"
|
||||
- "src/editor/lsp/diagnostics.ts"
|
||||
- "src/editor/lsp/files.ts"
|
||||
- "src/editor/lsp/hint.ts"
|
||||
- "src/editor/lsp/lsp.ts"
|
||||
- "src/editor/lsp/positions.ts"
|
||||
- "src/bindings.ts"
|
||||
- "src/styles/tokens.css"
|
||||
- "src/test/setup.ts"
|
||||
- "src-tauri/icons/128x128.png"
|
||||
- "smoke/**"
|
||||
- "vite.config.ts"
|
||||
- "tsconfig.json"
|
||||
- "package.json"
|
||||
- "pnpm-lock.yaml"
|
||||
- "pnpm-workspace.yaml"
|
||||
- "patches/**"
|
||||
- ".github/workflows/language-smoke.yml"
|
||||
- ".github/tool-versions.env"
|
||||
pull_request:
|
||||
@@ -70,10 +93,12 @@ jobs:
|
||||
--jq '.[] | .filename, (.previous_filename // empty)' > files.txt
|
||||
cat files.txt
|
||||
# Crates outside what the smoke runs (language servers, debuggers, run configurations,
|
||||
# SDKs, build tools and the project model): cargo metadata, deps of ide-lsp/dap/run/sdk/tools.
|
||||
unused='^crates/(ide-agent|ide-analysis|ide-android|ide-cli|ide-clipboard|ide-coverage|ide-db|ide-docker|ide-fonts|ide-github|ide-http|ide-mcp|ide-notebook|ide-profiler|ide-scaffold|ide-search|ide-spell|ide-ssh|ide-streams|ide-vcs|ide-web)/'
|
||||
# SDKs, build tools, the project model, Find Usages candidates, debug stream traces):
|
||||
# cargo metadata, ide-host's direct deps ide-search/ide-streams and the deps of
|
||||
# ide-lsp/dap/run/sdk/tools.
|
||||
unused='^crates/(ide-agent|ide-analysis|ide-android|ide-cli|ide-clipboard|ide-coverage|ide-db|ide-docker|ide-fonts|ide-github|ide-http|ide-mcp|ide-notebook|ide-profiler|ide-scaffold|ide-spell|ide-ssh|ide-vcs|ide-web)/'
|
||||
# The workflow's paths, less those handled per language below.
|
||||
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger)/|src/platform/|smoke/|package\.json$|pnpm-lock\.yaml$|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)'
|
||||
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|core/cm/(cornerInset|iconArea)|lsp/(availability|diagnostics|files|hint|lsp|positions))\.ts$|src/bindings\.ts$|src/styles/tokens\.css$|src/test/setup\.ts$|src-tauri/icons/128x128\.png$|smoke/|vite\.config\.ts$|tsconfig\.json$|package\.json$|pnpm-(lock|workspace)\.yaml$|patches/|\.github/workflows/language-smoke\.yml$|\.github/tool-versions\.env$)'
|
||||
langs=""
|
||||
while read -r f; do
|
||||
case "$f" in
|
||||
|
||||
+3
-1
@@ -73,7 +73,9 @@ Shared agent skills live in `.agents/skills/` (`.claude/skills/` links to them):
|
||||
|
||||
## Commands
|
||||
|
||||
- `pnpm tauri dev` — run the app with worktree isolation (Node 22.18+).
|
||||
- Optional: `mise install` provisions the contributor toolchain; `mise tasks` lists the task aliases.
|
||||
See [Development setup](docs/en/contribute/setup.mdx). The direct commands below still work without mise.
|
||||
- `pnpm tauri dev` — run the app with worktree isolation. Use Node 22.22.2 or later on the 22.x line.
|
||||
`pnpm dev:app` also enables the global Tauri API. `pnpm dev:status` reports
|
||||
this worktree's running MCP bridges and actual ports.
|
||||
- `pnpm build` — typecheck + bundle frontend.
|
||||
|
||||
Створено
+115
-124
@@ -1203,27 +1203,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-assembler-x64"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aecefa88696b62f833cc0c997d19c93246b0268e2aaf23e0e8692e527f6de088"
|
||||
checksum = "c19fba13ee427c4dd29488ea51127e945bf07fd9d79093f14c9cc57f74acf757"
|
||||
dependencies = [
|
||||
"cranelift-assembler-x64-meta",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-assembler-x64-meta"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1391a2546f5edf06a0ff5e9430d73c2713fd536aefec53200dc21846d1467f53"
|
||||
checksum = "dd88c766346fcc14bbadbd68cb11e9bc1e555e99f7e8f6b1f4c27a73ca659bec"
|
||||
dependencies = [
|
||||
"cranelift-srcgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-bforest"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9528915fbc2c950702329e08c6d72aaff8ece9b7ecdbd225742825c09a445227"
|
||||
checksum = "f19d43d75dd963d6b1a653f2e03d4eed4365ca2e598ec57e52c15afdad6c3276"
|
||||
dependencies = [
|
||||
"cranelift-entity",
|
||||
"wasmtime-internal-core",
|
||||
@@ -1231,9 +1231,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-bitset"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9dd69a6db85c1bcff989809e0e0b3b06506425f32b545c46aeafda5fe7775d6a"
|
||||
checksum = "45d0b93e50856858c89c61cbe3f6d4b07596da22eb5a03a95b19420e1d08a275"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
@@ -1242,9 +1242,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24c2db6c26cd96393cf785c4b51b900738963cc7422aa0045416a7641ae2f6cd"
|
||||
checksum = "efbdff32d3b6b4f33f1ba8a4ac747b97ce569b1d6834c3089c1c0933b94e618c"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"cranelift-assembler-x64",
|
||||
@@ -1273,9 +1273,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-meta"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e284270142e7f1dcb73a992a62a8b3716b4062a65a52d8f2732c6ebf6f7f342f"
|
||||
checksum = "67fd11ff24916a2c1ff852ce4bb664fcf2c2970ed551de44dd5b573321123703"
|
||||
dependencies = [
|
||||
"cranelift-assembler-x64-meta",
|
||||
"cranelift-codegen-shared",
|
||||
@@ -1286,24 +1286,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen-shared"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6595667b7d505cf85d5bdd014e6f57ad6128183238f8e372319d9384782472f5"
|
||||
checksum = "ba5d321229c3e00a17d7bb3633529ffdf97a13bcf4962fd2e92f1e0fd39360aa"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-control"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26ffdbfcd24c3833d730849e6d132af34a400a2b89b44446015c01eecbea21d"
|
||||
checksum = "71cd63450256d0f80f7a0527e133452f84fa6e1ca73c7db6ca2a9e8cc89d1c18"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-entity"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ffb08ccd8a77fb31cdbbda2afa2333d8f85299b1bc0d1c194259ba66d160d74"
|
||||
checksum = "18d2f259130db1bbb89500d26944971a9beeb410de91ff14039203f055d7f9f0"
|
||||
dependencies = [
|
||||
"cranelift-bitset",
|
||||
"serde",
|
||||
@@ -1313,9 +1313,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-frontend"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b447e4f2bb44b1188185a77f478e5a91b7723a40b3b58c3e2d5b26df2ed5a665"
|
||||
checksum = "cf37a38d982d45fe2c065d55e4de76e596b443b6acceb3ca726c2072c8ba6d7b"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"hashbrown 0.17.1",
|
||||
@@ -1326,15 +1326,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-isle"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f0989e943f3a9d41989595826bba544df9fda64bcddd4df0c06fb2e26af3cb3"
|
||||
checksum = "8ce8f84e2d44326879e18016d763457a2cb5d775e4a5822cd7473fc171fca063"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-native"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fa10df59e776c42dae5b6ba5216ba5321707a2136abd2219e615c54b234fc1b"
|
||||
checksum = "df64a0392edac7b38fb2965ce8e205e7c5e219e4c531ed3cd1929c782f21853d"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"libc",
|
||||
@@ -1343,9 +1343,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-srcgen"
|
||||
version = "0.136.6"
|
||||
version = "0.136.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36508559c8839a8b6ee091f9deaa9cfe620a82f1abb5e358a0a0c65290583622"
|
||||
checksum = "3748e3c77c0717359cd4c089e1dc057221eb8598a9c18b0b5afccb5685975abb"
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
@@ -2154,7 +2154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2386,7 +2386,7 @@ checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a"
|
||||
dependencies = [
|
||||
"io-lifetimes 2.0.4",
|
||||
"rustix",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4144,7 +4144,7 @@ checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "ide-agent"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -4171,7 +4171,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-analysis"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ast-grep-core",
|
||||
"ide-core",
|
||||
@@ -4185,7 +4185,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-android"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"serde",
|
||||
@@ -4196,7 +4196,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-build"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"chardetng",
|
||||
@@ -4214,7 +4214,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-cli"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"serde",
|
||||
@@ -4228,7 +4228,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-clipboard"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"objc2 0.6.5",
|
||||
@@ -4239,7 +4239,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-command"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
@@ -4250,7 +4250,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-core"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"encoding_rs",
|
||||
@@ -4267,7 +4267,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-coverage"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-run",
|
||||
@@ -4281,7 +4281,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-dap"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"futures",
|
||||
@@ -4310,7 +4310,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-db"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bb8",
|
||||
@@ -4348,7 +4348,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-docker"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"serde",
|
||||
@@ -4361,7 +4361,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-drag-out"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"objc2 0.6.5",
|
||||
@@ -4375,7 +4375,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-extension"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
@@ -4396,7 +4396,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-flutter"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-android",
|
||||
"ide-core",
|
||||
@@ -4407,7 +4407,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-fonts"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"objc2-core-foundation",
|
||||
"objc2-core-text",
|
||||
@@ -4419,7 +4419,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-github"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-vcs",
|
||||
@@ -4432,7 +4432,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-heap"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"ide-core",
|
||||
@@ -4450,7 +4450,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-host"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
@@ -4525,7 +4525,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-http"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"hyper-util",
|
||||
"ide-core",
|
||||
@@ -4545,7 +4545,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-index"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"criterion",
|
||||
@@ -4567,7 +4567,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jdwp"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-jvm-inspect",
|
||||
"proptest",
|
||||
@@ -4579,7 +4579,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jsonrpc"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"futures",
|
||||
@@ -4596,7 +4596,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jvm-attach"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"tempfile",
|
||||
@@ -4605,7 +4605,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jvm-inspect"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"serde",
|
||||
@@ -4616,7 +4616,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-language"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"criterion",
|
||||
@@ -4675,7 +4675,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-lsp"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"dunce",
|
||||
@@ -4704,7 +4704,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-mcp"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"dunce",
|
||||
@@ -4723,7 +4723,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-notebook"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"ide-core",
|
||||
@@ -4746,7 +4746,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-plugin"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -4769,7 +4769,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-profiler"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-jvm-attach",
|
||||
@@ -4783,7 +4783,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-remote"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"futures",
|
||||
@@ -4803,7 +4803,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-run"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"encoding_rs",
|
||||
@@ -4827,7 +4827,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-scaffold"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-tools",
|
||||
@@ -4843,7 +4843,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-sdk"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"flate2",
|
||||
@@ -4866,7 +4866,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-search"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"encoding_rs",
|
||||
@@ -4887,7 +4887,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-spell"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"parking_lot",
|
||||
@@ -4900,7 +4900,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-ssh"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"flate2",
|
||||
@@ -4925,7 +4925,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-streams"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-language",
|
||||
@@ -4938,7 +4938,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-syntax"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-language",
|
||||
@@ -4953,7 +4953,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-terminal"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"libc",
|
||||
@@ -4967,7 +4967,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-text"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"ide-core",
|
||||
@@ -4980,7 +4980,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-tools"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"hex",
|
||||
@@ -5001,7 +5001,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-vcs"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -5022,7 +5022,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-vfs"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"chardetng",
|
||||
"dunce",
|
||||
@@ -5049,7 +5049,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-web"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"ide-core",
|
||||
@@ -5065,7 +5065,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-workspace"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -5227,7 +5227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20fd6de4ccfcc187e38bc21cfa543cb5a302cb86a8b114eb7f0bf0dc9f8ac00f"
|
||||
dependencies = [
|
||||
"io-lifetimes 3.0.1",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5265,7 +5265,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6694,7 +6694,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "openidea"
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
@@ -7424,9 +7424,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pulley-interpreter"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "335e459f9c7809af04768799880504d014d07e8e2fc6ae682fe2a105d8ced33f"
|
||||
checksum = "99ecf828c291348e4066f8e45bf37c35ea6012b07a9201e7911c21f03ad1af3e"
|
||||
dependencies = [
|
||||
"cranelift-bitset",
|
||||
"log",
|
||||
@@ -7436,9 +7436,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pulley-macros"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd492ac929a6ca0357362d9fa0a09e31290feac5914550ccfb539b21f89c4b9e"
|
||||
checksum = "20e35ece122b2e8bbd7ea9db0709b3d32f20555b73985efc3eaf6afa4ef2ecdf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -7968,7 +7968,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -8036,7 +8036,7 @@ dependencies = [
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9783,7 +9783,7 @@ dependencies = [
|
||||
"getrandom 0.3.4",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11117,9 +11117,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f32390bdc8d7cdb6259a1b855178bfed88226b4004b209fd48fb30e0deb01cd3"
|
||||
checksum = "263d6a66a772efff2c98a1aa367e8e61dae32d2ecf95f85f4776733762322aa7"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"async-trait",
|
||||
@@ -11159,9 +11159,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-environ"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c10f8ef1c9ee5e0f125c775fe56a4d07b8525db30a96e6358c61d93bd11dee4"
|
||||
checksum = "5f2f0898bedc77f110dca6f70394780f89af68a8ca19e12559ee73d4187a6fe9"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cpp_demangle",
|
||||
@@ -11190,9 +11190,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-component-macro"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "620c53182ebd26c9fff5b90dd53cf8ec3103c381403fd32f8d395da31a9e4a46"
|
||||
checksum = "b140c28283bd2255a4bb8834621f7200bbe7581cbca91d803b5ba4adf9119a5e"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"proc-macro2",
|
||||
@@ -11205,15 +11205,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-component-util"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "011e31ca343d9ba0ec623153cd94131b6f03973ef1a0ab791161f642e4a16a93"
|
||||
checksum = "853075a197694ba7f0749e7af78b59e12c0956dff5b16dafbfc49c3b90cdbc93"
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-core"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab15e50a060b746493e6e95ef3ce4e6e7ebfdd7cc336a7dff0f0277e01b447ef"
|
||||
checksum = "e6e13ab3aa598d863643ef9ec043d63fde7effca4465270446d5b868936b27a6"
|
||||
dependencies = [
|
||||
"hashbrown 0.17.1",
|
||||
"libm",
|
||||
@@ -11222,9 +11222,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-cranelift"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc3d27440a83fba26dd2784a997e13d9acb3606a75fb127c324929b52221c5c5"
|
||||
checksum = "660103cff91df46f9f06568f3889b8b59a6ae0f56756abfcc002a0a69974cc9f"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"cranelift-control",
|
||||
@@ -11248,9 +11248,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-fiber"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e54b28d0d453ca8932e4504065ae66a78f01fcb22b1a2ee287128d732fa9d6f"
|
||||
checksum = "c4d0e958516bdf283b83015283774e11c86b66f2f4bd7d2ea52e9799fa59cddb"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -11262,9 +11262,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-jit-debug"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9293e75a3048b900f7b7c524702abca16d8a2332f970324eefc519f454cd5d69"
|
||||
checksum = "ad61b1e661871bb7d11b5543202a05c44ed8682806b438f68ced629a22719463"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"wasmtime-internal-versioned-export-macros",
|
||||
@@ -11272,9 +11272,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-jit-icache-coherence"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b852e568831b913d410541bb37edc45a5002e472208fbdbaf844ed801dd4255f"
|
||||
checksum = "52c641b9e1bab449c7316896f01d4a0c426e2a502a5a8098e1af4a0392053e7a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasmtime-internal-core",
|
||||
@@ -11283,9 +11283,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-unwinder"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1f7349c9834a542275ad757340079e6453fccb429efce581454d23f85af92c0"
|
||||
checksum = "03303a9abd333edcbd44fee3b1e0905ad156d3bcec311323d061cdff92e7d1f3"
|
||||
dependencies = [
|
||||
"cranelift-codegen",
|
||||
"log",
|
||||
@@ -11295,9 +11295,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-versioned-export-macros"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30b3e0768a450d9dea3e16b83f2498f0b08db0e32bad695e35564eef017be3f1"
|
||||
checksum = "8db0c7f417e5ca3ba92d127d17b980529455d01c141be99204e6d309630c42de"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -11306,9 +11306,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-internal-wit-bindgen"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9d085c540b95d0ffebf98c266e6f152e1acf96a9f676f224a74307b9d422c15"
|
||||
checksum = "6292ee4f797f9befb64aa2b3477ec8576501d6302ec21fd2785a8d3f94cf8717"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags 2.13.2",
|
||||
@@ -11320,9 +11320,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-wasi"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17f8ce6b9e77539b5f52d440346f876a84c513ec1b07162845282f8652f7f7f9"
|
||||
checksum = "3175ff29e2992269f51ec372f7757941f11f87b265a614761726960d42ef6e4d"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bitflags 2.13.2",
|
||||
@@ -11344,9 +11344,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmtime-wasi-io"
|
||||
version = "49.0.6"
|
||||
version = "49.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da9f90eb7ce6edbead27dba3a58843398875defa73b8dce4bbc29d0ce3dc9b40"
|
||||
checksum = "3bb561839e32b61bf0cdd51efe3874fac5de1bd5775a5b7c41bdf70993e367ea"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
@@ -11620,7 +11620,7 @@ version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11788,15 +11788,6 @@ dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.60.2"
|
||||
@@ -12069,7 +12060,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ members = ["crates/*", "src-tauri"]
|
||||
exclude = ["sdk", "plugins"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.49"
|
||||
version = "0.1.50"
|
||||
edition = "2024"
|
||||
rust-version = "1.96"
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -1014,8 +1014,7 @@ impl AgentManager {
|
||||
pending_switch: None,
|
||||
before,
|
||||
saved,
|
||||
// Turns across nested repositories record no files: their changes count against `before`.
|
||||
touched: (req.isolation == Isolation::Local && !worktree::spans_repos(&task.cwd.0)).then(BTreeSet::new),
|
||||
touched: (req.isolation == Isolation::Local).then(BTreeSet::new),
|
||||
turn: None,
|
||||
subagents: Vec::new(),
|
||||
pending_rollback: 0,
|
||||
|
||||
@@ -3684,6 +3684,73 @@ async fn a_task_lists_what_it_changed_in_a_nested_repository() {
|
||||
mgr.shutdown();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn the_last_turn_of_a_task_spans_nested_repositories() {
|
||||
use ide_vcs::ChangeKind::{Added, Modified};
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let base = dunce::canonicalize(tmp.path()).unwrap();
|
||||
let root = base.join("project");
|
||||
let nested = root.join("libs/validation");
|
||||
let git = |repo: &Path, args: &[&str]| {
|
||||
let ok = std::process::Command::new("git")
|
||||
.args(["-c", "user.name=t", "-c", "user.email=t@t", "-c", "commit.gpgsign=false"])
|
||||
.args(args)
|
||||
.current_dir(repo)
|
||||
.status()
|
||||
.unwrap()
|
||||
.success();
|
||||
assert!(ok, "{args:?}");
|
||||
};
|
||||
for repo in [&root, &nested] {
|
||||
std::fs::create_dir_all(repo).unwrap();
|
||||
std::fs::write(repo.join("a.txt"), "one\n").unwrap();
|
||||
git(repo, &["init", "-q", "-b", "main"]);
|
||||
git(repo, &["add", "a.txt"]);
|
||||
git(repo, &["commit", "-q", "-m", "init"]);
|
||||
}
|
||||
let mgr = manager(&base.join("ide"), Arc::new(FakeAgent::default()));
|
||||
let task = mgr
|
||||
.create(NewAgentTask {
|
||||
project_root: Some(IpcPath(root.clone())),
|
||||
prompt: text("Hello"),
|
||||
provider: "claude".into(),
|
||||
isolation: Isolation::Local,
|
||||
..Default::default()
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
one_turn(&mgr, &task.id, None, || std::fs::write(root.join("a.txt"), "two\n").unwrap()).await;
|
||||
one_turn(&mgr, &task.id, Some("more"), || {
|
||||
std::fs::write(nested.join("a.txt"), "two\n").unwrap();
|
||||
std::fs::write(nested.join("b.txt"), "new\n").unwrap();
|
||||
// Committed in the nested repository: still the turn's.
|
||||
std::fs::write(nested.join("c.txt"), "committed\n").unwrap();
|
||||
git(&nested, &["add", "c.txt"]);
|
||||
git(&nested, &["commit", "-q", "-m", "c"]);
|
||||
})
|
||||
.await;
|
||||
|
||||
// Only the second turn's files, from the nested repository, named from the project.
|
||||
assert_eq!(
|
||||
turn_changed(&mgr, &task.id).await,
|
||||
[
|
||||
("libs/validation/a.txt".into(), Modified, 1, 1),
|
||||
("libs/validation/b.txt".into(), Added, 1, 0),
|
||||
("libs/validation/c.txt".into(), Added, 1, 0),
|
||||
]
|
||||
);
|
||||
let repos: Vec<_> = mgr.turn_changes(&task.id).await.unwrap().into_iter().map(|c| c.repo).collect();
|
||||
assert_eq!(repos, [Some(IpcPath(nested.clone())), Some(IpcPath(nested.clone())), Some(IpcPath(nested.clone()))]);
|
||||
let then = mgr.base_text(&task.id, nested.join("a.txt"), AgentChangesView::LastTurn).await.unwrap();
|
||||
assert_eq!(then.as_deref(), Some("one\n"));
|
||||
|
||||
mgr.rollback_changes(&task.id, None, AgentChangesView::LastTurn).await.unwrap();
|
||||
assert_eq!(std::fs::read_to_string(nested.join("a.txt")).unwrap(), "one\n");
|
||||
assert!(!nested.join("b.txt").exists());
|
||||
assert_eq!(std::fs::read_to_string(root.join("a.txt")).unwrap(), "two\n", "the first turn's change stays");
|
||||
mgr.shutdown();
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn the_last_turn_lists_and_rolls_back_only_its_own_changes() {
|
||||
use ide_vcs::ChangeKind::{Added, Deleted, Modified};
|
||||
|
||||
@@ -47,6 +47,37 @@ pub(crate) fn spans_repos(cwd: &Path) -> bool {
|
||||
nested_repos(cwd).is_ok_and(|r| r.is_some())
|
||||
}
|
||||
|
||||
/// The repositories a turn's files are in, and the folder those files are named from.
|
||||
struct TurnRepos {
|
||||
base: PathBuf,
|
||||
repos: Vec<Repo>,
|
||||
/// The project holds nested repositories: each one's `HEAD` is recorded on its own.
|
||||
nested: bool,
|
||||
}
|
||||
|
||||
impl TurnRepos {
|
||||
fn of(cwd: &Path) -> IdeResult<Option<Self>> {
|
||||
if let Some((base, repos)) = nested_repos(cwd)? {
|
||||
return Ok(Some(Self { base, repos, nested: true }));
|
||||
}
|
||||
Ok(discover(cwd)?.map(|repo| Self { base: repo.root().to_path_buf(), repos: vec![repo], nested: false }))
|
||||
}
|
||||
|
||||
/// The innermost repository holding `path`.
|
||||
fn owner(&self, path: &Path) -> Option<&Repo> {
|
||||
self.repos.iter().filter(|r| path.starts_with(r.root())).max_by_key(|r| r.root().as_os_str().len())
|
||||
}
|
||||
|
||||
/// `repo`'s `HEAD` as the turn `start` began.
|
||||
fn head_then<'a>(&self, start: &'a TurnStart, repo: &Repo) -> Option<&'a str> {
|
||||
if self.nested { start.heads.get(&root_key(repo.root())) } else { start.head.as_ref() }.map(String::as_str)
|
||||
}
|
||||
}
|
||||
|
||||
fn root_key(root: &Path) -> String {
|
||||
root.to_string_lossy().into_owned()
|
||||
}
|
||||
|
||||
/// `path` as a task in `base` names it, if it is not in a repository nested below `repo` (that
|
||||
/// one lists it itself; to `repo` its folder is untracked).
|
||||
fn nested_rel(base: &Path, repo: &Repo, roots: &[PathBuf], path: &Path) -> Option<String> {
|
||||
@@ -762,6 +793,9 @@ pub(crate) struct TurnStart {
|
||||
/// `HEAD` then (`None` outside a repository or before its first commit).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub head: Option<String>,
|
||||
/// With nested repositories, each one's `HEAD` then, by its root.
|
||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||
pub heads: BTreeMap<String, String>,
|
||||
/// The files already changed then, stamped.
|
||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||
pub before: BTreeMap<String, Stamp>,
|
||||
@@ -777,12 +811,16 @@ pub(crate) struct TurnStart {
|
||||
/// The copies `previous` saved of files unchanged since are kept rather than made again, so
|
||||
/// starting a turn copies little more than what the turn before it changed.
|
||||
pub(crate) fn start_turn(cwd: &Path, dir: &Path, previous: Option<&TurnStart>) -> IdeResult<TurnStart> {
|
||||
// Turns across nested repositories are not recorded.
|
||||
if spans_repos(cwd) {
|
||||
return Ok(TurnStart::default());
|
||||
}
|
||||
let Some(repo) = discover(cwd)? else { return Ok(TurnStart::default()) };
|
||||
let head = repo.head()?.1;
|
||||
let Some(at) = TurnRepos::of(cwd)? else { return Ok(TurnStart::default()) };
|
||||
let mut heads = BTreeMap::new();
|
||||
let head = if at.nested {
|
||||
for repo in &at.repos {
|
||||
heads.extend(repo.head()?.1.map(|h| (root_key(repo.root()), h)));
|
||||
}
|
||||
None
|
||||
} else {
|
||||
at.repos[0].head()?.1
|
||||
};
|
||||
// As the turn's end is read, so the two compare.
|
||||
let before = snapshot(cwd)?;
|
||||
let mut saved = BTreeSet::new();
|
||||
@@ -803,7 +841,7 @@ pub(crate) fn start_turn(cwd: &Path, dir: &Path, previous: Option<&TurnStart>) -
|
||||
}
|
||||
}
|
||||
for (rel, stamp) in &before {
|
||||
let path = repo.root().join(rel);
|
||||
let path = at.base.join(rel);
|
||||
if stamp.is_none()
|
||||
|| saved.contains(rel)
|
||||
|| !std::fs::metadata(&path).is_ok_and(|m| m.is_file() && m.len() <= SAVED_MAX)
|
||||
@@ -816,32 +854,34 @@ pub(crate) fn start_turn(cwd: &Path, dir: &Path, previous: Option<&TurnStart>) -
|
||||
saved.insert(rel.clone());
|
||||
}
|
||||
}
|
||||
Ok(TurnStart { head, before, saved, changed: None })
|
||||
Ok(TurnStart { head, heads, before, saved, changed: None })
|
||||
}
|
||||
|
||||
/// The files that changed in `cwd` since the turn `start` began: in the working tree (as
|
||||
/// `changed_between` sees them), and in the commits made since.
|
||||
pub(crate) fn changed_in_turn(cwd: &Path, start: &TurnStart) -> IdeResult<(Vec<String>, BTreeSet<String>)> {
|
||||
if spans_repos(cwd) {
|
||||
return Ok(Default::default());
|
||||
}
|
||||
let end = snapshot(cwd)?;
|
||||
let worktree = changed_between(&start.before, &end);
|
||||
let mut all: BTreeSet<String> = worktree.iter().cloned().collect();
|
||||
if let Some(repo) = discover(cwd)?
|
||||
&& let (Some(from), Some(to)) = (&start.head, repo.head()?.1)
|
||||
&& *from != to
|
||||
{
|
||||
let Some(at) = TurnRepos::of(cwd)? else { return Ok((worktree, all)) };
|
||||
for repo in &at.repos {
|
||||
let (Some(from), Some(to)) = (at.head_then(start, repo), repo.head()?.1) else { continue };
|
||||
if from == to {
|
||||
continue;
|
||||
}
|
||||
// Named from the base, as the working tree's files are.
|
||||
let prefix = rel_in(&at.base, repo.root())?;
|
||||
let named = |rel: String| if prefix.is_empty() { rel } else { format!("{prefix}/{rel}") };
|
||||
for f in repo.diff_revisions(from, &to)? {
|
||||
all.extend(f.old_path);
|
||||
all.insert(f.path);
|
||||
all.extend(f.old_path.map(named));
|
||||
all.insert(named(f.path));
|
||||
}
|
||||
}
|
||||
Ok((worktree, all))
|
||||
}
|
||||
|
||||
/// The content of `rel` as the turn `start` began (`None`: no file), its copies in `dir`.
|
||||
fn at_turn_start(repo: &Repo, rel: &str, start: &TurnStart, dir: &Path) -> IdeResult<Option<Vec<u8>>> {
|
||||
fn at_turn_start(at: &TurnRepos, rel: &str, start: &TurnStart, dir: &Path) -> IdeResult<Option<Vec<u8>>> {
|
||||
match start.before.get(rel) {
|
||||
Some(None) => Ok(None),
|
||||
Some(Some(_)) => match start.saved.contains(rel).then(|| saved_copy(dir, rel)).flatten() {
|
||||
@@ -850,10 +890,13 @@ fn at_turn_start(repo: &Repo, rel: &str, start: &TurnStart, dir: &Path) -> IdeRe
|
||||
"{rel} had changes when the turn started that weren't saved; roll it back in Git instead"
|
||||
))),
|
||||
},
|
||||
None => match &start.head {
|
||||
Some(head) => repo.file_bytes_at(&repo.root().join(rel), Some(head)),
|
||||
None => Ok(None),
|
||||
},
|
||||
None => {
|
||||
let path = at.base.join(rel);
|
||||
match at.owner(&path).and_then(|repo| Some((repo, at.head_then(start, repo)?))) {
|
||||
Some((repo, head)) => repo.file_bytes_at(&path, Some(head)),
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -875,16 +918,13 @@ pub(crate) fn turn_changes(
|
||||
dir: &Path,
|
||||
changed: &BTreeSet<String>,
|
||||
) -> IdeResult<Vec<AgentChange>> {
|
||||
if spans_repos(cwd) {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
let Some(repo) = discover(cwd)? else { return Ok(Vec::new()) };
|
||||
let Some(at) = TurnRepos::of(cwd)? else { return Ok(Vec::new()) };
|
||||
let mut out = Vec::new();
|
||||
for rel in changed {
|
||||
let path = repo.root().join(rel);
|
||||
let path = at.base.join(rel);
|
||||
// A folder (a submodule, say) or a file that can't be read has nothing to compare.
|
||||
let Some(now) = existing(&path) else { continue };
|
||||
let (kind, (added, removed)) = match at_turn_start(&repo, rel, start, dir) {
|
||||
let (kind, (added, removed)) = match at_turn_start(&at, rel, start, dir) {
|
||||
Ok(then) if then == now => continue,
|
||||
Ok(then) => {
|
||||
let kind = match (&then, &now) {
|
||||
@@ -898,13 +938,13 @@ pub(crate) fn turn_changes(
|
||||
Err(_) => (ChangeKind::Modified, (0, 0)),
|
||||
};
|
||||
out.push(AgentChange {
|
||||
path: IpcPath(path),
|
||||
rel_path: rel.clone(),
|
||||
kind,
|
||||
added,
|
||||
removed,
|
||||
old_path: None,
|
||||
repo: None,
|
||||
repo: at.nested.then(|| at.owner(&path).map(|r| IpcPath(r.root().to_path_buf()))).flatten(),
|
||||
path: IpcPath(path),
|
||||
});
|
||||
}
|
||||
Ok(out)
|
||||
@@ -912,15 +952,14 @@ pub(crate) fn turn_changes(
|
||||
|
||||
/// The text of `path` as the turn `start` began, `None` when there was no file.
|
||||
pub(crate) fn turn_text(cwd: &Path, path: &Path, start: &TurnStart, dir: &Path) -> IdeResult<Option<String>> {
|
||||
if spans_repos(cwd) {
|
||||
return Ok(None);
|
||||
}
|
||||
let Some(repo) = discover(cwd)? else { return Ok(None) };
|
||||
let rel = rel_in(repo.root(), path)?;
|
||||
if let (None, Some(head)) = (start.before.get(&rel), &start.head) {
|
||||
let Some(at) = TurnRepos::of(cwd)? else { return Ok(None) };
|
||||
let rel = rel_in(&at.base, path)?;
|
||||
if !start.before.contains_key(&rel)
|
||||
&& let Some(head) = at.owner(&at.base.join(&rel)).and_then(|repo| at.head_then(start, repo))
|
||||
{
|
||||
return file_at(cwd, path, head);
|
||||
}
|
||||
let Some(bytes) = at_turn_start(&repo, &rel, start, dir)? else { return Ok(None) };
|
||||
let Some(bytes) = at_turn_start(&at, &rel, start, dir)? else { return Ok(None) };
|
||||
let encoding = match ide_vfs::load_text(path) {
|
||||
Ok(loaded) => encoding_rs::Encoding::for_label(loaded.encoding.as_bytes()).unwrap_or(encoding_rs::UTF_8),
|
||||
Err(_) => ide_vfs::detect_encoding(&bytes, None),
|
||||
@@ -946,8 +985,9 @@ fn rel_in(root: &Path, path: &Path) -> IdeResult<String> {
|
||||
|
||||
/// Puts `change` back as it was when the turn `start` began.
|
||||
pub(crate) fn restore_turn(cwd: &Path, start: &TurnStart, dir: &Path, change: &AgentChange) -> IdeResult<()> {
|
||||
let repo = repo_at(cwd)?;
|
||||
put(&change.path.0, at_turn_start(&repo, &change.rel_path, start, dir)?)
|
||||
let at = TurnRepos::of(cwd)?
|
||||
.ok_or_else(|| IdeError::unavailable(format!("{} is not in a git repository", cwd.display())))?;
|
||||
put(&change.path.0, at_turn_start(&at, &change.rel_path, start, dir)?)
|
||||
}
|
||||
|
||||
pub(crate) fn file_at(cwd: &Path, path: &Path, rev: &str) -> IdeResult<Option<String>> {
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
//! Exception breakpoints on a chosen class. The manager keeps one list; a session given a backend
|
||||
//! for them at start arms it before `configurationDone`, so a throw in the program's first line
|
||||
//! stops, and again after each `setExceptionBreakpoints`, which drops them in java-debug.
|
||||
|
||||
use crate::session::Session;
|
||||
use crate::{DebugManager, jvm_memory};
|
||||
use ide_jvm_inspect::ExceptionClassSpec;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExceptionClassBreakpoint {
|
||||
pub id: String,
|
||||
/// Fully qualified binary name (`com.acme.Outer$Inner`); its subclasses stop too.
|
||||
pub class_name: String,
|
||||
pub caught: bool,
|
||||
pub uncaught: bool,
|
||||
pub enabled: bool,
|
||||
/// Patterns (`com.acme.*`, `*Test`, a full name) for the class whose code throws.
|
||||
pub class_filters: Vec<String>,
|
||||
pub class_exclusion_filters: Vec<String>,
|
||||
}
|
||||
|
||||
/// What a session's exception class breakpoints can do.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExceptionClassSupport {
|
||||
/// Whose class names the session takes: `java`.
|
||||
pub family: String,
|
||||
pub condition: bool,
|
||||
pub class_filters: bool,
|
||||
/// Filters on the class whose code catches the exception.
|
||||
pub catch_filters: bool,
|
||||
}
|
||||
|
||||
/// The JVM backends stop through java-debug's own exception events, which a condition or a
|
||||
/// catch-location filter cannot veto.
|
||||
pub(crate) fn support(s: &Session) -> Option<ExceptionClassSupport> {
|
||||
s.exception_classes.is_some().then(|| ExceptionClassSupport {
|
||||
family: "java".into(),
|
||||
condition: false,
|
||||
class_filters: true,
|
||||
catch_filters: false,
|
||||
})
|
||||
}
|
||||
|
||||
fn spec(b: &ExceptionClassBreakpoint) -> ExceptionClassSpec {
|
||||
ExceptionClassSpec {
|
||||
id: b.id.clone(),
|
||||
class_name: b.class_name.clone(),
|
||||
caught: b.caught,
|
||||
uncaught: b.uncaught,
|
||||
enabled: b.enabled,
|
||||
class_filters: b.class_filters.clone(),
|
||||
class_exclusion_filters: b.class_exclusion_filters.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
impl DebugManager {
|
||||
/// Arms the manager's list in `s`; the caller holds `s.exception_turn`. `clear`: also when the
|
||||
/// list is empty, to take down what an earlier list armed.
|
||||
pub(crate) async fn arm_exception_classes(&self, s: &Session, clear: bool) {
|
||||
let Some(backend) = &s.exception_classes else { return };
|
||||
let specs: Vec<_> = self.exception_classes.lock().iter().map(spec).collect();
|
||||
// Without either, no VM is known yet: `configure` arms once it is.
|
||||
let target = jvm_memory::vm_target(s);
|
||||
if (specs.is_empty() && !clear) || (target.pid.is_none() && target.attach_port.is_none()) {
|
||||
return;
|
||||
}
|
||||
match backend.set(&target, &specs).await {
|
||||
Ok(states) => tracing::debug!("exception class breakpoints of session {}: {states:?}", s.id.0),
|
||||
Err(e) => tracing::debug!("exception class breakpoints of session {} failed: {e}", s.id.0),
|
||||
}
|
||||
}
|
||||
|
||||
/// Stores exception breakpoints on chosen classes (kept without a session, armed on start)
|
||||
/// and arms them in every session that takes them. Also in one still starting: one that has
|
||||
/// armed already would miss the list, and one that has not answers `vmNotFound` until then.
|
||||
pub async fn set_exception_class_breakpoints(&self, list: Vec<ExceptionClassBreakpoint>) {
|
||||
*self.exception_classes.lock() = list;
|
||||
for s in self.live_sessions() {
|
||||
if s.exception_classes.is_none() || s.conn.is_closed() {
|
||||
continue;
|
||||
}
|
||||
let _turn = s.exception_turn.lock().await;
|
||||
self.arm_exception_classes(&s, true).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ pub mod adapter;
|
||||
pub mod attach;
|
||||
mod cargo;
|
||||
pub mod connection;
|
||||
mod exception_classes;
|
||||
pub mod jdwp;
|
||||
mod js_cdp;
|
||||
mod js_debug;
|
||||
@@ -24,6 +25,7 @@ pub mod unity;
|
||||
|
||||
use adapter::{AdapterLauncher, AdapterSpec, ProcessLauncher};
|
||||
use connection::{Connection, DapError};
|
||||
pub use exception_classes::{ExceptionClassBreakpoint, ExceptionClassSupport};
|
||||
use futures::future::join_all;
|
||||
use ide_core::{DebugSessionId, IdeError, IdeResult, SharedSink};
|
||||
use ide_language::LanguageRegistry;
|
||||
@@ -283,6 +285,8 @@ pub struct SessionExceptionFilters {
|
||||
pub session: DebugSessionId,
|
||||
pub adapter: String,
|
||||
pub filters: Vec<ExceptionFilter>,
|
||||
/// Set when the session takes exception breakpoints on a chosen class.
|
||||
pub classes: Option<ExceptionClassSupport>,
|
||||
}
|
||||
|
||||
/// What triggered a hot reload; `flutter debug_adapter` takes it as `reason`.
|
||||
@@ -336,6 +340,7 @@ pub struct DebugManager {
|
||||
states: Mutex<HashMap<PathBuf, Vec<BreakpointState>>>,
|
||||
/// Explicit exception filter choices (filter id → enabled); unset filters use the adapter default.
|
||||
exception_choices: Mutex<BTreeMap<String, bool>>,
|
||||
exception_classes: Mutex<Vec<ExceptionClassBreakpoint>>,
|
||||
function_breakpoints: Mutex<Vec<FunctionBreakpoint>>,
|
||||
data_breakpoints: Mutex<Vec<DataBreakpoint>>,
|
||||
/// In-flight stops, by session: a second Stop sets `stop_force`, the waiting one kills.
|
||||
@@ -788,6 +793,7 @@ impl DebugManager {
|
||||
breakpoints: Mutex::default(),
|
||||
states: Mutex::default(),
|
||||
exception_choices: Mutex::default(),
|
||||
exception_classes: Mutex::default(),
|
||||
function_breakpoints: Mutex::default(),
|
||||
data_breakpoints: Mutex::default(),
|
||||
stopping: Mutex::default(),
|
||||
@@ -836,6 +842,18 @@ impl DebugManager {
|
||||
config: LaunchConfig,
|
||||
owner: SessionOwner,
|
||||
custom_command: impl FnOnce(&str) -> Option<String>,
|
||||
) -> IdeResult<DebugSessionId> {
|
||||
self.start_with_exception_classes(config, owner, custom_command, None).await
|
||||
}
|
||||
|
||||
/// [`start_with`](Self::start_with), the session arming [`Self::set_exception_class_breakpoints`]
|
||||
/// through `exception_classes`.
|
||||
pub async fn start_with_exception_classes(
|
||||
&self,
|
||||
config: LaunchConfig,
|
||||
owner: SessionOwner,
|
||||
custom_command: impl FnOnce(&str) -> Option<String>,
|
||||
exception_classes: Option<Arc<dyn ide_jvm_inspect::ExceptionClassBreakpoints>>,
|
||||
) -> IdeResult<DebugSessionId> {
|
||||
let mut arguments = launch_arguments(&config)?;
|
||||
// An IDE-side marker (never sent to the adapter): the session is a Flutter
|
||||
@@ -977,7 +995,19 @@ impl DebugManager {
|
||||
}
|
||||
}
|
||||
let port = debug_server.map(|s| s.port);
|
||||
self.start_session(id, owner, config.name, config.adapter, None, config.request, arguments, spec, port).await
|
||||
self.start_session(
|
||||
id,
|
||||
owner,
|
||||
config.name,
|
||||
config.adapter,
|
||||
None,
|
||||
config.request,
|
||||
arguments,
|
||||
spec,
|
||||
port,
|
||||
exception_classes,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
/// `startDebugging` reverse request: a child session on the same adapter.
|
||||
@@ -1002,6 +1032,7 @@ impl DebugManager {
|
||||
configuration,
|
||||
parent.spec.clone(),
|
||||
parent.port,
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.map(|_| ())
|
||||
@@ -1019,6 +1050,7 @@ impl DebugManager {
|
||||
arguments: Value,
|
||||
spec: AdapterSpec,
|
||||
reuse_port: Option<u16>,
|
||||
exception_classes: Option<Arc<dyn ide_jvm_inspect::ExceptionClassBreakpoints>>,
|
||||
) -> IdeResult<DebugSessionId> {
|
||||
if request != "launch" && request != "attach" {
|
||||
return Err(IdeError::invalid(format!("request must be `launch` or `attach`, got `{request}`")));
|
||||
@@ -1033,8 +1065,9 @@ impl DebugManager {
|
||||
let rdbg_pid = (adapter_name == "rdbg" && request == "launch")
|
||||
.then(|| io.child.as_ref().and_then(tokio::process::Child::id))
|
||||
.flatten();
|
||||
let session =
|
||||
Arc::new(Session::new(id, owner, name, adapter_name, parent, request, conn, spec, io.port, io.child));
|
||||
let mut session = Session::new(id, owner, name, adapter_name, parent, request, conn, spec, io.port, io.child);
|
||||
session.exception_classes = exception_classes;
|
||||
let session = Arc::new(session);
|
||||
if let Some(launch_type) = arguments.get("type").and_then(Value::as_str) {
|
||||
let _ = session.launch_type.set(launch_type.to_owned());
|
||||
}
|
||||
@@ -1259,8 +1292,12 @@ impl DebugManager {
|
||||
tracing::debug!("setDataBreakpoints failed: {e}");
|
||||
}
|
||||
let has_filters = s.caps.lock().get("exceptionBreakpointFilters").and_then(Value::as_array).is_some();
|
||||
if has_filters {
|
||||
let _ = self.send_exception_breakpoints(s).await;
|
||||
{
|
||||
let _turn = s.exception_turn.lock().await;
|
||||
if has_filters {
|
||||
let _ = self.send_exception_breakpoints(s).await;
|
||||
}
|
||||
self.arm_exception_classes(s, false).await;
|
||||
}
|
||||
if s.supports("supportsConfigurationDoneRequest") {
|
||||
if s.adapter == kotlin::ADAPTER {
|
||||
@@ -1481,6 +1518,7 @@ impl DebugManager {
|
||||
session: s.id,
|
||||
adapter: s.adapter.clone(),
|
||||
filters: exception_filters_from(&s.caps.lock()),
|
||||
classes: exception_classes::support(s),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -1496,9 +1534,11 @@ impl DebugManager {
|
||||
if exception_filters_from(&s.caps.lock()).is_empty() {
|
||||
continue;
|
||||
}
|
||||
let _turn = s.exception_turn.lock().await;
|
||||
if let Err(e) = self.send_exception_breakpoints(&s).await {
|
||||
tracing::debug!("setExceptionBreakpoints on session {} failed: {e}", s.id.0);
|
||||
}
|
||||
self.arm_exception_classes(&s, false).await;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -118,6 +118,11 @@ pub(crate) struct Session {
|
||||
pub kotlin_mirror: Mutex<Option<crate::kotlin::SourceMirror>>,
|
||||
pub jvm_memory: tokio::sync::Mutex<crate::JvmMemoryState>,
|
||||
pub stream_tracer: parking_lot::Mutex<Option<Arc<dyn ide_jvm_inspect::StreamTracer>>>,
|
||||
/// Given at start: the class breakpoints must be armed before `configurationDone`.
|
||||
pub(crate) exception_classes: Option<Arc<dyn ide_jvm_inspect::ExceptionClassBreakpoints>>,
|
||||
/// Held from `setExceptionBreakpoints`, which drops the class breakpoints, until they are
|
||||
/// armed again, so that the last list armed is the manager's.
|
||||
pub(crate) exception_turn: tokio::sync::Mutex<()>,
|
||||
pub(crate) stream_trace: parking_lot::Mutex<Option<crate::stream_trace::ActiveTrace>>,
|
||||
/// The last trace that finished, until the stop its records were read in ends.
|
||||
pub(crate) stream_trace_done: parking_lot::Mutex<Option<crate::stream_trace::DoneTrace>>,
|
||||
@@ -286,6 +291,8 @@ impl Session {
|
||||
kotlin_mirror: Mutex::new(None),
|
||||
jvm_memory: tokio::sync::Mutex::default(),
|
||||
stream_tracer: parking_lot::Mutex::new(None),
|
||||
exception_classes: None,
|
||||
exception_turn: tokio::sync::Mutex::default(),
|
||||
stream_trace: parking_lot::Mutex::new(None),
|
||||
stream_trace_done: parking_lot::Mutex::new(None),
|
||||
quirks: kotlin_lsp::Quirks::default(),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! Protocol flow against an in-memory fake adapter.
|
||||
|
||||
mod exception_classes;
|
||||
mod jvm_inspect;
|
||||
mod stream_trace;
|
||||
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
//! Exception breakpoints on a chosen class, armed through a session's backend.
|
||||
|
||||
use super::*;
|
||||
use ide_jvm_inspect::{ExceptionArmState, ExceptionClassBreakpoints, ExceptionClassSpec, InspectFuture, VmTarget};
|
||||
|
||||
/// The target, the list, and the DAP requests sent before it.
|
||||
type ArmCall = (VmTarget, Vec<ExceptionClassSpec>, Vec<String>);
|
||||
|
||||
/// Records each list it is given with the DAP requests sent before it.
|
||||
struct FakeArmer {
|
||||
log: Log,
|
||||
calls: Mutex<Vec<ArmCall>>,
|
||||
}
|
||||
|
||||
impl FakeArmer {
|
||||
fn new(h: &Harness) -> Arc<Self> {
|
||||
Arc::new(Self { log: h.log.clone(), calls: Mutex::default() })
|
||||
}
|
||||
|
||||
fn lists(&self) -> Vec<Vec<String>> {
|
||||
self.calls.lock().iter().map(|(_, specs, _)| specs.iter().map(|s| s.class_name.clone()).collect()).collect()
|
||||
}
|
||||
|
||||
/// The DAP requests sent before each call.
|
||||
fn before(&self) -> Vec<Vec<String>> {
|
||||
self.calls.lock().iter().map(|(_, _, sent)| sent.clone()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
impl ExceptionClassBreakpoints for FakeArmer {
|
||||
fn set<'a>(
|
||||
&'a self,
|
||||
target: &'a VmTarget,
|
||||
breakpoints: &'a [ExceptionClassSpec],
|
||||
) -> InspectFuture<'a, Vec<(String, ExceptionArmState)>> {
|
||||
let sent = self
|
||||
.log
|
||||
.lock()
|
||||
.iter()
|
||||
.filter(|m| m["type"] == "request")
|
||||
.map(|m| m["command"].as_str().unwrap().to_owned())
|
||||
.collect();
|
||||
self.calls.lock().push((target.clone(), breakpoints.to_vec(), sent));
|
||||
let states = breakpoints.iter().map(|b| (b.id.clone(), ExceptionArmState::Armed)).collect();
|
||||
Box::pin(async move { Ok(states) })
|
||||
}
|
||||
}
|
||||
|
||||
fn class_bp(id: &str, class_name: &str) -> ExceptionClassBreakpoint {
|
||||
ExceptionClassBreakpoint {
|
||||
id: id.into(),
|
||||
class_name: class_name.into(),
|
||||
caught: true,
|
||||
uncaught: true,
|
||||
enabled: true,
|
||||
class_filters: vec![],
|
||||
class_exclusion_filters: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
/// A java-debug attach to a JVM on another machine: the target is known from the request alone.
|
||||
fn attach() -> LaunchConfig {
|
||||
LaunchConfig {
|
||||
extra_json: Some(json!({"hostName": "10.0.0.5", "port": 5005}).to_string()),
|
||||
..java_config("attach")
|
||||
}
|
||||
}
|
||||
|
||||
async fn start(h: &Harness, config: LaunchConfig, armer: &Arc<FakeArmer>) -> DebugSessionId {
|
||||
let backend: Arc<dyn ExceptionClassBreakpoints> = armer.clone();
|
||||
h.manager.start_with_exception_classes(config, h.owner.clone(), |_| None, Some(backend)).await.unwrap()
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn armed_after_the_exception_filters_and_before_configuration_done() {
|
||||
let h = harness(Script::default());
|
||||
let armer = FakeArmer::new(&h);
|
||||
let filtered = ExceptionClassBreakpoint {
|
||||
caught: false,
|
||||
enabled: false,
|
||||
class_filters: vec!["com.acme.*".into()],
|
||||
class_exclusion_filters: vec!["*Test".into()],
|
||||
..class_bp("b", "com.acme.Boom")
|
||||
};
|
||||
h.manager.set_exception_class_breakpoints(vec![class_bp("a", "java.lang.IllegalStateException"), filtered]).await;
|
||||
start(&h, attach(), &armer).await;
|
||||
|
||||
assert_eq!(armer.before(), [["initialize", "attach", "setExceptionBreakpoints"]]);
|
||||
let (target, specs, _) = armer.calls.lock()[0].clone();
|
||||
assert_eq!((target.pid, target.attach_host.as_deref(), target.attach_port), (None, Some("10.0.0.5"), Some(5005)));
|
||||
assert_eq!(
|
||||
specs[1],
|
||||
ExceptionClassSpec {
|
||||
id: "b".into(),
|
||||
class_name: "com.acme.Boom".into(),
|
||||
caught: false,
|
||||
uncaught: true,
|
||||
enabled: false,
|
||||
class_filters: vec!["com.acme.*".into()],
|
||||
class_exclusion_filters: vec!["*Test".into()],
|
||||
}
|
||||
);
|
||||
assert!(h.commands().contains(&"configurationDone".to_owned()));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn armed_again_after_every_set_exception_breakpoints() {
|
||||
let h = harness(Script::default());
|
||||
let armer = FakeArmer::new(&h);
|
||||
h.manager.set_exception_class_breakpoints(vec![class_bp("a", "com.acme.Boom")]).await;
|
||||
start(&h, attach(), &armer).await;
|
||||
h.manager.set_exception_breakpoints(BTreeMap::from([("raised".into(), true)])).await.unwrap();
|
||||
|
||||
assert_eq!(armer.lists(), [["com.acme.Boom"], ["com.acme.Boom"]]);
|
||||
let last = armer.before().pop().unwrap();
|
||||
assert_eq!(last.iter().filter(|c| *c == "setExceptionBreakpoints").count(), 2, "{last:?}");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_new_list_reaches_the_sessions_that_take_it() {
|
||||
let h = harness(Script::default());
|
||||
let armer = FakeArmer::new(&h);
|
||||
start(&h, attach(), &armer).await;
|
||||
let other = h.start(attach()).await.unwrap();
|
||||
assert!(armer.lists().is_empty(), "nothing to arm at start");
|
||||
|
||||
h.manager.set_exception_class_breakpoints(vec![class_bp("a", "com.acme.Boom")]).await;
|
||||
h.manager.set_exception_class_breakpoints(vec![]).await;
|
||||
assert_eq!(armer.lists(), [vec!["com.acme.Boom".to_owned()], vec![]], "an empty list takes them down");
|
||||
|
||||
let filters = h.manager.exception_filters(None);
|
||||
let support = |id| filters.iter().find(|f| f.session == id).unwrap().classes.clone();
|
||||
assert_eq!(support(other), None);
|
||||
let java = filters.iter().find(|f| f.session != other).unwrap().session;
|
||||
assert_eq!(
|
||||
support(java),
|
||||
Some(ExceptionClassSupport {
|
||||
family: "java".into(),
|
||||
condition: false,
|
||||
class_filters: true,
|
||||
catch_filters: false
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn nothing_is_sent_before_the_jvm_is_known() {
|
||||
let h = harness(Script::default());
|
||||
let armer = FakeArmer::new(&h);
|
||||
h.manager.set_exception_class_breakpoints(vec![class_bp("a", "com.acme.Boom")]).await;
|
||||
// The fake adapter sends no `process` event before `configurationDone`: no pid to name.
|
||||
start(&h, java_config("launch"), &armer).await;
|
||||
assert!(armer.lists().is_empty());
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
//! remote server ([`crate::rpc`]). `db_export_file` stays in the desktop
|
||||
//! shell: its path comes from a local save dialog, so the export must land
|
||||
//! on the user's machine, not the side the project runs on.
|
||||
use super::Channel;
|
||||
use crate::Host;
|
||||
use ide_command::command;
|
||||
use ide_core::{IdeError, IdeResult, IpcPath, RequestId};
|
||||
@@ -24,6 +25,14 @@ pub struct StatementOutcome {
|
||||
pub error: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Type)]
|
||||
#[serde(tag = "type", rename_all = "camelCase")]
|
||||
pub enum ExecutionEvent {
|
||||
Started { index: u32 },
|
||||
Completed { index: u32, outcome: StatementOutcome },
|
||||
Done { error: Option<IdeError> },
|
||||
}
|
||||
|
||||
#[command(trust = trusted)]
|
||||
pub fn db_approve_jdbc_source(host: &Host, window: &str, source: DataSource) -> IdeResult<()> {
|
||||
host.project(window)?.db.approve_jdbc_source(&source)
|
||||
@@ -357,36 +366,79 @@ pub async fn db_execute(
|
||||
max_rows: u32,
|
||||
schema: Option<String>,
|
||||
) -> IdeResult<Vec<StatementOutcome>> {
|
||||
// Runs `statements` in order on data source `id`, stopping at the first
|
||||
// error. Each result reads past its first `skip` rows (a later page) and keeps
|
||||
// `max_rows`. `schema` is the console's active context: the connection running
|
||||
// each statement is put in it first. Cancel with `cancel_request(request)`.
|
||||
let mut outcomes = Vec::new();
|
||||
execute_statements(host, window, request, &id, statements, skip, max_rows, schema.as_deref(), |event| {
|
||||
if let ExecutionEvent::Completed { outcome, .. } = event {
|
||||
outcomes.push(outcome);
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.await?;
|
||||
Ok(outcomes)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[command(trust = trusted)]
|
||||
pub async fn db_execute_stream(
|
||||
host: &Host,
|
||||
window: &str,
|
||||
request: RequestId,
|
||||
id: String,
|
||||
statements: Vec<SqlStatement>,
|
||||
max_rows: u32,
|
||||
schema: Option<String>,
|
||||
on_progress: Channel<ExecutionEvent>,
|
||||
) -> IdeResult<()> {
|
||||
let result = execute_statements(host, window, request, &id, statements, 0, max_rows, schema.as_deref(), |event| {
|
||||
on_progress.send(event)
|
||||
})
|
||||
.await;
|
||||
// The invocation reply can reach the viewer before a large result frame.
|
||||
on_progress.send(ExecutionEvent::Done { error: result.err() })
|
||||
}
|
||||
|
||||
/// Runs in order on one request and stops on cancellation or the first error.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn execute_statements(
|
||||
host: &Host,
|
||||
window: &str,
|
||||
request: RequestId,
|
||||
id: &str,
|
||||
statements: Vec<SqlStatement>,
|
||||
skip: u32,
|
||||
max_rows: u32,
|
||||
schema: Option<&str>,
|
||||
mut emit: impl FnMut(ExecutionEvent) -> IdeResult<()>,
|
||||
) -> IdeResult<()> {
|
||||
let db = host.project(window)?.db.clone();
|
||||
let cancel = host.begin_request(request);
|
||||
let mut out = Vec::new();
|
||||
for statement in statements {
|
||||
match db
|
||||
.execute_from(&id, &statement.text, skip as usize, max_rows.max(1) as usize, &cancel, schema.as_deref())
|
||||
.await
|
||||
{
|
||||
Ok(result) => out.push(StatementOutcome { statement, result: Some(result), error: None }),
|
||||
Err(e) if e.kind == ide_core::error::ErrorKind::Cancelled => {
|
||||
host.end_request(request);
|
||||
return Err(e);
|
||||
let result = async {
|
||||
for (index, statement) in statements.into_iter().enumerate() {
|
||||
if cancel.is_cancelled() {
|
||||
return Err(IdeError::cancelled());
|
||||
}
|
||||
Err(e) if e.kind == ide_core::error::ErrorKind::PermissionDenied && out.is_empty() => {
|
||||
// Not connected for lack of a password: the UI asks and retries.
|
||||
host.end_request(request);
|
||||
return Err(e);
|
||||
}
|
||||
Err(e) => {
|
||||
out.push(StatementOutcome { statement, result: None, error: Some(e.message) });
|
||||
emit(ExecutionEvent::Started { index: index as u32 })?;
|
||||
let outcome = match db
|
||||
.execute_from(id, &statement.text, skip as usize, max_rows.max(1) as usize, &cancel, schema)
|
||||
.await
|
||||
{
|
||||
Ok(result) => StatementOutcome { statement, result: Some(result), error: None },
|
||||
Err(e) if e.kind == ide_core::error::ErrorKind::Cancelled => return Err(e),
|
||||
// The UI may retry a login failure only before any statement has completed.
|
||||
Err(e) if e.kind == ide_core::error::ErrorKind::PermissionDenied && index == 0 => return Err(e),
|
||||
Err(e) => StatementOutcome { statement, result: None, error: Some(e.message) },
|
||||
};
|
||||
let failed = outcome.error.is_some();
|
||||
emit(ExecutionEvent::Completed { index: index as u32, outcome })?;
|
||||
if failed {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
.await;
|
||||
host.end_request(request);
|
||||
Ok(out)
|
||||
result
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@@ -539,6 +591,7 @@ ide_command::domain!(
|
||||
db_disconnect,
|
||||
db_drop_database,
|
||||
db_execute,
|
||||
db_execute_stream,
|
||||
db_explain,
|
||||
db_finish_transaction,
|
||||
db_history,
|
||||
@@ -567,3 +620,69 @@ ide_command::domain!(
|
||||
db_test_tunnel,
|
||||
db_trust_ssh_host,
|
||||
);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::HostConfig;
|
||||
use ide_db::DbDriver;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn a_reporting_error_stops_the_batch_and_releases_the_request() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let base = dunce::canonicalize(temp.path()).unwrap();
|
||||
let root = base.join("project");
|
||||
std::fs::create_dir(&root).unwrap();
|
||||
let host = Host::new(HostConfig {
|
||||
config_dir: base.join("config"),
|
||||
data_dir: base.join("data"),
|
||||
local_data_dir: base.join("local"),
|
||||
languages: Arc::new(ide_language::LanguageRegistry::load(None).unwrap()),
|
||||
syntax: Arc::default(),
|
||||
sink_for: Box::new(|_| Arc::new(|_| {})),
|
||||
owner: |w| w,
|
||||
runtime: tokio::runtime::Handle::current(),
|
||||
project_environment: false,
|
||||
});
|
||||
let window = "main";
|
||||
host.open_project(window, &root).unwrap();
|
||||
host.set_project_trust(&root, true, false).await.unwrap();
|
||||
let id = "test";
|
||||
let file = root.join("test.sqlite");
|
||||
std::fs::File::create(&file).unwrap();
|
||||
db_save_sources(
|
||||
&host,
|
||||
window,
|
||||
vec![DataSource { id: id.into(), name: id.into(), file: Some(file.into()), ..Default::default() }],
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let statements =
|
||||
ide_db::split::split("CREATE TABLE items (n INTEGER); INSERT INTO items VALUES (1);", DbDriver::Sqlite);
|
||||
let request = RequestId(1);
|
||||
let error = execute_statements(&host, window, request, id, statements, 0, 10, None, |event| match event {
|
||||
ExecutionEvent::Started { index: 0 } => Ok(()),
|
||||
ExecutionEvent::Completed { index: 0, outcome } => {
|
||||
assert!(outcome.error.is_none(), "{:?}", outcome.error);
|
||||
Err(IdeError::internal("cannot report result"))
|
||||
}
|
||||
_ => panic!("the failed callback must stop execution"),
|
||||
})
|
||||
.await
|
||||
.unwrap_err();
|
||||
assert_eq!(error.message, "cannot report result");
|
||||
|
||||
// After cleanup, cancel is remembered for the next request with this id.
|
||||
host.cancel_request(request);
|
||||
assert!(host.begin_request(request).is_cancelled());
|
||||
|
||||
let query = ide_db::split::split(
|
||||
"SELECT 99 AS n UNION ALL SELECT count(*) FROM items ORDER BY n DESC",
|
||||
DbDriver::Sqlite,
|
||||
);
|
||||
let outcomes = db_execute(&host, window, RequestId(2), id.into(), query, 1, 10, None).await.unwrap();
|
||||
assert_eq!(outcomes[0].result.as_ref().unwrap().rows, vec![vec![Some("0".into())]]);
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,8 @@ pub async fn debug_start(host: &Host, window: &str, config: LaunchConfig) -> Ide
|
||||
};
|
||||
host.require_trust(window)?;
|
||||
let server_port = debug_server_port(&config);
|
||||
let result = host.debugger.start_with(config, owner, custom).await;
|
||||
let exception_classes = server_port.and_then(|port| exception_class_backend(host, window, port));
|
||||
let result = host.debugger.start_with_exception_classes(config, owner, custom, exception_classes).await;
|
||||
flush_output();
|
||||
if let Ok(id) = &result {
|
||||
let sink = host.window_sink(label);
|
||||
@@ -208,6 +209,18 @@ fn attach_jvm_inspector(host: &Host, window: &str, session: DebugSessionId, port
|
||||
}
|
||||
}
|
||||
|
||||
/// Given before the session starts, unlike the inspector: the breakpoints are armed before
|
||||
/// `configurationDone`, so a throw in `main`'s first line stops.
|
||||
fn exception_class_backend(
|
||||
host: &Host,
|
||||
window: &str,
|
||||
port: u16,
|
||||
) -> Option<std::sync::Arc<dyn ide_jvm_inspect::ExceptionClassBreakpoints>> {
|
||||
let project = host.project(window).ok()?;
|
||||
let module = project.lsp.java_debug_server_module(port)?;
|
||||
Some(std::sync::Arc::new(ide_lsp::JdtExceptionBreakpoints::new(project.lsp.clone(), module)))
|
||||
}
|
||||
|
||||
/// A JVM the debugger starts itself: an Application or Spring Boot configuration, launched by
|
||||
/// java-debug, java-analyzer or the Kotlin debugger (JAR Application debugs through a run with a
|
||||
/// JDWP agent).
|
||||
@@ -453,6 +466,16 @@ pub async fn debug_set_exception_breakpoints(
|
||||
host.debugger.set_exception_breakpoints(choices).await
|
||||
}
|
||||
|
||||
/// Exception breakpoints on chosen classes (all sessions that take them, and later ones).
|
||||
#[command(trust = trusted)]
|
||||
pub async fn debug_set_exception_class_breakpoints(
|
||||
host: &Host,
|
||||
breakpoints: Vec<ExceptionClassBreakpoint>,
|
||||
) -> IdeResult<()> {
|
||||
host.debugger.set_exception_class_breakpoints(breakpoints).await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[command(trust = trusted)]
|
||||
pub async fn debug_set_variable(
|
||||
@@ -849,6 +872,7 @@ ide_command::domain!(
|
||||
debug_set_breakpoints,
|
||||
debug_set_data_breakpoints,
|
||||
debug_set_exception_breakpoints,
|
||||
debug_set_exception_class_breakpoints,
|
||||
debug_set_function_breakpoints,
|
||||
debug_set_variable,
|
||||
debug_stack_trace,
|
||||
|
||||
@@ -301,19 +301,30 @@ fn finish_launch(
|
||||
// The module/project JDK, else the JDK the Java language server builds the module with, else one
|
||||
// matching its Java version.
|
||||
let project_jdk = ide_sdk::apply::module_jdk(root, module, settings);
|
||||
let from_server = info.java_home.as_deref().map(ide_sdk::java::java_executable).filter(|p| p.is_file());
|
||||
let java = project_jdk.map(|j| ide_sdk::java::java_executable(&j.home)).or(from_server).or_else(|| {
|
||||
// The build model's level includes what the module inherits from its parent POMs.
|
||||
let release = model
|
||||
// The build model's level includes what the module inherits from its parent POMs.
|
||||
let release = || {
|
||||
model
|
||||
.maven
|
||||
.as_ref()
|
||||
.and_then(|m| m.projects.iter().find(|p| root.join(&p.dir) == module))
|
||||
.and_then(|p| p.java_version)
|
||||
.or_else(|| ide_sdk::java::project_java_version(module));
|
||||
let jdks = ide_sdk::java::installed_jdks();
|
||||
info.hints.extend(ide_sdk::java::missing_jdk_message(&jdks, release));
|
||||
ide_sdk::java::pick_jdk(&jdks, release).map(|j| ide_sdk::java::java_executable(&j.home))
|
||||
});
|
||||
.or_else(|| ide_sdk::java::project_java_version(module))
|
||||
};
|
||||
let java = match project_jdk {
|
||||
Some(j) => Some(ide_sdk::java::java_executable(&j.home)),
|
||||
None => {
|
||||
let release = release();
|
||||
let server = info.java_home.as_deref().and_then(|home| server_java(home, release));
|
||||
match server {
|
||||
Some(java) => Some(java),
|
||||
None => {
|
||||
let jdks = ide_sdk::java::installed_jdks();
|
||||
info.hints.extend(ide_sdk::java::missing_jdk_message(&jdks, release));
|
||||
ide_sdk::java::pick_jdk(&jdks, release).map(|j| ide_sdk::java::java_executable(&j.home))
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
info.java_exec = Some(java.map(|p| p.to_string_lossy().into_owned()).unwrap_or_else(|| "java".to_owned()));
|
||||
let exec = PathBuf::from(info.java_exec.as_deref().unwrap_or("java"));
|
||||
let shorten = ide_run::java_cmdline::shortening_for(&exec, &info.class_paths, &info.module_paths, cfg!(windows));
|
||||
@@ -328,6 +339,19 @@ fn finish_launch(
|
||||
}
|
||||
}
|
||||
|
||||
/// The `java` of the JDK a Java language server reports, when it can run classes compiled for
|
||||
/// `release`: that JDK is the one the server runs on or defaults to, not necessarily one the
|
||||
/// module's bytecode loads on. A home whose version is unknown is used only when `release` is too.
|
||||
fn server_java(home: &Path, release: Option<u32>) -> Option<PathBuf> {
|
||||
match ide_sdk::java::jdk_at(home) {
|
||||
Some(jdk) if release.is_none_or(|release| jdk.major >= release) => {
|
||||
Some(ide_sdk::java::java_executable(&jdk.home))
|
||||
}
|
||||
Some(_) => None,
|
||||
None => Some(ide_sdk::java::java_executable(home)).filter(|java| release.is_none() && java.is_file()),
|
||||
}
|
||||
}
|
||||
|
||||
/// With Settings › Maven › Delegate IDE build/run actions to Maven, javac's verdict replaces
|
||||
/// JDT's. Classes JDT wrote for sources with errors look up to date to Maven's incremental
|
||||
/// compiler, so a launch JDT reports errors for recompiles everything.
|
||||
@@ -557,6 +581,38 @@ fn drop_processor_recreate_errors(info: &mut JavaLaunchInfo) {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn fake_jdk(dir: &Path, version: Option<&str>) -> PathBuf {
|
||||
let bin = dir.join("bin");
|
||||
std::fs::create_dir_all(&bin).unwrap();
|
||||
std::fs::write(bin.join(if cfg!(windows) { "java.exe" } else { "java" }), "").unwrap();
|
||||
if let Some(version) = version {
|
||||
std::fs::write(dir.join("release"), format!("JAVA_VERSION=\"{version}\"\n")).unwrap();
|
||||
}
|
||||
dir.to_path_buf()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_server_jdk_older_than_the_module_release_is_not_used() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let jdk17 = fake_jdk(&tmp.path().join("17"), Some("17.0.12"));
|
||||
let jdk21 = fake_jdk(&tmp.path().join("21"), Some("21.0.4"));
|
||||
let unknown = fake_jdk(&tmp.path().join("unknown"), None);
|
||||
// (server JDK, module release, used?)
|
||||
let cases = [
|
||||
(&jdk17, Some(21), false),
|
||||
(&jdk17, Some(17), true),
|
||||
(&jdk17, Some(11), true),
|
||||
(&jdk17, None, true),
|
||||
(&jdk21, Some(21), true),
|
||||
(&unknown, None, true),
|
||||
(&unknown, Some(21), false),
|
||||
];
|
||||
for (home, release, used) in cases {
|
||||
assert_eq!(server_java(home, release).is_some(), used, "{} for release {release:?}", home.display());
|
||||
}
|
||||
assert!(server_java(&tmp.path().join("missing"), None).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recognises_a_processor_recreating_its_output() {
|
||||
assert!(processor_recreated_a_file(
|
||||
|
||||
@@ -3059,6 +3059,10 @@ impl HostApi for PluginApi {
|
||||
dunce::canonicalize(files).map_err(failed)
|
||||
}
|
||||
|
||||
fn install_dir(&self) -> Result<PathBuf, HostError> {
|
||||
dunce::canonicalize(&self.pkg.dir).map_err(failed)
|
||||
}
|
||||
|
||||
fn read_text_file(&self, real: &Path, max: usize) -> Result<String, HostError> {
|
||||
// Unsaved editor contents win, as they do for project files.
|
||||
if let Some(text) = self.shared.workspace().and_then(|w| w.buffer_text(real)) {
|
||||
@@ -3749,6 +3753,19 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn install_dir_is_the_canonical_package_directory() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let pkg = tmp.path().join("acme.lint");
|
||||
std::fs::create_dir_all(&pkg).unwrap();
|
||||
std::fs::write(pkg.join("readme.pdf"), b"%PDF").unwrap();
|
||||
let api = api(&pkg, Arc::default());
|
||||
let install = api.install_dir().unwrap();
|
||||
assert_eq!(install, dunce::canonicalize(&pkg).unwrap());
|
||||
assert!(install.join("readme.pdf").is_file());
|
||||
assert_ne!(install, api.plugin_dir().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn storage_moves_an_older_storage_json_to_one_file_per_key() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -6,15 +6,21 @@ use serde_json::json;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Codex's modes as it reported them last time, in "ask".
|
||||
fn remember_codex_modes(data: &Path) {
|
||||
/// Codex's modes as its catalog for `root` listed them last time, in "ask".
|
||||
fn remember_codex_modes(data: &Path, root: &Path) {
|
||||
std::fs::create_dir_all(data.join("agents")).unwrap();
|
||||
let modes = json!({ "codex": { "config": [ {
|
||||
let config = json!([ {
|
||||
"id": "mode", "name": "Mode", "description": null, "category": "mode", "current": "ask",
|
||||
"values": [ { "value": "read-only", "name": "Read Only", "description": null },
|
||||
{ "value": "ask", "name": "Ask", "description": null },
|
||||
{ "value": "full-access", "name": "Full Access", "description": null } ],
|
||||
"via": "option" } ] } });
|
||||
"via": "option" } ]);
|
||||
let mut catalogs = serde_json::Map::new();
|
||||
catalogs.insert(
|
||||
root.to_string_lossy().into_owned(),
|
||||
json!({ "fingerprint": "test", "config": config, "thoughtLevels": {} }),
|
||||
);
|
||||
let modes = json!({ "codex": { "projectCatalogs": catalogs } });
|
||||
std::fs::write(data.join("agents/models.json"), modes.to_string()).unwrap();
|
||||
}
|
||||
|
||||
@@ -30,7 +36,7 @@ async fn new_tasks_start_asking_for_approval_when_the_user_chose_so() {
|
||||
let root = dunce::canonicalize(tmp.path()).unwrap().join("project");
|
||||
std::fs::create_dir_all(root.join(".openidea")).unwrap();
|
||||
let (config, data) = (tmp.path().join("config"), tmp.path().join("data"));
|
||||
remember_codex_modes(&data);
|
||||
remember_codex_modes(&data, &root);
|
||||
std::fs::create_dir_all(&config).unwrap();
|
||||
std::fs::write(config.join("settings.toml"), "[agents]\nnewTaskApprovals = \"ask\"\n").unwrap();
|
||||
// A project's own settings don't choose this.
|
||||
|
||||
@@ -128,6 +128,44 @@ async fn serves_projects_files_documents_search_and_runs() {
|
||||
let current = invoke(&peer, "project_current", json!({})).await.unwrap();
|
||||
assert_eq!(current["name"], "demo");
|
||||
|
||||
// A SQL batch sends each outcome precisely once before the request reply.
|
||||
let file = project.join("test.sqlite");
|
||||
std::fs::File::create(&file).unwrap();
|
||||
let source = ide_db::DataSource {
|
||||
id: "test-db".into(),
|
||||
name: "Test database".into(),
|
||||
file: Some(file.into()),
|
||||
..Default::default()
|
||||
};
|
||||
invoke(&peer, "db_save_sources", json!({ "sources": [source] })).await.unwrap();
|
||||
let sql = "SELECT 1 AS n; SELECT 'second' AS n";
|
||||
let statements =
|
||||
invoke(&peer, "db_statements", json!({ "id": "test-db", "text": sql, "from": 0, "to": sql.len() }))
|
||||
.await
|
||||
.unwrap();
|
||||
let done = invoke(
|
||||
&peer,
|
||||
"db_execute_stream",
|
||||
json!({ "request": 21, "id": "test-db", "statements": statements, "maxRows": 10,
|
||||
"schema": null, "onProgress": { "$channel": 521 } }),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(done.is_null());
|
||||
let events = client
|
||||
.channels
|
||||
.lock()
|
||||
.iter()
|
||||
.filter(|frame| frame.id == 521)
|
||||
.map(|frame| frame.data.clone())
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(events.len(), 5);
|
||||
assert_eq!(events[0], json!({ "type": "started", "index": 0 }));
|
||||
assert_eq!(events[1]["outcome"]["result"]["rows"], json!([["1"]]));
|
||||
assert_eq!(events[2], json!({ "type": "started", "index": 1 }));
|
||||
assert_eq!(events[3]["outcome"]["result"]["rows"], json!([["second"]]));
|
||||
assert_eq!(events[4], json!({ "type": "done", "error": null }));
|
||||
|
||||
// The built-in web server runs where the project is; the client forwards its port.
|
||||
let root = std::path::PathBuf::from(opened["root"].as_str().unwrap());
|
||||
let url = invoke(&peer, "web_url", json!({ "path": root.join("src/main.py") })).await.unwrap();
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
//! Exception breakpoints on a chosen class, armed inside the debuggee's VM by the debugger's own
|
||||
//! connection. The adapter stops on them as on its own exception filters.
|
||||
|
||||
use crate::{InspectFuture, VmTarget};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExceptionClassSpec {
|
||||
/// Echoed back with the breakpoint's state.
|
||||
pub id: String,
|
||||
/// Binary name (`com.acme.Outer$Inner`); subclasses stop too.
|
||||
pub class_name: String,
|
||||
pub caught: bool,
|
||||
pub uncaught: bool,
|
||||
pub enabled: bool,
|
||||
/// JDI class patterns (`com.acme.*`, `*Test`) matched against the class whose code throws.
|
||||
pub class_filters: Vec<String>,
|
||||
pub class_exclusion_filters: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum ExceptionArmState {
|
||||
Armed,
|
||||
/// No class of that name is loaded yet; it is armed when one is.
|
||||
Pending,
|
||||
Disabled,
|
||||
/// A stream trace silences the VM's breakpoints; applied when it ends.
|
||||
Deferred,
|
||||
}
|
||||
|
||||
pub trait ExceptionClassBreakpoints: Send + Sync {
|
||||
/// Replaces the VM's whole list; `(id, state)` per breakpoint, in order. The adapter can drop
|
||||
/// these whenever it sets its own exception filters, so set them again after each time.
|
||||
fn set<'a>(
|
||||
&'a self,
|
||||
target: &'a VmTarget,
|
||||
breakpoints: &'a [ExceptionClassSpec],
|
||||
) -> InspectFuture<'a, Vec<(String, ExceptionArmState)>>;
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
//! Types and the [`JvmInspector`] trait for reading live JVM objects while a debug session is
|
||||
//! suspended. Implementations live elsewhere (jdtls bundle for Java, JDWP link for Kotlin).
|
||||
|
||||
mod exceptions;
|
||||
mod names;
|
||||
mod stream;
|
||||
|
||||
pub use exceptions::{ExceptionArmState, ExceptionClassBreakpoints, ExceptionClassSpec};
|
||||
pub use names::{is_boxed, name_to_signature, signature_to_name, string_length};
|
||||
pub use stream::{AbortState, CollectedTerminal, StreamTracer, TraceCollected, TraceId, TraceState};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ pub(crate) const SERVER: &str = "jdtls";
|
||||
const GENERATED_SOURCES: &str = "openidea.java.generatedSources";
|
||||
|
||||
pub(crate) mod configuration;
|
||||
pub(crate) mod exception_breakpoints;
|
||||
mod extract_interface;
|
||||
mod formatter;
|
||||
mod generated;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//! [`ExceptionClassBreakpoints`] over `openidea.jvm.exceptions.set` of the JVM inspector bundle that
|
||||
//! runs inside jdtls (`java/jvm-inspect`).
|
||||
|
||||
use super::jvm_inspect::{command_error, decode, target_json};
|
||||
use crate::LspManager;
|
||||
use ide_jvm_inspect::{
|
||||
ExceptionArmState, ExceptionClassBreakpoints, ExceptionClassSpec, InspectError, InspectFuture, VmTarget,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use serde_json::json;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::time::timeout;
|
||||
|
||||
/// The bundle waits for the inspect commands' turn, which a `classes` on a large heap can hold.
|
||||
const COMMAND_TIMEOUT: Duration = Duration::from_secs(30);
|
||||
|
||||
pub struct JdtExceptionBreakpoints {
|
||||
lsp: Arc<LspManager>,
|
||||
/// A path inside the module whose jdtls runs the debug session.
|
||||
server: PathBuf,
|
||||
}
|
||||
|
||||
impl JdtExceptionBreakpoints {
|
||||
pub fn new(lsp: Arc<LspManager>, server: PathBuf) -> Self {
|
||||
Self { lsp, server }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct WireState {
|
||||
id: String,
|
||||
state: ExceptionArmState,
|
||||
}
|
||||
|
||||
impl ExceptionClassBreakpoints for JdtExceptionBreakpoints {
|
||||
fn set<'a>(
|
||||
&'a self,
|
||||
target: &'a VmTarget,
|
||||
breakpoints: &'a [ExceptionClassSpec],
|
||||
) -> InspectFuture<'a, Vec<(String, ExceptionArmState)>> {
|
||||
Box::pin(async move {
|
||||
let arguments = vec![target_json(target), json!({ "breakpoints": breakpoints })];
|
||||
let reply = timeout(
|
||||
COMMAND_TIMEOUT,
|
||||
self.lsp.jdtls_command(&self.server, "openidea.jvm.exceptions.set", arguments),
|
||||
)
|
||||
.await
|
||||
.map_err(|_| InspectError::TimedOut)?
|
||||
.map_err(command_error)?;
|
||||
let states: Vec<WireState> = decode(reply)?;
|
||||
Ok(states.into_iter().map(|s| (s.id, s.state)).collect())
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ mod xml_catalog;
|
||||
|
||||
pub use injections::{InjectedRange, InjectionProvider, MAX_INJECTED_DOCUMENT_BYTES};
|
||||
pub use inspect::{CheckedServer, DocumentCheck, FileInspection, InspectHost, InspectOptions};
|
||||
pub use jdtls::exception_breakpoints::JdtExceptionBreakpoints;
|
||||
pub use jdtls::jvm_inspect::JdtJvmInspector;
|
||||
pub use jdtls::stream_trace::JdtStreamTracer;
|
||||
pub use kotlin_lsp::{KotlinDebugServer, KotlinDebugUnavailable};
|
||||
|
||||
@@ -3714,6 +3714,62 @@ async fn stream_collect_fails_cleanly_on_a_step_beyond_u16() {
|
||||
assert!(matches!(error, InspectError::Failed(ref m) if m.contains("malformed")), "{error:?}");
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn exception_breakpoints_send_the_whole_list_and_decode_states() {
|
||||
use ide_jvm_inspect::{ExceptionArmState, ExceptionClassBreakpoints, ExceptionClassSpec};
|
||||
let h = harness_for("java", "java", &[("jdtls", incremental_caps())], &[]);
|
||||
let (_, path) = h.open("Sample.java", "class Sample {}");
|
||||
h.wait_status("jdtls", ServerStatus::Ready).await;
|
||||
let s = h.launcher.state("jdtls");
|
||||
let client = ide_lsp::JdtExceptionBreakpoints::new(h.mgr.clone(), path);
|
||||
let specs = [
|
||||
ExceptionClassSpec {
|
||||
id: "a".into(),
|
||||
class_name: "com.acme.Boom".into(),
|
||||
caught: true,
|
||||
uncaught: false,
|
||||
enabled: true,
|
||||
class_filters: vec!["com.acme.*".into()],
|
||||
class_exclusion_filters: vec![],
|
||||
},
|
||||
ExceptionClassSpec {
|
||||
id: "b".into(),
|
||||
class_name: "java.lang.IllegalStateException".into(),
|
||||
caught: true,
|
||||
uncaught: true,
|
||||
enabled: false,
|
||||
class_filters: vec![],
|
||||
class_exclusion_filters: vec!["*Test".into()],
|
||||
},
|
||||
];
|
||||
s.respond(
|
||||
"workspace/executeCommand",
|
||||
json!({"ok": [{"id": "a", "state": "pending"}, {"id": "b", "state": "disabled"}]}),
|
||||
);
|
||||
let states = client.set(&stream_launch_target(), &specs).await.unwrap();
|
||||
assert_eq!(states, vec![("a".into(), ExceptionArmState::Pending), ("b".into(), ExceptionArmState::Disabled)]);
|
||||
let asked = s.requested("workspace/executeCommand");
|
||||
assert_eq!(asked[0]["command"], "openidea.jvm.exceptions.set");
|
||||
assert_eq!(
|
||||
asked[0]["arguments"],
|
||||
json!([
|
||||
{"pid": 42, "host": null, "port": null, "generation": 3},
|
||||
{"breakpoints": [
|
||||
{"id": "a", "className": "com.acme.Boom", "caught": true, "uncaught": false, "enabled": true,
|
||||
"classFilters": ["com.acme.*"], "classExclusionFilters": []},
|
||||
{"id": "b", "className": "java.lang.IllegalStateException", "caught": true, "uncaught": true,
|
||||
"enabled": false, "classFilters": [], "classExclusionFilters": ["*Test"]},
|
||||
]},
|
||||
])
|
||||
);
|
||||
|
||||
s.respond("workspace/executeCommand", json!({"error": "noSession", "detail": "hotCodeReplace is never?"}));
|
||||
assert_eq!(
|
||||
client.set(&stream_launch_target(), &specs).await.unwrap_err(),
|
||||
ide_jvm_inspect::InspectError::NoSession
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn debug_server_port_maps_to_module() {
|
||||
let h = harness_for("java", "java", &[("jdtls", incremental_caps())], &[]);
|
||||
|
||||
@@ -652,6 +652,10 @@ pub trait HostApi: Send + Sync {
|
||||
fn plugin_dir(&self) -> Result<PathBuf, HostError> {
|
||||
Err(HostError::Failed("private plugin storage is unavailable".into()))
|
||||
}
|
||||
/// The plugin's install / package directory (read-only for the guest).
|
||||
fn install_dir(&self) -> Result<PathBuf, HostError> {
|
||||
Err(HostError::Failed("plugin install directory is unavailable".into()))
|
||||
}
|
||||
/// Replaces the text of a file whose real path the caller already checked:
|
||||
/// in one step, keeping its encoding and BOM (a new file is UTF-8). Refused
|
||||
/// while an editor holds unsaved changes for it.
|
||||
|
||||
@@ -313,11 +313,11 @@ impl StoreData {
|
||||
|
||||
/// `path` as the real path an `fs.read:…` grant covers, or what the plugin
|
||||
/// should be told instead (`denied` naming the capability to declare).
|
||||
/// The private plugin-dir and the install directory are readable without a
|
||||
/// grant; writing still needs `fs.write` or the private dir.
|
||||
fn granted_file(&self, path: &str) -> Result<PathBuf, wit::Error> {
|
||||
let mut granted = self.granted.clone();
|
||||
if let Ok(dir) = self.host.plugin_dir() {
|
||||
granted.push(Capability::FsRead(to_ipc(&dir)));
|
||||
}
|
||||
granted.extend(self.builtin_read_roots());
|
||||
sandbox::resolve_granted(&granted, path).map_err(Into::into)
|
||||
}
|
||||
|
||||
@@ -331,6 +331,19 @@ impl StoreData {
|
||||
sandbox::resolve_writable(&granted, path).map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Private plugin-dir and install directory: readable without an `fs.read`
|
||||
/// grant; `editor.open` / `open-location` may use them without project.read.
|
||||
fn builtin_read_roots(&self) -> Vec<Capability> {
|
||||
let mut roots = Vec::new();
|
||||
if let Ok(dir) = self.host.plugin_dir() {
|
||||
roots.push(Capability::FsRead(to_ipc(&dir)));
|
||||
}
|
||||
if let Ok(dir) = self.host.install_dir() {
|
||||
roots.push(Capability::FsRead(to_ipc(&dir)));
|
||||
}
|
||||
roots
|
||||
}
|
||||
|
||||
fn client(&self) -> Option<&str> {
|
||||
self.invocation.client.as_deref()
|
||||
}
|
||||
@@ -1144,9 +1157,7 @@ impl StoreData {
|
||||
sandbox::resolve_in_root(root, path).map_err(wit::Error::Invalid)
|
||||
}
|
||||
fn openable_path(&self, path: &str) -> Result<PathBuf, wit::Error> {
|
||||
if let Ok(dir) = self.host.plugin_dir()
|
||||
&& let Ok(real) = sandbox::resolve_granted(&[Capability::FsRead(to_ipc(&dir))], path)
|
||||
{
|
||||
if let Ok(real) = sandbox::resolve_granted(&self.builtin_read_roots(), path) {
|
||||
return Ok(real);
|
||||
}
|
||||
self.require(Capability::ProjectRead)?;
|
||||
@@ -2078,9 +2089,7 @@ impl views::Host for StoreData {
|
||||
}
|
||||
|
||||
fn open_location(&mut self, path: String, line: u32, column: u32) -> Fallible<()> {
|
||||
if let Ok(dir) = self.host.plugin_dir()
|
||||
&& let Ok(real) = sandbox::resolve_granted(&[Capability::FsRead(to_ipc(&dir))], &path)
|
||||
{
|
||||
if let Ok(real) = sandbox::resolve_granted(&self.builtin_read_roots(), &path) {
|
||||
if let Err(e) = self.require_interactive() {
|
||||
return Ok(Err(e));
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
b59392bcc1999048f0ab922ec659bc21d9e825c696fa41d9f0a40c85627a5b2c
|
||||
d442e600d82cab0f79ad6decf95ca9d06c89dcd3119c500a11f48cdc54a5d5f4
|
||||
+1
-1
@@ -1 +1 @@
|
||||
034b99891313c03eb2a6b8c3cb2e4784129e1936965be803512f1d869b1768c2
|
||||
af048639f57e86262543c3dcd18bca27d384b6ad99a625af869f0812bf8ac93c
|
||||
@@ -1 +1 @@
|
||||
29ec0a96e2a0f6965915c7c25e35036743fc27a49037df588c217e8abfff93e3
|
||||
95b7263ca584c6b1b035be4dde64c7ae57b407c6a86b5ab6fe2736134e1d7754
|
||||
@@ -1 +1 @@
|
||||
87b367cfdd65c360920eff7be4d6a8d6b939721f6398aa6a01e39a289590699e
|
||||
1e5b10e8e77bdc7ed6bf002a415458caef7eee9a98123229dddf0d148af58f73
|
||||
+1
-1
@@ -1 +1 @@
|
||||
7d034ee1a4b99615642d5bf033802f8e4662216d45b209c4c7a24eb8f1338f48
|
||||
5b3d4ad737cde32fc808bcd8c93d9cdd7d53961985db0428ab567b4e97ed4ffb
|
||||
+1
-1
@@ -1 +1 @@
|
||||
3fdf985273ec14ae623fa84602a9220cfbfb2e0e587ab192fc2bcb8d990ce9e3
|
||||
04b1cbc2148cff8c0fa2d6a4f127a6a3c8ade5a7dc1541c1a16a656def299f33
|
||||
+1
-1
@@ -1 +1 @@
|
||||
8434e9271e27a6778bb3d5922e8925f3fd9f1d35377e5dddf5b5eb5416bd09bb
|
||||
918c44ee3a58a073dd65e2f7e32501cf9e84a59f24452c166e75457f7c232c89
|
||||
@@ -1 +1 @@
|
||||
9fa7468ce385ff33c1f3b99c84711e0d11a84b10e8e4f95b358fcd2ccc96e255
|
||||
c980260c235249186f754e16597de9d49663771d711ce6873bf83ebaf2a0fc34
|
||||
@@ -1 +1 @@
|
||||
5220a5bfb6ec0467a72e63e21d690e70b7d46b4f2eaff4116a8a79220a5eca8f
|
||||
df5729d63b83fbc511e0ba8509f9d370c5124b5af4c70f286c8965d2b0d890ef
|
||||
@@ -1 +1 @@
|
||||
a962127d1c6e37e85b81973a272a5d6b383cc2884b41bb2d82e8640ef5f8f943
|
||||
305965c6cbf2fd2b331bf9e2c473cfa9a543ab39ff0d47317ee9e28be9ea5b0f
|
||||
+1
-1
@@ -1 +1 @@
|
||||
92ad3e43e7f343004dcf26a51e282e97ed694cc9bd7325ff75aa5b18f1a2eeb6
|
||||
a1bb95a8a23ddd2d55bf64c724f73debfb503f252f57d8ae46afda8a0717fc20
|
||||
+1
-1
@@ -1 +1 @@
|
||||
2200ed0d44dbafb70ad864cb9569b0b2c37cf9eec1582b05efa903a9e8ec89ee
|
||||
b8be3120a468190aebb473c8f5d2e13889210241c9ab43c89cbf703c00366c8e
|
||||
+1
-1
@@ -1 +1 @@
|
||||
644612ee4228010f141042ea0eab5431b8386370f863a70b63cd3315f69d963a
|
||||
9b345dec001bcb7c0d8e6e214099d597b02976f20c2449af9847e8b69d0a5ab7
|
||||
@@ -1 +1 @@
|
||||
2af5d46516bfc1d38ad1f24d6cf3c57e2d6db6b0d3225748f55c4f13110430fb
|
||||
23e0c2ab39ba83aa332b57046b0b8c1bf236e3e61a14874ed82d20ce388873b6
|
||||
+1
-1
@@ -1 +1 @@
|
||||
0ee0773cefd61b8144d0550718e1988a1e60438bee826c3867350e28886a56f7
|
||||
e2d2afeb53f0af478963cde0c97fb016b1a424bf97952c7474a18e38e9e9ed55
|
||||
@@ -1 +1 @@
|
||||
941cb9008aaab11464b193c37b91e2476d771ec526247713f291c6642caf5995
|
||||
6bff7a7521a4a969aa8d9bd1363ef5efd544e079e77e55e51b19fff13b586b3a
|
||||
@@ -1 +1 @@
|
||||
06d70aae3152c88d1299a9b33f151b0baa4a77c3ca7145215c6f6e0aa40727b2
|
||||
27bb4c06b18703c43155e1a45c9edfb249a19443a68e87441babeeb71cb127d9
|
||||
+1
-1
@@ -1 +1 @@
|
||||
86eb87758e4f7c0242a18f12a113c31d418da64d7198041120f19401a5707bfb
|
||||
deb7995931cf8e344a486fbab275fd3ec7ddff73b05a841593e5521c4a514084
|
||||
@@ -1 +1 @@
|
||||
4442bb686fa18e8e8a52fd1cd8683b8767ec7908ffc1454dff476d9cb1711be9
|
||||
dc6670ff6373d148430f5c9c13d1ec5407b2d94c74c2209562737076468ca79d
|
||||
+1
-1
@@ -1 +1 @@
|
||||
dd51f1b8634ff6305ba1a69c8457bd586996200a2b18e4a08d0cfa2fb60abaf6
|
||||
9e111c4c541312dc231bac5a4fd1120b59191ecadce2dca73c77f4bff2a9d0e8
|
||||
+1
-1
@@ -1 +1 @@
|
||||
4319f2655ee1e240b33f4b96c23fff59c61aa62d6ccc628715e5ff9fe38c2717
|
||||
caa4053cd7f0135ab14a8c5c56abe198394e370549fea6d9df4d4c11c38fcabf
|
||||
@@ -1 +1 @@
|
||||
50c4fd7e08a4187afae0e00c775a61578b82bbad056807ad063ee47e79e2cef1
|
||||
8beb151f14b062438c4024b13bbdedbf5d65099415ad9d055fe63a4b1d64d010
|
||||
+1
-1
@@ -1 +1 @@
|
||||
220666302d814e6d8bde346954205c94c82320d5584d46f01672fd7d32400bf3
|
||||
fa6a660890e0beee7599726e9c30142601fbcd6f82a519b1b5952ef30f450bfb
|
||||
+1
-1
@@ -1 +1 @@
|
||||
4ee484afaa1a1f71a9e544582d90db3260307fc89b8f514aaaff883df2761ba6
|
||||
a7c1ec4814e4268fe185ae493413532528970264e84f717087b57a303ebe3591
|
||||
@@ -1 +1 @@
|
||||
3fba59ce802d88a2a1c026480a2cb8ce4d9539eb7b88f5a18bf6232f7adef147
|
||||
450d1e698882257d6c75b16984a6086259acce2c66a92b96c76ed3d6e15a0b4d
|
||||
+1
-1
@@ -1 +1 @@
|
||||
73433da25d5304d0a3cb83d750d02feb5e270ee7e9f680c4ee9d923afa9aa066
|
||||
738791aa00d63961fa7e8ed6ac7601f46848ecc0d25a498b6019eb151bf9169e
|
||||
+1
-1
@@ -1 +1 @@
|
||||
12df43f99eac93f4e1a070635780ad653932cf69a14595175d8ba6d4f0a4445c
|
||||
957d02e3d72673ca4a9ca80eb7c3e63087a6d8377411fc820d3808f024326b2e
|
||||
@@ -1 +1 @@
|
||||
427b63c11188689262101cde971af0a92e54bd6c88a4e3cc8fdfa1a7c8c95fce
|
||||
f0a57acc6ca29b0dc2803596a0a39ceb1e2185b59a44f5533e8f9b19bf214afd
|
||||
@@ -1 +1 @@
|
||||
07ae58fe39746b779b1e466d7bbbb666ba550f427c7bf8de97d7ede647c00bc0
|
||||
7890cfd9a08b67b47ae098ce24e02551935337b8501636e29164ff4ca6244e7e
|
||||
@@ -1 +1 @@
|
||||
f9912644c28512e37299834123cd4c94f6ed11f29bd38ddbc1c92df168447494
|
||||
769f873adfa7ed3752a059dac89e60f2203b8ce91b36fe0a7cb9c724e0cf895b
|
||||
+1
-1
@@ -1 +1 @@
|
||||
ea0eec8c07d6469d3ab63c3bb08c85b01208be1757edffe5eabcb7be79ccf537
|
||||
ea31cbeefee7f219f86fc7e65315aea7efebe3b91c9cec6e12d4f551b9655d95
|
||||
@@ -1 +1 @@
|
||||
1ce55fabaa5ea1ddf770c8a1ad7f7b60a843c82c453d42289088c4b2fec61d84
|
||||
bb30795e7d62b19b237759beeab9da6f6028fea7862d8fa83c6b3238a26f540d
|
||||
@@ -1 +1 @@
|
||||
3356b4ec918c668c4c249f84afb9bafcd06c073ba86235b6ceea7ef6220cdaf5
|
||||
65725512c8a8d3ad6cb02a4f947541dd1688a3208e37fa4ed0474ca8197f2340
|
||||
@@ -1649,7 +1649,7 @@ pub fn jvm_inspect_bundle(data_dir: &Path) -> Option<PathBuf> {
|
||||
install_bundle(
|
||||
data_dir,
|
||||
"jvm-inspect",
|
||||
"1.1.1",
|
||||
"1.2.0",
|
||||
include_bytes!("../../../java/jvm-inspect/openidea-jvm-inspect.jar"),
|
||||
)
|
||||
}
|
||||
@@ -1745,7 +1745,7 @@ mod usages_bundle_tests {
|
||||
std::fs::write(dir.path().join(name), b"old").unwrap();
|
||||
}
|
||||
let jar = super::jvm_inspect_bundle(dir.path()).unwrap();
|
||||
assert_eq!(jar, dir.path().join("jvm-inspect-1.1.1.jar"));
|
||||
assert_eq!(jar, dir.path().join("jvm-inspect-1.2.0.jar"));
|
||||
assert_eq!(std::fs::read(&jar).unwrap(), include_bytes!("../../../java/jvm-inspect/openidea-jvm-inspect.jar"));
|
||||
assert!(!dir.path().join("jvm-inspect-0.9.0.jar").exists());
|
||||
assert_eq!(std::fs::read(dir.path().join("java-usages-1.7.0.jar")).unwrap(), b"old");
|
||||
|
||||
@@ -640,11 +640,13 @@ async fn with_key(handle: &mut Handle<Client>, user: &str, key: keys::PrivateKey
|
||||
}
|
||||
|
||||
/// Every identity of the running SSH agent, until one is accepted.
|
||||
async fn with_agent(handle: &mut Handle<Client>, user: &str) -> bool {
|
||||
async fn with_agent(handle: &mut Handle<Client>, hop: &Hop) -> bool {
|
||||
let user = hop.user.as_str();
|
||||
let Some(socket) = hop.agent.socket() else { return false };
|
||||
#[cfg(unix)]
|
||||
let agent = keys::agent::client::AgentClient::connect_env().await;
|
||||
let agent = keys::agent::client::AgentClient::connect_uds(socket).await;
|
||||
#[cfg(windows)]
|
||||
let agent = keys::agent::client::AgentClient::connect_named_pipe(r"\\.\pipe\openssh-ssh-agent").await;
|
||||
let agent = keys::agent::client::AgentClient::connect_named_pipe(socket).await;
|
||||
let Ok(mut agent) = agent else { return false };
|
||||
let Ok(identities) = agent.request_identities().await else { return false };
|
||||
let hash = rsa_hash(handle).await;
|
||||
@@ -693,7 +695,7 @@ async fn authenticate(
|
||||
if handle.authenticate_none(user).await.map(|r| r.success()).unwrap_or(false) {
|
||||
return Ok(());
|
||||
}
|
||||
if with_agent(handle, user).await {
|
||||
if with_agent(handle, hop).await {
|
||||
return Ok(());
|
||||
}
|
||||
let files: Vec<PathBuf> = if hop.identity_files.is_empty() {
|
||||
|
||||
@@ -53,6 +53,65 @@ pub(crate) struct Hop {
|
||||
pub proxy_command: Option<String>,
|
||||
pub host_key_policy: HostKeyPolicy,
|
||||
pub known_hosts: Option<PathBuf>,
|
||||
pub agent: Agent,
|
||||
}
|
||||
|
||||
/// Where the SSH agent of a hop listens (`IdentityAgent`).
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub(crate) enum Agent {
|
||||
/// `SSH_AUTH_SOCK` (the OpenSSH pipe on Windows when it is unset).
|
||||
Default,
|
||||
/// `IdentityAgent none`, or an unset `$VARIABLE`.
|
||||
Off,
|
||||
Socket(PathBuf),
|
||||
}
|
||||
|
||||
impl Agent {
|
||||
/// The socket (or Windows pipe) to connect to, `None` for no agent.
|
||||
pub fn socket(&self) -> Option<PathBuf> {
|
||||
match self {
|
||||
Agent::Off => None,
|
||||
Agent::Socket(path) => Some(path.clone()),
|
||||
Agent::Default => {
|
||||
let var = env_var("SSH_AUTH_SOCK").filter(|v| !v.is_empty()).map(PathBuf::from);
|
||||
if cfg!(windows) {
|
||||
// Only a pipe works there; a Unix socket path comes from MSYS or WSL tools.
|
||||
let pipe = var.filter(|p| p.to_string_lossy().starts_with(r"\\.\pipe\"));
|
||||
Some(pipe.unwrap_or_else(|| PathBuf::from(r"\\.\pipe\openssh-ssh-agent")))
|
||||
} else {
|
||||
var
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A variable as the user's shell sees it. An app started from Finder or the Dock has the
|
||||
/// login session's environment; the shell's rc files may set another value (an SSH agent
|
||||
/// socket exported in `~/.zshrc`), and that is the one `ssh` in a terminal uses.
|
||||
fn env_var(name: &str) -> Option<std::ffi::OsString> {
|
||||
ide_core::process::login_env()
|
||||
.and_then(|vars| vars.iter().find(|(k, _)| k == name).map(|(_, v)| v.clone()))
|
||||
.or_else(|| std::env::var_os(name))
|
||||
}
|
||||
|
||||
/// `IdentityAgent`: `none`, `SSH_AUTH_SOCK`, `$VARIABLE`, or a path (`~` and `%` tokens expanded).
|
||||
fn identity_agent(value: Option<&str>, expand_path: impl Fn(&str) -> PathBuf) -> Agent {
|
||||
let Some(value) = value.map(str::trim).filter(|v| !v.is_empty()) else { return Agent::Default };
|
||||
if value.eq_ignore_ascii_case("none") {
|
||||
return Agent::Off;
|
||||
}
|
||||
if value == "SSH_AUTH_SOCK" {
|
||||
return Agent::Default;
|
||||
}
|
||||
if let Some(name) = value.strip_prefix('$') {
|
||||
let name = name.strip_prefix('{').and_then(|n| n.strip_suffix('}')).unwrap_or(name);
|
||||
return match env_var(name).filter(|v| !v.is_empty()) {
|
||||
Some(path) => Agent::Socket(expand(&path.to_string_lossy())),
|
||||
None => Agent::Off,
|
||||
};
|
||||
}
|
||||
Agent::Socket(expand_path(value))
|
||||
}
|
||||
|
||||
/// `StrictHostKeyChecking`: what happens to a host key missing from `known_hosts`.
|
||||
@@ -98,6 +157,7 @@ struct RawConfig {
|
||||
proxy_command: Option<String>,
|
||||
host_key_policy: Option<HostKeyPolicy>,
|
||||
user_known_hosts_file: Option<String>,
|
||||
identity_agent: Option<String>,
|
||||
}
|
||||
|
||||
fn strip_quotes(s: &str) -> &str {
|
||||
@@ -444,6 +504,11 @@ fn parse_config_file(
|
||||
});
|
||||
}
|
||||
}
|
||||
"identityagent" => {
|
||||
if out.identity_agent.is_none() {
|
||||
out.identity_agent = Some(strip_quotes(value).to_owned());
|
||||
}
|
||||
}
|
||||
"userknownhostsfile" => {
|
||||
if out.user_known_hosts_file.is_none()
|
||||
&& let Some(first) = split_args(value).into_iter().next()
|
||||
@@ -492,7 +557,9 @@ fn config_hop(
|
||||
};
|
||||
let host_key_policy =
|
||||
if null_known_hosts { HostKeyPolicy::Off } else { raw.host_key_policy.unwrap_or(HostKeyPolicy::Ask) };
|
||||
let hop = Hop { host, port, user, identity_files, proxy_command, host_key_policy, known_hosts };
|
||||
let agent =
|
||||
identity_agent(raw.identity_agent.as_deref(), |p| expand(&expand_tokens(p, alias, &host, port, &user, &local)));
|
||||
let hop = Hop { host, port, user, identity_files, proxy_command, host_key_policy, known_hosts, agent };
|
||||
(hop, proxy_jump)
|
||||
}
|
||||
|
||||
@@ -529,6 +596,7 @@ pub(crate) fn resolve_hops(target: &SshTarget, config: Option<&Path>) -> IdeResu
|
||||
proxy_command: None,
|
||||
host_key_policy: HostKeyPolicy::Ask,
|
||||
known_hosts: None,
|
||||
agent: Agent::Default,
|
||||
},
|
||||
None,
|
||||
)
|
||||
@@ -594,6 +662,32 @@ mod tests {
|
||||
assert!(resolve_hops(&SshTarget::default(), None).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn identity_agent_picks_the_agent_of_each_hop() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let config = tmp.path().join("config");
|
||||
std::fs::write(
|
||||
&config,
|
||||
"Host vault\n IdentityAgent \"~/agents/%h.sock\"\n ProxyJump plain\n\n\
|
||||
Host off\n IdentityAgent none\n\nHost shell\n IdentityAgent ${OPENIDEA_TEST_AGENT}\n\n\
|
||||
Host unset\n IdentityAgent $OPENIDEA_TEST_UNSET_AGENT\n\nHost env\n IdentityAgent SSH_AUTH_SOCK\n",
|
||||
)
|
||||
.unwrap();
|
||||
// Exported only by the shell's rc files, as a GUI app sees it (#4934).
|
||||
ide_core::process::set_shell_env(vec![("OPENIDEA_TEST_AGENT".into(), "/run/agent.sock".into())]);
|
||||
let agent = |host: &str| {
|
||||
let target = SshTarget { host: host.into(), auth: SshAuth::OpenSsh, ..Default::default() };
|
||||
resolve_hops(&target, Some(&config)).unwrap().into_iter().map(|h| h.agent).collect::<Vec<_>>()
|
||||
};
|
||||
let home = home().unwrap();
|
||||
assert_eq!(agent("vault"), [Agent::Default, Agent::Socket(home.join("agents/vault.sock"))]);
|
||||
assert_eq!(agent("off"), [Agent::Off]);
|
||||
assert_eq!(agent("shell"), [Agent::Socket("/run/agent.sock".into())]);
|
||||
assert_eq!(agent("unset"), [Agent::Off]);
|
||||
assert_eq!(agent("env"), [Agent::Default]);
|
||||
assert_eq!(Agent::Off.socket(), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolves_include_match_equals_and_proxy_command() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -384,6 +384,7 @@ fn run_raw_env_once(
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped());
|
||||
tracing::debug!(?args, "git");
|
||||
let refresh = IndexRefresh::before(root, args, env);
|
||||
let mut session = CommandSession::start(&mut cmd);
|
||||
let mut child = cmd.spawn().map_err(spawn_error)?;
|
||||
let writer = match (stdin, child.stdin.take()) {
|
||||
@@ -401,9 +402,49 @@ fn run_raw_env_once(
|
||||
let _ = w.join();
|
||||
}
|
||||
session.finish(out.status.success(), &String::from_utf8_lossy(&out.stderr));
|
||||
refresh.after();
|
||||
Ok(Output { stdout: out.stdout, stderr: out.stderr, code: out.status.code() })
|
||||
}
|
||||
|
||||
/// `git diff` against the working tree rewrites the index when it meets files whose stat data
|
||||
/// is stale (`diff.autoRefreshIndex`), even under `--no-optional-locks`. Like status's
|
||||
/// write-back, that is a side effect of reading: recorded as ours, watchers don't report it as
|
||||
/// a repository change. Otherwise a view that re-reads on repository changes re-triggers itself,
|
||||
/// endlessly where git and gix disagree on stat data (Windows, #4792).
|
||||
struct IndexRefresh(Option<(PathBuf, crate::index_writes::Stamp)>);
|
||||
|
||||
impl IndexRefresh {
|
||||
fn before(root: &Path, args: &[&str], env: &[(&str, &std::ffi::OsStr)]) -> Self {
|
||||
let reads_worktree = subcommand(args) == "diff"
|
||||
&& !args.iter().any(|a| matches!(*a, "--cached" | "--staged" | "--no-index"))
|
||||
&& !env.iter().any(|(k, _)| *k == "GIT_INDEX_FILE");
|
||||
Self(reads_worktree.then(|| index_file(root)).flatten().map(|index| {
|
||||
let stamp = crate::index_writes::stamp(&index);
|
||||
(index, stamp)
|
||||
}))
|
||||
}
|
||||
|
||||
fn after(self) {
|
||||
if let Some((index, stamp)) = self.0
|
||||
&& !stamp.still_holds(&index)
|
||||
{
|
||||
crate::index_writes::lock().record(&index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The index of the working tree at `root`: `.git/index`, or a linked worktree's own index
|
||||
/// in the gitdir its `.git` file names.
|
||||
fn index_file(root: &Path) -> Option<PathBuf> {
|
||||
let dot_git = root.join(".git");
|
||||
if dot_git.is_dir() {
|
||||
return Some(dot_git.join("index"));
|
||||
}
|
||||
let text = std::fs::read_to_string(&dot_git).ok()?;
|
||||
let dir = Path::new(text.trim().strip_prefix("gitdir:")?.trim());
|
||||
Some(root.join(dir).join("index"))
|
||||
}
|
||||
|
||||
/// Captures binary/NUL-delimited read output while allowing cancellation to kill git.
|
||||
pub(crate) fn run_cancellable(root: &Path, args: &[&str], cancel: &CancellationToken) -> IdeResult<Output> {
|
||||
let out = run_cancellable_raw(root, args, cancel)?;
|
||||
@@ -497,6 +538,7 @@ fn run_capture(
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped());
|
||||
own_group(&mut cmd);
|
||||
let refresh = IndexRefresh::before(root, args, &[]);
|
||||
let mut session = CommandSession::start(&mut cmd);
|
||||
let mut child = cmd.spawn().map_err(spawn_error)?;
|
||||
let writer = match (stdin, child.stdin.take()) {
|
||||
@@ -550,6 +592,7 @@ fn run_capture(
|
||||
};
|
||||
let out = Output { stdout: join(stdout)?, stderr: join(stderr)?, code: status.code() };
|
||||
session.finish(status.success(), &String::from_utf8_lossy(&out.stderr));
|
||||
refresh.after();
|
||||
if out.stdout.len() > max || out.stderr.len() > max {
|
||||
return Err(IdeError::invalid(format!("git output exceeds {max} bytes")));
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ impl Repos {
|
||||
}
|
||||
|
||||
/// Changes of every repository. A nested repository reports its own files, so the
|
||||
/// enclosing one's "untracked folder" entry for it is dropped. A repository that cannot
|
||||
/// enclosing one's "untracked folder" entry for it, and its entries inside it, are dropped. A repository that cannot
|
||||
/// be read (e.g. deleted since the last scan) is left out; fails only when all fail.
|
||||
///
|
||||
/// The reads go through [`Backend`], the Changes-view surface — repositories of a
|
||||
@@ -207,10 +207,13 @@ impl Repos {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
// A file belongs to its innermost repository: the nested one reports what lies
|
||||
// inside it, including files the enclosing one still tracks there (#4990).
|
||||
out.extend(status.into_iter().filter(|f| {
|
||||
let untracked_root =
|
||||
f.unstaged == Some(crate::ChangeKind::Untracked) && nested.iter().any(|n| f.path.0 == *n);
|
||||
!untracked_root
|
||||
let in_nested = nested.iter().any(|n| f.path.0 != *n && f.path.0.starts_with(n));
|
||||
!untracked_root && !in_nested
|
||||
}));
|
||||
}
|
||||
match first_error {
|
||||
@@ -350,6 +353,39 @@ mod tests {
|
||||
assert!(repos.for_path(&plain.join("x")).is_none());
|
||||
}
|
||||
|
||||
/// A folder the enclosing repository still tracks became a repository of its own: both
|
||||
/// report its files, and each file must be listed once, by its innermost repository (#4990).
|
||||
#[test]
|
||||
fn a_file_of_a_nested_repository_is_listed_once() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let root = dunce::canonicalize(tmp.path()).unwrap();
|
||||
git_init(&root);
|
||||
std::fs::create_dir_all(root.join("web")).unwrap();
|
||||
std::fs::write(root.join("web/page.html"), "v1").unwrap();
|
||||
let git = |dir: &Path, args: &[&str]| {
|
||||
let ok = Command::new("git")
|
||||
.args(["-c", "user.name=t", "-c", "user.email=t@t", "-c", "commit.gpgsign=false"])
|
||||
.args(args)
|
||||
.current_dir(dir)
|
||||
.status()
|
||||
.is_ok_and(|s| s.success());
|
||||
assert!(ok, "git {args:?}");
|
||||
};
|
||||
git(&root, &["add", "."]);
|
||||
git(&root, &["commit", "-qm", "init"]);
|
||||
git_init(&root.join("web"));
|
||||
std::fs::write(root.join("web/page.html"), "v2").unwrap();
|
||||
std::fs::write(root.join("README.md"), "x").unwrap();
|
||||
|
||||
let repos = Repos::discover(&root, &|_| false).unwrap();
|
||||
assert_eq!(repos.all().len(), 2);
|
||||
for status in [repos.status().unwrap(), repos.status_paths(&[root.join("web/page.html")]).unwrap()] {
|
||||
let page: Vec<_> = status.iter().filter(|f| f.path.0 == root.join("web/page.html")).collect();
|
||||
assert_eq!(page.len(), 1, "{status:?}");
|
||||
assert_eq!(page[0].rel_path, "page.html", "listed by the nested repository");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn side_by_side_repositories_without_an_enclosing_one() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -2288,3 +2288,30 @@ fn status_from_the_git_command_line_matches_the_in_process_one() {
|
||||
assert_eq!(from_git, in_process);
|
||||
assert_eq!(from_git.len(), 4, "{from_git:#?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_worktree_diff_refreshing_the_index_is_not_reported_as_a_repository_change() {
|
||||
let fx = Fixture::new();
|
||||
fx.write("a.txt", "a\n");
|
||||
fx.write("b.txt", "b\n");
|
||||
fx.git(&["add", "."]);
|
||||
fx.git(&["commit", "-qm", "init"]);
|
||||
let base = fx.git(&["rev-parse", "HEAD"]);
|
||||
let index = fx.dir.join(".git/index");
|
||||
let backdate = |rel: &str| {
|
||||
let file = std::fs::File::options().write(true).open(fx.dir.join(rel)).unwrap();
|
||||
file.set_modified(std::time::SystemTime::now() - std::time::Duration::from_secs(100)).unwrap();
|
||||
};
|
||||
// Same content, stale stat data: `git diff` refreshes and rewrites the index while reading.
|
||||
backdate("a.txt");
|
||||
let before = std::fs::read(&index).unwrap();
|
||||
let repo = fx.repo();
|
||||
assert!(repo.numstat_with_worktree(&base).unwrap().is_empty());
|
||||
assert_ne!(std::fs::read(&index).unwrap(), before, "git rewrote the index");
|
||||
assert!(is_own_index_write(&index));
|
||||
|
||||
// A write by someone else is still a change.
|
||||
fx.write("b.txt", "changed\n");
|
||||
fx.git(&["add", "b.txt"]);
|
||||
assert!(!is_own_index_write(&index));
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
use crate::FsBatch;
|
||||
use crate::rules::{ExcludeMatcher, GitignoreStack};
|
||||
use ide_core::{IdeError, IdeEvent, IdeResult, SharedSink};
|
||||
use notify::event::{ModifyKind, RenameMode};
|
||||
use notify::event::{CreateKind, DataChange, ModifyKind, RemoveKind, RenameMode};
|
||||
use notify::{ErrorKind, Event, EventKind, PollWatcher, RecommendedWatcher, RecursiveMode, WatcherKind};
|
||||
use parking_lot::{Condvar, Mutex, RwLock};
|
||||
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
||||
@@ -238,17 +238,113 @@ fn event_handler(state: Weak<DirState>, polled: bool) -> impl FnMut(notify::Resu
|
||||
match event {
|
||||
Ok(event) if !is_change_event(&event) => {}
|
||||
Ok(event) if polled && is_dir_touch(&event) => {}
|
||||
Ok(event) => {
|
||||
state.queue.lock().push(event, Instant::now());
|
||||
state.wake.notify_one();
|
||||
}
|
||||
Ok(event) => state.enqueue(event),
|
||||
Err(e) => tracing::warn!("file watcher: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A directory's own mtime moving as entries come and go: polling sees it, the
|
||||
/// OS watchers report only the entries (also seen, through that directory's watch).
|
||||
/// One queued change for a path. A rename without a peer stays a rename so the batch
|
||||
/// resolves its existence after the quiet window, as it always did.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum PathChange {
|
||||
Change(Change),
|
||||
Rename,
|
||||
}
|
||||
|
||||
/// The per-path result of one raw event, in arrival order. `merge` in the batch is
|
||||
/// order-sensitive (create+remove ≠ remove+create), so a path keeps its sequence of
|
||||
/// distinct changes, with repetitions collapsed. A storm repeating the same change
|
||||
/// still leaves one entry per path; the order of real transitions is preserved.
|
||||
#[derive(Default)]
|
||||
struct QueuedChanges {
|
||||
paths: BTreeMap<PathBuf, Vec<PathChange>>,
|
||||
}
|
||||
|
||||
impl QueuedChanges {
|
||||
fn push(&mut self, path: PathBuf, change: PathChange) {
|
||||
let changes = self.paths.entry(path).or_default();
|
||||
if changes.last() != Some(&change) {
|
||||
changes.push(change);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The per-path changes one raw event contributes, classified exactly as `batch_detailed`
|
||||
/// classifies it. A rename with both paths keeps from/removal and to/creation apart; one
|
||||
/// without a peer is left for the batch to resolve by the path's existence.
|
||||
fn queue_changes(filter: &EventFilter, event: &Event, out: &mut QueuedChanges) {
|
||||
// `classify` drops `.git/info/exclude` as VCS noise (the index handles it), but
|
||||
// `batch_detailed` needs the event to reload repo-level ignore rules. Keep it queued;
|
||||
// classification at batch time still drops it from the reported paths.
|
||||
let mut classify = |path: &Path, change: Change| {
|
||||
if path.ends_with(".git/info/exclude") {
|
||||
out.push(path.to_path_buf(), PathChange::Change(change));
|
||||
} else {
|
||||
// `classify` applies the VCS/atomic-temp filters and merges; we only need to
|
||||
// know the resulting single change for this one event at this path.
|
||||
let mut one = BTreeMap::new();
|
||||
filter.classify(path, change, &mut one);
|
||||
for (_, merged) in one {
|
||||
out.push(path.to_path_buf(), PathChange::Change(merged));
|
||||
}
|
||||
}
|
||||
};
|
||||
// A rename without a peer keeps the same resolution the batch applies to its
|
||||
// `Modify(Name(_))` arm (created if the path exists, removed otherwise).
|
||||
let renamed = |path: &Path| {
|
||||
if path.symlink_metadata().is_ok() { Change::Created } else { Change::Removed }
|
||||
};
|
||||
match event.kind {
|
||||
EventKind::Create(_) => {
|
||||
for path in &event.paths {
|
||||
classify(path, Change::Created);
|
||||
}
|
||||
}
|
||||
EventKind::Remove(_) => {
|
||||
for path in &event.paths {
|
||||
classify(path, Change::Removed);
|
||||
}
|
||||
}
|
||||
EventKind::Modify(ModifyKind::Name(RenameMode::Both)) => {
|
||||
if let [from, to] = event.paths.as_slice() {
|
||||
classify(from, Change::Removed);
|
||||
classify(to, Change::Created);
|
||||
} else {
|
||||
// Some backends emit a `Both` rename with a missing endpoint.
|
||||
for path in &event.paths {
|
||||
classify(path, renamed(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
EventKind::Modify(ModifyKind::Name(RenameMode::From)) => {
|
||||
for path in &event.paths {
|
||||
classify(path, Change::Removed);
|
||||
}
|
||||
}
|
||||
EventKind::Modify(ModifyKind::Name(RenameMode::To)) => {
|
||||
for path in &event.paths {
|
||||
classify(path, Change::Created);
|
||||
}
|
||||
}
|
||||
EventKind::Modify(ModifyKind::Name(_)) => {
|
||||
// Defer resolution: the batch checks existence after the quiet window, so a
|
||||
// file created and removed within one window is not reported as created.
|
||||
for path in &event.paths {
|
||||
out.push(path.clone(), PathChange::Rename);
|
||||
}
|
||||
}
|
||||
EventKind::Modify(_) | EventKind::Any | EventKind::Other => {
|
||||
for path in &event.paths {
|
||||
classify(path, Change::Modified);
|
||||
}
|
||||
}
|
||||
EventKind::Access(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
/// A directory's own mtime moving as entries come and go. Polling also reports
|
||||
/// each changed entry through that directory's watch.
|
||||
fn is_dir_touch(event: ¬ify::Event) -> bool {
|
||||
matches!(event.kind, EventKind::Modify(_)) && event.paths.iter().all(|p| p.is_dir())
|
||||
}
|
||||
@@ -280,11 +376,13 @@ fn watcher_error(what: &str, error: notify::Error) -> IdeError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Only adjacent identical file modifications are redundant before classification.
|
||||
/// Keep the arrival window separately so compaction cannot extend MAX_DELAY.
|
||||
/// Events waiting for the debounce window, coalesced by path: each path keeps its distinct
|
||||
/// changes in arrival order, so a storm repeating one change collapses to a single entry
|
||||
/// while the batch still sees the exact sequence it would have received. Memory is bounded
|
||||
/// by the number of paths and real transitions touched in the window, not by raw events.
|
||||
#[derive(Default)]
|
||||
struct PendingEvents {
|
||||
events: Vec<Event>,
|
||||
changes: BTreeMap<PathBuf, Vec<PathChange>>,
|
||||
first: Option<Instant>,
|
||||
last: Option<Instant>,
|
||||
received: usize,
|
||||
@@ -292,32 +390,61 @@ struct PendingEvents {
|
||||
|
||||
impl PendingEvents {
|
||||
fn is_empty(&self) -> bool {
|
||||
self.events.is_empty()
|
||||
self.changes.is_empty()
|
||||
}
|
||||
|
||||
fn push(&mut self, event: Event, now: Instant) {
|
||||
fn add(&mut self, changes: QueuedChanges, now: Instant) {
|
||||
self.first.get_or_insert(now);
|
||||
self.last = Some(now);
|
||||
self.received += 1;
|
||||
let redundant = event.paths.len() == 1
|
||||
&& event.flag().is_none()
|
||||
&& matches!(event.kind, EventKind::Modify(ModifyKind::Any | ModifyKind::Data(_) | ModifyKind::Metadata(_)))
|
||||
&& self.events.last().is_some_and(|previous| {
|
||||
// Reject different spellings before Path's component-wise equality.
|
||||
// Keeping a normalized alias is safe; only exact duplicates compact.
|
||||
previous.paths.len() == 1
|
||||
&& previous.paths[0].as_os_str() == event.paths[0].as_os_str()
|
||||
&& previous == &event
|
||||
&& previous.attrs.process_id() == event.attrs.process_id()
|
||||
});
|
||||
if !redundant {
|
||||
self.events.push(event);
|
||||
for (path, kinds) in changes.paths {
|
||||
let queued = self.changes.entry(path).or_default();
|
||||
for kind in kinds {
|
||||
if queued.last() != Some(&kind) {
|
||||
queued.push(kind);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn deadline(&self) -> Option<Instant> {
|
||||
Some((self.last? + DEBOUNCE).min(self.first? + MAX_DELAY))
|
||||
}
|
||||
|
||||
/// Rebuild the events for `batch_detailed`, in the order each path received them.
|
||||
/// `merge` is order-sensitive, so this preserves the exact transition sequence with
|
||||
/// repetitions removed. A rename is emitted as `Modify(Name(Any))` so its existence
|
||||
/// check stays in the batch, and a transient path stays a create+remove pair.
|
||||
fn into_events(self) -> Vec<Event> {
|
||||
self.changes
|
||||
.into_iter()
|
||||
.flat_map(|(path, changes)| {
|
||||
changes
|
||||
.into_iter()
|
||||
.flat_map(|kind| {
|
||||
let event = match kind {
|
||||
PathChange::Rename => Event::new(EventKind::Modify(ModifyKind::Name(RenameMode::Any))),
|
||||
PathChange::Change(Change::Created) => Event::new(EventKind::Create(CreateKind::File)),
|
||||
PathChange::Change(Change::Removed) => Event::new(EventKind::Remove(RemoveKind::File)),
|
||||
PathChange::Change(Change::Modified) => {
|
||||
Event::new(EventKind::Modify(ModifyKind::Data(DataChange::Content)))
|
||||
}
|
||||
// Any kind classifies a VCS path as `Vcs` again, except a modified
|
||||
// directory, which the batch drops as a lock-file touch.
|
||||
PathChange::Change(Change::Vcs) => Event::new(EventKind::Create(CreateKind::Any)),
|
||||
PathChange::Change(Change::Transient) => {
|
||||
return vec![
|
||||
Event::new(EventKind::Create(CreateKind::File)).add_path(path.clone()),
|
||||
Event::new(EventKind::Remove(RemoveKind::File)).add_path(path.clone()),
|
||||
];
|
||||
}
|
||||
};
|
||||
vec![event.add_path(path.clone())]
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared with the notify callback (weakly) and the debounce thread.
|
||||
@@ -340,6 +467,19 @@ impl DirState {
|
||||
self.stop.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
/// Coalesces one raw event into the pending batch. Everything `batch_detailed` does to
|
||||
/// a path (VCS metadata, atomic-save temps, `merge` of repeated changes) is applied here
|
||||
/// through `classify`, so the batch gets the same final state per path it always did.
|
||||
fn enqueue(&self, event: Event) {
|
||||
let mut changes = QueuedChanges::default();
|
||||
queue_changes(&self.filter, &event, &mut changes);
|
||||
if changes.paths.is_empty() {
|
||||
return;
|
||||
}
|
||||
self.queue.lock().add(changes, Instant::now());
|
||||
self.wake.notify_one();
|
||||
}
|
||||
|
||||
/// Debounce loop: finishes any deferred startup watches, then waits for a
|
||||
/// quiet period and processes each batch. `polled` is whether the watcher
|
||||
/// already polls.
|
||||
@@ -372,13 +512,15 @@ impl DirState {
|
||||
}
|
||||
std::mem::take(&mut *q)
|
||||
};
|
||||
// A scan may publish a path before its create event is delivered:
|
||||
// keep create + remove pairs so the consumer still sees the removal.
|
||||
let processing = Instant::now();
|
||||
let queue_age_ms = processing.duration_since(events.first.expect("nonempty event queue")).as_millis();
|
||||
let received = events.received;
|
||||
let queued = events.events.len();
|
||||
let (mut batch, rule_dirs) = self.filter.batch_detailed(&events.events);
|
||||
// One event can contribute two path changes (a `Both` rename), so the queued
|
||||
// count can exceed the raw event count; never let the log arithmetic underflow.
|
||||
let queued = events.changes.values().map(Vec::len).sum::<usize>();
|
||||
let coalesced = received.saturating_sub(queued);
|
||||
let events = events.into_events();
|
||||
let (mut batch, rule_dirs) = self.filter.batch_detailed(&events);
|
||||
if self.mode == WatchMode::PerDirectory {
|
||||
self.update_watches(&mut batch, &rule_dirs);
|
||||
// Again once polling: a refused directory was not read, and
|
||||
@@ -393,7 +535,7 @@ impl DirState {
|
||||
tracing::debug!(
|
||||
received,
|
||||
queued,
|
||||
coalesced = received - queued,
|
||||
coalesced,
|
||||
queue_age_ms,
|
||||
processing_ms,
|
||||
callback_ms = callback.elapsed().as_millis(),
|
||||
@@ -728,6 +870,9 @@ impl EventFilter {
|
||||
Err(_) => None,
|
||||
};
|
||||
let change = match rel.and_then(Self::git_internal) {
|
||||
// Windows also reports a directory modification when Git creates or removes a lock.
|
||||
// The entries carry the actual changes, including edits to a linked worktree's gitfile.
|
||||
Some(true) if change == Change::Modified && path.is_dir() => return,
|
||||
Some(true) => Change::Vcs,
|
||||
Some(false) => return,
|
||||
None if crate::encoding::is_atomic_temp(path) => return,
|
||||
@@ -873,78 +1018,91 @@ mod tests {
|
||||
Event { kind, paths, attrs: Default::default() }
|
||||
}
|
||||
|
||||
fn push_event(pending: &mut PendingEvents, filter: &EventFilter, event: &Event) {
|
||||
let mut changes = QueuedChanges::default();
|
||||
queue_changes(filter, event, &mut changes);
|
||||
pending.add(changes, Instant::now());
|
||||
}
|
||||
|
||||
/// Evidence for the bounded queue (issue #3936): 100,000 notifications over 1,000
|
||||
/// distinct paths, measured before (one raw event each) and after (one change per path).
|
||||
/// `cargo test -p ide-vfs --release --lib -- --ignored --nocapture storm_coalescing_numbers`
|
||||
#[test]
|
||||
#[ignore = "prints queued entries for a storm; see issue #3936"]
|
||||
fn storm_coalescing_numbers() {
|
||||
let root = PathBuf::from("/proj");
|
||||
let filter = EventFilter::new(root.clone(), &[]);
|
||||
let mut pending = PendingEvents::default();
|
||||
for i in 0..100_000 {
|
||||
let event = ev(
|
||||
EventKind::Modify(ModifyKind::Data(DataChange::Content)),
|
||||
vec![root.join(format!("src/{}.zig", i % 1_000))],
|
||||
);
|
||||
push_event(&mut pending, &filter, &event);
|
||||
}
|
||||
let queued = pending.changes.values().map(Vec::len).sum::<usize>();
|
||||
// One entry per path: a repeat of the same change never grows the queue.
|
||||
assert_eq!(queued, 1_000);
|
||||
println!("100,000 raw events over 1,000 paths -> {queued} queued changes (lossless final states)");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pending_modifications_keep_the_original_debounce_window() {
|
||||
let start = Instant::now();
|
||||
// ReadDirectoryChangesW reports ordinary Windows writes as Modify(Any).
|
||||
let event = ev(EventKind::Modify(ModifyKind::Any), vec!["file.rs".into()]);
|
||||
let mut pending = PendingEvents::default();
|
||||
assert_eq!(pending.deadline(), None);
|
||||
for n in 0..10_000 {
|
||||
pending.push(event.clone(), start + Duration::from_micros(n * 95));
|
||||
let mut changes = QueuedChanges::default();
|
||||
changes.push("file.rs".into(), PathChange::Change(Change::Modified));
|
||||
pending.add(changes, start + Duration::from_micros(n * 95));
|
||||
}
|
||||
assert_eq!(pending.received, 10_000);
|
||||
assert_eq!(pending.events.len(), 1);
|
||||
assert_eq!(pending.changes.len(), 1);
|
||||
assert_eq!(pending.first, Some(start));
|
||||
assert_eq!(pending.last, Some(start + Duration::from_micros(9_999 * 95)));
|
||||
assert_eq!(pending.deadline(), Some(start + MAX_DELAY));
|
||||
let drained = std::mem::take(&mut pending);
|
||||
assert_eq!(drained.events, vec![event.clone()]);
|
||||
assert_eq!(drained.into_events().len(), 1);
|
||||
assert!(pending.is_empty());
|
||||
assert_eq!(pending.deadline(), None);
|
||||
pending.push(event, start + MAX_DELAY);
|
||||
let mut changes = QueuedChanges::default();
|
||||
changes.push("file.rs".into(), PathChange::Change(Change::Modified));
|
||||
pending.add(changes, start + MAX_DELAY);
|
||||
assert_eq!(pending.received, 1);
|
||||
assert_eq!(pending.deadline(), Some(start + MAX_DELAY + DEBOUNCE));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pending_events_preserve_boundaries_and_attributes() {
|
||||
let now = Instant::now();
|
||||
let modify = ev(EventKind::Modify(ModifyKind::Data(DataChange::Content)), vec!["a".into()]);
|
||||
let variants = [
|
||||
modify.clone().set_tracker(1),
|
||||
modify.clone().set_info("backend detail"),
|
||||
modify.clone().set_process_id(2),
|
||||
modify.clone().set_flag(notify::event::Flag::Rescan),
|
||||
modify.clone().add_path("b".into()),
|
||||
ev(EventKind::Create(CreateKind::File), vec!["a".into()]),
|
||||
ev(EventKind::Remove(RemoveKind::File), vec!["a".into()]),
|
||||
ev(EventKind::Modify(ModifyKind::Name(RenameMode::Both)), vec!["a".into(), "b".into()]),
|
||||
ev(EventKind::Modify(ModifyKind::Name(RenameMode::From)), vec!["a".into()]),
|
||||
ev(EventKind::Modify(ModifyKind::Name(RenameMode::To)), vec!["a".into()]),
|
||||
ev(EventKind::Any, vec!["a".into()]),
|
||||
];
|
||||
for middle in variants {
|
||||
let events = vec![modify.clone(), middle, modify.clone()];
|
||||
let mut pending = PendingEvents::default();
|
||||
for event in &events {
|
||||
pending.push(event.clone(), now);
|
||||
}
|
||||
assert_eq!(pending.events, events);
|
||||
}
|
||||
let mut interleaved = PendingEvents::default();
|
||||
for event in [
|
||||
modify.clone(),
|
||||
modify.clone().set_kind(EventKind::Create(CreateKind::File)).add_path("b".into()),
|
||||
modify.clone(),
|
||||
fn pending_coalesces_a_storm_into_one_change_per_path() {
|
||||
let root = PathBuf::from("/proj");
|
||||
let filter = EventFilter::new(root.clone(), &[]);
|
||||
let mut pending = PendingEvents::default();
|
||||
// create → modify → modify → remove resolves to the final state of the path;
|
||||
// the event stream is lossless for every consumer that sees that final state.
|
||||
for kind in [
|
||||
EventKind::Create(CreateKind::File),
|
||||
EventKind::Modify(ModifyKind::Data(DataChange::Content)),
|
||||
EventKind::Modify(ModifyKind::Data(DataChange::Content)),
|
||||
] {
|
||||
interleaved.push(event, now);
|
||||
}
|
||||
assert_eq!(interleaved.events.len(), 3);
|
||||
let mut interleaved = PendingEvents::default();
|
||||
for event in [modify.clone(), ev(modify.kind, vec!["b".into()]), modify.clone()] {
|
||||
interleaved.push(event, now);
|
||||
}
|
||||
assert_eq!(interleaved.events.len(), 3);
|
||||
for event in [
|
||||
modify.set_flag(notify::event::Flag::Rescan),
|
||||
ev(EventKind::Modify(ModifyKind::Name(RenameMode::From)), vec!["a".into()]),
|
||||
] {
|
||||
let mut pending = PendingEvents::default();
|
||||
pending.push(event.clone(), now);
|
||||
pending.push(event, now);
|
||||
assert_eq!(pending.events.len(), 2);
|
||||
push_event(&mut pending, &filter, &ev(kind, vec![root.join("a.zig")]));
|
||||
}
|
||||
assert_eq!(
|
||||
pending.changes[&root.join("a.zig")],
|
||||
vec![PathChange::Change(Change::Created), PathChange::Change(Change::Modified)]
|
||||
);
|
||||
push_event(&mut pending, &filter, &ev(EventKind::Remove(RemoveKind::File), vec![root.join("a.zig")]));
|
||||
assert_eq!(
|
||||
pending.changes[&root.join("a.zig")],
|
||||
vec![
|
||||
PathChange::Change(Change::Created),
|
||||
PathChange::Change(Change::Modified),
|
||||
PathChange::Change(Change::Removed)
|
||||
]
|
||||
);
|
||||
push_event(&mut pending, &filter, &ev(EventKind::Create(CreateKind::File), vec![root.join("b.zig")]));
|
||||
assert_eq!(pending.changes.len(), 2);
|
||||
assert_eq!(pending.received, 5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -958,15 +1116,16 @@ mod tests {
|
||||
assert_ne!(paths[0].as_os_str(), paths[1].as_os_str());
|
||||
let events: Vec<_> =
|
||||
paths.into_iter().map(|path| Event::new(EventKind::Modify(ModifyKind::Any)).add_path(path)).collect();
|
||||
let filter = EventFilter::new(root.clone(), &[]);
|
||||
let mut pending = PendingEvents::default();
|
||||
for event in &events {
|
||||
pending.push(event.clone(), Instant::now());
|
||||
let mut changes = QueuedChanges::default();
|
||||
queue_changes(&filter, event, &mut changes);
|
||||
pending.add(changes, Instant::now());
|
||||
}
|
||||
assert_eq!(pending.events.len(), events.len());
|
||||
assert_same_batch(
|
||||
&EventFilter::new(root.clone(), &[]).batch(&events),
|
||||
&EventFilter::new(root, &[]).batch(&pending.events),
|
||||
);
|
||||
// Path equality merges the spellings; one final state is all any consumer can see.
|
||||
assert_eq!(pending.changes.len(), 1);
|
||||
assert_same_batch(&filter.batch(&events), &EventFilter::new(root, &[]).batch(&pending.into_events()));
|
||||
}
|
||||
|
||||
fn assert_same_batch(left: &FsBatch, right: &FsBatch) {
|
||||
@@ -995,29 +1154,37 @@ mod tests {
|
||||
EventKind::Modify(ModifyKind::Metadata(MetadataKind::WriteTime)),
|
||||
EventKind::Modify(ModifyKind::Name(RenameMode::From)),
|
||||
EventKind::Modify(ModifyKind::Name(RenameMode::To)),
|
||||
// The macOS FSEvents rename (no peer), and whole-event kinds the batch handles.
|
||||
EventKind::Modify(ModifyKind::Name(RenameMode::Any)),
|
||||
EventKind::Modify(ModifyKind::Name(RenameMode::Other)),
|
||||
EventKind::Any,
|
||||
EventKind::Other,
|
||||
// A `Both` rename missing its second endpoint (some inotify backends).
|
||||
EventKind::Modify(ModifyKind::Name(RenameMode::Both)),
|
||||
];
|
||||
// All four-event histories, with both present and absent final state.
|
||||
// All three-event histories, with both present and absent final state.
|
||||
for rel in ["source.rs", "file.ignored", "excluded/source.rs", ".git/HEAD"] {
|
||||
let path = root.join(rel);
|
||||
for exists in [false, true] {
|
||||
if exists {
|
||||
std::fs::write(&path, "x").unwrap();
|
||||
}
|
||||
for code in 0..kinds.len().pow(4) {
|
||||
for code in 0..kinds.len().pow(3) {
|
||||
let mut code = code;
|
||||
let mut events = Vec::new();
|
||||
let mut pending = PendingEvents::default();
|
||||
for _ in 0..4 {
|
||||
let filter = EventFilter::new(root.clone(), &excludes);
|
||||
for _ in 0..3 {
|
||||
let event = ev(kinds[code % kinds.len()], vec![path.clone()]);
|
||||
code /= kinds.len();
|
||||
// Each event is repeated to exercise compaction after transitions.
|
||||
// Each event is repeated to exercise coalescing after transitions.
|
||||
for _ in 0..2 {
|
||||
events.push(event.clone());
|
||||
pending.push(event.clone(), Instant::now());
|
||||
push_event(&mut pending, &filter, &event);
|
||||
}
|
||||
}
|
||||
let plain = EventFilter::new(root.clone(), &excludes).batch(&events);
|
||||
let compact = EventFilter::new(root.clone(), &excludes).batch(&pending.events);
|
||||
let compact = EventFilter::new(root.clone(), &excludes).batch(&pending.into_events());
|
||||
assert_same_batch(&plain, &compact);
|
||||
}
|
||||
}
|
||||
@@ -1053,13 +1220,13 @@ mod tests {
|
||||
std::fs::write(root.join("new.rs"), "x").unwrap();
|
||||
let mut pending = PendingEvents::default();
|
||||
for event in &events {
|
||||
pending.push(event.clone(), Instant::now());
|
||||
push_event(&mut pending, &plain, event);
|
||||
}
|
||||
let expected = plain.batch(&events);
|
||||
assert_eq!(expected.ignore_rules, vec![root.clone()]);
|
||||
assert_eq!(expected.ignored, vec![root.join("file.ignored")]);
|
||||
assert!(!expected.modified.contains(&root.join("file.ignored")));
|
||||
assert_same_batch(&expected, &compact.batch(&pending.events));
|
||||
assert_same_batch(&expected, &compact.batch(&pending.into_events()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1330,6 +1497,43 @@ mod tests {
|
||||
assert_eq!(g(".git/objects"), Some(false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn git_metadata_directory_touches_do_not_refresh_vcs() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let root = dunce::canonicalize(tmp.path()).unwrap();
|
||||
let filter = EventFilter::new(root.clone(), &[]);
|
||||
let modify = EventKind::Modify(ModifyKind::Any);
|
||||
for (dir, lock) in
|
||||
[(".git", "index.lock"), (".git/refs/heads", "main.lock"), (".git/worktrees/wt", "index.lock")]
|
||||
{
|
||||
let dir = root.join(dir);
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let lock = dir.join(lock);
|
||||
let batch = filter.batch(&[
|
||||
ev(EventKind::Create(CreateKind::File), vec![lock.clone()]),
|
||||
ev(EventKind::Remove(RemoveKind::File), vec![lock]),
|
||||
ev(modify, vec![dir.clone()]),
|
||||
]);
|
||||
assert!(batch.is_empty(), "{}: {batch:?}", dir.display());
|
||||
for kind in [EventKind::Create(CreateKind::Folder), EventKind::Remove(RemoveKind::Folder)] {
|
||||
let batch = filter.batch(&[ev(kind, vec![dir.clone()])]);
|
||||
assert_eq!(batch.vcs, vec![dir.clone()]);
|
||||
}
|
||||
}
|
||||
|
||||
let gitfile = root.join("wt/.git");
|
||||
std::fs::create_dir_all(root.join("wt")).unwrap();
|
||||
std::fs::write(&gitfile, "gitdir: ../.git/worktrees/wt\n").unwrap();
|
||||
let index = root.join(".git/index");
|
||||
let head = root.join(".git/refs/heads/main");
|
||||
std::fs::write(&index, b"index data").unwrap();
|
||||
std::fs::write(&head, b"commit id").unwrap();
|
||||
for path in [gitfile, index, head] {
|
||||
let batch = filter.batch(&[ev(modify, vec![path.clone()])]);
|
||||
assert_eq!(batch.vcs, vec![path]);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested_gitignore_and_rule_changes_in_one_batch() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
@@ -1941,8 +2145,7 @@ mod tests {
|
||||
std::fs::create_dir_all(file.parent().unwrap()).unwrap();
|
||||
std::fs::write(&file, "x").unwrap();
|
||||
let created = Event::new(EventKind::Create(notify::event::CreateKind::Folder)).add_path(root.join("new"));
|
||||
inner.state.queue.lock().push(created, Instant::now());
|
||||
inner.state.wake.notify_all();
|
||||
inner.state.enqueue(created);
|
||||
// Written before polling took over, so the poller never reports it.
|
||||
assert!(wait_for(&batches, |b| all_paths(b).contains(&file)), "{:?}", batches.lock());
|
||||
// root, a, c, new, new/inner
|
||||
|
||||
@@ -40,10 +40,12 @@ fn original(input: &[Event], filter: &EventFilter) -> (usize, FsBatch) {
|
||||
fn compact(input: &[Event], filter: &EventFilter) -> (usize, FsBatch) {
|
||||
let mut queue = PendingEvents::default();
|
||||
for event in input {
|
||||
queue.push(event.clone(), Instant::now());
|
||||
let mut changes = QueuedChanges::default();
|
||||
queue_changes(filter, event, &mut changes);
|
||||
queue.add(changes, Instant::now());
|
||||
}
|
||||
let events = std::mem::take(&mut queue);
|
||||
(events.events.len(), filter.batch(&events.events))
|
||||
let queued = queue.changes.values().map(Vec::len).sum::<usize>();
|
||||
(queued, filter.batch(&queue.into_events()))
|
||||
}
|
||||
|
||||
fn event(kind: EventKind, root: &Path, rel: &str) -> Event {
|
||||
@@ -126,15 +128,16 @@ fn pipeline_comparison_preserves_batches_and_rule_changes() {
|
||||
for reverse in [false, true] {
|
||||
let (old, new) = pair(&input, &root, warm, reverse);
|
||||
assert_eq!(old, 32);
|
||||
let expected = match name {
|
||||
"repeated" => 1,
|
||||
"distinct" | "interleaved" => 32,
|
||||
"pairs" => 16,
|
||||
"runs10" => 4,
|
||||
"mixed" => 28,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
assert_eq!(new, expected, "{name}");
|
||||
// The queue holds exactly one merged change per distinct changed path;
|
||||
// the batch `pair` already checked is identical to the un-coalesced one.
|
||||
let filter = EventFilter::new(root.clone(), &["excluded".to_owned()]);
|
||||
let mut queued = PendingEvents::default();
|
||||
for event in &input {
|
||||
let mut changes = QueuedChanges::default();
|
||||
queue_changes(&filter, event, &mut changes);
|
||||
queued.add(changes, Instant::now());
|
||||
}
|
||||
assert_eq!(new, queued.changes.values().map(Vec::len).sum::<usize>(), "{name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,7 +156,13 @@ fn pipeline_comparison_preserves_batches_and_rule_changes() {
|
||||
}
|
||||
let (old, new) = pair(&special, &root, true, false);
|
||||
assert_eq!(old, special.len());
|
||||
assert_eq!(new, special.len());
|
||||
// Attributes no longer keep identical paths apart: one merged change per path.
|
||||
let mut queued = QueuedChanges::default();
|
||||
let filter = EventFilter::new(root.clone(), &[]);
|
||||
for event in &special {
|
||||
queue_changes(&filter, event, &mut queued);
|
||||
}
|
||||
assert_eq!(new, queued.paths.values().map(Vec::len).sum::<usize>());
|
||||
for rule in [".gitignore", ".ignore", ".git/info/exclude"] {
|
||||
let tmp = fixture(1);
|
||||
let root = dunce::canonicalize(tmp.path()).unwrap();
|
||||
|
||||
@@ -846,6 +846,7 @@ mod tests {
|
||||
"wrapAtMargin": false,
|
||||
"disabledPluginChecks": [],
|
||||
"doubleClickOpensDiff": null,
|
||||
"includeChangesByDefault": true,
|
||||
"agentInstructions": "",
|
||||
"agent": "",
|
||||
"agentModel": "",
|
||||
|
||||
@@ -7,12 +7,12 @@ OpenIDEA is a Tauri 2 app: a Rust backend (`crates/`, `src-tauri/`) and a React
|
||||
|
||||
## Prerequisites
|
||||
|
||||
| Tool | Version | Notes |
|
||||
| ------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| Rust | stable, at least 1.96 | `rust-version` in the root `Cargo.toml`. Install `clippy` and `rustfmt` too. |
|
||||
| Node.js | 22.18 or newer | The repo's scripts (`scripts/*.ts`, `perf/*.ts`) are run directly by Node as TypeScript. CI uses Node 22. |
|
||||
| pnpm | 11 | The version CI uses. |
|
||||
| Tauri system dependencies | — | Per OS: see [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/). |
|
||||
| Tool | Version | Notes |
|
||||
| ------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
||||
| Rust | stable, at least 1.96 | `rust-version` in the root `Cargo.toml`. Install `clippy` and `rustfmt` too. |
|
||||
| Node.js | 22.x, at least 22.22.2 | CI uses Node 22. Node runs the TypeScript scripts directly; the locked jsdom requires this patch or newer on 22.x. |
|
||||
| pnpm | 11 | The version CI uses. |
|
||||
| Tauri system dependencies | — | Per OS: see [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/). |
|
||||
|
||||
On Linux (Ubuntu 22.04, as in CI) the system packages are:
|
||||
|
||||
@@ -54,6 +54,21 @@ Other everyday commands:
|
||||
| `pnpm gen:bindings` | Regenerate `src/bindings.ts` from the Rust command signatures. |
|
||||
| `pnpm dev` | Vite alone: the UI in a plain browser with in-memory backends (no Rust). |
|
||||
|
||||
## Optional: use mise
|
||||
|
||||
Instead of installing Rust, Node.js and pnpm separately, [install mise](https://mise.jdx.dev/installing-mise.html). You still need the Tauri system dependencies above. From the cloned worktree, after reviewing `mise.toml`, run:
|
||||
|
||||
```sh
|
||||
mise trust
|
||||
mise install
|
||||
mise run setup
|
||||
mise run dev
|
||||
```
|
||||
|
||||
`setup` runs `pnpm install` in this worktree. `dev` and `dev:app` use the same worktree-aware launchers as the direct commands. No shell activation is needed for `mise run`.
|
||||
|
||||
Run `mise tasks` to list all six tasks. `mise run build` builds the frontend (not a desktop installer). `mise run test` runs Vitest and `cargo test --workspace`; `mise run check` runs the format, lint, type and unused-code checks, then both test suites. Neither requires nextest or the plugin WASM target.
|
||||
|
||||
## Worktrees
|
||||
|
||||
Several worktrees can be developed and run side by side. Create one per task:
|
||||
|
||||
@@ -49,10 +49,13 @@ never to a settings file. The **+**, **−** and copy buttons above the list add
|
||||
### `~/.ssh/config` support
|
||||
|
||||
OpenIDEA has its own SSH client and reads `~/.ssh/config` itself. It understands `Host`, `Match`, `Include`,
|
||||
`HostName`, `User`, `Port`, `IdentityFile`, `ProxyJump`, `ProxyCommand`, `StrictHostKeyChecking` and
|
||||
`HostName`, `User`, `Port`, `IdentityFile`, `IdentityAgent`, `ProxyJump`, `ProxyCommand`, `StrictHostKeyChecking` and
|
||||
`UserKnownHostsFile`. Jump hosts authenticate with the agent and identity files; the password or passphrase of the
|
||||
configuration is only used for the target host.
|
||||
|
||||
The SSH agent is the one `IdentityAgent` names, otherwise `SSH_AUTH_SOCK` as your login shell sets it, so an agent
|
||||
socket exported in `~/.zshrc` (for example a password manager's agent) works even when OpenIDEA is started from the Dock.
|
||||
|
||||
Host keys are checked against `known_hosts`. An unknown key has to be trusted once; a changed key is refused unless
|
||||
host key checking is turned off for that host.
|
||||
|
||||
|
||||
@@ -7,12 +7,12 @@ OpenIDEA 是一个 Tauri 2 应用:Rust 后端(`crates/`、`src-tauri/`)加
|
||||
|
||||
## 前置条件
|
||||
|
||||
| 工具 | 版本 | 说明 |
|
||||
| -------------- | ----------------- | ------------------------------------------------------------------------------------------ |
|
||||
| Rust | stable,至少 1.96 | 见根目录 `Cargo.toml` 的 `rust-version`。同时安装 `clippy` 和 `rustfmt`。 |
|
||||
| Node.js | 22.18 及以上 | 仓库脚本(`scripts/*.ts`、`perf/*.ts`)由 Node 直接按 TypeScript 运行。CI 用的是 Node 22。 |
|
||||
| pnpm | 11 | 与 CI 一致。 |
|
||||
| Tauri 系统依赖 | — | 各平台要求见 [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/)。 |
|
||||
| 工具 | 版本 | 说明 |
|
||||
| -------------- | ------------------ | ------------------------------------------------------------------------------------------- |
|
||||
| Rust | stable,至少 1.96 | 见根目录 `Cargo.toml` 的 `rust-version`。同时安装 `clippy` 和 `rustfmt`。 |
|
||||
| Node.js | 22.x,至少 22.22.2 | CI 使用 Node 22。Node 直接运行 TypeScript 脚本;锁定的 jsdom 在 22.x 上至少需要此补丁版本。 |
|
||||
| pnpm | 11 | 与 CI 一致。 |
|
||||
| Tauri 系统依赖 | — | 各平台要求见 [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/)。 |
|
||||
|
||||
Linux(与 CI 一样以 Ubuntu 22.04 为例)需要的系统包:
|
||||
|
||||
@@ -54,6 +54,21 @@ sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librs
|
||||
| `pnpm gen:bindings` | 根据 Rust 命令签名重新生成 `src/bindings.ts`。 |
|
||||
| `pnpm dev` | 只起 Vite:在普通浏览器里运行 UI,后端用内存实现(不需要 Rust)。 |
|
||||
|
||||
## 可选:使用 mise
|
||||
|
||||
如果不想分别安装 Rust、Node.js 和 pnpm,可以[安装 mise](https://mise.jdx.dev/installing-mise.html)。上面列出的 Tauri 系统依赖仍需单独安装。在克隆的 worktree 中查看 `mise.toml`,然后运行:
|
||||
|
||||
```sh
|
||||
mise trust
|
||||
mise install
|
||||
mise run setup
|
||||
mise run dev
|
||||
```
|
||||
|
||||
`setup` 在当前 worktree 中执行 `pnpm install`。`dev` 和 `dev:app` 都沿用原来的启动脚本,保留 worktree 隔离。使用 `mise run` 不需要在 shell 中激活 mise。
|
||||
|
||||
运行 `mise tasks` 可以查看全部六个任务。`mise run build` 构建前端,不生成桌面安装包。`mise run test` 运行 Vitest 和 `cargo test --workspace`;`mise run check` 先检查格式、代码规范、类型和未使用的代码,再运行这两套测试。两者都不需要 nextest 或插件的 WASM 目标。
|
||||
|
||||
## Worktree
|
||||
|
||||
可以同时开发和运行多个 worktree。每个任务建一个:
|
||||
|
||||
@@ -41,9 +41,12 @@ OpenIDEA 通过 SSH 连接;在 Windows 上也可以直接连入 WSL 发行版
|
||||
### `~/.ssh/config` 支持
|
||||
|
||||
OpenIDEA 自带 SSH 客户端,自行读取 `~/.ssh/config`,支持 `Host`、`Match`、`Include`、`HostName`、`User`、`Port`、
|
||||
`IdentityFile`、`ProxyJump`、`ProxyCommand`、`StrictHostKeyChecking` 和 `UserKnownHostsFile`。跳板机通过代理和身份文件认证,
|
||||
`IdentityFile`、`IdentityAgent`、`ProxyJump`、`ProxyCommand`、`StrictHostKeyChecking` 和 `UserKnownHostsFile`。跳板机通过代理和身份文件认证,
|
||||
配置里的密码或密码短语只用于目标主机。
|
||||
|
||||
SSH 代理使用 `IdentityAgent` 指定的那个,未指定时使用登录 shell 设置的 `SSH_AUTH_SOCK`,所以在 `~/.zshrc` 里导出的代理 socket
|
||||
(例如密码管理器的 SSH 代理)在从程序坞启动 OpenIDEA 时也能用。
|
||||
|
||||
主机密钥会与 `known_hosts` 比对。未知密钥需要先信任一次;密钥发生变化时会拒绝连接,除非对该主机关闭了主机密钥检查。
|
||||
|
||||
## 打开远程项目
|
||||
|
||||
@@ -285,7 +285,7 @@ async function expectNoSubmission(page: Page) {
|
||||
}
|
||||
|
||||
for (const surface of ["new", "task"] as const) {
|
||||
test(`${surface}: configure another model from its row, then edit its context from the composer`, async ({
|
||||
test(`${surface}: switch models from the list, then set effort and context from the settings chip`, async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
const context = option(
|
||||
@@ -306,22 +306,16 @@ for (const surface of ["new", "task"] as const) {
|
||||
await modelButton(page).click();
|
||||
const row = page.getByRole("option", { name: /^Swift\b/ });
|
||||
await row.hover();
|
||||
const configure = row.getByRole("button", { name: "Configure Swift…" });
|
||||
if (surface === "task") await configure.press("Enter");
|
||||
else await configure.click();
|
||||
await expect(modelButton(page)).toHaveText("Atlas");
|
||||
await expect(page.getByRole("radio", { name: "Gentle" })).toHaveCount(0);
|
||||
await page.getByRole("radio", { name: "Thorough" }).click();
|
||||
await expect(row.getByRole("button", { name: /^Configure/ })).toHaveCount(0);
|
||||
if (surface === "task") await row.press("Enter");
|
||||
else await row.click();
|
||||
await expect(modelButton(page)).toHaveText("Swift");
|
||||
await expect(page.getByRole("radio", { name: "Thorough" })).toBeChecked();
|
||||
await page.keyboard.press("Escape");
|
||||
const settings = page.getByRole("button", { name: /^Model settings:/ });
|
||||
await expect(settings).toHaveText("Thorough · 200K");
|
||||
await settings.click();
|
||||
await expect(page.getByRole("button", { name: "Back to models" })).toHaveCount(0);
|
||||
await page.getByRole("radio", { name: "Thorough" }).click();
|
||||
await page.getByRole("radio", { name: "1M" }).click();
|
||||
await expect(settings).toHaveText("Thorough · 1M");
|
||||
await page.getByRole("button", { name: "Back to models" }).click();
|
||||
await expect(page.getByRole("listbox", { name: "Model", exact: true })).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(box(page)).toHaveText("Review the project structure");
|
||||
await expectNoSubmission(page);
|
||||
@@ -642,7 +636,7 @@ test("New Task discovers uncached model effort before the first prompt", async (
|
||||
await expect
|
||||
.poll(async () => (await ipcCalls(page, "agent_refresh_models")).filter((call) => call.model === "swift"))
|
||||
.toEqual([{ provider: provider.id, force: false, model: "swift" }]);
|
||||
await expect(page.getByRole("status").filter({ hasText: "Loading model settings…" })).toBeVisible();
|
||||
await expect(page.getByRole("status", { name: "Loading model settings…" })).toBeVisible();
|
||||
await expect(effortLabel(page)).toHaveCount(0);
|
||||
await page.screenshot({ path: testInfo.outputPath("model-settings-loading.png") });
|
||||
await page.evaluate(() => document.dispatchEvent(new Event("test:model-settings-ready")));
|
||||
@@ -671,7 +665,7 @@ test("an existing chat can choose effort for a refreshed model before sending",
|
||||
await page.getByRole("button", { name: "Refresh models", exact: true }).click();
|
||||
await swiftModel.click();
|
||||
|
||||
const loading = page.getByRole("status").filter({ hasText: "Loading model settings…" });
|
||||
const loading = page.getByRole("status", { name: "Loading model settings…" });
|
||||
const send = page.getByRole("button", { name: "Send", exact: true });
|
||||
await expect(loading).toBeVisible();
|
||||
await expect(send).toBeDisabled();
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("Appearance keeps themes and UI font controls grouped across Settings widths", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1120, height: 800 });
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
const search = dialog.getByRole("textbox", { name: "Search settings" });
|
||||
await search.fill("Use custom font");
|
||||
await dialog.getByRole("treeitem", { name: "Appearance", exact: true }).click();
|
||||
await search.clear();
|
||||
|
||||
const theme = dialog.getByRole("button", { name: "Theme", exact: true });
|
||||
const sync = dialog.getByRole("checkbox", { name: "Sync with OS", exact: true });
|
||||
const preferences = dialog.getByRole("button", { name: "Preferred themes", exact: true });
|
||||
const more = dialog.getByRole("button", { name: "Get more themes", exact: true });
|
||||
const font = dialog.getByRole("combobox", { name: "UI font", exact: true });
|
||||
const fallback = dialog.getByRole("combobox", { name: "UI fallback font", exact: true });
|
||||
const size = dialog.getByRole("textbox", { name: "UI font size", exact: true });
|
||||
const custom = dialog.getByRole("checkbox", { name: "Use custom font:", exact: true });
|
||||
await expect(preferences).toBeDisabled();
|
||||
await expect(font).toBeDisabled();
|
||||
await expect(size).toBeDisabled();
|
||||
await expect(fallback).toBeDisabled();
|
||||
|
||||
const [themeBox, gearBox, linkBox, fontBox, sizeBox, fallbackBox] = await Promise.all(
|
||||
[theme, preferences, more, font, size, fallback].map((control) => control.boundingBox()),
|
||||
);
|
||||
if (!themeBox || !gearBox || !linkBox || !fontBox || !sizeBox || !fallbackBox) {
|
||||
throw new Error("Missing Appearance control bounds");
|
||||
}
|
||||
expect(linkBox.y).toBeGreaterThan(themeBox.y + themeBox.height);
|
||||
expect(gearBox.x).toBeGreaterThan(themeBox.x + themeBox.width);
|
||||
expect(gearBox.y + gearBox.height / 2).toBeCloseTo(themeBox.y + themeBox.height / 2, 0);
|
||||
expect(sizeBox.y).toBeCloseTo(fontBox.y, 0);
|
||||
expect(sizeBox.x).toBeGreaterThan(fontBox.x + fontBox.width);
|
||||
expect(fallbackBox.x).toBeCloseTo(fontBox.x, 0);
|
||||
expect(fallbackBox.y).toBeGreaterThan(fontBox.y);
|
||||
|
||||
await sync.check();
|
||||
await expect(theme).toBeDisabled();
|
||||
for (const width of [580, 520]) {
|
||||
await page.setViewportSize({ width, height: 800 });
|
||||
await preferences.click();
|
||||
const popup = page.getByRole("dialog", { name: "Preferred themes", exact: true });
|
||||
const light = popup.getByRole("button", { name: "Preferred light theme", exact: true });
|
||||
const dark = popup.getByRole("button", { name: "Preferred dark theme", exact: true });
|
||||
await expect(light).toBeInViewport({ ratio: 1 });
|
||||
await expect(dark).toBeInViewport({ ratio: 1 });
|
||||
const [lightBox, darkBox] = await Promise.all([light.boundingBox(), dark.boundingBox()]);
|
||||
if (!lightBox || !darkBox) throw new Error("Missing preferred theme bounds");
|
||||
expect(lightBox.x).toBeCloseTo(darkBox.x, 0);
|
||||
expect(lightBox.width).toBeCloseTo(darkBox.width, 0);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(popup).toBeHidden();
|
||||
for (const field of [font, size, fallback]) await expect(field).toBeInViewport({ ratio: 1 });
|
||||
const [narrowFont, narrowSize, narrowFallback] = await Promise.all(
|
||||
[font, size, fallback].map((control) => control.boundingBox()),
|
||||
);
|
||||
if (!narrowFont || !narrowSize || !narrowFallback) throw new Error("Missing narrow font control bounds");
|
||||
expect(narrowSize.y).toBeGreaterThan(narrowFont.y);
|
||||
expect(narrowFallback.x).toBeCloseTo(narrowFont.x, 0);
|
||||
}
|
||||
|
||||
await custom.check();
|
||||
await font.fill("Inter");
|
||||
await size.fill("15");
|
||||
await fallback.fill("Noto Sans CJK SC");
|
||||
await fallback.press("Enter");
|
||||
await expect(font).toHaveValue("Inter");
|
||||
await expect(size).toHaveValue("15");
|
||||
await expect(fallback).toHaveValue("Noto Sans CJK SC");
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(dialog).toBeHidden();
|
||||
});
|
||||
@@ -0,0 +1,95 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import type { PatchFile } from "../src/bindings";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
const repo = "/dev/billing";
|
||||
const path = "/tmp/release-2026/requests/adjust-invoices.patch";
|
||||
const patch = "diff --git a/ledger/invoice.ts b/ledger/invoice.ts";
|
||||
const invoice: PatchFile = {
|
||||
path: "ledger/invoice.ts",
|
||||
oldPath: null,
|
||||
kind: "modified",
|
||||
added: 3,
|
||||
removed: 1,
|
||||
binary: false,
|
||||
applies: true,
|
||||
};
|
||||
|
||||
async function openPatch(page: Page, source: "file" | "clipboard", files: PatchFile[]) {
|
||||
await page.evaluate(
|
||||
async ({ source, repo, path, patch, files }) => {
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.fs_read_text = () => patch;
|
||||
handlers.clipboard_text = () => patch;
|
||||
handlers.vcs_patch_preview = () => files;
|
||||
handlers.vcs_apply_patch = () => ({ applied: [files[0]?.path], conflicts: [] });
|
||||
const store = "/src/features/vcs/store.ts";
|
||||
const context = "/src/platform/context.ts";
|
||||
const actions = "/src/platform/actions.ts";
|
||||
(await import(/* @vite-ignore */ store)).useVcs.setState({ available: true, root: repo, repo, roots: [repo] });
|
||||
(await import(/* @vite-ignore */ context)).setContext("vcsAvailable", true);
|
||||
const { executeAction } = await import(/* @vite-ignore */ actions);
|
||||
await executeAction(source === "file" ? "vcs.applyPatch" : "vcs.applyPatchFromClipboard", path);
|
||||
},
|
||||
{ source, repo, path, patch, files },
|
||||
);
|
||||
}
|
||||
|
||||
test("Apply Patch keeps the source, repository and file status aligned in a narrow dialog", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 485, height: 490 });
|
||||
await stubDesktop(page);
|
||||
await openPatch(page, "file", [
|
||||
invoice,
|
||||
{ ...invoice, path: "apps/batch/ledger/international/settlement/settle-invoice.ts", applies: false },
|
||||
...Array.from({ length: 20 }, (_, i) => ({ ...invoice, path: `ledger/settlement-${i + 1}.ts` })),
|
||||
]);
|
||||
const dialog = page.getByRole("dialog", { name: "Apply Patch: adjust-invoices.patch", exact: true });
|
||||
const source = dialog.getByRole("textbox", { name: "Patch source", exact: true });
|
||||
const target = dialog.getByRole("textbox", { name: "Repository", exact: true });
|
||||
const list = dialog.getByRole("listbox", { name: "Patch files", exact: true });
|
||||
|
||||
await expect(source).toHaveValue(path);
|
||||
await expect(source).not.toBeEditable();
|
||||
await expect(target).toHaveValue(repo);
|
||||
await expect(dialog.getByRole("heading", { name: "Patch files", exact: true })).toBeVisible();
|
||||
await expect(dialog.getByText("22 files", { exact: true })).toBeVisible();
|
||||
expect((await source.boundingBox())!.y).toBeLessThan((await target.boundingBox())!.y);
|
||||
expect((await target.boundingBox())!.y).toBeLessThan((await list.boundingBox())!.y);
|
||||
|
||||
const stats = list.getByText("+3 −1", { exact: true });
|
||||
const first = (await stats.nth(0).boundingBox())!;
|
||||
const second = (await stats.nth(1).boundingBox())!;
|
||||
expect(Math.abs(first.x - second.x)).toBeLessThan(1);
|
||||
await expect(list.getByLabel("Does not apply cleanly", { exact: true })).toBeInViewport({ ratio: 1 });
|
||||
await expect(dialog.getByRole("status")).toHaveText("1 file will be merged; conflicts open in the merge tool");
|
||||
await list.press("End");
|
||||
await expect(list.getByText("settlement-20.ts", { exact: true })).toBeInViewport({ ratio: 1 });
|
||||
await expect(dialog.getByRole("button", { name: "Apply", exact: true })).toBeInViewport({ ratio: 1 });
|
||||
expect(await dialog.locator("[data-dialog-body]").evaluate((el) => el.scrollWidth - el.clientWidth)).toBe(0);
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(dialog).toBeHidden();
|
||||
expect(await ipcCalls(page, "vcs_apply_patch")).toEqual([]);
|
||||
});
|
||||
|
||||
test("Apply Patch previews clipboard contents and applies them to the previewed repository", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await stubDesktop(page);
|
||||
await openPatch(page, "clipboard", []);
|
||||
const dialog = page.getByRole("dialog", { name: "Apply Patch: Clipboard", exact: true });
|
||||
await expect(dialog.getByRole("textbox", { name: "Patch source", exact: true })).toHaveValue("Clipboard");
|
||||
await expect(dialog.getByText("No changes", { exact: true })).toBeVisible();
|
||||
const apply = dialog.getByRole("button", { name: "Apply", exact: true });
|
||||
await expect(apply).toBeDisabled();
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(dialog).toBeHidden();
|
||||
|
||||
await openPatch(page, "clipboard", [invoice]);
|
||||
await expect(dialog.getByText("1 file", { exact: true })).toBeVisible();
|
||||
await expect(apply).toBeEnabled();
|
||||
await apply.click();
|
||||
await expect(dialog).toBeHidden();
|
||||
await expect.poll(() => ipcCalls(page, "vcs_apply_patch")).toEqual([{ repo, patch }]);
|
||||
});
|
||||
@@ -0,0 +1,88 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("Background Tasks keeps task details and actions reachable while resizing and scrolling", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1200, height: 820 });
|
||||
await page.evaluate(() => {
|
||||
window.addEventListener("error", (event) => {
|
||||
if (event.message.includes("ResizeObserver loop")) document.body.dataset.taskResizeError = event.message;
|
||||
});
|
||||
});
|
||||
const title = "Synchronizing the settlement service and reconciliation workspace";
|
||||
const message = "Reading the payment service dependencies and refreshing the reconciliation workspace model.";
|
||||
await page.evaluate(
|
||||
async ({ title, message }) => {
|
||||
const path = "/src/workbench/tasks.ts";
|
||||
const { upsertTask, removeTask } = await import(/* @vite-ignore */ path);
|
||||
upsertTask({ id: "refresh", title: "Refreshing project files", message: null, fraction: null, done: false });
|
||||
upsertTask({ id: "sync", title, message, fraction: 0.42, done: false, cancel: () => removeTask("sync") });
|
||||
},
|
||||
{ title, message },
|
||||
);
|
||||
|
||||
const status = page.getByRole("button", { name: `Background tasks: ${title}` });
|
||||
await status.click();
|
||||
const popup = page.getByRole("dialog", { name: "Background tasks", exact: true });
|
||||
const resize = popup.getByRole("separator", { name: "Resize" });
|
||||
await expect(resize).toBeVisible();
|
||||
const initial = (await popup.boundingBox())!;
|
||||
const corner = (await resize.boundingBox())!;
|
||||
const x = corner.x + corner.width / 2;
|
||||
const y = corner.y + corner.height / 2;
|
||||
await page.mouse.move(x, y);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(x + 60, y + 48, { steps: 6 });
|
||||
await page.mouse.up();
|
||||
await expect.poll(async () => (await popup.boundingBox())!.width).toBeGreaterThan(initial.width + 32);
|
||||
const size = (await popup.boundingBox())!;
|
||||
expect(size.height).toBeGreaterThan(initial.height + 24);
|
||||
await popup.getByRole("button", { name: "Close", exact: true }).click();
|
||||
await expect(popup).toBeHidden();
|
||||
await status.click();
|
||||
await expect.poll(async () => (await popup.boundingBox())!.width).toBeCloseTo(size.width, 0);
|
||||
await expect.poll(async () => (await popup.boundingBox())!.height).toBeCloseTo(size.height, 0);
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/workbench/tasks.ts";
|
||||
const { upsertTask } = await import(/* @vite-ignore */ path);
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
upsertTask({
|
||||
id: `check-${i}`,
|
||||
title: `Checking workspace module ${i}`,
|
||||
message: "Reading source files",
|
||||
fraction: null,
|
||||
done: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
await page.setViewportSize({ width: 400, height: 430 });
|
||||
await expect(popup).toBeInViewport({ ratio: 1 });
|
||||
const list = popup.getByRole("list", { name: "Background Tasks" });
|
||||
const sync = list.getByRole("listitem").filter({ hasText: title });
|
||||
const detail = sync.getByText(message, { exact: true });
|
||||
expect(await detail.evaluate((element) => element.scrollWidth - element.clientWidth)).toBe(0);
|
||||
const [detailBox, progressBox] = await Promise.all([
|
||||
detail.boundingBox(),
|
||||
sync.getByRole("progressbar", { name: title }).boundingBox(),
|
||||
]);
|
||||
expect(progressBox!.y).toBeGreaterThan(detailBox!.y + detailBox!.height);
|
||||
expect(
|
||||
await list.evaluate((element) => {
|
||||
element.scrollTop = element.scrollHeight;
|
||||
return element.scrollTop;
|
||||
}),
|
||||
).toBeGreaterThan(0);
|
||||
await expect(popup.getByRole("heading", { name: "Background Tasks" })).toBeInViewport({ ratio: 1 });
|
||||
await sync.getByRole("button", { name: `Cancel ${title}` }).click();
|
||||
await expect(sync).toHaveCount(0);
|
||||
await expect(popup).toBeVisible();
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/workbench/tasks.ts";
|
||||
const { useTasks, removeTask } = await import(/* @vite-ignore */ path);
|
||||
for (const task of useTasks.getState().tasks) removeTask(task.id);
|
||||
});
|
||||
await expect(popup).toBeHidden();
|
||||
expect(await page.locator("body").getAttribute("data-task-resize-error")).toBeNull();
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, openFromTree, test } from "./fixtures";
|
||||
|
||||
async function bookmarkAction(page: Page, id: "navigate.toggleBookmark" | "navigate.showBookmarks") {
|
||||
await page.evaluate(async (id) => {
|
||||
const path = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ path);
|
||||
await executeAction(id);
|
||||
}, id);
|
||||
}
|
||||
|
||||
test("Bookmarks remembers its size and keeps the list and preview usable in a narrow window", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1200, height: 820 });
|
||||
const resizeErrors: string[] = [];
|
||||
page.on("pageerror", (error) => {
|
||||
if (error.message.includes("ResizeObserver loop")) resizeErrors.push(error.message);
|
||||
});
|
||||
const editor = await openFromTree(page, "build.gradle.kts");
|
||||
const first = "val order: Order = service.create(req)";
|
||||
const second = "return order.toDto()";
|
||||
for (const line of [first, second]) {
|
||||
await editor.locator(".cm-line", { hasText: line }).click();
|
||||
await bookmarkAction(page, "navigate.toggleBookmark");
|
||||
}
|
||||
|
||||
await bookmarkAction(page, "navigate.showBookmarks");
|
||||
const dialog = page.getByRole("dialog", { name: "Bookmarks", exact: true });
|
||||
const list = dialog.getByRole("listbox", { name: "Bookmarks" });
|
||||
const preview = dialog.getByRole("region", { name: "Preview" });
|
||||
const divider = dialog.getByRole("separator", { name: "Resize bookmark panes", exact: true });
|
||||
await expect(divider).toHaveAttribute("aria-orientation", "vertical");
|
||||
await expect(list).toBeFocused();
|
||||
await expect(list.getByRole("option", { selected: true })).toContainText(first);
|
||||
await expect(preview.locator(".cm-activeLine")).toContainText(first);
|
||||
const lineNumbers = list.getByRole("option").locator(":scope > span > span:last-child");
|
||||
const [firstNumber, secondNumber] = await Promise.all([
|
||||
lineNumbers.nth(0).boundingBox(),
|
||||
lineNumbers.nth(1).boundingBox(),
|
||||
]);
|
||||
expect(firstNumber!.x + firstNumber!.width).toBeCloseTo(secondNumber!.x + secondNumber!.width, 0);
|
||||
const initial = (await dialog.boundingBox())!;
|
||||
expect(initial.x + initial.width / 2).toBeCloseTo(600, 0);
|
||||
expect(Math.abs(initial.y + initial.height / 2 - 410)).toBeLessThan(16);
|
||||
|
||||
const listWidth = (await list.boundingBox())!.width;
|
||||
await divider.press("ArrowRight");
|
||||
await expect.poll(async () => (await list.boundingBox())!.width).toBeGreaterThan(listWidth + 4);
|
||||
|
||||
const corner = (await dialog.getByRole("separator", { name: "Resize", exact: true }).boundingBox())!;
|
||||
const x = corner.x + corner.width / 2;
|
||||
const y = corner.y + corner.height / 2;
|
||||
await page.mouse.move(x, y);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(x + 80, y + 48, { steps: 6 });
|
||||
await page.mouse.up();
|
||||
await expect.poll(async () => (await dialog.boundingBox())!.width).toBeGreaterThan(initial.width + 50);
|
||||
const resized = (await dialog.boundingBox())!;
|
||||
expect(resized.height).toBeGreaterThan(initial.height + 30);
|
||||
const resizedList = (await list.boundingBox())!.width;
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dialog).toBeHidden();
|
||||
await bookmarkAction(page, "navigate.showBookmarks");
|
||||
await expect.poll(async () => (await dialog.boundingBox())!.width).toBeCloseTo(resized.width, 0);
|
||||
await expect.poll(async () => (await dialog.boundingBox())!.height).toBeCloseTo(resized.height, 0);
|
||||
await expect.poll(async () => Math.abs((await list.boundingBox())!.width - resizedList)).toBeLessThan(2);
|
||||
|
||||
await page.setViewportSize({ width: 470, height: 430 });
|
||||
await expect(divider).toHaveAttribute("aria-orientation", "horizontal");
|
||||
const narrowList = (await list.boundingBox())!;
|
||||
const narrowPreview = (await preview.boundingBox())!;
|
||||
expect(narrowPreview.y).toBeGreaterThanOrEqual(narrowList.y + narrowList.height - 1);
|
||||
expect(narrowPreview.width).toBeCloseTo(narrowList.width, 0);
|
||||
expect(narrowPreview.height).toBeGreaterThan(100);
|
||||
await expect(dialog).toBeInViewport({ ratio: 1 });
|
||||
|
||||
await list.press("ArrowDown");
|
||||
await expect(list.getByRole("option", { selected: true })).toContainText(second);
|
||||
await expect(preview.locator(".cm-activeLine")).toContainText(second);
|
||||
await list.press("Enter");
|
||||
await expect(dialog).toBeHidden();
|
||||
await expect(editor.locator(".cm-activeLine")).toContainText(second);
|
||||
expect(resizeErrors).toEqual([]);
|
||||
});
|
||||
@@ -0,0 +1,146 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import type { ChangelistState } from "../src/bindings";
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
async function action(page: Page, id: string, arg?: string[]) {
|
||||
await page.evaluate(
|
||||
async ({ id, arg }) => {
|
||||
const actions = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actions);
|
||||
await executeAction(id, arg);
|
||||
},
|
||||
{ id, arg },
|
||||
);
|
||||
}
|
||||
|
||||
async function savedLists(page: Page) {
|
||||
const last = (await ipcCalls(page, "vcs_changelists_save")).at(-1);
|
||||
return last?.changelists as ChangelistState | undefined;
|
||||
}
|
||||
|
||||
test("changelist forms align the fields and preserve multiline comments through create, edit and move", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1100, height: 700 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const root = "/dev/acme-api";
|
||||
const vcsModule = "/src/features/vcs/store.ts";
|
||||
const { useVcs } = await import(/* @vite-ignore */ vcsModule);
|
||||
useVcs.setState({
|
||||
available: true,
|
||||
root,
|
||||
repo: root,
|
||||
roots: [root],
|
||||
status: [{ path: root + "/build.gradle.kts", relPath: "build.gradle.kts", staged: null, unstaged: "modified" }],
|
||||
});
|
||||
const listModule = "/src/features/vcs/changelists.ts";
|
||||
const { initialChangelists, useChangelists } = await import(/* @vite-ignore */ listModule);
|
||||
useChangelists.setState({
|
||||
state: {
|
||||
...initialChangelists(),
|
||||
lists: [
|
||||
...initialChangelists().lists,
|
||||
{ id: "inbox", name: "Review inbox", comment: "Choose a reviewer before merging." },
|
||||
{ id: "unsorted", name: "Unsorted" },
|
||||
],
|
||||
files: { "build.gradle.kts": "default" },
|
||||
},
|
||||
loaded: true,
|
||||
});
|
||||
window.__ipc.handlers.vcs_changelists_save = () => null;
|
||||
const context = "/src/platform/context.ts";
|
||||
const { setContext } = await import(/* @vite-ignore */ context);
|
||||
setContext("vcsAvailable", true);
|
||||
});
|
||||
|
||||
await action(page, "vcs.changelist.new");
|
||||
const create = page.getByRole("dialog", { name: "New Changelist", exact: true });
|
||||
const name = create.getByRole("textbox", { name: "Name:", exact: true });
|
||||
const comment = create.getByRole("textbox", { name: "Comment:", exact: true });
|
||||
const ok = create.getByRole("button", { name: "OK", exact: true });
|
||||
await expect(name).toBeFocused();
|
||||
await expect(ok).toBeDisabled();
|
||||
const nameLabel = (await create.getByText("Name:", { exact: true }).boundingBox())!;
|
||||
const nameField = (await name.boundingBox())!;
|
||||
expect(nameLabel.x + nameLabel.width).toBeLessThan(nameField.x);
|
||||
const commentLabel = (await create.getByText("Comment:", { exact: true }).boundingBox())!;
|
||||
const commentField = (await comment.boundingBox())!;
|
||||
expect(Math.abs(nameField.x - commentField.x)).toBeLessThan(1);
|
||||
expect(commentLabel.x + commentLabel.width).toBeLessThan(commentField.x);
|
||||
expect(commentField.height).toBeGreaterThan(76);
|
||||
await expect(create.getByText("Name:", { exact: true })).toHaveCSS(
|
||||
"font-size",
|
||||
await name.evaluate((el) => getComputedStyle(el).fontSize),
|
||||
);
|
||||
await name.fill("Changes");
|
||||
await expect(name).toHaveAccessibleDescription(/already exists/);
|
||||
await expect(ok).toBeDisabled();
|
||||
|
||||
await name.fill("Release review");
|
||||
await comment.fill("Review the totals.\nAsk for a second check.");
|
||||
await create.getByRole("checkbox", { name: "Set active" }).check();
|
||||
await ok.click();
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const state = await savedLists(page);
|
||||
return state?.lists.find((list) => list.id === state.active)?.comment;
|
||||
})
|
||||
.toBe("Review the totals.\nAsk for a second check.");
|
||||
|
||||
await action(page, "vcs.changelist.edit");
|
||||
const edit = page.getByRole("dialog", { name: "Edit Changelist", exact: true });
|
||||
await expect(edit.getByRole("textbox", { name: "Name:", exact: true })).toHaveValue("Release review");
|
||||
const editComment = edit.getByRole("textbox", { name: "Comment:", exact: true });
|
||||
await expect(editComment).toHaveValue("Review the totals.\nAsk for a second check.");
|
||||
await expect(edit.getByRole("checkbox", { name: "Set active" })).toBeDisabled();
|
||||
await editComment.fill("Review complete.\nReady for the release checklist.");
|
||||
await edit.getByRole("button", { name: "OK", exact: true }).click();
|
||||
await expect
|
||||
.poll(async () => (await savedLists(page))?.lists.find((list) => list.name === "Release review")?.comment)
|
||||
.toBe("Review complete.\nReady for the release checklist.");
|
||||
|
||||
await action(page, "vcs.changelist.move", ["/dev/acme-api/build.gradle.kts"]);
|
||||
const move = page.getByRole("dialog", { name: "Move Changes to Another Changelist" });
|
||||
const newName = move.getByRole("textbox", { name: "Name:", exact: true });
|
||||
const targetComment = move.getByRole("textbox", { name: "Comment:", exact: true });
|
||||
const moveOk = move.getByRole("button", { name: "OK", exact: true });
|
||||
await expect(newName).toBeFocused();
|
||||
await expect(newName).toHaveValue("Release review");
|
||||
await expect(targetComment).toHaveAttribute("readonly", "");
|
||||
await newName.press("ArrowDown");
|
||||
const options = page.getByRole("listbox", { name: "Target changelist" });
|
||||
await expect(options).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(options).toBeHidden();
|
||||
await expect(newName).toBeFocused();
|
||||
await newName.press("ArrowDown");
|
||||
await expect(options.getByRole("option", { name: "Changes", exact: true })).toHaveCount(0);
|
||||
await options.getByRole("option", { name: "Review inbox", exact: true }).click();
|
||||
await expect(newName).toHaveValue("Review inbox");
|
||||
await expect(targetComment).toHaveValue("Choose a reviewer before merging.");
|
||||
await newName.fill("Changes");
|
||||
await expect(newName).toHaveAccessibleDescription(/already exists/);
|
||||
await expect(moveOk).toBeDisabled();
|
||||
|
||||
await page.setViewportSize({ width: 400, height: 540 });
|
||||
const stackedName = (await newName.boundingBox())!;
|
||||
const stackedLabel = (await move.getByText("Name:", { exact: true }).boundingBox())!;
|
||||
expect(stackedLabel.y + stackedLabel.height).toBeLessThanOrEqual(stackedName.y);
|
||||
expect(Math.abs(stackedLabel.x - stackedName.x)).toBeLessThan(1);
|
||||
await newName.fill("Ready to ship");
|
||||
await expect(targetComment).toBeEditable();
|
||||
await targetComment.fill("Move the reviewed change here.");
|
||||
await newName.fill("Unsorted");
|
||||
await expect(targetComment).toHaveAttribute("readonly", "");
|
||||
await expect(targetComment).toHaveValue("");
|
||||
await newName.fill("Ready to ship");
|
||||
await expect(targetComment).toHaveValue("Move the reviewed change here.");
|
||||
await moveOk.click();
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const state = await savedLists(page);
|
||||
return state?.lists.find((list) => list.id === state.files?.["build.gradle.kts"])?.name;
|
||||
})
|
||||
.toBe("Ready to ship");
|
||||
});
|
||||
@@ -2,7 +2,7 @@ import { expect, test } from "./fixtures";
|
||||
|
||||
for (const [id, selector] of [
|
||||
["general", "[class*='radios'] label"],
|
||||
["notifications", "table tbody td:first-child"],
|
||||
["notifications", "[role='listbox'] [role='option'] > [class*='notificationGroupLabel']"],
|
||||
["keymap", "[class*='presetLabel']"],
|
||||
["editor.inspections", "[class*='profileControls'] > span:first-child"],
|
||||
["vcs.issueNavigation", "[class*='pageBody'] button:not([aria-label])"],
|
||||
|
||||
@@ -39,3 +39,55 @@ test("Compare With… compares against a file picked in the browser", async ({ w
|
||||
const tabs = page.getByRole("tablist", { name: "Editor tabs" });
|
||||
await expect(tabs.getByRole("tab", { name: /other\.md/ })).toBeVisible({ timeout: 15_000 });
|
||||
});
|
||||
|
||||
for (const fragment of [false, true]) {
|
||||
test(`clipboard comparison labels the ${fragment ? "selection" : "file"} and its origin`, async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.evaluate(async (fragment) => {
|
||||
const path = "/dev/acme-api/src/estimate.ts";
|
||||
const source = "const estimate = 4;\nconst total = estimate + 1;\n";
|
||||
const backend = "/src/editor/core/backend.ts";
|
||||
(await import(/* @vite-ignore */ backend)).docBackend().files.set(path, source);
|
||||
const service = "/src/workbench/contributions.ts";
|
||||
await (await import(/* @vite-ignore */ service)).editorService().openFile(path);
|
||||
const editor = "/src/editor/api.ts";
|
||||
const { view } = (await import(/* @vite-ignore */ editor)).activeEditor()!;
|
||||
view.dispatch({ selection: { anchor: 0, head: fragment ? source.indexOf("\n") : 0 } });
|
||||
view.focus();
|
||||
Object.defineProperty(navigator, "clipboard", {
|
||||
value: { readText: async () => "const estimate = 3;\n" },
|
||||
configurable: true,
|
||||
});
|
||||
localStorage.setItem("openidea.vcs.diffOptions", JSON.stringify({ mode: "split", collapse: false }));
|
||||
const actions = "/src/platform/actions.ts";
|
||||
await (await import(/* @vite-ignore */ actions)).executeAction("diff.compareWithClipboard");
|
||||
}, fragment);
|
||||
|
||||
const toolbar = page.getByRole("toolbar", { name: "Diff", exact: true });
|
||||
const viewer = toolbar.locator("..");
|
||||
const file = fragment ? "Selection from estimate.ts" : "estimate.ts";
|
||||
const caption = viewer.getByTitle(`${file} src`, { exact: true });
|
||||
const clipboard = viewer.getByTitle("From Clipboard", { exact: true });
|
||||
await expect(clipboard).toBeVisible();
|
||||
await expect(caption.getByText("src", { exact: true })).toBeVisible();
|
||||
await expect(caption.getByText(file, { exact: true })).toHaveCSS("font-size", "13px");
|
||||
await expect(caption.getByText("src", { exact: true })).toHaveCSS("font-size", "12px");
|
||||
const sides = viewer.locator(".cm-content");
|
||||
await expect(sides.first()).toContainText("const estimate = 3;");
|
||||
await expect(sides.last()).toContainText("const estimate = 4;");
|
||||
const remainingLine = sides.last().getByText("const total =", { exact: false });
|
||||
if (fragment) await expect(remainingLine).toBeHidden();
|
||||
else await expect(remainingLine).toBeVisible();
|
||||
const tabs = page.getByRole("tablist", { name: "Editor tabs" });
|
||||
const title = `Clipboard ↔ estimate.ts${fragment ? " (selection)" : ""}`;
|
||||
await expect(tabs.getByRole("tab", { name: title, exact: true })).toBeVisible();
|
||||
|
||||
await toolbar.getByRole("button", { name: "Swap Sides", exact: true }).click();
|
||||
await expect(caption).toBeVisible();
|
||||
expect((await caption.boundingBox())!.x).toBeLessThan((await clipboard.boundingBox())!.x);
|
||||
await toolbar.getByRole("button", { name: "Settings", exact: true }).click();
|
||||
await page.getByRole("menuitemcheckbox", { name: "Unified Viewer", exact: true }).click();
|
||||
await expect(viewer.getByTitle(`${file} src → From Clipboard`, { exact: true })).toBeVisible();
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function openConsoleSettings(page: Page) {
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
const search = dialog.getByRole("textbox", { name: "Search settings" });
|
||||
await search.fill("Fold console lines that contain");
|
||||
await dialog.getByRole("treeitem", { name: "Console", exact: true }).click();
|
||||
await search.clear();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
test("Console settings put folding between the basic controls and log colors", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1120, height: 740 });
|
||||
const dialog = await openConsoleSettings(page);
|
||||
const wrap = dialog.getByRole("checkbox", { name: "Use soft wraps in console", exact: true });
|
||||
const override = dialog.getByRole("checkbox", { name: /^Override console cycle buffer size/ });
|
||||
const size = dialog.getByRole("textbox", { name: "Override console cycle buffer size", exact: true });
|
||||
const encoding = dialog.getByRole("button", { name: "Default encoding", exact: true });
|
||||
const list = dialog.getByRole("listbox", { name: "Fold console lines that contain", exact: true });
|
||||
const colors = dialog.getByRole("checkbox", { name: "Colour log lines by level", exact: true });
|
||||
await expect(list).toBeVisible();
|
||||
expect((await list.boundingBox())!.width).toBeGreaterThan(480);
|
||||
const controls = [wrap, override, encoding, list, colors];
|
||||
const positions = await Promise.all(controls.map(async (control) => (await control.boundingBox())!.y));
|
||||
positions.forEach((y, index) => {
|
||||
if (index > 0) expect(y).toBeGreaterThan(positions[index - 1]!);
|
||||
});
|
||||
|
||||
for (const width of [580, 520]) {
|
||||
await page.setViewportSize({ width, height: 740 });
|
||||
for (const control of [...controls, size]) await expect(control).toBeInViewport({ ratio: 1 });
|
||||
expect(await list.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
|
||||
}
|
||||
});
|
||||
|
||||
test("Console settings keep the stored buffer size and fold rules across Apply and reopen", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
const dialog = await openConsoleSettings(page);
|
||||
const override = dialog.getByRole("checkbox", { name: /^Override console cycle buffer size/ });
|
||||
const size = dialog.getByRole("textbox", { name: "Override console cycle buffer size", exact: true });
|
||||
const list = dialog.getByRole("listbox", { name: "Fold console lines that contain", exact: true });
|
||||
await override.check();
|
||||
await expect(size).toBeEnabled();
|
||||
await size.fill("2048");
|
||||
await override.uncheck();
|
||||
await expect(size).toBeDisabled();
|
||||
await expect(size).toHaveValue("2048");
|
||||
|
||||
await dialog.getByRole("button", { name: "Add", exact: true }).click();
|
||||
const pattern = list.getByRole("textbox", { name: "Pattern", exact: true });
|
||||
await pattern.fill("at example.retry");
|
||||
await pattern.press("Enter");
|
||||
await expect(list.getByRole("option", { name: "at example.retry", exact: true })).toBeVisible();
|
||||
const apply = dialog.getByRole("button", { name: "Apply", exact: true });
|
||||
await apply.click();
|
||||
await expect(apply).toBeDisabled();
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(dialog).toBeHidden();
|
||||
|
||||
await openConsoleSettings(page);
|
||||
await expect(override).not.toBeChecked();
|
||||
await expect(size).toBeDisabled();
|
||||
await expect(size).toHaveValue("2048");
|
||||
await expect(list.getByRole("option", { name: "at example.retry", exact: true })).toBeVisible();
|
||||
await override.check();
|
||||
await expect(size).toBeEnabled();
|
||||
await expect(size).toHaveValue("2048");
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, openFromTree, test } from "./fixtures";
|
||||
import { expect, openFromTree, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("managed console tabs identify their data source and ordinary SQL tabs keep the file name", async ({
|
||||
workbench: page,
|
||||
@@ -495,8 +495,10 @@ async function runConsole(page: Page, path: string, text: string) {
|
||||
async ({ path, text }) => {
|
||||
const bindingsPath = "/src/bindings.ts";
|
||||
const storePath = "/src/features/database/store.ts";
|
||||
const streamFixturePath = "/src/features/database/executeStream.fixture.ts";
|
||||
const { commands } = await import(bindingsPath);
|
||||
const { executeConsole } = await import(storePath);
|
||||
const { streamExecution } = await import(streamFixturePath);
|
||||
commands.dbStatements = async (_id: string, sql: string) => {
|
||||
let from = 0;
|
||||
const data = sql.split(";").flatMap((part) => {
|
||||
@@ -523,6 +525,7 @@ async function runConsole(page: Page, path: string, text: string) {
|
||||
},
|
||||
})),
|
||||
});
|
||||
commands.dbExecuteStream = streamExecution(commands.dbExecute);
|
||||
await executeConsole(path, text, 0, text.length);
|
||||
},
|
||||
{ path, text },
|
||||
@@ -532,6 +535,7 @@ async function runConsole(page: Page, path: string, text: string) {
|
||||
test("console runs replace their unpinned results; pinned results stay until Close All but Pinned", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await stubDesktop(page);
|
||||
await seedResults(page);
|
||||
const strip = page.getByRole("tablist", { name: "Results", exact: true }).getByRole("tab");
|
||||
await choose(page, "Result 1", "Close All");
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("Date Formats keeps its preview beside the formatting controls and updates it while editing", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.clock.setFixedTime(new Date(2026, 0, 16, 14, 35));
|
||||
await page.keyboard.press("Meta+,");
|
||||
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
const search = dialog.getByRole("textbox", { name: "Search settings" });
|
||||
const openPage = async () => {
|
||||
await search.fill("Date Formats");
|
||||
await dialog.getByRole("treeitem", { name: "Date Formats", exact: true }).click();
|
||||
await search.clear();
|
||||
};
|
||||
await openPage();
|
||||
|
||||
const override = dialog.getByRole("checkbox", { name: "Override system date and time format" });
|
||||
const pattern = dialog.getByRole("textbox", { name: /^Date format/ });
|
||||
const hour = dialog.getByRole("checkbox", { name: "Use 24-hour time format" });
|
||||
const pretty = dialog.getByRole("checkbox", { name: "Use pretty formatting" });
|
||||
const hint = dialog.getByText("Placeholders: yyyy, yy, MMMM, MMM, MM, M, dd, d", { exact: true });
|
||||
const initialPreview = dialog.getByText(/Today .* · /);
|
||||
|
||||
for (const width of [1120, 580, 520]) {
|
||||
await page.setViewportSize({ width, height: 680 });
|
||||
await expect(async () => {
|
||||
const [hourBox, previewBox, prettyBox, patternBox, hintBox] = await Promise.all(
|
||||
[hour, initialPreview, pretty, pattern, hint].map((control) => control.boundingBox()),
|
||||
);
|
||||
expect(previewBox!.y).toBeGreaterThan(hourBox!.y + hourBox!.height);
|
||||
expect(prettyBox!.y).toBeGreaterThan(previewBox!.y + previewBox!.height);
|
||||
if (width === 1120) {
|
||||
expect(hintBox!.x).toBeGreaterThan(patternBox!.x + patternBox!.width);
|
||||
expect(hintBox!.y + hintBox!.height).toBeLessThanOrEqual(patternBox!.y + patternBox!.height + 1);
|
||||
} else {
|
||||
expect(hintBox!.y).toBeGreaterThanOrEqual(patternBox!.y + patternBox!.height);
|
||||
}
|
||||
}).toPass({ timeout: 3000 });
|
||||
}
|
||||
|
||||
const preview = dialog.getByRole("status", { name: /^Preview/ });
|
||||
await expect(pattern).toBeDisabled();
|
||||
await expect(hour).toBeDisabled();
|
||||
await expect(pretty).toBeEnabled();
|
||||
await override.check();
|
||||
await pattern.fill("yyyy-MM-dd");
|
||||
await expect(preview).toHaveText("Today 12:35 · 2026-01-13 14:35");
|
||||
await hour.uncheck();
|
||||
await expect(preview).toHaveText("Today 12:35 PM · 2026-01-13 2:35 PM");
|
||||
await pretty.uncheck();
|
||||
await expect(preview).toHaveText("2026-01-16 12:35 PM · 2026-01-13 2:35 PM");
|
||||
|
||||
await dialog.getByRole("button", { name: "OK", exact: true }).click();
|
||||
await page.keyboard.press("Meta+,");
|
||||
await openPage();
|
||||
await expect(override).toBeChecked();
|
||||
await expect(pattern).toHaveValue("yyyy-MM-dd");
|
||||
await expect(hour).not.toBeChecked();
|
||||
await expect(pretty).not.toBeChecked();
|
||||
await expect(preview).toHaveText("2026-01-16 12:35 PM · 2026-01-13 2:35 PM");
|
||||
});
|
||||
@@ -133,16 +133,30 @@ test("Evaluate keeps a multiline expression and its result visible in a short di
|
||||
];
|
||||
const stateModule = "/src/features/debugger/state.ts";
|
||||
const { adoptSession } = await import(/* @vite-ignore */ stateModule);
|
||||
const projectModule = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
||||
const settings = useProject.getState().settings;
|
||||
useProject.setState({
|
||||
settings: {
|
||||
...settings,
|
||||
editor: { ...settings?.editor, fontFamily: "Consolas", fontSize: 18, lineHeight: 28 },
|
||||
},
|
||||
});
|
||||
adoptSession(session, { name: "Checkout", adapter: "debugpy", status: "paused", selectedFrame: 11 });
|
||||
}, SESSION);
|
||||
|
||||
await page.keyboard.press("Alt+F8");
|
||||
const dialog = page.getByRole("dialog", { name: "Evaluate expression" });
|
||||
const field = dialog.getByRole("textbox", { name: "Expression" });
|
||||
await expect(field).toHaveCSS("font-size", "18px");
|
||||
await expect(field).toHaveCSS("line-height", "28px");
|
||||
await expect(field).toHaveCSS("font-family", /^"?Consolas"?,/);
|
||||
const expression = ["orderSummary(", ...Array.from({ length: 12 }, (_, i) => ` item${i},`), ")"].join("\n");
|
||||
await field.fill(expression);
|
||||
await field.press("Enter");
|
||||
const result = dialog.getByRole("tree", { name: "Evaluation result" });
|
||||
const result = dialog.getByRole("region", { name: "Result", exact: true }).getByRole("tree", {
|
||||
name: "Evaluation result",
|
||||
});
|
||||
const row = result.getByRole("treeitem").first();
|
||||
await expect(row).toContainText("total = 36");
|
||||
await expect
|
||||
@@ -165,8 +179,24 @@ test("Evaluate keeps a multiline expression and its result visible in a short di
|
||||
await expect(result.getByText("tax", { exact: true })).toBeVisible();
|
||||
|
||||
await field.fill("otherExpression");
|
||||
await dialog.getByRole("button", { name: "History", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: /orderSummary/ }).click();
|
||||
const historyButton = dialog.getByRole("button", { name: "History", exact: true });
|
||||
const history = page.getByRole("menu", { name: "Expression history" });
|
||||
const option = history.getByRole("menuitem", { name: /orderSummary/ });
|
||||
await historyButton.click();
|
||||
await expect(option).toBeVisible();
|
||||
await expect(option).toHaveCSS("font-size", "18px");
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const inputBounds = (await field.locator("..").boundingBox())!;
|
||||
const menuBounds = (await history.locator("..").boundingBox())!;
|
||||
return Math.max(Math.abs(inputBounds.x - menuBounds.x), Math.abs(inputBounds.width - menuBounds.width));
|
||||
})
|
||||
.toBeLessThan(1);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(history).toBeHidden();
|
||||
await expect(historyButton).toBeFocused();
|
||||
await historyButton.press("Enter");
|
||||
await option.press("Enter");
|
||||
await expect(field).toHaveValue(expression);
|
||||
await expect(field).toBeFocused();
|
||||
});
|
||||
@@ -69,7 +69,11 @@ test("keeps frame sources and the keyboard selection visible in a narrow debug d
|
||||
expect(await frames.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
|
||||
|
||||
await thread.click();
|
||||
await page.getByRole("option", { name: "Order worker", exact: true }).click();
|
||||
await page
|
||||
.getByRole("listbox", { name: "Thread" })
|
||||
.getByRole("option")
|
||||
.filter({ has: page.getByText("Order worker", { exact: true }) })
|
||||
.click();
|
||||
await expect(thread).toContainText("Order worker");
|
||||
await expect(frames.getByRole("option", { selected: true })).toContainText("processOrder");
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("shows thread states in the compact frames header and switches frames by keyboard", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 940, height: 740 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const stateModule = "/src/features/debugger/state.ts";
|
||||
const workbenchModule = "/src/workbench/contributions.ts";
|
||||
const { adoptSession } = await import(/* @vite-ignore */ stateModule);
|
||||
const { toolWindowService } = await import(/* @vite-ignore */ workbenchModule);
|
||||
const frame = (id: number, name: string) => ({
|
||||
id,
|
||||
name,
|
||||
path: null,
|
||||
line: 0,
|
||||
column: 0,
|
||||
presentationHint: null,
|
||||
});
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.debug_stack_trace = ({ threadId }) => [frame(Number(threadId) * 10, "writeLedger")];
|
||||
handlers.debug_scopes = () => [];
|
||||
adoptSession(97, {
|
||||
name: "Settlement",
|
||||
adapter: "debugpy",
|
||||
status: "paused",
|
||||
stoppedThread: 1,
|
||||
selectedThread: 1,
|
||||
stopReason: "breakpoint",
|
||||
suspendedThreads: [{ id: 2, reason: "pause", description: null }],
|
||||
threads: [
|
||||
{ id: 1, name: "MainThread" },
|
||||
{ id: 2, name: "Audit writer" },
|
||||
{ id: 3, name: "Regional settlement reconciliation worker with a long queue name" },
|
||||
],
|
||||
selectedFrame: 10,
|
||||
frames: [frame(10, "settle")],
|
||||
});
|
||||
toolWindowService().show("debug", true);
|
||||
});
|
||||
|
||||
const debug = page.getByRole("region", { name: "Debug", exact: true });
|
||||
const thread = debug.getByRole("button", { name: "Thread", exact: true });
|
||||
await expect(thread).toBeVisible();
|
||||
const remainder = await thread.evaluate((button) => button.parentElement!.clientWidth - button.clientWidth);
|
||||
expect(remainder).toBeLessThan(12);
|
||||
await expect(thread).toHaveAccessibleDescription("MainThread (At breakpoint)");
|
||||
const frames = debug.getByRole("listbox", { name: "Frames" });
|
||||
await expect(frames.getByText("settle", { exact: true })).toBeVisible();
|
||||
|
||||
await thread.press("ArrowDown");
|
||||
const menu = page.getByRole("listbox", { name: "Thread" });
|
||||
await expect(menu).toBeInViewport({ ratio: 1 });
|
||||
await expect(menu.getByRole("option", { name: "MainThread At breakpoint" })).toBeVisible();
|
||||
await expect(menu.getByRole("option", { name: "Audit writer Suspended" })).toBeVisible();
|
||||
await expect(
|
||||
menu.getByRole("option", { name: /Regional settlement reconciliation worker .* Running/ }),
|
||||
).toBeVisible();
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(menu).toBeHidden();
|
||||
await expect(thread).toHaveAccessibleDescription("Audit writer (Suspended)");
|
||||
await expect(frames.getByText("writeLedger", { exact: true })).toBeVisible();
|
||||
expect(await ipcCalls(page, "debug_stack_trace")).toEqual([{ session: 97, threadId: 2 }]);
|
||||
});
|
||||
@@ -0,0 +1,86 @@
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test.use({ reducedMotion: "reduce" });
|
||||
|
||||
const NAME = "settlementTranscript";
|
||||
const TRANSCRIPT = Array.from(
|
||||
{ length: 78 },
|
||||
(_, index) => `Event ${String(index + 1).padStart(3, "0")}\tSettlement record verified`,
|
||||
).join("\n");
|
||||
|
||||
test("the debugger's full value uses the editor font and fills the resized viewer", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1320, height: 880 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(
|
||||
async ({ name, transcript }) => {
|
||||
const project = "/src/platform/project.ts";
|
||||
const debug = "/src/features/debugger/state.ts";
|
||||
const services = "/src/workbench/contributions.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ project);
|
||||
const { settings } = useProject.getState();
|
||||
useProject.setState({
|
||||
settings: { ...settings, editor: { ...settings?.editor, fontSize: 18, lineHeight: 24, tabSize: 8 } },
|
||||
});
|
||||
const { adoptSession } = await import(/* @vite-ignore */ debug);
|
||||
const { toolWindowService } = await import(/* @vite-ignore */ services);
|
||||
const ipc = window.__ipc.handlers;
|
||||
ipc.debug_scopes = () => [{ name: "Locals", variablesReference: 100, expensive: false }];
|
||||
ipc.debug_variables = () => [
|
||||
{
|
||||
name,
|
||||
value: JSON.stringify(transcript.slice(0, 720)),
|
||||
typeName: "str",
|
||||
variablesReference: 0,
|
||||
evaluateName: name,
|
||||
},
|
||||
];
|
||||
ipc.debug_evaluate_in = () => ({
|
||||
name,
|
||||
value: JSON.stringify(transcript),
|
||||
typeName: "str",
|
||||
variablesReference: 0,
|
||||
evaluateName: name,
|
||||
});
|
||||
adoptSession(91, {
|
||||
name: "Settlement review",
|
||||
adapter: "debugpy",
|
||||
status: "paused",
|
||||
selectedFrame: 11,
|
||||
frames: [{ id: 11, name: "checkout", path: null, line: 0, column: 0, presentationHint: null }],
|
||||
});
|
||||
toolWindowService().show("debug", true);
|
||||
},
|
||||
{ name: NAME, transcript: TRANSCRIPT },
|
||||
);
|
||||
const debug = page.getByRole("region", { name: "Debug", exact: true });
|
||||
await debug.getByRole("tab", { name: "Threads & Variables", exact: true }).click();
|
||||
await debug.getByRole("treeitem").filter({ hasText: NAME }).getByTitle("Show", { exact: true }).click();
|
||||
const dialog = page.getByRole("dialog", { name: `Value of ${NAME}` });
|
||||
const value = dialog.locator("pre");
|
||||
await expect(value).toHaveText(TRANSCRIPT, { useInnerText: false });
|
||||
await expect(value).toHaveCSS("font-size", "18px");
|
||||
await expect(value).toHaveCSS("line-height", "24px");
|
||||
await expect(value).toHaveCSS("tab-size", "8");
|
||||
await expect(value).toBeFocused();
|
||||
const before = (await value.boundingBox())!.height;
|
||||
const grip = (await dialog.getByRole("separator", { name: "Resize", exact: true }).boundingBox())!;
|
||||
const x = grip.x + grip.width - 3;
|
||||
const y = grip.y + grip.height - 3;
|
||||
await page.mouse.move(x, y);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(x + 190, y + 180, { steps: 6 });
|
||||
await page.mouse.up();
|
||||
await expect.poll(async () => (await value.boundingBox())!.height).toBeGreaterThan(before + 120);
|
||||
const overflow = (el: Element) => el.scrollHeight - el.clientHeight;
|
||||
expect(await dialog.locator("[data-dialog-body]").evaluate(overflow)).toBe(0);
|
||||
expect(await value.evaluate(overflow)).toBeGreaterThan(0);
|
||||
|
||||
await page.setViewportSize({ width: 490, height: 440 });
|
||||
await expect(dialog).toBeInViewport({ ratio: 1 });
|
||||
await expect(value).toBeInViewport({ ratio: 1 });
|
||||
await value.evaluate((el) => (el.scrollTop = el.scrollHeight));
|
||||
expect(await value.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
|
||||
expect(await value.textContent()).toBe(TRANSCRIPT);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(dialog).toBeHidden();
|
||||
});
|
||||
@@ -0,0 +1,56 @@
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("Debugger Data Views keeps the hover delay with its setting at each window width", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1120, height: 740 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(() => {
|
||||
window.__ipc.handlers.settings_get_global = () => ({});
|
||||
});
|
||||
await page.keyboard.press("Meta+,");
|
||||
const settings = page.getByRole("dialog", { name: "Settings", exact: true });
|
||||
const search = settings.getByRole("textbox", { name: "Search settings" });
|
||||
await search.fill("value tooltip delay");
|
||||
await settings.getByRole("treeitem", { name: "Data Views", exact: true }).click();
|
||||
await search.clear();
|
||||
|
||||
const hover = settings.getByRole("checkbox", { name: "Show value tooltip on mouse hover", exact: true });
|
||||
const delay = settings.getByRole("textbox", { name: "Value tooltip delay (ms)", exact: true });
|
||||
const selection = settings.getByRole("checkbox", { name: "Show value tooltip on code selection", exact: true });
|
||||
const sort = settings.getByRole("checkbox", { name: "Sort values alphabetically", exact: true });
|
||||
const editor = settings.getByRole("region", { name: "Editor", exact: true });
|
||||
|
||||
for (const width of [1120, 580, 520]) {
|
||||
await page.setViewportSize({ width, height: 740 });
|
||||
await expect(delay).toBeInViewport({ ratio: 1 });
|
||||
const [toggleBox, delayBox, selectionBox] = await Promise.all(
|
||||
[hover, delay, selection].map((control) => control.boundingBox()),
|
||||
);
|
||||
if (!toggleBox || !delayBox || !selectionBox) throw new Error("Missing Data Views control bounds");
|
||||
expect(delayBox.y + delayBox.height).toBeLessThan(selectionBox.y);
|
||||
if (width === 1120) {
|
||||
expect(delayBox.x).toBeGreaterThan(toggleBox.x + toggleBox.width);
|
||||
expect(Math.abs(delayBox.y + delayBox.height / 2 - toggleBox.y - toggleBox.height / 2)).toBeLessThan(3);
|
||||
} else {
|
||||
expect(delayBox.y).toBeGreaterThan(toggleBox.y + toggleBox.height);
|
||||
}
|
||||
}
|
||||
await expect(editor.getByRole("checkbox", { name: "Show values inline", exact: true })).toBeVisible();
|
||||
await expect(editor.getByRole("checkbox", { name: "Sort values alphabetically", exact: true })).toHaveCount(0);
|
||||
await expect(sort).toBeVisible();
|
||||
|
||||
await expect(hover).toBeChecked();
|
||||
await expect(delay).toHaveValue("700");
|
||||
await delay.fill("900");
|
||||
await selection.uncheck();
|
||||
await hover.uncheck();
|
||||
await expect(delay).toBeDisabled();
|
||||
await expect(delay).toHaveValue("900");
|
||||
await selection.check();
|
||||
await expect(hover).not.toBeChecked();
|
||||
await hover.check();
|
||||
await expect(delay).toBeEnabled();
|
||||
await expect(delay).toHaveValue("900");
|
||||
await settings.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(settings).toBeHidden();
|
||||
expect(await ipcCalls(page, "settings_set")).toEqual([]);
|
||||
});
|
||||
@@ -46,6 +46,50 @@ test("a narrow diff keeps navigation, settings and the difference count visible"
|
||||
await expect(toolbar).toContainText("1 of 1 differences");
|
||||
});
|
||||
|
||||
test("combined diff file actions stay visible beside a long name in a narrow pane", async ({ workbench: page }) => {
|
||||
const longName = "OrderHistoryCustomerNotificationDeliveryPreferencesValidationDefaults.txt";
|
||||
const directory = "/dev/acme-api/src/main/orders/preferences";
|
||||
await page.evaluate(
|
||||
async (paths) => {
|
||||
const optionsPath = "/src/features/vcs/allInOneDiff.ts";
|
||||
const inputPath = "/src/features/vcs/diffInput.ts";
|
||||
const { setAllInOneDiff } = await import(optionsPath);
|
||||
const { openDiff, withChain } = await import(inputPath);
|
||||
setAllInOneDiff(true);
|
||||
await openDiff(
|
||||
withChain(
|
||||
paths.map((path) => ({
|
||||
path,
|
||||
left: { type: "text", text: "before\n", label: "HEAD" },
|
||||
right: { type: "worktree" },
|
||||
})),
|
||||
0,
|
||||
),
|
||||
);
|
||||
},
|
||||
[`${directory}/${longName}`, `${directory}/Notes.txt`],
|
||||
);
|
||||
await page.setViewportSize({ width: 460, height: 600 });
|
||||
|
||||
const file = page.getByRole("region", { name: longName, exact: true });
|
||||
const header = file.getByRole("button", { name: /^(Collapse|Expand) File$/ }).locator("..");
|
||||
const open = header.getByRole("button", { name: "Open in Separate Tab", exact: true });
|
||||
const jump = header.getByRole("button", { name: "Jump to Source", exact: true });
|
||||
await expect(open).toBeInViewport({ ratio: 1 });
|
||||
await expect(jump).toBeInViewport({ ratio: 1 });
|
||||
const label = header.getByText(longName, { exact: true });
|
||||
await expect(label).toHaveCSS("text-overflow", "ellipsis");
|
||||
const labelBox = (await label.boundingBox())!;
|
||||
const jumpBox = (await jump.boundingBox())!;
|
||||
expect(labelBox.x).toBeGreaterThan(jumpBox.x + jumpBox.width);
|
||||
await expect(header).toContainText("src/main/orders/preferences");
|
||||
|
||||
await header.getByRole("button", { name: "Collapse File", exact: true }).click();
|
||||
await expect(file.getByRole("button", { name: "Expand File", exact: true })).toBeVisible();
|
||||
await open.click();
|
||||
await expect(page.getByRole("tab", { name: new RegExp(longName), selected: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("maximizes a diff preview tab and restores its previous layout", async ({ workbench: page }) => {
|
||||
const toolbar = await openChain(page);
|
||||
const viewer = toolbar.locator("..");
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
import type { Locator } from "@playwright/test";
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
async function expectAligned(grid: Locator, names: string[]) {
|
||||
await expect(grid.getByRole("columnheader")).toHaveText(names);
|
||||
await expect
|
||||
.poll(() =>
|
||||
grid.evaluate((element) => {
|
||||
const head = [...element.querySelectorAll('[role="columnheader"]')].filter(
|
||||
(cell) => cell.getClientRects().length,
|
||||
);
|
||||
const row = element.querySelector('[aria-rowindex="2"]');
|
||||
const cells = [...(row?.querySelectorAll('[role="gridcell"]') ?? [])].filter(
|
||||
(cell) => cell.getClientRects().length,
|
||||
);
|
||||
return (
|
||||
cells.length === head.length &&
|
||||
head.every((cell, index) => {
|
||||
const header = cell.getBoundingClientRect();
|
||||
const value = cells[index]!.getBoundingClientRect();
|
||||
return Math.abs(header.x - value.x) < 1 && Math.abs(header.width - value.width) < 1;
|
||||
})
|
||||
);
|
||||
}),
|
||||
)
|
||||
.toBe(true);
|
||||
}
|
||||
|
||||
test("directory comparison mirrors both sides and keeps the headers aligned while the list scrolls", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1220, height: 780 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const entry = {
|
||||
leftKind: "file",
|
||||
rightKind: "file",
|
||||
status: "different",
|
||||
leftSize: 120,
|
||||
rightSize: 144,
|
||||
leftModified: Date.UTC(2026, 9, 8, 12),
|
||||
rightModified: Date.UTC(2026, 9, 9, 12),
|
||||
};
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.fs_entry_kind = ({ path }) => (String(path).endsWith(".txt") ? "file" : "dir");
|
||||
handlers.cancel_request = () => null;
|
||||
handlers.fs_read_text = () => "";
|
||||
handlers.fs_compare_directories = () => [
|
||||
{ ...entry, path: "00-configuration.txt" },
|
||||
...Array.from({ length: 65 }, (_, index) => ({ ...entry, path: `log-${index}.txt` })),
|
||||
{ ...entry, path: "only-left.txt", rightKind: null, rightSize: null, status: "leftOnly" },
|
||||
{ ...entry, path: "shared.txt", status: "equal" },
|
||||
];
|
||||
const actions = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actions);
|
||||
await executeAction("toolwindow.hideAll");
|
||||
await executeAction("diff.compareDirectories", ["/dev/acme-api/source", "/dev/acme-api/target"]);
|
||||
});
|
||||
|
||||
const grid = page.getByRole("grid", { name: "Compared files" });
|
||||
const filter = page.getByRole("textbox", { name: "Filter by name" });
|
||||
const source = page.getByText("Left: source", { exact: true });
|
||||
const target = page.getByText("Right: target", { exact: true });
|
||||
await expect(source).toBeVisible();
|
||||
await expect(target).toBeVisible();
|
||||
const [pathBox, filterBox] = await Promise.all([source.boundingBox(), filter.boundingBox()]);
|
||||
if (!pathBox || !filterBox) throw new Error("Missing comparison toolbar bounds");
|
||||
expect(pathBox.y).toBeGreaterThanOrEqual(filterBox.y + filterBox.height);
|
||||
await expectAligned(grid, ["Name", "Size", "Date", "", "Date", "Size", "Name"]);
|
||||
const first = grid.getByRole("row").filter({ has: page.getByRole("gridcell", { name: "00-configuration.txt" }) });
|
||||
const values = await first.getByRole("gridcell").allTextContents();
|
||||
expect(values.at(0)).toBe("00-configuration.txt");
|
||||
expect(values.at(1)).toBe("120 B");
|
||||
expect(values.at(-2)).toBe("144 B");
|
||||
expect(values.at(-1)).toBe("00-configuration.txt");
|
||||
const rows = grid.locator('[role="rowgroup"][tabindex="0"]');
|
||||
expect(await rows.evaluate((el) => el.scrollHeight)).toBeGreaterThan(await rows.evaluate((el) => el.clientHeight));
|
||||
|
||||
await page.setViewportSize({ width: 630, height: 740 });
|
||||
await expectAligned(grid, ["Name", "Size", "", "Size", "Name"]);
|
||||
await expect(first.getByRole("gridcell").first()).toHaveAttribute("title", /00-configuration.txt.*120 B/);
|
||||
const setContainerType = (value: string) =>
|
||||
filter.evaluate((el, type) => {
|
||||
const container = el.parentElement?.parentElement;
|
||||
if (!container) throw new Error("Missing directory comparison container");
|
||||
container.style.containerType = type;
|
||||
}, value);
|
||||
await setContainerType("normal");
|
||||
await expectAligned(grid, ["Name", "Size", "Date", "", "Date", "Size", "Name"]);
|
||||
await expect(first.getByRole("gridcell").first()).toBeInViewport({ ratio: 1 });
|
||||
await setContainerType("");
|
||||
await page.setViewportSize({ width: 360, height: 740 });
|
||||
await expectAligned(grid, ["Name", "", "Name"]);
|
||||
|
||||
await page.setViewportSize({ width: 630, height: 740 });
|
||||
await filter.fill("shared");
|
||||
await expect(page.getByText("No matching differences", { exact: true })).toBeVisible();
|
||||
await page.getByRole("button", { name: "Show identical files" }).click();
|
||||
const shared = grid.getByRole("gridcell", { name: "shared.txt", exact: true });
|
||||
await expect(shared).toHaveCount(2);
|
||||
await shared.first().click();
|
||||
await expect(page.getByRole("button", { name: "Copy to Right", exact: true })).toBeEnabled();
|
||||
await expect(page.getByRole("toolbar", { name: "Diff", exact: true })).toBeVisible();
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
const INSTALL_PATH = `C:/toolchains/${"managed-java-".repeat(16)}jdk`;
|
||||
|
||||
test("Download JDK keeps its fields in order and fits long paths in a narrow window", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1120, height: 740 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async (path) => {
|
||||
const ipc = window.__ipc;
|
||||
ipc.handlers.sdk_detect = () => [];
|
||||
ipc.handlers.jdk_download_vendors = () => [
|
||||
{ id: "temurin", name: "Eclipse Temurin" },
|
||||
{ id: "microsoft", name: "Microsoft Build of OpenJDK" },
|
||||
];
|
||||
ipc.handlers.jdk_download_releases = () => ({ versions: [25, 21, 17], lts: [25, 21, 17], recommended: 25 });
|
||||
ipc.handlers.jdk_download_location = () => path;
|
||||
ipc.handlers.jdk_download = ({ onEvent }) => {
|
||||
ipc.send(onEvent, { type: "progress", fraction: 0.5, message: "Downloaded 50 of 100 MB" });
|
||||
return new Promise(() => {});
|
||||
};
|
||||
ipc.handlers.cancel_request = () => null;
|
||||
const actions = "/src/platform/actions.ts";
|
||||
await (await import(/* @vite-ignore */ actions)).executeAction("file.projectStructure", "sdks");
|
||||
}, INSTALL_PATH);
|
||||
await page.getByRole("button", { name: "Add SDK", exact: true }).click();
|
||||
await page.getByRole("menuitem", { name: "Download JDK…", exact: true }).click();
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Download JDK", exact: true });
|
||||
const version = dialog.getByRole("button", { name: "Version", exact: true });
|
||||
const vendor = dialog.getByRole("button", { name: "Vendor", exact: true });
|
||||
const location = dialog.getByRole("textbox", { name: "Location:", exact: true });
|
||||
await expect(version).toHaveText("25");
|
||||
expect((await version.boundingBox())!.y).toBeLessThan((await vendor.boundingBox())!.y);
|
||||
expect((await version.boundingBox())!.x).toBeCloseTo((await vendor.boundingBox())!.x, 0);
|
||||
expect((await location.boundingBox())!.x).toBeCloseTo((await vendor.boundingBox())!.x, 0);
|
||||
await expect(location).toHaveValue(INSTALL_PATH);
|
||||
await expect(location).toHaveCSS("font-size", "13px");
|
||||
|
||||
await page.setViewportSize({ width: 400, height: 560 });
|
||||
const content = dialog.locator("[data-dialog-body]");
|
||||
expect(await content.evaluate((el) => el.scrollWidth)).toBe(await content.evaluate((el) => el.clientWidth));
|
||||
const locationLabel = dialog.getByText("Location:", { exact: true });
|
||||
expect((await locationLabel.boundingBox())!.y).toBeLessThan((await location.boundingBox())!.y);
|
||||
expect((await locationLabel.boundingBox())!.x).toBeCloseTo((await location.boundingBox())!.x, 0);
|
||||
await expect(dialog.getByRole("button", { name: "Browse…", exact: true })).toBeInViewport({ ratio: 1 });
|
||||
await vendor.click();
|
||||
await page.getByRole("option", { name: "Microsoft Build of OpenJDK", exact: true }).click();
|
||||
await version.click();
|
||||
await page.getByRole("option", { name: /21/ }).click();
|
||||
const editedPath = INSTALL_PATH + "-lts";
|
||||
await location.fill(editedPath);
|
||||
const download = dialog.getByRole("button", { name: "Download", exact: true });
|
||||
await download.click();
|
||||
await expect(dialog.getByRole("progressbar", { name: "Downloading JDK" })).toHaveAttribute("aria-valuenow", "50");
|
||||
await expect(download).toBeDisabled();
|
||||
const [request] = await ipcCalls(page, "jdk_download");
|
||||
expect(request).toMatchObject({ vendor: "microsoft", version: 21, location: editedPath });
|
||||
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect.poll(() => ipcCalls(page, "cancel_request")).toContainEqual({ id: request!.request });
|
||||
});
|
||||
@@ -13,6 +13,40 @@ test("opens a file from the project tree and types into it", async ({ workbench:
|
||||
await expect(editor.locator(".cm-content")).not.toContainText("// typed by e2e");
|
||||
});
|
||||
|
||||
test("indentation shows the language and current width with room for the keyboard choices", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await openFromTree(page, "build.gradle.kts");
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/editor/core/controller.ts";
|
||||
const { editorController, useEditorStatus } = await import(/* @vite-ignore */ path);
|
||||
const active = useEditorStatus.getState().status!.path;
|
||||
editorController().manager.get(active)!.setIndent({ tabSize: 3, insertSpaces: true });
|
||||
});
|
||||
|
||||
const status = page.getByRole("button", { name: "3 spaces", exact: true });
|
||||
await status.click();
|
||||
const menu = page.getByRole("menu", { name: "Indentation", exact: true });
|
||||
const title = page.getByText("Kotlin Code Style", { exact: true });
|
||||
await expect(title).toBeVisible();
|
||||
await page.setViewportSize({ width: 500, height: 520 });
|
||||
await expect(title).toBeInViewport({ ratio: 1 });
|
||||
await expect(title).toHaveCSS("font-size", "13px");
|
||||
await expect(title).toHaveCSS("font-weight", "600");
|
||||
await expect(menu.getByRole("menuitemcheckbox", { name: "3 spaces", checked: true })).toBeInViewport({ ratio: 1 });
|
||||
await expect(menu.getByRole("menuitem", { name: "Configure Indents…" })).toBeInViewport({ ratio: 1 });
|
||||
|
||||
await expect(menu.getByRole("menuitemcheckbox", { name: "2 spaces", checked: false })).toBeFocused();
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await page.keyboard.press("ArrowDown");
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(menu).toBeHidden();
|
||||
const four = page.getByRole("button", { name: "4 spaces", exact: true });
|
||||
await expect(four).toBeVisible();
|
||||
await four.click();
|
||||
await expect(menu.getByRole("menuitemcheckbox", { name: "4 spaces", checked: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("Delete edits text after the focused Project tree is remounted", async ({ workbench: page }) => {
|
||||
const editor = await openFromTree(page, "README.md");
|
||||
const content = editor.locator(".cm-content");
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
test("empty editor hints form a readable block and reveal the Project shortcut when needed", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1200, height: 820 });
|
||||
const hints = page.locator("[data-editor-area] dl");
|
||||
const project = hints.getByRole("button", { name: "Project", exact: true });
|
||||
await expect(hints).toBeVisible();
|
||||
await expect(hints).toHaveCSS("font-size", "16px");
|
||||
await expect(project).toBeHidden();
|
||||
const rowLefts = await hints.locator("dt").evaluateAll((rows) => rows.map((row) => row.getBoundingClientRect().left));
|
||||
expect(new Set(rowLefts).size).toBe(1);
|
||||
const bounds = await hints.evaluate((element) => {
|
||||
const area = element.parentElement!.getBoundingClientRect();
|
||||
const block = element.getBoundingClientRect();
|
||||
const first = element.querySelector("dt")!.getBoundingClientRect();
|
||||
return {
|
||||
center: Math.abs(block.left + block.width / 2 - (area.left + area.width / 2)),
|
||||
topRatio: (first.top - area.top) / area.height,
|
||||
};
|
||||
});
|
||||
expect(bounds.center).toBeLessThan(1);
|
||||
expect(bounds.topRatio).toBeGreaterThan(0.31);
|
||||
expect(bounds.topRatio).toBeLessThan(0.39);
|
||||
|
||||
await page.locator('[data-stripe-button="project"]').click();
|
||||
await expect(project).toBeVisible();
|
||||
await expect(project.locator("xpath=../../dd")).not.toBeEmpty();
|
||||
await project.click();
|
||||
await expect(page.getByRole("region", { name: "Project", exact: true })).toBeVisible();
|
||||
await expect(project).toBeHidden();
|
||||
|
||||
await page.setViewportSize({ width: 400, height: 360 });
|
||||
await expect(project).toBeVisible();
|
||||
await expect(hints.getByText("Drop files here to open them", { exact: true })).toBeInViewport({ ratio: 1 });
|
||||
expect(await hints.evaluate((element) => element.scrollWidth - element.clientWidth)).toBeLessThanOrEqual(1);
|
||||
await hints.getByRole("button", { name: "Search Everywhere", exact: true }).click();
|
||||
await expect(page.getByRole("dialog", { name: "Search Everywhere" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("the empty LightEdit window keeps its file actions at the same readable size", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 400, height: 360 });
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ path);
|
||||
useProject.setState({ project: null, lightEdit: true });
|
||||
});
|
||||
const hints = page.locator("[data-editor-area] dl");
|
||||
await expect(hints).toHaveCSS("font-size", "16px");
|
||||
await expect(hints.locator("dt")).toHaveText(["New File", "Open File", "Drop files here to open them"]);
|
||||
await expect(hints.getByRole("button", { name: "Open File", exact: true })).toBeInViewport({ ratio: 1 });
|
||||
});
|
||||
@@ -0,0 +1,104 @@
|
||||
import { expect, ipcCalls, openFromTree, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("the file revision chooser previews commit messages and compares the selected revision", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await openFromTree(page, "build.gradle.kts");
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const root = "/dev/acme-api";
|
||||
const path = `${root}/build.gradle.kts`;
|
||||
const latest = "123abcd000000000000000000000000000000000";
|
||||
const previous = "456efab000000000000000000000000000000000";
|
||||
window.__ipc.handlers.vcs_revision_files = () => ["build.gradle.kts"];
|
||||
window.__ipc.handlers.vcs_log = () => [
|
||||
{
|
||||
id: latest,
|
||||
shortId: "123abcd",
|
||||
author: "Lena Park",
|
||||
timeMs: Date.now(),
|
||||
summary: "Update reviewed totals",
|
||||
message: "Update reviewed totals",
|
||||
messageTruncated: true,
|
||||
},
|
||||
{
|
||||
id: previous,
|
||||
shortId: "456efab",
|
||||
author: "Morgan Chen",
|
||||
timeMs: Date.UTC(2025, 9, 18),
|
||||
summary: "Include October adjustments",
|
||||
message: "Include October adjustments\n\nUse the corrected quantities from the October review.",
|
||||
},
|
||||
];
|
||||
window.__ipc.handlers.vcs_log_details_batch = () => [
|
||||
{ message: "Update reviewed totals\n\nUse the totals reviewed by the release team." },
|
||||
];
|
||||
window.__ipc.handlers.vcs_file_at = () => "val reviewedTotal = 28\n";
|
||||
window.__ipc.handlers.vcs_file_mode = () => "100644";
|
||||
|
||||
const storeModule = "/src/features/vcs/store.ts";
|
||||
const historyModule = "/src/features/vcs/fileRevisions.ts";
|
||||
const contextModule = "/src/platform/context.ts";
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { useVcs } = await import(/* @vite-ignore */ storeModule);
|
||||
const { hasFileHistory, trackFileHistory } = await import(/* @vite-ignore */ historyModule);
|
||||
const { setContext } = await import(/* @vite-ignore */ contextModule);
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
useVcs.setState({ roots: [root], heads: { [root]: { headCommit: latest } }, statusLoaded: true });
|
||||
trackFileHistory();
|
||||
await expectFileHistory();
|
||||
setContext("vcsAvailable", true);
|
||||
await executeAction("vcs.compareWithRevision", path);
|
||||
|
||||
async function expectFileHistory() {
|
||||
for (let i = 0; i < 20 && !hasFileHistory(path); i++) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
}
|
||||
if (!hasFileHistory(path)) throw new Error("The sample file has no tracked history");
|
||||
}
|
||||
});
|
||||
|
||||
const chooser = page.getByRole("dialog", { name: "Compare with Revision…" });
|
||||
const search = chooser.getByRole("textbox", { name: "Search file revisions" });
|
||||
const revisions = chooser.getByRole("listbox", { name: "File revisions" });
|
||||
const message = chooser.getByRole("region", { name: "Commit message" });
|
||||
await expect(revisions.getByRole("option")).toHaveCount(2);
|
||||
await expect(message).toContainText("Use the totals reviewed by the release team.");
|
||||
await expect
|
||||
.poll(() => ipcCalls(page, "vcs_log_details_batch"))
|
||||
.toEqual([
|
||||
expect.objectContaining({
|
||||
repo: "/dev/acme-api",
|
||||
revisions: ["123abcd000000000000000000000000000000000"],
|
||||
}),
|
||||
]);
|
||||
|
||||
const firstAuthor = await revisions.getByText("Lena Park", { exact: true }).boundingBox();
|
||||
const secondAuthor = await revisions.getByText("Morgan Chen", { exact: true }).boundingBox();
|
||||
expect(Math.abs(firstAuthor!.x - secondAuthor!.x)).toBeLessThan(1);
|
||||
await search.press("Tab");
|
||||
await expect(message).toBeFocused();
|
||||
await search.press("ArrowDown");
|
||||
await expect(revisions.getByRole("option", { name: /Morgan Chen/ })).toHaveAttribute("aria-selected", "true");
|
||||
await expect(message).toContainText("Use the corrected quantities from the October review.");
|
||||
|
||||
await page.setViewportSize({ width: 480, height: 350 });
|
||||
const listBox = (await revisions.boundingBox())!;
|
||||
const messageBox = (await message.boundingBox())!;
|
||||
expect(messageBox.y).toBeGreaterThanOrEqual(listBox.y + listBox.height - 1);
|
||||
expect(messageBox.y + messageBox.height).toBeLessThanOrEqual(350);
|
||||
await search.fill("unmatched");
|
||||
await expect(revisions).toContainText("No commits");
|
||||
await expect(message).not.toContainText("Use the corrected quantities from the October review.");
|
||||
await search.fill("October adjustments");
|
||||
await expect(revisions.getByRole("option")).toHaveCount(1);
|
||||
await expect(message).toContainText("Use the corrected quantities from the October review.");
|
||||
await search.press("Enter");
|
||||
await expect(chooser).toBeHidden();
|
||||
await expect
|
||||
.poll(() => ipcCalls(page, "vcs_file_at"))
|
||||
.toContainEqual({
|
||||
path: "/dev/acme-api/build.gradle.kts",
|
||||
rev: "456efab000000000000000000000000000000000",
|
||||
});
|
||||
});
|
||||
@@ -15,8 +15,15 @@ test("File Structure keeps symbol filters readable at desktop and minimum window
|
||||
selection_range: range,
|
||||
children: [],
|
||||
};
|
||||
const methods = Array.from({ length: 36 }, (_, i) => ({
|
||||
name: `method${String(i).padStart(2, "0")}`,
|
||||
kind: "method",
|
||||
range,
|
||||
selection_range: range,
|
||||
children: [],
|
||||
})).reverse();
|
||||
window.__ipc.handlers.doc_outline = () => [
|
||||
{ name: "OrderController", kind: "class", range, selection_range: range, children: [field] },
|
||||
{ name: "OrderController", kind: "class", range, selection_range: range, children: [field, ...methods] },
|
||||
];
|
||||
window.__ipc.handlers.lsp_type_hierarchy = () => [];
|
||||
const path = "/src/platform/actions.ts";
|
||||
@@ -25,10 +32,15 @@ test("File Structure keeps symbol filters readable at desktop and minimum window
|
||||
});
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "File Structure" });
|
||||
const filter = dialog.getByRole("textbox", { name: "Filter symbols" });
|
||||
const options = dialog.getByRole("button", { name: "View Options" });
|
||||
const tree = dialog.getByRole("tree", { name: "Symbols" });
|
||||
const fields = dialog.getByRole("checkbox", { name: "Show fields" });
|
||||
await expect(dialog.getByRole("checkbox", { name: "Show inherited members" })).toBeVisible();
|
||||
await expect(filter).toBeFocused();
|
||||
await expect(options).toBeVisible();
|
||||
for (const width of [400, 1000]) {
|
||||
await page.setViewportSize({ width, height: 600 });
|
||||
await page.setViewportSize({ width, height: 420 });
|
||||
const clipped = await dialog.evaluate((element) => {
|
||||
const labels = [...element.querySelectorAll("label")].filter((label) =>
|
||||
label.querySelector('input[type="checkbox"]'),
|
||||
@@ -44,6 +56,10 @@ test("File Structure keeps symbol filters readable at desktop and minimum window
|
||||
});
|
||||
});
|
||||
expect(clipped).toEqual([]);
|
||||
await expect(options).toBeInViewport({ ratio: 1 });
|
||||
const filterTop = (await filter.boundingBox())!.y;
|
||||
expect((await options.boundingBox())!.y).toBeLessThan(filterTop);
|
||||
expect((await tree.boundingBox())!.y).toBeGreaterThan(filterTop);
|
||||
}
|
||||
// The dialog scales in when it opens: wait for its settled width.
|
||||
await expect.poll(async () => Math.round((await dialog.boundingBox())!.width)).toBe(540);
|
||||
@@ -51,4 +67,32 @@ test("File Structure keeps symbol filters readable at desktop and minimum window
|
||||
await expect(field).toBeVisible();
|
||||
await fields.uncheck();
|
||||
await expect(field).toBeHidden();
|
||||
|
||||
await tree.evaluate((el) => (el.scrollTop = el.scrollHeight));
|
||||
await expect(tree.getByRole("treeitem", { name: "method00", exact: true })).toBeInViewport();
|
||||
await expect(options).toBeInViewport({ ratio: 1 });
|
||||
await expect(filter).toBeInViewport({ ratio: 1 });
|
||||
|
||||
await options.click();
|
||||
const menu = page.getByRole("menu", { name: "View Options" });
|
||||
await expect(menu).toBeInViewport({ ratio: 1 });
|
||||
const alphabetically = menu.getByRole("menuitemcheckbox", { name: "Sort Alphabetically" });
|
||||
await expect(alphabetically).not.toBeChecked();
|
||||
await alphabetically.click();
|
||||
await expect(menu).toBeHidden();
|
||||
await tree.evaluate((el) => (el.scrollTop = 0));
|
||||
await expect(tree.getByRole("treeitem").nth(1)).toHaveAccessibleName("method00");
|
||||
|
||||
await filter.fill("method21");
|
||||
await expect(tree.getByRole("treeitem", { name: "method21", selected: true })).toBeVisible();
|
||||
await options.click();
|
||||
await menu.getByRole("menuitemcheckbox", { name: "Narrow down on typing", checked: true }).click();
|
||||
await expect(tree.getByRole("treeitem", { name: "method22", exact: true })).toBeVisible();
|
||||
await options.click();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(menu).toBeHidden();
|
||||
await expect(dialog).toBeVisible();
|
||||
await expect(options).toBeFocused();
|
||||
await filter.press("Escape");
|
||||
await expect(filter).toHaveValue("");
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
import { expect, openFromTree, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("Git annotations align dates and full author names at UI text size", async ({ workbench: page }) => {
|
||||
const editor = await openFromTree(page, "build.gradle.kts");
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const root = "/dev/acme-api";
|
||||
const file = `${root}/build.gradle.kts`;
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.vcs_blame = () => [
|
||||
{
|
||||
commit: "a1234567".padEnd(40, "a"),
|
||||
author: "Lena Park",
|
||||
timeMs: Date.UTC(2026, 4, 3, 12),
|
||||
summary: "Update totals",
|
||||
},
|
||||
{
|
||||
commit: "b1234567".padEnd(40, "b"),
|
||||
author: "Lena Ortiz",
|
||||
timeMs: Date.UTC(2026, 8, 23, 12),
|
||||
summary: "Review totals",
|
||||
},
|
||||
];
|
||||
const projectModule = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectModule);
|
||||
const { settings } = useProject.getState();
|
||||
useProject.setState({
|
||||
settings: {
|
||||
...settings,
|
||||
general: { ...settings?.general, dateFormat: { overrideSystem: true, pattern: "d MMMM yyyy" } },
|
||||
},
|
||||
});
|
||||
const storeModule = "/src/features/vcs/store.ts";
|
||||
const { useVcs } = await import(/* @vite-ignore */ storeModule);
|
||||
useVcs.setState({ available: true, root, repo: root, roots: [root] });
|
||||
const contextModule = "/src/platform/context.ts";
|
||||
const { setContext } = await import(/* @vite-ignore */ contextModule);
|
||||
setContext("vcsAvailable", true);
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction("vcs.annotate", file);
|
||||
});
|
||||
|
||||
const gutter = editor.locator(".cm-vcs-blame");
|
||||
const first = gutter.locator("[data-commit]").filter({ hasText: "3 May 2026" });
|
||||
const second = gutter.locator("[data-commit]").filter({ hasText: "23 September 2026" });
|
||||
const firstAuthor = first.locator(".cm-vcs-blame-author");
|
||||
const secondAuthor = second.locator(".cm-vcs-blame-author");
|
||||
await expect(firstAuthor).toHaveText("Lena Park");
|
||||
await expect(secondAuthor).toHaveText("Lena Ortiz");
|
||||
await expect
|
||||
.poll(async () => Math.abs((await firstAuthor.boundingBox())!.x - (await secondAuthor.boundingBox())!.x))
|
||||
.toBeLessThan(1);
|
||||
const uiSize = await editor.evaluate((el) => getComputedStyle(el).getPropertyValue("--fs-ui").trim());
|
||||
await expect(firstAuthor).toHaveCSS("font-size", uiSize);
|
||||
|
||||
const firstRevision = first.locator(".cm-vcs-blame-revision");
|
||||
await expect(firstRevision).toBeHidden();
|
||||
await second.click({ button: "right" });
|
||||
await page.getByRole("menuitem", { name: "Options", exact: true }).hover();
|
||||
await page.getByRole("menuitemcheckbox", { name: "Revision", exact: true }).click();
|
||||
await expect(firstRevision).toBeVisible();
|
||||
expect((await firstRevision.boundingBox())!.x).toBeLessThan(
|
||||
(await first.locator(".cm-vcs-blame-date").boundingBox())!.x,
|
||||
);
|
||||
await expect
|
||||
.poll(async () => Math.abs((await firstAuthor.boundingBox())!.x - (await secondAuthor.boundingBox())!.x))
|
||||
.toBeLessThan(1);
|
||||
});
|
||||
@@ -0,0 +1,99 @@
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("the history message editor shows commit context and grows with the dialog", async ({ workbench: page }) => {
|
||||
const author = "Sam Rivera";
|
||||
const earlier = "Keep the settlement audit trail";
|
||||
const latest = "Finalize the settlement report";
|
||||
const detail = "Preserve the original export for review.";
|
||||
await page.setViewportSize({ width: 1120, height: 760 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(
|
||||
async ({ author, earlier, latest, detail }) => {
|
||||
const root = "/dev/acme-api";
|
||||
const head = "c".repeat(40);
|
||||
const branch = { head: "main", headCommit: head, upstream: null, ahead: 0, behind: 0, operation: null };
|
||||
const commits = [
|
||||
{ id: head, shortId: "cccccccc", parents: ["b".repeat(40)], summary: latest },
|
||||
{ id: "b".repeat(40), shortId: "bbbbbbbb", parents: ["a".repeat(40)], summary: earlier },
|
||||
].map((commit) => ({
|
||||
...commit,
|
||||
author,
|
||||
email: "[email protected]",
|
||||
refs: [],
|
||||
timeMs: 1795100200000,
|
||||
message: commit.summary + "\n\n" + detail,
|
||||
}));
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.vcs_roots = () => [{ root, ...branch }];
|
||||
handlers.vcs_branch_info = () => branch;
|
||||
handlers.vcs_status = () => [];
|
||||
handlers.vcs_log = ({ query }) =>
|
||||
(query as { range: string | null }).range?.startsWith("b".repeat(40)) ? commits.slice(0, 1) : commits;
|
||||
handlers.vcs_log_refs = () => ({});
|
||||
handlers.vcs_log_users = () => [author];
|
||||
handlers.vcs_config_get = () => null;
|
||||
handlers.vcs_commit_files = () => [];
|
||||
handlers.vcs_log_details_batch = () => [];
|
||||
handlers.vcs_reword = () => ({ before: head, after: "d".repeat(40) });
|
||||
|
||||
const projectPath = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ projectPath);
|
||||
const settings = useProject.getState().settings;
|
||||
useProject.setState({ settings: { ...settings, editor: { ...settings?.editor, fontSize: 16 } } });
|
||||
const vcsPath = "/src/features/vcs/store.ts";
|
||||
const { useVcs } = await import(/* @vite-ignore */ vcsPath);
|
||||
useVcs.setState({ available: true, root, repo: root, roots: [root], branchesLoaded: true });
|
||||
const contextPath = "/src/platform/context.ts";
|
||||
(await import(/* @vite-ignore */ contextPath)).setContext("vcsAvailable", true);
|
||||
const actionsPath = "/src/platform/actions.ts";
|
||||
await (await import(/* @vite-ignore */ actionsPath)).executeAction("vcs.showLog");
|
||||
},
|
||||
{ author, earlier, latest, detail },
|
||||
);
|
||||
|
||||
const log = page.getByRole("listbox", { name: "Commits" });
|
||||
const newest = log.getByRole("option", { name: new RegExp(latest) });
|
||||
const older = log.getByRole("option", { name: new RegExp(earlier) });
|
||||
await newest.click({ button: "right" });
|
||||
await page.getByRole("menuitem", { name: /Edit Commit Message/ }).click();
|
||||
const edit = page.getByRole("dialog", { name: /^Edit Commit Message/ });
|
||||
const context = "Edit message for commit cccccccc by " + author;
|
||||
await expect(edit.getByText(context, { exact: true })).toBeVisible();
|
||||
const message = edit.getByRole("textbox", { name: context });
|
||||
await expect(message).toBeFocused();
|
||||
await expect(message).toHaveValue(latest + "\n\n" + detail);
|
||||
await expect(message).toHaveCSS("font-size", "16px");
|
||||
|
||||
const grip = edit.getByRole("separator", { name: "Resize" });
|
||||
const before = (await message.boundingBox())!;
|
||||
const corner = (await grip.boundingBox())!;
|
||||
await page.mouse.move(corner.x + corner.width / 2, corner.y + corner.height / 2);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(corner.x + corner.width / 2 + 72, corner.y + corner.height / 2 + 40);
|
||||
await page.mouse.up();
|
||||
await expect.poll(async () => (await message.boundingBox())!.width).toBeGreaterThan(before.width + 60);
|
||||
await expect.poll(async () => (await message.boundingBox())!.height).toBeGreaterThan(before.height + 30);
|
||||
|
||||
const ok = edit.getByRole("button", { name: "OK", exact: true });
|
||||
await message.fill(" ");
|
||||
await expect(ok).toBeDisabled();
|
||||
const revised = "Finalize the reviewed settlement report\n\n" + detail;
|
||||
await message.fill(revised);
|
||||
await ok.click();
|
||||
await expect
|
||||
.poll(() => ipcCalls(page, "vcs_reword"))
|
||||
.toEqual([{ repo: "/dev/acme-api", commit: "c".repeat(40), message: revised }]);
|
||||
|
||||
await newest.click();
|
||||
await older.click({ modifiers: ["Shift"] });
|
||||
await newest.click({ button: "right" });
|
||||
await page.getByRole("menuitem", { name: /Squash Commits/ }).click();
|
||||
const squash = page.getByRole("dialog", { name: "Squashed Commit Message" });
|
||||
const combined = squash.getByRole("textbox", { name: "Edit message for squashed commit" });
|
||||
await expect(combined).toHaveValue([earlier, detail, latest, detail].join("\n\n"));
|
||||
await page.setViewportSize({ width: 420, height: 490 });
|
||||
await expect(combined).toBeInViewport({ ratio: 1 });
|
||||
await expect(squash.getByRole("button", { name: "OK", exact: true })).toBeInViewport({ ratio: 1 });
|
||||
await squash.getByRole("button", { name: "Cancel", exact: true }).click();
|
||||
await expect(squash).toBeHidden();
|
||||
});
|
||||
@@ -0,0 +1,95 @@
|
||||
import { expect, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("file history puts commit details below the revisions and keeps directory history in the log layout", async ({
|
||||
workbench: page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 1100, height: 760 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const root = "/dev/acme-api";
|
||||
const id = (n: number) => n.toString().padStart(40, "0");
|
||||
const commits = ["Update the reviewed totals", "Add the weekly total"].map((summary, index) => ({
|
||||
id: id(index + 1),
|
||||
shortId: id(index + 1).slice(-8),
|
||||
author: index === 0 ? "Lena Park" : "Morgan Chen",
|
||||
email: "[email protected]",
|
||||
timeMs: Date.UTC(2026, 9, 25 - index),
|
||||
parents: index === 0 ? [id(2)] : [],
|
||||
refs: [],
|
||||
summary,
|
||||
message: `${summary}\n\nRevision notes for the release review.`,
|
||||
}));
|
||||
const h = window.__ipc.handlers;
|
||||
h.fs_entry_kind = ({ path }) => (path === `${root}/src` ? "dir" : "file");
|
||||
h.vcs_log = ({ query }) => {
|
||||
const { skip, path } = query as { skip: number; path?: string };
|
||||
return commits
|
||||
.slice(skip)
|
||||
.map((c) => ({ ...c, historyPath: path?.endsWith(".kts") ? "build.gradle.kts" : null }));
|
||||
};
|
||||
h.vcs_log_refs = () => ({});
|
||||
h.vcs_branches = () => [];
|
||||
h.vcs_commit_files = () => [{ path: "build.gradle.kts", kind: "modified" }];
|
||||
h.vcs_log_details_batch = ({ revisions }) =>
|
||||
(revisions as string[]).map((revision) => ({
|
||||
message: commits.find((commit) => commit.id === revision)!.message,
|
||||
containingBranches: ["main"],
|
||||
signature: "N",
|
||||
signer: "",
|
||||
key: "",
|
||||
fingerprint: "",
|
||||
}));
|
||||
const storeModule = "/src/features/vcs/store.ts";
|
||||
const { useVcs } = await import(/* @vite-ignore */ storeModule);
|
||||
useVcs.setState({ available: true, root, repo: root, roots: [root], branchesLoaded: true });
|
||||
const contextModule = "/src/platform/context.ts";
|
||||
const { setContext } = await import(/* @vite-ignore */ contextModule);
|
||||
setContext("vcsAvailable", true);
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction("vcs.showHistory", `${root}/build.gradle.kts`);
|
||||
});
|
||||
|
||||
const git = page.getByRole("tablist", { name: "Git" });
|
||||
const historyTab = git.getByRole("tab", { name: /History: build.gradle.kts/ });
|
||||
const revisions = page.getByRole("listbox", { name: "Commits" });
|
||||
const separator = page.getByRole("separator", { name: "Details", exact: true });
|
||||
const details = page.getByRole("region", { name: "Commit message" });
|
||||
await expect(historyTab).toHaveAttribute("aria-selected", "true");
|
||||
const newest = revisions.getByRole("option", { name: /Update the reviewed totals/ });
|
||||
await expect(newest).toBeVisible();
|
||||
await expect(separator).toHaveAttribute("aria-orientation", "horizontal");
|
||||
await expect(page.getByRole("toolbar", { name: "Branches", exact: true })).toHaveCount(0);
|
||||
await expect(page.getByRole("button", { name: "Show Branches", exact: true })).toHaveCount(0);
|
||||
|
||||
const author = await newest.getByText("Lena Park", { exact: true }).boundingBox();
|
||||
const subject = await newest.getByText("Update the reviewed totals", { exact: true }).boundingBox();
|
||||
expect(author!.x).toBeLessThan(subject!.x);
|
||||
const earlier = revisions.getByRole("option", { name: /Add the weekly total/ });
|
||||
await earlier.click();
|
||||
await expect(details).toContainText("Add the weekly total");
|
||||
await expect(details).toContainText("Revision notes for the release review.");
|
||||
const listBox = (await revisions.boundingBox())!;
|
||||
expect((await details.boundingBox())!.y).toBeGreaterThanOrEqual(listBox.y + listBox.height - 1);
|
||||
await expect(
|
||||
page.getByRole("tree", { name: "Changed files" }).getByRole("treeitem", { name: "build.gradle.kts" }),
|
||||
).toBeVisible();
|
||||
|
||||
await separator.press("ArrowUp");
|
||||
await expect.poll(async () => (await revisions.boundingBox())!.height).toBeLessThan(listBox.height);
|
||||
await expect(earlier).toHaveAttribute("aria-selected", "true");
|
||||
const resized = (await revisions.boundingBox())!.height;
|
||||
await page.evaluate(async () => {
|
||||
const actionsModule = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
||||
await executeAction("vcs.showHistory", "/dev/acme-api/src");
|
||||
});
|
||||
await expect(git.getByRole("tab", { name: /History: src/ })).toHaveAttribute("aria-selected", "true");
|
||||
await expect(page.getByRole("toolbar", { name: "Branches", exact: true })).toBeVisible();
|
||||
await expect(separator).toHaveCount(0);
|
||||
|
||||
await historyTab.click();
|
||||
await expect(earlier).toHaveAttribute("aria-selected", "true");
|
||||
await expect.poll(async () => (await revisions.boundingBox())!.height).toBeCloseTo(resized, 0);
|
||||
await expect(details).toContainText("Add the weekly total");
|
||||
});
|
||||
@@ -0,0 +1,91 @@
|
||||
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
|
||||
|
||||
test("the Git Merge form shows the command and selected options", async ({ workbench: page }) => {
|
||||
await page.setViewportSize({ width: 1100, height: 700 });
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
const root = "/dev/acme-api";
|
||||
const service = `${root}/service`;
|
||||
const branchInfo = (repo: unknown) => ({
|
||||
head: repo === service ? "release" : "main",
|
||||
headCommit: "a1234567",
|
||||
upstream: null,
|
||||
ahead: 0,
|
||||
behind: 0,
|
||||
operation: null,
|
||||
});
|
||||
const handlers = window.__ipc.handlers;
|
||||
handlers.vcs_branch_info = ({ repo }) => branchInfo(repo);
|
||||
handlers.vcs_branches = ({ repo }) => [
|
||||
{ name: branchInfo(repo).head, remote: false, current: true },
|
||||
{ name: repo === service ? "feature/service" : "feature/api", remote: false, current: false },
|
||||
];
|
||||
handlers.vcs_merge_with = () => null;
|
||||
const store = "/src/features/vcs/store.ts";
|
||||
const { useVcs } = await import(/* @vite-ignore */ store);
|
||||
useVcs.setState({ root, roots: [root, service], repo: root, branch: branchInfo(root), available: true });
|
||||
const context = "/src/platform/context.ts";
|
||||
const { setContext } = await import(/* @vite-ignore */ context);
|
||||
setContext("vcsAvailable", true);
|
||||
const actions = "/src/platform/actions.ts";
|
||||
const { executeAction } = await import(/* @vite-ignore */ actions);
|
||||
await executeAction("vcs.merge");
|
||||
});
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: /Merge into/ });
|
||||
const command = dialog.getByText("git merge", { exact: true });
|
||||
const repo = dialog.getByRole("button", { name: "Repository", exact: true });
|
||||
const branch = dialog.getByRole("button", { name: "Branch to merge", exact: true });
|
||||
const merge = dialog.getByRole("button", { name: "Merge", exact: true });
|
||||
const modifyOptions = dialog.getByRole("button", { name: "Modify options" });
|
||||
await expect(command).toBeVisible();
|
||||
const repoBox = (await repo.boundingBox())!;
|
||||
const commandBox = (await command.boundingBox())!;
|
||||
const branchBox = (await branch.boundingBox())!;
|
||||
expect(repoBox.x + repoBox.width).toBeLessThan(commandBox.x);
|
||||
expect(commandBox.x + commandBox.width).toBeLessThan(branchBox.x);
|
||||
expect(Math.abs(repoBox.y - branchBox.y)).toBeLessThan(1);
|
||||
await expect(repo).toBeFocused();
|
||||
await expect(merge).toBeDisabled();
|
||||
|
||||
await repo.click();
|
||||
await page.getByRole("option", { name: "service", exact: true }).click();
|
||||
await expect(dialog).toHaveAccessibleName("Merge into release");
|
||||
await branch.click();
|
||||
await page.getByRole("option", { name: "feature/service", exact: true }).click();
|
||||
await expect(merge).toBeEnabled();
|
||||
await modifyOptions.click();
|
||||
await page.getByRole("menuitemcheckbox", { name: "--no-ff", exact: true }).click();
|
||||
const flags = dialog.getByRole("group", { name: "Merge options" });
|
||||
await expect(flags).toHaveText("--no-ff");
|
||||
await modifyOptions.click();
|
||||
await expect(page.getByRole("menuitemcheckbox", { name: "--ff-only", exact: true })).toBeDisabled();
|
||||
await page.getByRole("menuitemcheckbox", { name: "-m (commit message)", exact: true }).click();
|
||||
await expect(flags).toHaveText("--no-ff-m");
|
||||
|
||||
const message = dialog.getByRole("textbox", { name: "Commit message", exact: true });
|
||||
await expect(message).toHaveCSS("font-size", await branch.evaluate((el) => getComputedStyle(el).fontSize));
|
||||
await page.setViewportSize({ width: 410, height: 620 });
|
||||
const narrowRepo = (await repo.boundingBox())!;
|
||||
const narrowBranch = (await branch.boundingBox())!;
|
||||
expect(narrowRepo.y + narrowRepo.height).toBeLessThan(narrowBranch.y);
|
||||
expect(narrowBranch.x + narrowBranch.width).toBeLessThan(410);
|
||||
await message.fill("Merge service changes\n\nReviewed the service update.");
|
||||
await merge.click();
|
||||
|
||||
await expect
|
||||
.poll(() => ipcCalls(page, "vcs_merge_with"))
|
||||
.toEqual([
|
||||
{
|
||||
repo: "/dev/acme-api/service",
|
||||
branches: ["feature/service"],
|
||||
options: {
|
||||
noFf: true,
|
||||
ffOnly: false,
|
||||
squash: false,
|
||||
noCommit: false,
|
||||
message: "Merge service changes\n\nReviewed the service update.",
|
||||
},
|
||||
},
|
||||
]);
|
||||
});
|
||||
Loaded 100 of 454 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Заблокувати користувача