Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 059c1ff8de fix(vcs): give outgoing commit messages a clear subject 2026-11-22 14:44:41 +08:00
LU XIANGRUIтаwildcatDownstairs c57af26f9d feat(python): offer to install pylsp-rope when a refactoring needs it (#5161)
On Python files, Extract Method, Inline, Introduce Parameter and module-level Introduce Constant come from pylsp-rope, a companion server the missing-server prompt skipped, so without it these refactorings only said "Cannot perform refactoring". Now, when one of them finds nothing and pylsp-rope isn't installed, the usual missing-tool notification offers to install it (Install restarts the server, so the refactoring works right away). `promptInstall` takes a purpose (code insight, formatter or a refactoring) instead of a formatter flag; a refactoring purpose lets a companion server through, even when another server already serves the files. Opening a project stays quiet.

Closes #5149

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-22 14:21:33 +08:00
Ainul YaqinтаAkin01 ed6f264875 fix(plugins): provide lossless bounded streaming and configurable capture for processes (#4812)
Plugins running compilers, linters or large diffs lost output: `start` kept only a 1 MiB tail and `run`/`run-command` truncated stderr. API 1.15 adds `process-options` (`max-output-bytes` up to 128 MiB, `buffer-bytes` up to 4 MiB), `run-captured`, which fails explicitly when either stream overflows, and `start-stream`, which streams losslessly with pipe backpressure: readers pause at the buffer limit, resume as `poll`/`chunk` consume, and `wait` drains up to the total limit so fast producers don't deadlock. Overflow stops the process tree and records its exit status before reaping it. `run`, `run-command` and `start` behave as before, and 1.14 components still load.

Closes #4763

Co-authored-by: Akin01 <[email protected]>
2026-11-22 14:11:13 +08:00
HEOJUNFO 369f52d39e fix(http-client): use http when server.ssl.enabled is false (#5143)
A request generated from a Spring mapping got an `https://` host when `server.ssl.enabled=false` and a key store was also configured (typically a base file with the key store and a profile that turns TLS off for local runs). `hostFromConfig` picked https when TLS was enabled or a key store was set, so the key store won over an explicit `false`. In Spring Boot the property defaults to true and SSL is configured only when it is, so an explicit `false` now wins; the other cases are unchanged.

Co-authored-by: HEOJUNFO <[email protected]>
2026-11-22 14:06:03 +08:00
HEOJUNFO 305ff382e7 fix(run): carry a duration's rounded seconds into its minutes (#5142)
A run or test lasting between 1 m 59.5 s and 2 m showed as `1 m 60 s` (and likewise at every minute) in the test tree, the exported test report and the run tab's "Finished in …" tooltip. `formatDuration` split off whole minutes first and rounded the remainder afterwards; it now rounds to whole seconds first and splits after.

Co-authored-by: HEOJUNFO <[email protected]>
2026-11-22 14:04:54 +08:00
l0ng-ai 92dbf0baa5 fix(terminal): separate session choices from window actions (#5138)
Open the predefined session chooser directly on the installed shells and SSH. The plus button opens the default shell. Split commands live in the terminal tool window's Options menu, with Settings at the bottom of the session chooser. On the Windows fixture the chooser went from nine actions to six and from 267 px to 153 px in height.
2026-11-22 14:03:13 +08:00
l0ng-ai b02f212d3e fix(completion): keep suggestion names readable in narrow lookups (#5133)
Keep suggestion names readable when long signatures compete for space. The name keeps its natural width when it fits, the return type gets space next, and parameters use the rest. Exceptionally long names can still truncate within the editor.
2026-11-22 13:36:07 +08:00
l0ng-ai ca7f26f484 fix(editor): give a completed foreach its body (#5123)
⌘⇧↵ after `foreach ($xs as $x)` in PHP produced `foreach ($xs as $x);` with the caret on the next line: a semicolon that terminates an empty loop. `foreach` was missing from the block-head keywords, so the line was treated as a plain statement.

`foreach` (PHP, C#) and PHP's `elseif` are now block heads: the line gets `{` / caret / `}`, and a bare `foreach` gets `(|)` like `for`.
2026-11-22 13:21:34 +08:00
l0ng-ai bf4fff8fcf fix(editor): end completed C and C++ type definitions with }; (#5122)
⌘⇧↵ after `struct S` (C) or `class A` (C++) produced `struct S {` / `|` / `}`: a type definition without its terminating `;`, which does not compile.

`completeStatementSpec` now closes the body with `};` in C, C++, Objective-C and Objective-C++ when the header is a type definition: `struct` / `class` / `union` / `enum` / `enum class`, optionally with `typedef`, `template <…>`, `final` and base classes. `typedef struct Node`, `union U` and `template <typename T> class Box` are now recognised as block heads too. Namespaces and control flow keep a plain `}`.
2026-11-22 13:20:15 +08:00
l0ng-ai 3cbe327a6a fix(editor): line up C++ access specifiers with their class (#5128)
Typing `public:` on a member line of a C++ class left it at member indentation (`    public:`) instead of lining it up with the class, as CLion's default code style does. The Lezer C++ indentation has no rule for access specifiers, and its `indentOnInput` only reindents `case`, `default:` and braces.

For C++ (`EXTRA_SUPPORT` in `languages.ts`), an indent service puts a `public:` / `protected:` / `private:` line at the indentation of the line opening its class body (`FieldDeclarationList`), and an `indentOnInput` pattern reindents the line when the colon is typed. Members after it keep the member indentation; `std::` is unaffected.
2026-11-22 13:18:09 +08:00
l0ng-ai 0311297886 fix(editor): indent the body after a case label in C, C++ and PHP (#5124)
Enter after an 8-space `case 1:` (or `default:`) in C, C++ or PHP put the caret at 8 spaces, aligned with the label, instead of 12 for the branch body: the Lezer C++ and PHP grammars indent a `case` body from the switch body, not from the label.

`caseBodyIndent`, an indent service added for C, C++ and PHP in `EXTRA_SUPPORT`, puts the new line one level deeper than a `case …:` / `default:` line when nothing follows the caret. Other lines, including a C++ `std::`, are unchanged.
2026-11-22 13:16:56 +08:00
l0ng-ai a711c991b6 fix(navigation): compact navigation bar child lists (#5132)
Use compact rows and content-based widths in navigation bar child lists. The default row height is 18 px and the text stays at 13 px. The wide desktop fixture shows 20 complete rows, up from 14. The two-folder list in the narrow fixture uses 95 px of width, down from 199 px.
2026-11-22 13:15:32 +08:00
Gabriel Gondim 698cad2b3f fix(ci): run language smoke when editor navigation providers change (#5101)
src/editor/api.ts re-exports navigationProviders and relatedProviders, which the frontend smoke loads. Add both files to the Language smoke workflow paths and to the Changes step's smoke pattern, so scripts/smoke-paths.test.ts passes again and a change to either file runs every language.

Closes #5073
2026-11-22 12:57:44 +08:00
l0ng-ai 581c64f544 fix(vcs): surface the Git Log affected changes filter (#5130)
Show the affected-changes toggle on the changed-files toolbar when Git Log has a path filter. This makes it possible to narrow the selected commit's file list in one click. Group the Diff preview toggle and its location under Layout in View Options. Let the toolbar wrap when the pane is narrow.
2026-11-22 12:52:57 +08:00
l0ng-ai 77d6d81f8a fix(editor): complete /** doc stubs in PHP files and list C/C++ tags (#5127)
Two problems with the `/**` + Enter stub:

- **PHP**: `/**` + Enter right after `<?php` gave `/**` / caret, with no `*/`, so the function below ended up inside an open comment. With an unclosed `/**` directly after `<?php`, Lezer PHP parses the text as the surrounding HTML: `languageDataAt("commentTokens")` there returns only `<!-- -->` (checked with the real PHP language), and `enterInDocComment` stood back. In PHP documents it no longer requires `/* */` tokens at the caret, so the stub is closed and lists `@param` / `@return` as elsewhere in PHP.
- **C / C++**: the stub had no tags. New `cDocTags` lists `@param` per named parameter (defaults and array suffixes dropped, `void` / `...` skipped) and `@return` unless the function returns `void` or is a constructor or destructor. It handles specifiers, pointers and references, `template <…>`, qualified names (`Box<T>::take`), trailing `const` / `noexcept` / `override` and initializer lists; types, calls and statements get no tags.
2026-11-22 12:45:26 +08:00
l0ng-ai ea62941bc6 fix(editor): pair include and template angle brackets in C and C++ (#5126)
With bracket pairing on, `<` after `#include ` (C, C++) and after `std::vector` (C++) stayed single: `smartAngleBrackets` had no rule for C or C++.

- C and Objective-C: `#include <` (and `#include_next`, `#import`) pairs.
- C++ and Objective-C++: the same, plus `template <`, a standard template or cast written against its `<` (`std::vector<`, `std::make_unique<`, `static_cast<`…) and a capitalized name (`Box<`).
- Lowercase values (`a <`, `i<`), `std::cout <`, all-caps macros (`MAX<`) and `operator<` stay single.

`inLiteral` treated any node whose name contains "template" as a template literal, which made Lezer C++'s `TemplateFunction` (`std::make_unique`) look like a string; C++ template nodes are now excluded.
2026-11-22 12:42:18 +08:00
l0ng-ai 00e044b66b fix(project): group tool window options in submenus (#5118)
Project's Options menu groups its settings under Behavior, Appearance, and Sort By. Sort By includes the folder ordering toggle alongside the sort choices. The first level now has seven items, so the window controls stay visible in a short window.
2026-11-22 12:39:34 +08:00
l0ng-ai 1db368d2b4 fix(refactor): find clangd's extractions from the refactoring shortcuts (#5121)
⌥⌘V on `value * value` in C or C++ said "Selected block should represent an expression", while ⌥↵ on the same selection offered **Extract subexpression to variable** and it worked. clangd gives every tweak the kind `refactor`, and `refactor` is not contained in `refactor.extract`, so the shortcut's request returned nothing. Checked with a small LSP script against the installed clangd: `only: ["refactor"]` → `Extract subexpression to variable` (`refactor`); `only: ["refactor.extract"]` → none.

`requestKind` now asks for `refactor` in C, C++, Objective-C and Objective-C++ too (as it already does for typescript-language-server); `classifyAction` already maps a generic `refactor` action by its title.
2026-11-22 12:36:03 +08:00
l0ng-ai db50b5df5b fix(editor): keep inline find controls together (#5120)
Keep the Close button next to More in the editor's Find and Replace toolbar. The two fields share a column that scales with the editor pane. In narrow panes, the controls wrap below the query and the fields use the space freed by moving Close.
2026-11-22 12:32:52 +08:00
Deng Liu 17fe162f6c chore(dev): add dogfood build and install tasks (#5125)
Add `pnpm dogfood:build` / `pnpm dogfood:install` (and matching mise tasks) to build a fast local release app named openidea_dogfood with a grey icon. It keeps the release identifier, so it shares settings and data with the installed app.

The dogfood config clears the updater endpoints so a release never replaces the dogfood bundle, the bundle is read from Cargo's target directory, and the install output and setup docs note that the two apps share one instance and settings and that the dogfood app never updates itself.
2026-11-22 12:26:36 +08:00
167 змінених файлів з 2144 додано та 264 видалено

No files matched your search

+3 -1
Переглянути файл
@@ -28,6 +28,8 @@ on:
- "src/workbench/**"
- "src/ui/**"
- "src/editor/api.ts"
- "src/editor/navigationProviders.ts"
- "src/editor/relatedProviders.ts"
- "src/editor/core/cm/cornerInset.ts"
- "src/editor/core/cm/iconArea.ts"
- "src/editor/lsp/availability.ts"
@@ -98,7 +100,7 @@ jobs:
# 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|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$)'
smoke='^(crates/|Cargo\.(toml|lock)$|src/features/(run|debugger|build-tools)/|src/platform/|src/workbench/|src/ui/|src/editor/(api|navigationProviders|relatedProviders|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
+1
Переглянути файл
@@ -79,6 +79,7 @@ Shared agent skills live in `.agents/skills/` (`.claude/skills/` links to them):
`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.
- `pnpm dogfood:build` / `pnpm dogfood:install` (or `mise run dogfood:build` / `mise run dogfood:install`) — build and locally install the grey-icon dogfood desktop app sharing release settings and data.
- `cargo nextest run --workspace` (or `cargo test`), `cargo clippy --workspace --all-targets -- -D warnings`, `cargo fmt --all`.
- `cargo test -p ide-host --test language_smoke -- --ignored --exact <language>` — code intelligence
on `fixtures/` with that language's real server installed (CI: `Language smoke`, pinned versions).
+398 -29
Переглянути файл
@@ -10,7 +10,7 @@ use ide_extension::ledger::{Ledger, Subject};
use ide_language::ProgramPin;
use ide_plugin::{
CommitChange, CommitDraft, EventKind, HostApi, HostError, HttpRequest, HttpResponse, NotificationLevel,
ProcessChunk, ProcessCommand, ProcessOutput, Prompt, RepositoryStatus, StatusItem,
ProcessChunk, ProcessCommand, ProcessOptions, ProcessOutput, Prompt, RepositoryStatus, StatusItem,
};
use parking_lot::{Mutex, RwLock};
use std::collections::{BTreeMap, BTreeSet, HashMap};
@@ -200,8 +200,14 @@ impl SecretStore for FileSecretStore {
/// Largest response body a plugin receives.
const MAX_RESPONSE: usize = 16 << 20;
/// Largest stdout / stderr kept from a process.
/// Largest stdout / stderr kept from a process by default.
const MAX_OUTPUT: usize = 16 << 20;
/// Hard ceiling for configurable process output capture.
const MAX_ALLOWED_OUTPUT: usize = 128 << 20;
/// Default in-flight stream buffer for lossless streaming backpressure.
const DEFAULT_STREAM_BUFFER: usize = 256 << 10;
/// Default total lifetime stream output limit for lossless streaming.
const DEFAULT_STREAM_MAX_TOTAL: usize = 32 << 20;
/// Most processes one plugin keeps running at once.
const MAX_PROCESSES: usize = 8;
/// Most output one stream of a handle holds until the plugin reads it.
@@ -317,11 +323,18 @@ fn clipboard_content(answer: super::ClipboardAnswer) -> Result<ide_plugin::Clipb
Ok(ide_plugin::ClipboardContent { text: text.filter(|t| !t.is_empty()), image })
}
/// A process a plugin started and has not released (API 1.3 `process.start`).
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum StreamMode {
Tail,
Lossless,
}
/// A process a plugin started and has not released (API 1.3 `process.start`, API 1.15 `process.start-stream`).
/// Two reader threads copy its output into bounded buffers; the handle lives
/// as long as the plugin instance that started it.
struct Proc {
client: Option<String>,
can_read: parking_lot::Condvar,
state: Mutex<ProcState>,
}
@@ -335,6 +348,29 @@ struct ProcState {
status: Option<i32>,
/// Reader threads still copying its pipes into the buffers above.
readers: usize,
/// Active wait_process callers. While positive, reader threads buffer up to
/// max_total instead of buffer_limit so producers emitting more than the chunk
/// buffer do not deadlock waiting for process exit.
waiters: usize,
mode: StreamMode,
buffer_limit: usize,
max_total: usize,
total_stdout: usize,
total_stderr: usize,
overflow_err: Option<String>,
stopped: bool,
}
impl ProcState {
/// Ends a child whose output went over the limit. `kill_tree` reaps it, so its status
/// is noted here: a later reap must not wait on a process id that is already gone.
fn stop_overflowed(&mut self) {
self.stdin = None;
ide_core::process::kill_tree(&mut self.child);
if self.status.is_none() {
self.status = Some(self.child.try_wait().ok().flatten().and_then(|s| s.code()).unwrap_or(-1));
}
}
}
/// Which pipe a reader thread drains.
@@ -346,34 +382,100 @@ enum Stream {
impl Proc {
/// Copies `pipe` into the matching buffer until it closes, keeping the last
/// [`MAX_PENDING`] bytes, then notes that the reader finished.
/// [`MAX_PENDING`] bytes (in tail mode) or pausing on backpressure (in lossless mode),
/// then notes that the reader finished.
fn read(self: &Arc<Self>, mut pipe: impl Read + Send + 'static, stream: Stream) {
self.state.lock().readers += 1;
let this = Arc::clone(self);
std::thread::spawn(move || {
let mut buf = [0u8; 8 << 10];
loop {
{
let mut state = this.state.lock();
while state.mode == StreamMode::Lossless
&& !state.stopped
&& state.overflow_err.is_none()
&& match stream {
Stream::Out => {
// While wait_process is active, allow readers to buffer up to max_total
// to prevent pipe write backpressure from hanging the child process.
if state.waiters > 0 {
state.stdout.len() >= state.max_total
} else {
state.stdout.len() >= state.buffer_limit
}
}
Stream::Err => {
if state.waiters > 0 {
state.stderr.len() >= state.max_total
} else {
state.stderr.len() >= state.buffer_limit
}
}
}
{
this.can_read.wait(&mut state);
}
if state.stopped || state.overflow_err.is_some() {
break;
}
}
match pipe.read(&mut buf) {
Ok(0) => break,
Ok(n) => {
let mut state = this.state.lock();
let out = match stream {
Stream::Out => &mut state.stdout,
Stream::Err => &mut state.stderr,
};
out.extend_from_slice(&buf[..n]);
let over = out.len().saturating_sub(MAX_PENDING);
if over > 0 {
out.drain(..over);
let continuation = out.iter().take_while(|b| (**b & 0xC0) == 0x80).count();
out.drain(..continuation);
if state.stopped || state.overflow_err.is_some() {
break;
}
if state.mode == StreamMode::Lossless {
match stream {
Stream::Out => {
state.total_stdout = state.total_stdout.saturating_add(n);
if state.total_stdout > state.max_total {
let limit_mib = (state.max_total + (1 << 20) - 1) >> 20;
state.overflow_err =
Some(format!("process stdout exceeded {limit_mib} MiB limit"));
state.stop_overflowed();
this.can_read.notify_all();
break;
}
state.stdout.extend_from_slice(&buf[..n]);
}
Stream::Err => {
state.total_stderr = state.total_stderr.saturating_add(n);
if state.total_stderr > state.max_total {
let limit_mib = (state.max_total + (1 << 20) - 1) >> 20;
state.overflow_err =
Some(format!("process stderr exceeded {limit_mib} MiB limit"));
state.stop_overflowed();
this.can_read.notify_all();
break;
}
state.stderr.extend_from_slice(&buf[..n]);
}
}
} else {
let out = match stream {
Stream::Out => &mut state.stdout,
Stream::Err => &mut state.stderr,
};
out.extend_from_slice(&buf[..n]);
let over = out.len().saturating_sub(MAX_PENDING);
if over > 0 {
out.drain(..over);
let continuation = out.iter().take_while(|b| (**b & 0xC0) == 0x80).count();
out.drain(..continuation);
}
}
}
Err(e) if e.kind() == std::io::ErrorKind::Interrupted => continue,
Err(_) => break,
}
}
this.state.lock().readers -= 1;
let mut state = this.state.lock();
state.readers -= 1;
this.can_read.notify_all();
});
}
@@ -397,6 +499,7 @@ impl Proc {
/// does nothing.
fn kill(&self) {
let mut state = self.state.lock();
state.stopped = true;
state.stdin = None;
if state.status.is_none() {
ide_core::process::kill_tree(&mut state.child);
@@ -404,18 +507,23 @@ impl Proc {
state.status = Some(status.code().unwrap_or(-1));
}
}
self.can_read.notify_all();
}
/// What it printed since the last call, each stream at most `max` bytes. The status
/// comes with the last chunk only: once it ended, its pipes reached the end and
/// nothing is left to read, so a caller can stop at the first chunk that has one.
fn chunk(&self, max: usize) -> ProcessChunk {
fn chunk(&self, max: usize) -> Result<ProcessChunk, HostError> {
let mut state = self.state.lock();
if let Some(err) = state.overflow_err.clone() {
return Err(HostError::Failed(err));
}
let eof = state.readers == 0;
let stdout = take_text(&mut state.stdout, max, eof);
let stderr = take_text(&mut state.stderr, max, eof);
let drained = eof && state.stdout.is_empty() && state.stderr.is_empty();
ProcessChunk { stdout, stderr, status: state.status.filter(|_| drained) }
self.can_read.notify_all();
Ok(ProcessChunk { stdout, stderr, status: state.status.filter(|_| drained) })
}
}
@@ -2668,6 +2776,22 @@ impl HostApi for PluginApi {
cancel: &CancellationToken,
timeout: Duration,
) -> Result<ProcessOutput, HostError> {
self.run_process_with_options(cmd, cwd, stdin, cancel, timeout, None)
}
fn run_process_with_options(
&self,
cmd: ProcessCommand,
cwd: Option<&Path>,
stdin: Option<String>,
cancel: &CancellationToken,
timeout: Duration,
options: Option<ProcessOptions>,
) -> Result<ProcessOutput, HostError> {
let max_output = options
.and_then(|o| o.max_output_bytes)
.map(|b| (b as usize).clamp(1 << 10, MAX_ALLOWED_OUTPUT))
.unwrap_or(MAX_OUTPUT);
let binary = self.approved_program_in_project(&cmd.program, cwd.or(cmd.approval_root.as_deref()))?;
let cwd = self.spawn_dir(cwd);
let mut command = StdCommand::new(&binary);
@@ -2694,15 +2818,15 @@ impl HostApi for PluginApi {
let mut overflow = false;
if let Some(p) = pipe {
let mut p = p;
let _ = p.by_ref().take((MAX_OUTPUT + 1) as u64).read_to_end(&mut out);
if out.len() > MAX_OUTPUT {
let _ = p.by_ref().take((max_output + 1) as u64).read_to_end(&mut out);
if out.len() > max_output {
overflow = true;
out.truncate(MAX_OUTPUT);
out.truncate(max_output);
}
let _ = std::io::copy(&mut p, &mut std::io::sink());
}
let mut text = String::from_utf8_lossy(&out).into_owned();
let mut end = text.len().min(MAX_OUTPUT);
let mut end = text.len().min(max_output);
while !text.is_char_boundary(end) {
end -= 1;
}
@@ -2728,15 +2852,35 @@ impl HostApi for PluginApi {
std::thread::sleep(Duration::from_millis(10));
};
let (stdout, stdout_overflow) = stdout.join().unwrap_or_default();
let (stderr, _) = stderr.join().unwrap_or_default();
if stdout_overflow {
let (stderr, stderr_overflow) = stderr.join().unwrap_or_default();
if options.is_some() {
// run_captured fails explicitly if either stdout or stderr exceeds the configured limit.
if stdout_overflow || stderr_overflow {
let stream = match (stdout_overflow, stderr_overflow) {
(true, true) => "stdout and stderr",
(true, false) => "stdout",
(false, true) => "stderr",
(false, false) => unreachable!(),
};
let limit_mib = (max_output + (1 << 20) - 1) >> 20;
tracing::warn!(
plugin = %self.id(),
program = %cmd.program,
limit_mib,
"process {stream} exceeded limit"
);
return Err(HostError::Failed(format!("{} {stream} exceeded {} MiB limit", cmd.program, limit_mib)));
}
} else if stdout_overflow {
// Documented legacy behavior for run / run-command: stdout overflow fails, but
// stderr overflow is silently truncated to 16 MiB.
tracing::warn!(
plugin = %self.id(),
program = %cmd.program,
limit_mib = MAX_OUTPUT >> 20,
limit_mib = (max_output >> 20),
"process stdout exceeded limit"
);
return Err(HostError::Failed(format!("{} stdout exceeded {} MiB limit", cmd.program, MAX_OUTPUT >> 20)));
return Err(HostError::Failed(format!("{} stdout exceeded 16 MiB limit", cmd.program)));
}
Ok(ProcessOutput { status: status.code(), stdout, stderr })
}
@@ -2761,6 +2905,16 @@ impl HostApi for PluginApi {
}
}
fn start_process(&self, cmd: ProcessCommand, cwd: Option<&Path>, client: Option<&str>) -> Result<u64, HostError> {
self.start_process_stream(cmd, cwd, client, None)
}
fn start_process_stream(
&self,
cmd: ProcessCommand,
cwd: Option<&Path>,
client: Option<&str>,
options: Option<ProcessOptions>,
) -> Result<u64, HostError> {
let binary = self.approved_program_in_project(&cmd.program, cwd.or(cmd.approval_root.as_deref()))?;
let cwd = self.spawn_dir(cwd);
if client.is_some_and(|c| self.shared.closed_clients.lock().contains(c)) {
@@ -2790,8 +2944,21 @@ impl HostApi for PluginApi {
.spawn()
.map_err(|e| HostError::Failed(format!("{}: {e}", binary.display())))?;
let (stdout, stderr) = (child.stdout.take(), child.stderr.take());
let (mode, buffer_limit, max_total) = match options {
Some(opts) => {
let buf =
opts.buffer_bytes.map(|b| (b as usize).clamp(4 << 10, 4 << 20)).unwrap_or(DEFAULT_STREAM_BUFFER);
let total = opts
.max_output_bytes
.map(|b| (b as usize).clamp(1 << 20, MAX_ALLOWED_OUTPUT))
.unwrap_or(DEFAULT_STREAM_MAX_TOTAL);
(StreamMode::Lossless, buf, total)
}
None => (StreamMode::Tail, MAX_PENDING, usize::MAX),
};
let proc = Arc::new(Proc {
client: client.map(str::to_owned),
can_read: parking_lot::Condvar::new(),
state: Mutex::new(ProcState {
stdin: child.stdin.take(),
child,
@@ -2799,6 +2966,14 @@ impl HostApi for PluginApi {
stderr: Vec::new(),
status: None,
readers: 0,
waiters: 0,
mode,
buffer_limit,
max_total,
total_stdout: 0,
total_stderr: 0,
overflow_err: None,
stopped: false,
}),
});
if let Some(pipe) = stdout {
@@ -2822,7 +2997,7 @@ impl HostApi for PluginApi {
fn poll_process(&self, id: u64, max: usize) -> Result<ProcessChunk, HostError> {
let proc = self.process(id)?;
proc.reap()?;
Ok(proc.chunk(max))
proc.chunk(max)
}
fn write_process(
@@ -2902,13 +3077,32 @@ impl HostApi for PluginApi {
cancel: &CancellationToken,
) -> Result<ProcessChunk, HostError> {
let proc = self.process(id)?;
// Track active waiters and wake reader threads so lossless streams continue
// draining into the retained buffer up to max_total without pipe deadlock.
struct WaitGuard<'a>(&'a Proc);
impl Drop for WaitGuard<'_> {
fn drop(&mut self) {
let mut state = self.0.state.lock();
state.waiters = state.waiters.saturating_sub(1);
self.0.can_read.notify_all();
}
}
let _guard = {
let mut state = proc.state.lock();
state.waiters += 1;
proc.can_read.notify_all();
WaitGuard(&proc)
};
let deadline = Instant::now() + timeout;
loop {
proc.reap()?;
let (ended, readers) = {
let (ended, readers, overflow) = {
let state = proc.state.lock();
(state.status.is_some(), state.readers)
(state.status.is_some(), state.readers, state.overflow_err.clone())
};
if let Some(err) = overflow {
return Err(HostError::Failed(err));
}
// Its output is only complete once its pipes reached the end too.
if ended && readers == 0 {
break;
@@ -2921,7 +3115,7 @@ impl HostApi for PluginApi {
}
std::thread::sleep(Duration::from_millis(10));
}
Ok(proc.chunk(max))
proc.chunk(max)
}
fn task_begin(&self, client: Option<&str>, title: String, cancellable: bool, cancel: CancellationToken) -> u64 {
@@ -4165,6 +4359,181 @@ mod tests {
api.release_process(id);
}
fn test_proc_api(dir: &Path) -> (PluginApi, impl Fn(&str, &str) -> ProcessCommand) {
let pins: Arc<RwLock<HashMap<(String, String), ProgramPin>>> = Arc::default();
#[cfg(unix)]
let (prog, path) = ("sh", PathBuf::from("/bin/sh"));
#[cfg(windows)]
let (prog, path) = {
let sysroot = std::env::var("SystemRoot").unwrap_or_else(|_| "C:\\Windows".into());
("powershell", PathBuf::from(sysroot).join(r"System32\WindowsPowerShell\v1.0\powershell.exe"))
};
pins.write().insert(("acme.lint".into(), format!("process:{prog}")), ProgramPin::approve(&path).unwrap());
let api = api(dir, pins);
let cmd = move |unix_script: &str, win_script: &str| {
#[cfg(unix)]
{
let _ = win_script;
ProcessCommand {
program: prog.into(),
args: vec!["-c".into(), unix_script.into()],
env: Vec::new(),
approval_root: None,
}
}
#[cfg(windows)]
{
let _ = unix_script;
ProcessCommand {
program: prog.into(),
args: vec!["-NoProfile".into(), "-Command".into(), win_script.into()],
env: Vec::new(),
approval_root: None,
}
}
};
(api, cmd)
}
#[test]
fn start_stream_lossless_backpressure_fast_producer() {
let tmp = tempfile::tempdir().unwrap();
let (api, make_cmd) = test_proc_api(tmp.path());
let cmd = make_cmd("head -c 65536 /dev/zero | tr '\\0' 'A'", "[Console]::Out.Write('A' * 65536)");
let options = ProcessOptions { buffer_bytes: Some(4096), max_output_bytes: Some(1 << 20) };
let id = api.start_process_stream(cmd, None, None, Some(options)).unwrap();
let mut total_out = String::new();
let deadline = Instant::now() + Duration::from_secs(10);
let status = loop {
let chunk = api.poll_process(id, 1024).unwrap();
total_out.push_str(&chunk.stdout);
if let Some(status) = chunk.status {
break status;
}
assert!(Instant::now() < deadline, "timed out waiting for process completion");
std::thread::sleep(Duration::from_millis(5));
};
assert_eq!(status, 0);
assert_eq!(total_out.len(), 65536);
assert!(total_out.chars().all(|c| c == 'A'));
api.release_process(id);
}
#[test]
fn start_stream_dual_stream_concurrency() {
let tmp = tempfile::tempdir().unwrap();
let (api, make_cmd) = test_proc_api(tmp.path());
let cmd = make_cmd(
"head -c 10000 /dev/zero | tr '\\0' 'O'; head -c 10000 /dev/zero | tr '\\0' 'E' >&2",
"[Console]::Out.Write('O' * 10000); [Console]::Error.Write('E' * 10000)",
);
let options = ProcessOptions { buffer_bytes: Some(4096), max_output_bytes: Some(1 << 20) };
let id = api.start_process_stream(cmd, None, None, Some(options)).unwrap();
let mut total_stdout = String::new();
let mut total_stderr = String::new();
let deadline = Instant::now() + Duration::from_secs(10);
let status = loop {
let chunk = api.poll_process(id, 1024).unwrap();
total_stdout.push_str(&chunk.stdout);
total_stderr.push_str(&chunk.stderr);
if let Some(status) = chunk.status {
break status;
}
assert!(Instant::now() < deadline, "timed out waiting for dual streams");
std::thread::sleep(Duration::from_millis(5));
};
assert_eq!(status, 0);
assert_eq!(total_stdout.len(), 10000);
assert_eq!(total_stderr.len(), 10000);
assert!(total_stdout.chars().all(|c| c == 'O'));
assert!(total_stderr.chars().all(|c| c == 'E'));
api.release_process(id);
}
#[test]
fn start_stream_total_limit_overflow() {
let tmp = tempfile::tempdir().unwrap();
let (api, make_cmd) = test_proc_api(tmp.path());
let cmd = make_cmd("head -c 2097152 /dev/zero | tr '\\0' 'X'", "[Console]::Out.Write('X' * 2097152)");
let options = ProcessOptions { buffer_bytes: Some(4096), max_output_bytes: Some(1 << 20) };
let id = api.start_process_stream(cmd, None, None, Some(options)).unwrap();
let deadline = Instant::now() + Duration::from_secs(10);
let mut err = None;
while Instant::now() < deadline {
match api.poll_process(id, 65536) {
Ok(chunk) => {
if chunk.status.is_some() {
break;
}
}
Err(e) => {
err = Some(e);
break;
}
}
std::thread::sleep(Duration::from_millis(10));
}
let err = err.expect("expected overflow error");
assert!(matches!(err, HostError::Failed(ref msg) if msg.contains("exceeded 1 MiB limit")), "{err}");
api.release_process(id);
}
#[test]
fn run_captured_configurable_limits() {
let tmp = tempfile::tempdir().unwrap();
let (api, make_cmd) = test_proc_api(tmp.path());
let token = CancellationToken::new();
let cmd = make_cmd("head -c 2097152 /dev/zero | tr '\\0' 'Z'", "[Console]::Out.Write('Z' * 2097152)");
let opts_ok = ProcessOptions { max_output_bytes: Some(4 << 20), buffer_bytes: None };
let out = api
.run_process_with_options(cmd.clone(), None, None, &token, Duration::from_secs(10), Some(opts_ok))
.unwrap();
assert_eq!(out.status, Some(0));
assert_eq!(out.stdout.len(), 2097152);
let opts_fail = ProcessOptions { max_output_bytes: Some(1 << 20), buffer_bytes: None };
let err = api
.run_process_with_options(cmd, None, None, &token, Duration::from_secs(10), Some(opts_fail))
.unwrap_err();
assert!(matches!(err, HostError::Failed(ref msg) if msg.contains("stdout exceeded 1 MiB limit")), "{err}");
// Stderr overflow in run_captured also fails explicitly
let cmd_err = make_cmd("head -c 2097152 /dev/zero >&2", "[Console]::Error.Write('E' * 2097152)");
let err = api
.run_process_with_options(cmd_err, None, None, &token, Duration::from_secs(10), Some(opts_fail))
.unwrap_err();
assert!(matches!(err, HostError::Failed(ref msg) if msg.contains("stderr exceeded 1 MiB limit")), "{err}");
}
#[test]
fn start_stream_wait_drains_producer_larger_than_buffer() {
let tmp = tempfile::tempdir().unwrap();
let (api, make_cmd) = test_proc_api(tmp.path());
let token = CancellationToken::new();
// Emits 64 KiB, which is 16x larger than the 4 KiB buffer. Calling wait drains without blocking on pipe.
let cmd = make_cmd("head -c 65536 /dev/zero | tr '\\0' 'W'", "[Console]::Out.Write('W' * 65536)");
let options = ProcessOptions { buffer_bytes: Some(4096), max_output_bytes: Some(1 << 20) };
let id = api.start_process_stream(cmd, None, None, Some(options)).unwrap();
let chunk = api.wait_process(id, 100_000, Duration::from_secs(10), &token).unwrap();
assert_eq!(chunk.status, Some(0));
assert_eq!(chunk.stdout.len(), 65536);
assert!(chunk.stdout.chars().all(|c| c == 'W'));
api.release_process(id);
}
#[test]
fn start_stream_cancellation_terminates_child() {
let tmp = tempfile::tempdir().unwrap();
let (api, make_cmd) = test_proc_api(tmp.path());
let cmd = make_cmd("sleep 60", "Start-Sleep -Seconds 60");
let id = api.start_process_stream(cmd, None, None, None).unwrap();
let proc = api.process(id).unwrap();
api.kill_process(id).unwrap();
assert!(proc.state.lock().child.try_wait().unwrap().is_some());
api.release_process(id);
}
#[test]
fn programs_run_only_as_approved() {
let tmp = tempfile::tempdir().unwrap();
+24
Переглянути файл
@@ -583,6 +583,19 @@ pub trait HostApi: Send + Sync {
cancel: &CancellationToken,
timeout: Duration,
) -> Result<ProcessOutput, HostError>;
/// Runs `cmd` with configurable capture options (API 1.15).
fn run_process_with_options(
&self,
cmd: ProcessCommand,
cwd: Option<&Path>,
stdin: Option<String>,
cancel: &CancellationToken,
timeout: Duration,
options: Option<crate::types::ProcessOptions>,
) -> Result<ProcessOutput, HostError> {
let _ = options;
self.run_process(cmd, cwd, stdin, cancel, timeout)
}
/// Delivers every event of `kind`, dropping its path filter.
fn subscribe(&self, kind: EventKind);
/// Delivers `kind` (`file-opened`, `file-saved`, `files-changed`) only for matching paths.
@@ -590,6 +603,17 @@ pub trait HostApi: Send + Sync {
fn unsubscribe(&self, kind: &str);
/// Starts `cmd` and returns the handle to it without waiting.
fn start_process(&self, cmd: ProcessCommand, cwd: Option<&Path>, client: Option<&str>) -> Result<u64, HostError>;
/// Starts `cmd` with streaming options (API 1.15).
fn start_process_stream(
&self,
cmd: ProcessCommand,
cwd: Option<&Path>,
client: Option<&str>,
options: Option<crate::types::ProcessOptions>,
) -> Result<u64, HostError> {
let _ = options;
self.start_process(cmd, cwd, client)
}
/// What process `id` printed since the last call, each stream at most
/// `max` bytes (the rest waits for the next call), and its status once it
/// ended.
+9
Переглянути файл
@@ -560,6 +560,15 @@ pub struct ProcessChunk {
pub status: Option<i32>,
}
/// Options for process execution and streaming (API 1.15; WIT `process.process-options`).
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct ProcessOptions {
/// Maximum bytes captured per stream before returning an error (up to 128 MiB; default 16 MiB).
pub max_output_bytes: Option<u32>,
/// In-flight buffer size per stream for streaming backpressure (default 256 KiB, max 4 MiB).
pub buffer_bytes: Option<u32>,
}
/// Where `net:` requests may go: the URL's host when it is `https`, or
/// `http` to the loopback interface.
pub fn net_host(url: &str) -> Result<String, String> {
+45
Переглянути файл
@@ -1862,6 +1862,10 @@ fn to_output(output: crate::types::ProcessOutput) -> process::Output {
process::Output { status: output.status, stdout: output.stdout, stderr: output.stderr }
}
fn to_process_options(opts: process::ProcessOptions) -> crate::types::ProcessOptions {
crate::types::ProcessOptions { max_output_bytes: opts.max_output_bytes, buffer_bytes: opts.buffer_bytes }
}
impl process::Host for StoreData {
fn run(
&mut self,
@@ -1916,6 +1920,47 @@ impl process::Host for StoreData {
};
self.push(ChildRes { id, host: self.host.clone() }).map(Ok)
}
fn run_captured(
&mut self,
cmd: process::Command,
cwd: Option<Resource<ProjectRes>>,
stdin: Option<String>,
options: Option<process::ProcessOptions>,
) -> Fallible<process::Output> {
let cmd = match self.command(cmd) {
Ok(cmd) => cmd,
Err(e) => return Ok(Err(e)),
};
let cwd = self.cwd_of(cwd)?;
let token = self.cancel.token();
let timeout = self.io_timeout();
let opts = options.map(to_process_options);
let outcome = self.host.run_process_with_options(cmd, cwd.as_deref(), stdin, &token, timeout, opts);
if outcome.is_err() {
self.grant_io_error_grace();
}
Ok(outcome.map(to_output).map_err(to_wit))
}
fn start_stream(
&mut self,
cmd: process::Command,
cwd: Option<Resource<ProjectRes>>,
options: Option<process::ProcessOptions>,
) -> Fallible<Resource<ChildRes>> {
let cmd = match self.command(cmd) {
Ok(cmd) => cmd,
Err(e) => return Ok(Err(e)),
};
let cwd = self.cwd_of(cwd)?;
let opts = options.map(to_process_options);
let id = match self.host.start_process_stream(cmd, cwd.as_deref(), self.invocation.client.as_deref(), opts) {
Ok(id) => id,
Err(e) => return Ok(Err(to_wit(e))),
};
self.push(ChildRes { id, host: self.host.clone() }).map(Ok)
}
}
impl process::HostChild for StoreData {
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
476dff19159556f8afc8ba4e7d1757d7faebb79046fc08e1601563a7cf9ad3d1
ef1aeca63e064ddd9c43126347fd69b39597230afe29c023effeecffb5dab627
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
988eeaa480210cef8d733f8305a7441f4d51699d756ac2e1cfd4728ff57bbc84
b5df63f7d04ab303ccf1c077187df063753a639670254c4bd64ced055e3bf806
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
c82d541d5c1c7e9ab595e33cf206fe065fa9b4bd6e94d19b181b78049ffc60a9
52dfaac64cd496de1685d8412e4073e609a8cb4ab6e1776346aac8c18793550a
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
c5dd0424fc7f3043139577e64de4b4a4e5e73913453b42ccde6ee9f0d878bc57
0a30717897bc970afff38a916353510db23c90123b2dccc0d2b722e734dd83b3
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
fb95d2b21ca4c0ffe8c9b359999d2bc80a37a2aaf389f4290b62c2bc7e0657eb
d41ca70e38b228af31d69302d0513db52311423f44ad5ef86e47e0f8a409a822
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
9e68d2e72a85c4b2491ebf3ca31e0ebedd47941db1dd8e1b69a418e1dfacbb71
e6ab772482157eae8b9bd558baf62f288899b335851e760bb4f2703dbbc52ede
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
9f56d68a45f3508ba89bab5af935986da1bd01ee3df5f045283ec82911409edf
3c45e59462de19c2ebba63072d2600e8340fdb9aeafc1e0f736facb79d8f3bb9
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
1f39c7829190e563f8145bd08385b595dab3bd5bd493182681126d3e17ef5035
fb64178b6cfa96e3b4c7ec03a6cf892467442c322f59d8441bc796e515607ad7
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
e5cc283d9df974bce79bcab1ddfba19b0d50702251176f7c1f71a0894319fc95
2fc18a5627776ab512afdb183ea8ea9aaf77b19496837c0f7b7287d03dc453d9
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
73a29153c691351dfaf3f37e2ba420d0d4ca9ee2f1c102616e64d5eb0532bde3
72d2ed671223b984982fc7740e3ea2febfadee0e37ab9490f21cd120abbd6316
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
01b33569f711f50f1114b718ba9ff5a9d4f0ac8e9e8e84d1cccd001ca2f46d20
49f428f9e258c0cc72ff6d4f85c573a1875d55a7d1cce9dc8246c950f08c2f5f
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
ae86f8929ac9fed59b511b64c9fc6409143d9ec6e4d84e9109bbdd849c4a4cf5
f6d1c7a6734996c0edd23e9e14e4487da5610712d2566b0b389c9d5c0273a71d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
8ae3c039570329a8b9f59b20450be8f96f1a125cb65f8b404419d20e6cd9b43f
1fcfcd161b3c719d24691ccd10c0eca329b47a6dd0195a77289d10eed8de0de9
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
60ed7b2c7c67e9d5fa3e2f6692619ad7406bd540c32fd178e5986f413e3e948c
b1b8cc4314d9d884da30e16628e79f4c1b844fa8ab39ec1d043de22492004570
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
48f755d33198a9bc7dfeeadedaa64fdfc8426cc6b697532e78e9093775d587b4
be0d5c276c63a310aef3ab1bf72f66ceb61cf064d24284c88883287936c27fd9
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
1a619dad978cadaeab8f181adc63cdb731aa392297cdbce894feadcc488bf8ca
a8f4e08bb96467d97e9466ac27ddfd3464ea6fc522a9cb46da0a7addf95bc049
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
007592c7adb4353cab3f2d748a511d073d9ca1523aa235fab8d3f063ade149e0
b5b4f2baaf59dc69b631209f1bbe681bae2ccf7007cd809c6d039c00f347c77d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
25a975ae7a81ef34e4635fd34dca2cf747d11bbdec206e1e9c5f27cea9b888e6
9befc1bcec69b69862b7089fd6c0b1ca0afeadbcc426ad9ea65985dfa0a2da8c
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
75bff3c38b179cc98d2c24e8d6add56077c69756e436d3b1ee3a064e6d566d94
a1ab5823612e4857fd549e1f4b5733dd7705e4ed9476b30fcf88866f8596f5f8
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
76641b6954d59c30dac9b08c3c5dacbcaa7632af517f403b14b7f7987c61d5f8
5f9e8ee5a69354ac954cd8445be90838424ae5d6cf0e3624c40848d94032f474
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
a307fedfeb01bc3dbdc3ac425b3f23dc7280f594e654c696902deaa0790f889f
a2ff5dd95aca671f24963f9a5fccd47b413d51e9823676d2e233bdc1ec9d5494
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
30e0f0782782ce4d0e697e026343708c44a1d53db2b9d44e063fff540850b471
cb26e176fcd652076e6042ce28741f06aecaad62db8252f753c197f5c77f273b
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
d2a3db92d7e1c39ce797013a04745abd918fb3f79bc581894e8820d5ce247557
e15654a146bb90a6334ebe41434e7acacb625be5a773aa3de9df0b182518bd5e
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
2b58e78383ccc2e4134f60fdbdb40ceaeeadd594b5f6f530d1598e3a84eecf1c
4afcc33e474f1b26d22c3b741334495264ba18f6e45fa67209573c0fda4590b0
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f8170b78126576f7bfcd25cfe97b55a12d9741e34ad743f5d3b78a36fa97bc67
0aa6ec978d4b26b7f799ec338f336613080b9292ec1f7dea16a3e5397b20d08d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
355d2a93b11c3ca487c8008c4f3f36cb6eeb41f80af58c42b5762976c6d905aa
82c142e158aa4e4e7a6fd85e49e0063e36f02c7bf2897590eea8278d98d2626d
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
1b63cc55968a8f748063e7c5a7055e37308746070b1252cacc162fde448eea0c
b262a5fcfa533b419e34a13fcb984872b13c56056fb76c9ff4ceacf269af3262
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
a0c4d4e8f4906255e5775e4fb5313c566119689ea81bf3ff4facf36c8eabebf8
2007393d974d7c0d42d07b714e88fb1a30300704bcf1b0ff0e3c16694ecb8df3
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
76105de451dd79c18e04ac8ec4d7e93fcd1ef3f1e72cb339434d10da811c9e4d
fe05d969b134a2871485c846f1816d177495fd5175c57f0758888706c5b88a2b
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
db0f738e7b25735e0d856500674106834ee02025b063ee659f4d6270dbce12aa
d219f0b2ae1d9233ad3a489dda4b96a224da94dbc57d5004225e0a4955abdbfa
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
13ef23569704549fe7274270ec4f77c9aee9206a4f0491273fdd5f84279fa9c5
d68d8c54020de78a95c37340f037d54e589db161e4ce5e95c683790c37955a59
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
9866f44c883bee81012e33ed1927cb6467a26aae6b5af7d9ad9217165e215328
2fb71f31a8fc0048b1f6f12f5c66207a78f5f6779e439034ad3ca51c435aa24a
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
d6dee51c4b07a8c08bde9c618736bf7667f55fdc628e89d6aaeacab2c5f4aa5c
6f32d8b109428badff099cdb39c0b80e5ed7b875a0ee4465acc6e30b4457f90b
+1 -1
Переглянути файл
@@ -67,7 +67,7 @@ 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.
Run `mise tasks` to list all tasks. `mise run build` builds the frontend (not a desktop installer); `mise run dogfood:build` and `mise run dogfood:install` build and locally install a grey-icon dogfood desktop app that shares settings and data with the release app. Only one of the two apps runs at a time, since they share one instance; settings written by the newer dogfood build can make an older release ignore the settings file. The dogfood app never updates itself: run `dogfood:install` again to pick up new changes. `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
+15 -9
Переглянути файл
@@ -297,12 +297,14 @@ launching as before.
## Running programs
| Function | What it does |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `Project::run_process(program, &args, stdin)` | Runs the pinned program in the project root and waits: `{ status, stdout, stderr }`, 4 MiB each. |
| `host::run_command(&Command, Some(&project), stdin)` | API 1.3: the same, with environment variables added by `Command::env`. |
| `host::start(&Command, Some(&project))` | API 1.3: a `Child` left running: `poll`, `write`, `close_stdin`, `wait`, `kill`. At most 8. |
| `host::open_terminal(title, program, &args)` | A Terminal tab running the program (see [Views](/en/plugins/guides/views)). |
| Function | What it does |
| ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| `Project::run_process(program, &args, stdin)` | Runs the pinned program in the project root and waits: `{ status, stdout, stderr }`, 4 MiB each. |
| `host::run_command(&Command, Some(&project), stdin)` | API 1.3: the same, with environment variables added by `Command::env`. |
| `host::run_captured(&Command, Some(&project), stdin, options)` | API 1.15: configurable output limit (up to 128 MiB per stream); errors explicitly if either stdout or stderr overflows. |
| `host::start(&Command, Some(&project))` | API 1.3: a `Child` left running: `poll`, `write`, `close_stdin`, `wait`, `kill`. At most 8. |
| `host::start_stream(&Command, Some(&project), options)` | API 1.15: lossless streaming with backpressure and bounded buffer, terminating with an explicit error on total overflow.|
| `host::open_terminal(title, program, &args)` | A Terminal tab running the program (see [Views](/en/plugins/guides/views)). |
```rust
use openidea_plugin::host::{self, Command};
@@ -319,8 +321,12 @@ let out = host::run_command(&Command::new("forge").arg("build").env("FOUNDRY_PRO
inside `host::begin_task`. Dropping a `Child` kills it, and disabling or reclaiming the
plugin ends its children.
- A `Child`'s `poll` and `wait` return what it printed since the last read. `status` comes
with the chunk that holds the last of its output, so read until it is set. Output nobody
reads keeps only its last 1 MiB per stream: for the whole output of a command that ends,
use `run_command`.
with the chunk that holds the last of its output, so read until it is set. For commands started
with `start`, unread output keeps only its last 1 MiB per stream (tail mode). For lossless
streaming without head data loss or output race conditions, use `start_stream` with `ProcessOptions`
(defaults to 256 KiB buffer per stream with OS pipe backpressure, and 32 MiB total limit).
- When a command exceeds output limits in `run_process`, `run_command`, or `run_captured`, or
when total stream output exceeds the ceiling in `start_stream`, the IDE produces an explicit
error rather than silently truncating stdout or stderr.
- In **Settings › Plugins** the user can choose the executable of a `process:` grant
globally or per project; the plugin keeps calling its declared program name.
+1 -1
Переглянути файл
@@ -67,7 +67,7 @@ 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 目标。
运行 `mise tasks` 可以查看全部任务。`mise run build` 构建前端,不生成桌面安装包;`mise run dogfood:build` 和 `mise run dogfood:install` 用于构建并在本地安装灰色图标的 dogfood 桌面版(与正式版共享设置和数据)。两者共用同一个实例,同一时间只能运行一个;较新的 dogfood 版写入的设置可能让较旧的正式版忽略整个设置文件。dogfood 版不会自动更新,需要更新时重新运行 `dogfood:install`。`mise run test` 运行 Vitest 和 `cargo test --workspace`;`mise run check` 先检查格式、代码规范、类型和未使用的代码,再运行这两套测试。两者都不需要 nextest 或插件的 WASM 目标。
## Worktree
+12 -7
Переглянути файл
@@ -254,12 +254,14 @@ register_plugin!(MyPlugin, run_target_validation);
## 运行程序
| 函数 | 作用 |
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| `Project::run_process(program, &args, stdin)` | 在项目根目录运行已固定的程序并等待结束:`{ status, stdout, stderr }`,各 4 MiB。 |
| `host::run_command(&Command, Some(&project), stdin)` | API 1.3:同上,可用 `Command::env` 追加环境变量。 |
| `host::start(&Command, Some(&project))` | API 1.3:保持运行的 `Child`:`poll`、`write`、`close_stdin`、`wait`、`kill`。最多 8 个。 |
| `host::open_terminal(title, program, &args)` | 运行该程序的终端标签页(见 [视图](/zh/plugins/guides/views))。 |
| 函数 | 作用 |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| `Project::run_process(program, &args, stdin)` | 在项目根目录运行已固定的程序并等待结束:`{ status, stdout, stderr }`,各 4 MiB。 |
| `host::run_command(&Command, Some(&project), stdin)` | API 1.3:同上,可用 `Command::env` 追加环境变量。 |
| `host::run_captured(&Command, Some(&project), stdin, options)` | API 1.15:可配置输出上限(每个流最高 128 MiB),stdout 或 stderr 溢出时明确报错。 |
| `host::start(&Command, Some(&project))` | API 1.3:保持运行的 `Child`:`poll`、`write`、`close_stdin`、`wait`、`kill`。最多 8 个。 |
| `host::start_stream(&Command, Some(&project), options)` | API 1.15:基于管道背压的有界无损流式传输,超出总预算时明确报错并终止进程。 |
| `host::open_terminal(title, program, &args)` | 运行该程序的终端标签页(见 [视图](/zh/plugins/guides/views))。 |
```rust
use openidea_plugin::host::{self, Command};
@@ -273,5 +275,8 @@ let out = host::run_command(&Command::new("forge").arg("build").env("FOUNDRY_PRO
- 调用会随任务或调用一起取消,超时即终止;耗时的工作请放进 `host::begin_task`。丢弃 `Child` 会终止进程,
禁用或回收插件会结束它启动的所有子进程。
- `Child` 的 `poll` 和 `wait` 返回上次读取之后的输出;`status` 随包含最后一段输出的那次结果返回,读到它为止。
没有读取的输出每个流只保留最后 1 MiB;要拿到会结束的命令的完整输出,请用 `run_command`。
通过 `start` 启动的命令,未读取的输出每个流只保留最后 1 MiB(尾部环形缓冲)。若需无头部丢弃、避免竞态的无损流式传输,
请使用 API 1.15 的 `start_stream` 与 `ProcessOptions`(默认每流 256 KiB 缓冲区并施加系统管道背压,总上限 32 MiB)。
- 当程序在 `run_process`、`run_command` 或 `run_captured` 中超出输出上限,或在 `start_stream` 中超出总流预算时,
IDE 会返回明确的错误,绝不静默截断 stdout 或 stderr。
- 用户可以在 **设置 › 插件** 中为 `process:` 授权全局或按项目选择可执行文件;插件仍使用其声明的程序名调用。
+62
Переглянути файл
@@ -196,6 +196,68 @@ test("long completion signatures fit the editor when the workbench is narrowed",
await expect(editor.locator(".cm-activeLine")).toContainText(`order.${label}()`);
});
test("completion clips long parameters before the suggestion name and return type", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1120, height: 760 });
const editor = await openSample(page);
const label = "reconcilePendingOrdersByRegion";
const returnType = "RegionalSettlementResult";
await page.evaluate(
({ label, returnType }) => {
const labelDetail =
"(pendingOrders: ReadonlyArray<PendingOrder>, reconciliationOptions: RegionalReconciliationOptions)";
const item: CompletionItem = {
label,
labelDetail,
labelDescription: returnType,
detail: null,
kind: "method",
documentation: null,
sortText: null,
filterText: null,
preselect: true,
deprecated: false,
insertText: `${label}()`,
isSnippet: false,
replaceRange: null,
replaceRangeTab: null,
additionalEdits: [],
commitCharacters: [],
command: null,
data: null,
server: 1,
};
window.__ipc.handlers.lsp_completion = () => ({ isIncomplete: false, items: [item] });
},
{ label, returnType },
);
await editor.locator(".cm-line", { hasText: "return order.toDto()" }).click();
await page.keyboard.press("End");
await page.keyboard.press("Enter");
await page.keyboard.type("order.");
await page.keyboard.press("Control+Space");
const popup = page.locator(".cm-tooltip-autocomplete");
const row = popup.getByRole("option").filter({
has: page.locator(".cm-completionLabel", { hasText: label }),
});
await expect(row.locator(".cm-lsp-type")).toHaveText(returnType);
await page.setViewportSize({ width: 820, height: 760 });
await expect
.poll(() =>
row.evaluate((el) => {
const name = el.querySelector<HTMLElement>(".cm-completionLabel")!;
const parameters = el.querySelector<HTMLElement>(".cm-completionDetail")!;
const type = el.querySelector<HTMLElement>(".cm-lsp-type")!;
return {
nameFits: name.scrollWidth <= name.clientWidth + 1,
typeFits: type.scrollWidth <= type.clientWidth + 1,
parametersClipped: parameters.scrollWidth > parameters.clientWidth,
};
}),
)
.toEqual({ nameFits: true, typeFits: true, parametersClipped: true });
});
test("documentation shows beside the lookup instead of being clipped by it", async ({ workbench: page }, info) => {
const editor = await openSample(page);
await page.evaluate(async () => {
+48 -1
Переглянути файл
@@ -299,6 +299,47 @@ test("⌘R replaces every match in the file", async ({ workbench: page }) => {
await expect(editor.locator(".cm-line", { hasText: "OrderDto" })).toHaveCount(2);
});
test("the inline find and replace fields share a column that grows with the editor", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1120, height: 760 });
const editor = await openFromTree(page, "build.gradle.kts");
await editor.locator(".cm-content").click();
await page.keyboard.press("Meta+r");
const bar = page.getByRole("search", { name: "Replace in file" });
const find = bar.getByRole("textbox", { name: "Find" });
const replace = bar.getByRole("textbox", { name: "Replace" });
const more = bar.getByRole("button", { name: "More", exact: true });
const close = bar.getByRole("button", { name: "Close", exact: true });
await find.fill("OrderDto");
await replace.fill("OrderView");
const column = () =>
bar.evaluate((panel) => {
const [find, replace] = panel.querySelectorAll("textarea");
const findField = find!.parentElement!.getBoundingClientRect();
const replaceField = replace!.parentElement!.getBoundingClientRect();
return {
left: findField.left,
width: findField.width,
replaceLeft: replaceField.left,
replaceWidth: replaceField.width,
};
});
const initial = await column();
expect(initial.left).toBeCloseTo(initial.replaceLeft);
expect(initial.width).toBeCloseTo(initial.replaceWidth);
for (const width of [1120, 1480]) {
await page.setViewportSize({ width, height: 760 });
const [moreBox, closeBox] = await Promise.all([more.boundingBox(), close.boundingBox()]);
expect(closeBox!.y).toBeCloseTo(moreBox!.y);
expect(closeBox!.x).toBeGreaterThanOrEqual(moreBox!.x + moreBox!.width);
expect(closeBox!.x).toBeLessThanOrEqual(moreBox!.x + moreBox!.width + 4);
}
await expect.poll(async () => (await column()).width).toBeGreaterThan(initial.width + 60);
await close.click();
await expect(bar).toBeHidden();
});
test("the inline find and replace controls stay inside a narrow editor pane", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1120, height: 760 });
const editor = await openFromTree(page, "build.gradle.kts");
@@ -331,13 +372,19 @@ test("the inline find and replace controls stay inside a narrow editor pane", as
await expect.poll(navigationIsBelowFind).toBe(true);
await page.setViewportSize({ width: 495, height: 760 });
await expect.poll(controlsFit).toBe(true);
const close = bar.getByRole("button", { name: "Close", exact: true });
const more = bar.getByRole("button", { name: "More", exact: true });
const [moreBox, closeBox] = await Promise.all([more.boundingBox(), close.boundingBox()]);
expect(closeBox!.y).toBeCloseTo(moreBox!.y);
expect(closeBox!.x).toBeGreaterThanOrEqual(moreBox!.x + moreBox!.width);
expect(closeBox!.x).toBeLessThanOrEqual(moreBox!.x + moreBox!.width + 4);
await expect(find).toHaveValue("OrderDto");
await expect(replace).toHaveValue("OrderView");
await next.click();
await expect(bar.getByText(/^[12]\/2$/)).toBeVisible();
await bar.getByRole("button", { name: "Replace All" }).click();
await expect(editor.locator(".cm-line", { hasText: "OrderView" })).toHaveCount(2);
await bar.getByRole("button", { name: "Close", exact: true }).click();
await close.click();
await expect(bar).toBeHidden();
});
+68
Переглянути файл
@@ -174,6 +174,74 @@ test("Git Log keeps filters and actions inside the commit pane at the minimum wi
await expect(page.getByRole("menuitem", { name: "Paths" })).toBeVisible();
});
test("Git Log puts affected changes on the changed-files toolbar and groups preview options", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1100, height: 720 });
await page.evaluate(() => {
window.__ipc.handlers.vcs_commit_files = () => [
{ path: "src/prices.ts", oldPath: null, kind: "modified" },
{ path: "docs/checkout.md", oldPath: null, kind: "modified" },
];
});
const commit = page.getByRole("listbox", { name: "Commits" }).getByRole("option").first();
const toolbar = page.getByRole("toolbar", { name: "Changed files" });
const tree = page.getByRole("tree", { name: "Changed files" });
const prices = tree.getByText("prices.ts", { exact: true });
const notes = tree.getByText("checkout.md", { exact: true });
const affected = toolbar.getByRole("button", { name: "Show Only Affected Changes" });
const viewOptions = toolbar.getByRole("button", { name: "View Options" });
const menu = page.getByRole("menu");
await commit.click();
await expect(notes).toBeVisible();
await expect(affected).toHaveCount(0);
const filter = (paths: string[]) =>
page.evaluate(async (paths) => {
const mod = "/src/features/vcs/logStore.ts";
const { setLogFilters } = await import(/* @vite-ignore */ mod);
setLogFilters({ paths });
}, paths);
await filter(["/dev/acme-api/src"]);
await commit.click();
await expect(affected).toHaveAttribute("aria-pressed", "false");
await affected.press("Space");
await expect(affected).toHaveAttribute("aria-pressed", "true");
await expect(prices).toBeVisible();
await expect(notes).toHaveCount(0);
await page.setViewportSize({ width: 490, height: 550 });
await expect(affected).toBeInViewport({ ratio: 1 });
await expect
.poll(() =>
toolbar.evaluate((el) => {
const bounds = el.getBoundingClientRect();
return [...el.querySelectorAll("button")].every((button) => {
const box = button.getBoundingClientRect();
return box.left >= bounds.left && box.right <= bounds.right && box.bottom <= bounds.bottom;
});
}),
)
.toBe(true);
await viewOptions.click();
await expect(menu.getByText("Layout", { exact: true })).toBeVisible();
await expect(menu.getByRole("menuitemcheckbox", { name: "Show Only Affected Changes" })).toHaveCount(0);
const preview = menu.getByRole("menuitemcheckbox", { name: "Show Diff Preview" });
await expect(preview).toHaveAttribute("aria-checked", "true");
await preview.click();
await viewOptions.click();
await expect(preview).toHaveAttribute("aria-checked", "false");
await page.keyboard.press("Escape");
await affected.click();
await expect(notes).toBeVisible();
await filter([]);
await commit.click();
await expect(affected).toHaveCount(0);
await expect(notes).toBeVisible();
});
test("the Paths filter replaces the repository filter and can be cleared from overflow", async ({
workbench: page,
}) => {
+19
Переглянути файл
@@ -61,8 +61,25 @@ test("the floating navigation list stays beside the visible segment and scrolls
const folderRow = list.getByRole("option", { name: "archive" });
await expect(folderRow).toHaveAttribute("aria-selected", "true");
await expect(folderRow).toBeInViewport({ ratio: 1 });
await expect(folderRow).toHaveCSS("height", "18px");
await expect(folderRow).toHaveCSS("font-size", "13px");
await expect(list.getByRole("option", { name: long, exact: true }).getByTitle(long)).toBeVisible();
expect(await list.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
await page.setViewportSize({ width: 1120, height: 820 });
await expect
.poll(() =>
list.evaluate((el) => {
const bounds = el.getBoundingClientRect();
return [...el.querySelectorAll('[role="option"]')].filter((row) => {
const box = row.getBoundingClientRect();
return box.top >= bounds.top && box.bottom <= bounds.bottom;
}).length;
}),
)
.toBe(20);
await page.setViewportSize({ width: 600, height: 560 });
await page.keyboard.press("End");
const lastRow = list.getByRole("option", { name: last, exact: true });
await expect(lastRow).toHaveAttribute("aria-selected", "true");
@@ -119,6 +136,8 @@ for (const position of ["top", "statusBar"] as const) {
const archive = list.getByRole("option", { name: "archive" });
await expect(archive).toHaveAttribute("aria-selected", "true");
await expect(list).toBeFocused();
expect((await list.boundingBox())!.width).toBeLessThan(140);
await expect(archive).toHaveCSS("height", "18px");
await expect
.poll(async () => {
const bounds = (await anchor.boundingBox())!;
+1
Переглянути файл
@@ -9,6 +9,7 @@ test("gives the project name room before its path in a narrow tree", async ({ wo
const pane = page.getByRole("region", { name: "Project", exact: true });
await pane.getByRole("button", { name: "Options", exact: true }).click();
await page.getByRole("menuitem", { name: "Appearance", exact: true }).hover();
await page.getByRole("menuitemcheckbox", { name: "Horizontal Scrolling" }).click();
const tree = pane.getByRole("tree", { name: "Project" });
+23 -1
Переглянути файл
@@ -176,7 +176,29 @@ test("Push keeps commit subjects and changed files readable in a narrow window",
await expect(input).toHaveValue("main");
await expect(dialog.getByRole("button", { name: "Push", exact: true })).toBeInViewport();
const details = dialog.getByRole("region", { name: "Commit details" });
await expect(details).toContainText("Keep the new totals consistent with receipts.");
await page.evaluate(async () => {
const project = "/src/platform/project.ts";
const { useProject } = await import(/* @vite-ignore */ project);
const { settings } = useProject.getState();
useProject.setState({
settings: {
...settings,
editor: { ...settings?.editor, fontFamily: "Consolas", fontSize: 18, fontWeight: 400, boldFontWeight: 700 },
},
});
});
const messageSubject = details.getByText(OUTGOING, { exact: true });
const messageBody = details.getByText("Keep the new totals consistent with receipts.", { exact: true });
await expect(messageSubject).toHaveCSS("font-weight", "700");
await expect(messageBody).toHaveCSS("font-weight", "400");
await expect(messageSubject).toHaveCSS("font-size", "18px");
await expect(messageBody).toHaveCSS("font-size", "18px");
await expect(messageBody).toHaveCSS("font-family", /Consolas/);
const metadata = details.getByText(/Sam Rivera <sam@example\.com>/);
await expect(metadata).toHaveCSS("font-size", "12px");
await metadata.scrollIntoViewIfNeeded();
await expect(metadata).toBeInViewport();
expect(await details.evaluate((el) => el.scrollWidth - el.clientWidth)).toBeLessThanOrEqual(1);
await expect
.poll(async () => {
const [tree, message] = await Promise.all([files.boundingBox(), details.boundingBox()]);
+26 -3
Переглянути файл
@@ -58,8 +58,8 @@ test("a narrow terminal panel keeps the selected tab's close button in view", as
await expect(selected).toHaveAttribute("data-tooltip", new RegExp(longName));
await expect(terminal.getByRole("button", { name: "Show Hidden Tabs" })).toBeHidden();
await expect(terminal.getByRole("button", { name: "New Tab", exact: true })).toBeVisible();
await terminal.getByRole("button", { name: "More Terminal Options" }).click();
await expect(page.getByRole("menuitem", { name: /^New Terminal Tab/ })).toBeVisible();
await terminal.getByRole("button", { name: "New Predefined Session" }).click();
await expect(page.getByRole("menuitem", { name: "zsh", exact: true })).toBeVisible();
await page.keyboard.press("Escape");
await strip.getByRole("button", { name: "Close Tab", exact: true }).click();
await expect(terminal).toBeHidden();
@@ -82,9 +82,32 @@ test("terminal split tabs fit when sessions overflow and switch through the menu
await page.getByRole("menuitem", { name: "Local (2)", exact: true }).click();
await expect(strip.getByRole("tab", { name: "Local (2)", selected: true })).toBeVisible();
await expectSelectedTabToFit(strip);
await expect(header.getByRole("button", { name: "More Terminal Options" })).toBeVisible();
await expect(header.getByRole("button", { name: "New Predefined Session" })).toBeVisible();
await hidden.click();
await page.getByRole("menuitem", { name: longName, exact: true }).click();
await expect(strip.getByRole("tab", { name: longName, selected: true })).toBeVisible();
await expectSelectedTabToFit(strip);
});
test("the terminal session chooser lists shells first and window options own the split commands", async ({
workbench: page,
}) => {
const terminal = await openTerminal(page, 520);
const chooser = terminal.getByRole("button", { name: "New Predefined Session", exact: true });
await expect(chooser).toBeVisible();
await chooser.press("Space");
const sessions = page.getByRole("menu", { name: "New Predefined Session", exact: true });
await expect(sessions.getByRole("menuitem")).toHaveText(["zsh", "SSH Session…", /^Settings/]);
await page.keyboard.press("Home");
await expect(sessions.getByRole("menuitem", { name: "zsh", exact: true })).toBeFocused();
await page.keyboard.press("Enter");
await expect(sessions).toBeHidden();
await expect(terminal.getByRole("tab", { name: "zsh", selected: true })).toBeVisible();
await terminal.getByRole("button", { name: "Options", exact: true }).click();
const options = page.getByRole("menu", { name: "Terminal options", exact: true });
await expect(options.getByRole("menuitem", { name: /^Split Down/ })).toBeVisible();
await expect(options.getByRole("menuitem", { name: /^Settings/ })).toBeVisible();
await options.getByRole("menuitem", { name: /^Split Right/ }).click();
await expect(terminal.getByRole("tablist", { name: "Terminal sessions" })).toHaveCount(2);
});
+46
Переглянути файл
@@ -65,3 +65,49 @@ test("tool window header keeps its actions visible as the Project pane narrows",
await hide.click();
await expect(project).toBeHidden();
});
test("Project options expose behavior, appearance, and sorting as submenus", async ({ workbench: page }) => {
await openFromTree(page, "build.gradle.kts");
await page.setViewportSize({ width: 700, height: 500 });
await page.evaluate(async () => {
const path = "/src/workbench/toolwindows/store.ts";
(await import(/* @vite-ignore */ path)).setToolWindowSize("left", 185);
});
const header = page.locator('[data-toolwindow="project"] header');
const options = header.getByRole("button", { name: "Options", exact: true });
const locate = header.getByRole("button", { name: "Select Opened File", exact: true });
await options.press("Enter");
const menu = page.getByRole("menu", { name: "Project options", exact: true });
const behavior = menu.getByRole("menuitem", { name: "Behavior", exact: true });
const appearance = menu.getByRole("menuitem", { name: "Appearance", exact: true });
const sort = menu.getByRole("menuitem", { name: "Sort By", exact: true });
await expect(behavior).toBeVisible();
await expect(behavior).toBeFocused();
await behavior.press("ArrowRight");
const alwaysSelect = page.getByRole("menuitemcheckbox", { name: "Always Select Opened File", exact: true });
await expect(alwaysSelect).toBeFocused();
await expect(alwaysSelect).toHaveAttribute("aria-checked", "false");
await alwaysSelect.press("Enter");
await expect(menu).toBeHidden();
await expect(locate).toBeHidden();
await options.press("Enter");
await page.keyboard.press("ArrowDown");
await expect(appearance).toBeFocused();
await appearance.press("ArrowRight");
const rootPaths = page.getByRole("menuitemcheckbox", { name: "Show Root Paths", exact: true });
await expect(rootPaths).toBeInViewport({ ratio: 1 });
await page.keyboard.press("ArrowLeft");
await expect(rootPaths).toBeHidden();
await expect(appearance).toBeFocused();
await sort.click();
const type = page.getByRole("menuitemcheckbox", { name: "Type", exact: true });
await expect(type).toBeInViewport({ ratio: 1 });
await expect(page.getByRole("menuitemcheckbox", { name: "Sort Folders First", exact: true })).toBeVisible();
await type.click();
await options.press("Enter");
await sort.click();
await expect(type).toHaveAttribute("aria-checked", "true");
});
+4 -2
Переглянути файл
@@ -46,7 +46,8 @@ test("sorts collapsed workspace roots by project type, shows their icons and ref
.getByRole("region", { name: "Project", exact: true })
.getByRole("button", { name: "Options", exact: true })
.click();
await page.getByRole("menuitemcheckbox", { name: "Sort by Type", exact: true }).click();
await page.getByRole("menuitem", { name: "Sort By", exact: true }).hover();
await page.getByRole("menuitemcheckbox", { name: "Type", exact: true }).click();
await expect(tree.locator("[data-project-path]")).toHaveText([
"rust/work/rust",
"dart/work/dart",
@@ -185,7 +186,8 @@ test("keeps surviving workspace icons and type order during removal", async ({ w
const panel = page.getByRole("region", { name: "Project", exact: true });
await panel.getByRole("button", { name: "Collapse All", exact: true }).click();
await panel.getByRole("button", { name: "Options", exact: true }).click();
await page.getByRole("menuitemcheckbox", { name: "Sort by Type", exact: true }).click();
await page.getByRole("menuitem", { name: "Sort By", exact: true }).hover();
await page.getByRole("menuitemcheckbox", { name: "Type", exact: true }).click();
const rows = tree.locator('[data-project-path^="/work/"]');
await expect(rows).toHaveText(["z-rust/work/z-rust", "a-go/work/a-go", "b-web/work/b-web"]);
const before = await icons();
+9
Переглянути файл
@@ -20,6 +20,15 @@ run = "pnpm dev:app"
description = "Typecheck, bundle and verify the frontend"
run = "pnpm build"
[tasks."dogfood:build"]
description = "Build a local dogfood desktop app bundle"
run = "pnpm dogfood:build"
[tasks."dogfood:install"]
description = "Build and install the local dogfood desktop app"
depends = ["dogfood:build"]
run = "pnpm dogfood:install --no-build"
[tasks.test]
description = "Run the frontend and Rust workspace tests"
run = ["pnpm test", "cargo test --workspace"]
+3 -1
Переглянути файл
@@ -33,7 +33,9 @@
"perf": "node perf/run.ts",
"perf:rust": "node perf/rust.ts",
"eval": "node evals/run.ts",
"release:prepare": "node scripts/release-prepare.ts"
"release:prepare": "node scripts/release-prepare.ts",
"dogfood:build": "node scripts/dogfood.ts build",
"dogfood:install": "node scripts/dogfood.ts install"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
a6c34627577ea95b1ffa0f1eef571284eafc5035f02c36123bcca70fdf6c84ed
e74df5365ba1aa2fa4a6047b86937d5484f4bad171d34eb563b0f50124e65a40
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
e7da1c8a8c57359a8b4f34c82bc76080420cbac1cd97f8b4d44a4b123155da1a
4191723e0466e07498d7c34543563848c8deaf5e08309d54e9d3609dcbf94d71
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f7e9281caea22e272df0d0f9daeae47eea0ddcc3ce3a4e22b1d9b811360df1bb
4746ceb627dd32cc1114e86e66b5c535dfb592ef12b8b10241d6bede16c6262c
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
f59d96f74da661c9e35ed6c95a79755d8a1bf679aad72c503cba34d0842daa06
7d5486b779865ffab3da5ae0c3ad22c1d57e05367d9916bf3571ad56fa4d6597
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
474b52b8cdfb4c49440667a5ee4bcabd7cdfe01ba9ee4e77244d8df64da56079
4eeb924688c063fc9687a8e0760b154a7a045b3e0d7a03a526c1dcb91c25c5cb
Бінарний файл не відображається.
+1 -1
Переглянути файл
@@ -1 +1 @@
1cc6981af57f6e355ae5528679769fdaf8ad8c1ad1bc2d37a3f959727f07c491
22f9fab2363ab2c0df50f1f1d7a1aaa54713137e93ce076058945cecefe3326a
Бінарний файл не відображається.
Loaded 100 of 167 files, more files were not shown because too many files have changed in this diff. Show more