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

..
Автор SHA1 Повідомлення Дата
l0ng-ai 3d26de001f refactor(settings): remove the unused RadioRow control 2026-11-21 09:32:55 +08:00
weigramтаweigram a5c8fe17fd feat(services): drag a run type's group to reorder it (#4929)
The Services tree persists the order of its run type groups per project, but only configurations inside a group could be moved. Groups now reorder among each other by drag or with Move Up / Move Down, using the project's type list as their order, so the new position survives reopening.

Co-authored-by: weigram <[email protected]>
2026-11-21 09:32:07 +08:00
l0ng-ai 0684795334 fix(vcs): align the new branch dialog (#4924)
New Branch used a stacked prompt with a small label above the name field and the creation options at the left edge. The dialog now puts the label beside the field, uses the workbench UI font for both, and aligns validation and options with the field. On narrow windows the label stacks above the field and the checkboxes can wrap.
2026-11-21 09:31:00 +08:00
l0ng-ai 30cbb80f22 fix(history): align the recent changes chooser (#4917)
fix(history): align the recent changes chooser
2026-11-21 09:30:49 +08:00
weigramтаweigram 5cfb0d3311 feat(settings): reopen Settings on the page it was closed on (#4927)
Settings now records the page it shows (when it opens and on each navigation) and reopens there, in the separate Settings window and across restarts. The page is UI state and stays in localStorage; Settings for New Projects keeps its own pages out of it, and an id that no longer exists falls back to the first page.

Co-authored-by: weigram <[email protected]>
2026-11-21 09:22:16 +08:00
l0ng-ai bccf1bd7d6 fix(vcs): align the tag dialog (#4926)
- Align the Tag dialog's labels and controls in two columns, use the workbench font throughout, and stack the fields on narrow windows.
- Show the selected repository and its current branch above the tag fields. Keep the duplicate-name message and Force checkbox under the tag name.
2026-11-21 09:18:46 +08:00
l0ng-ai 3d79454be8 fix(vcs): align the changelist form (#4925)
The changelist form stacked small labels above each field and left room for only three lines of comments. The Name and Comment labels now sit beside a shared field column at the workbench UI size. The comment field starts at four lines, and the fields stack on narrow windows. The same form is available when creating, editing or moving changes to a new list.
2026-11-21 08:59:25 +08:00
l0ng-ai 46e4af2b32 fix(vfs): ignore Git metadata directory touches (#4922)
Git for Windows reports a parent directory modification when Git creates or removes a lock. The watcher treated these notifications as repository changes and refreshed Git status even when the index was identical. Refresh Git status on metadata file changes and directory creation or removal. Skip directory modifications caused by the changed entries.
2026-11-21 08:43:26 +08:00
l0ng-ai 067edb7d60 fix(vcs): align the Git annotation gutter (#4921)
Git annotations displayed only the first part of each author's name, and variable-width dates pushed the author column out of alignment. The gutter now uses the workbench UI font and sizes the columns from the file's annotations. Authors are shown by full name, with a width cap for long labels. When enabled, the revision column leads the row.
2026-11-21 08:25:00 +08:00
l0ng-ai 0a4abf1705 fix(vcs): align the file history layout (#4920)
File History inherited the repository log's sidebars, which left little room for the revision list or commit message. It now uses a full-width toolbar and revision list, with author and date before the subject by default. A resizable pane below puts the selected commit message beside the changed files and remembers its size independently. The repository log and directory history keep their current layout.
2026-11-21 08:06:50 +08:00
l0ng-ai d31699c86a fix(vcs): align the file revision chooser (#4919)
fix(vcs): align the file revision chooser
2026-11-21 07:59:59 +08:00
Gabriel Gondim 9467c4ea1b fix(plugins): install-dir reads and default editors over associated apps (#4918)
A plugin's fs.read-*, editor.open and views.open-location rejected absolute paths under its own install (package) directory, so a linked plugin could not open files bundled next to its component. The install directory is now readable like fs.plugin-dir() (writes still need an fs.write grant). Custom editors with priority "default" now open in the IDE ahead of the Files opened in associated applications list, so a PDF editor plugin is not bypassed by the built-in *.pdf association. The SDK carries the updated WIT docs and the plugin components are rebuilt.

Fixes #4167

Co-authored-by: GGVidal <[email protected]>
2026-11-21 07:58:50 +08:00
l0ng-ai 7c12c58874 fix(vcs): align the operations chooser (#4915)
fix(vcs): align the operations chooser
2026-11-21 07:29:12 +08:00
l0ng-ai 9f47ef0991 style(settings): format the Git settings imports (#4916)
Formats an import line that came out of a merge too long for oxfmt. No behaviour change.
2026-11-21 07:26:17 +08:00
l0ng-ai 3b614dda7a fix(diff): clarify clipboard comparison labels (#4911)
fix(diff): clarify clipboard comparison labels
2026-11-21 07:25:45 +08:00
l0ng-ai 5acd778340 fix(navigation): align the Select In chooser (#4909)
fix(navigation): align the Select In chooser
2026-11-21 07:25:17 +08:00
l0ng-ai 7c682a580f fix(editor): group the Refactor This actions (#4906)
Refactor This uses a compact action list with an Extract/Introduce section and dividers for the related action groups. Filtering keeps captions only for groups with matching actions. The number beside each action still selects that action directly.
2026-11-21 07:25:05 +08:00
l0ng-ai dc07691279 fix(run): align the run configuration chooser (#4904)
The run configuration chooser adapts its width to configuration names and leaves room for the row actions. At large zoom or in a short viewport, the configuration list scrolls while the search field and keyboard shortcuts stay visible.
2026-11-21 07:24:47 +08:00
l0ng-ai 2d04a3d9bc fix(editor): align the Quick Definition preview (#4903)
Quick Definition opens with a toolbar above a resizable code preview. The header shows the symbol and its source location, with previous and next controls when several results are available. The preview uses the source editor's font size, line height, and zoom.
2026-11-21 07:24:36 +08:00
l0ng-ai 8f9b9b1016 fix(workbench): group commands in the tool window layouts menu (#4902)
Window → Tool Window Layouts groups commands under each saved layout and marks the active layout. The default layout is at the top, with commands for the current arrangement below the saved layouts. Rename opens the name field for the selected layout directly.
2026-11-21 07:24:18 +08:00
l0ng-ai 096964c798 fix(workbench): align the toolbar customization dialog (#4898)
Move the add, remove, reorder, transfer, and restore controls into a compact toolbar above the lists. Keep the left and right groups side by side when there is room, and stack them in narrow windows so the labels have more space. The add picker opens directly below its command.
2026-11-21 07:24:08 +08:00
l0ng-ai f1bfd5db52 fix(workbench): center and label Quick Switch Scheme (#4897)
Quick Switch Scheme now opens in the center of the window and stays there when the window is resized. A title identifies the popup, and a numeric column shows shortcuts 1–4 for opening its categories. Theme previews and editor focus still restore when the popup closes.
2026-11-21 07:23:50 +08:00
l0ng-ai a17af582f3 fix(settings): align the Date Formats layout (#4894)
Place the date pattern help beside the input when there is room and let it wrap under the input in narrow windows. Put the live examples just below the time format control in smaller, secondary text. Pretty formatting remains a separate setting and still updates both examples.
2026-11-21 07:23:32 +08:00
l0ng-ai 47f018d8b5 fix(settings): align the External Tools form (#4893)
Pair Name and Group when the form has room and put Description on its own row. Tool Settings contains the command fields, while the execution checkboxes sit in a collapsible Advanced options section that opens for matching settings searches. The fields and macro buttons adapt to the available width.
2026-11-21 07:23:22 +08:00
l0ng-ai 94aa62430c fix(settings): align the System Settings layout (#4890)
Put exit confirmation before Project, then place file saving and synchronization in a Files section before Caches. In narrow windows, the project-opening choices use less vertical space, the directory field keeps its browse button beside it, and the idle timeout keeps its unit. The existing Autosave search term still finds the page.
2026-11-21 07:23:03 +08:00
l0ng-ai 4242c94bfc fix(settings): align the Updates settings layout (#4889)
Put Check Now and Last checked on the same row, below automatic checks and the update source. The last-checked timestamp uses secondary text and follows the button as the window narrows. The release notes preference sits below the manual check.
2026-11-21 07:22:44 +08:00
l0ng-ai 8864ff595d fix(settings): align the Maven settings layout (#4886)
Put the snapshot option and a compact thread count at the top. Group Maven home, user settings, the local repository, and toolchains under Environment. Put source downloads under Importing, with build delegation, JRE, and profiles together under Runner.

Environment and Runner put labels above their fields in narrow windows. Browse buttons stay beside their paths, and Maven Daemon controls are available below Runner.
2026-11-21 07:22:34 +08:00
l0ng-ai 0a08d9f4ce fix(settings): align the Gradle settings layout (#4885)
Place Gradle user home at the top of the page, with separate sections for Build and Run and the Gradle runtime. Keep the local installation path and Browse button beside Distribution when there is room. In narrow windows the path field moves below the selector and stays next to Browse. The Gradle JVM picker sits below the distribution controls.
2026-11-21 07:22:23 +08:00
l0ng-ai 7dbfe8852e fix(settings): align the Spelling settings layout (#4884)
Place custom dictionary files above the accepted words. Give both lists the available pane width, with monospaced paths and standard UI text for words. A tab selects the project or application dictionary within the accepted words section. Settings for New Projects shows the application dictionary directly.
2026-11-21 07:22:13 +08:00
l0ng-ai ae97d5f1c2 fix(settings): group the debugger Data Views controls (#4883)
Group inline values and value tooltips under Editor. Keep the hover delay beside its checkbox in wide windows and below it in narrow windows. Turning off hover dims the delay field and keeps its value for when hover is enabled again. Sort order and live watches sit at the top of the page.
2026-11-21 07:21:54 +08:00
l0ng-ai 4340a96c59 fix(settings): align the Terminal settings layout (#4882)
Group the primary font, fallback font, and sizing controls above Application Settings. Let the start directory and default tab name use the available width. Keep the shell path, installed-shell menu, and Browse button together. Narrow windows place text fields below their labels and show the application checkboxes in one column.
2026-11-21 07:21:17 +08:00
l0ng-ai 0af7bcc7cf fix(settings): align the VCS confirmation settings (#4878)
The file creation and deletion policies use aligned selectors in Version Control settings. They fit on separate rows at narrow widths. The patch creation and history controls follow the Changes group as separate settings.
2026-11-21 07:21:07 +08:00
l0ng-ai 4f52f5ebfa fix(vcs): align the directory comparison layout (#4875)
fix(vcs): align the directory comparison layout
2026-11-21 07:20:29 +08:00
l0ng-ai f284633162 fix(settings): align the Appearance controls (#4867)
fix(settings): align the Appearance controls
2026-11-21 07:20:18 +08:00
l0ng-ai 0ceda2c385 fix(settings): align the Git settings controls (#4865)
fix(settings): align the Git settings controls
2026-11-21 07:20:07 +08:00
l0ng-ai 8b3f55dfb4 fix(settings): align the HTTP Proxy form (#4863)
fix(settings): align the HTTP Proxy form
2026-11-21 07:19:48 +08:00
l0ng-ai c0e888dd2f fix(settings): align the Console settings layout (#4861)
fix(settings): align the Console settings layout
2026-11-21 07:19:37 +08:00
l0ng-ai 04bed01942 fix(vcs): align the Apply Patch preview (#4860)
fix(vcs): align the Apply Patch preview
2026-11-21 07:19:24 +08:00
weigramтаweigram dfafe6c767 fix(app): bring the window forward before the quit prompts ask (#4913)
Confirm Exit and the Terminate / Unsaved Changes prompts of a quit are drawn inside the window, but a quit can start outside it (the Dock, a logout, another window). A minimized or covered window asked with nothing on screen and the app looked hung. The window is now unminimized, shown and focused right before a quit prompt; a window with nothing to ask is left where it is.

Fixes #4912

Co-authored-by: weigram <[email protected]>

Co-authored-by: weigram <[email protected]>
2026-11-21 07:06:44 +08:00
Vladislav Kuzmin 461c71a50b test(settings): measure notification labels in the group list (#4892)
#4810 replaced the notification group table with a listbox, and the compact settings test still waited for a table cell, so it timed out before measuring anything. It now measures the group labels inside the listbox.

Fixes #4891

Co-authored-by: principalwater <[email protected]>

Co-authored-by: principalwater <[email protected]>
2026-11-21 06:55:23 +08:00
l0ng-ai 82085a227e fix(agents): record a task's turns across nested repositories (#4910)
A local task in a project with nested git repositories recorded no turns, so the Changes pane's last-turn scope stayed empty there and the whole-task list no longer kept to the files the task touched. A turn now records each repository's HEAD as it starts; the files a turn changed, their text when it began and its rollback come from the repository holding each file, including commits made in a nested one.
2026-11-21 06:38:07 +08:00
Paweł SzymańskiтаPawelSzymanski89 c3f420374c fix(agents): list task changes per repository, including nested repos (#4543)
A local agent task in a project that holds nested git repositories (an own .git below the project root, not a submodule) only saw the changes of the repository at its root. Its changes are now read from every repository under the root, each against its own HEAD; the Changes pane groups them under a row per repository when there are several, and a rollback reads each file from its own repository.

Co-authored-by: PawelSzymanski89 <[email protected]>

Co-authored-by: PawelSzymanski89 <[email protected]>
2026-11-21 06:32:34 +08:00
faysouтаfaysou 6bf7bc8c2b fix(vcs): apply Directory Mappings changes to all selected roots (#4908)
Directory Mappings now supports multi-row selection with Cmd/Ctrl and Shift. Minus moves the selected Git roots to an Unregistered roots section instead of only removing manually added ones, and plus registers the selected unregistered roots again in one step. Applying a removal refreshes Git status and branches: removing the selected repository switches to the remaining one, and removing the last repository clears the previous Git state and decorations.

Co-authored-by: faysou <[email protected]>

Co-authored-by: faysou <[email protected]>
2026-11-21 06:18:36 +08:00
faysouтаfaysou 34dfc166db fix(vcs): keep Git Log paths and branches in sync (#4907)
The Paths filter of the Git Log now holds the repository checkboxes, path entry, the file and folder tree and recent paths. Selecting paths replaces the repository selection, so a path in another repository no longer leaves the log empty, and the commit log and the Branches panel are scoped to the repositories the paths belong to.

Co-authored-by: faysou <[email protected]>

Co-authored-by: faysou <[email protected]>
2026-11-21 06:15:44 +08:00
Chris Schofield 64632dc4d7 feat(editor): JSX/TSX tag editing — linked tag rename, prop values, Emmet (#4905)
JSX/TSX editing like the HTML modes: editing an opening or closing tag's name renames its partner (Simultaneous <tag></tag> editing), Enter between a tag pair puts the caret on an indented line with the closing tag below, and JSX tag pairs are matched. Typing = after a value-less prop inserts "" for string-typed props and {} otherwise (type from the server's hover, {} after 500 ms), following Pair quotes / Pair brackets. Emmet expands with Tab among an element's children and after return / => (className, self-closing void elements). Under TypeScript 7 the native server is asked for jsxAttributeCompletionStyle auto, so prop completion inserts the value delimiters as vtsls does.

Co-authored-by: ChildishForces <[email protected]>

Co-authored-by: ChildishForces <[email protected]>
2026-11-21 05:45:10 +08:00
Mr0Bread f484fd6802 fix(agents): let chats select any model their agent's catalog lists (#4901)
An existing agent chat listed models from the agent's catalog but refused to switch to them unless the catalog was under 15 minutes old and matched the launch fingerprint. A model the picker lists is now always selectable. The chat's picker offers the agent's current catalog plus the model the chat runs, and falls back to the session's own list when there is no catalog. The per-task copy of models and effort levels is removed, so the project catalog is the only source of available models and efforts.

Co-authored-by: Mr0Bread <[email protected]>

Co-authored-by: Mr0Bread <[email protected]>
2026-11-21 04:50:52 +08:00
l0ng-ai 8121dc87f1 test(e2e): wait for the Run window to take focus before toggling it (#4900)
The tool-window shortcut hides a window only once it is active, and activation focuses it on the next frame; under load the test pressed Cmd+4 or Shift+Escape before that, so the window stayed open. The test now waits for focus inside the Run window first.
2026-11-21 04:27:03 +08:00
227 змінених файлів з 7592 додано та 2094 видалено

No files matched your search

+18 -48
Переглянути файл
@@ -194,14 +194,14 @@ impl AgentCatalogs {
(shared.paths.models_file.clone(), shared.paths.project_root.clone(), provider.to_owned())
}
fn fallback(shared: &Shared, provider: &str) -> CatalogData {
/// The catalog saved for this project, for before this run looked anything up.
fn saved(shared: &Shared, provider: &str) -> CatalogData {
let cache = shared.known.lock();
let Some(known) = cache.get(provider) else { return CatalogData::default() };
known.catalogs.get(&shared.root_key()).map(|saved| saved.catalog.clone()).unwrap_or_else(|| CatalogData {
config: known.config.clone(),
thought_levels: known.thought_levels.clone(),
refreshed_at_ms: None,
})
cache
.get(provider)
.and_then(|known| known.catalogs.get(&shared.root_key()))
.map(|saved| saved.catalog.clone())
.unwrap_or_default()
}
pub(crate) fn cached(&self, shared: &Shared, provider: &str) -> CatalogData {
@@ -210,32 +210,14 @@ impl AgentCatalogs {
.entries
.get(&Self::key(shared, provider))
.and_then(|e| e.catalog.clone())
.unwrap_or_else(|| Self::fallback(shared, provider))
.unwrap_or_else(|| Self::saved(shared, provider))
}
/// Availability for an explicit session switch must come from a recent discovery for this
/// launch, not from the display fallback or a different project's session report.
pub(super) fn fresh_model(
&self,
shared: &Shared,
spec: &provider::ProviderSpec,
model: &str,
) -> Option<crate::AgentConfigValue> {
let context = LaunchContext::new(spec.clone(), &shared.paths.project_root);
let select = |catalog: &CatalogData| {
let age = self.epoch_ms() - catalog.refreshed_at_ms?;
if !(0.0..FRESH_FOR.as_millis() as f64).contains(&age) {
return None;
}
catalog.model_option()?.values.iter().find(|value| value.value == model).cloned()
};
let state = self.state.lock();
if let Some(entry) = state.entries.get(&Self::key(shared, &spec.id)) {
return select(entry.catalog.as_ref().filter(|_| entry.context == context)?);
}
let cache = shared.known.lock();
let saved = cache.get(&spec.id)?.catalogs.get(&shared.root_key())?;
(saved.fingerprint == context.fingerprint()).then(|| select(&saved.catalog)).flatten()
/// The entry a chat may switch to: exactly what the picker offers from the cached catalog,
/// however long ago it was read. Refreshing keeps that catalog current; a listed model is
/// never refused because the catalog aged.
pub(super) fn listed_model(&self, shared: &Shared, provider: &str, model: &str) -> Option<crate::AgentConfigValue> {
self.cached(shared, provider).model_option()?.values.iter().find(|value| value.value == model).cloned()
}
pub(crate) fn levels(&self, shared: &Shared, provider: &str, model: &str) -> Option<Vec<AgentConfigOption>> {
@@ -246,14 +228,7 @@ impl AgentCatalogs {
}
drop(state);
let cache = shared.known.lock();
let known = cache.get(provider)?;
known
.catalogs
.get(&shared.root_key())
.map(|saved| &saved.catalog.thought_levels)
.unwrap_or(&known.thought_levels)
.get(model)
.cloned()
cache.get(provider)?.catalogs.get(&shared.root_key())?.catalog.thought_levels.get(model).cloned()
}
pub(super) async fn load_levels(
@@ -297,7 +272,7 @@ impl AgentCatalogs {
}
fn snapshot(&self, shared: &Shared, provider: &str, entry: &Entry) -> AgentModelCatalog {
let catalog = entry.catalog.clone().unwrap_or_else(|| Self::fallback(shared, provider));
let catalog = entry.catalog.clone().unwrap_or_default();
let model_failure = entry.requested_model.as_ref().and_then(|model| entry.model_failures.get(model));
let unknown_model = entry
.requested_model
@@ -382,12 +357,11 @@ impl AgentCatalogs {
},
);
}
let fallback =
state.entries.get(&key).filter(|entry| entry.catalog.is_none()).map(|_| Self::fallback(shared, &spec.id));
state.generation += 1;
let generation = state.generation;
let entry = state.entries.get_mut(&key).expect("catalog entry");
let catalog = entry.catalog.as_ref().or(fallback.as_ref()).expect("cached catalog");
let empty = CatalogData::default();
let catalog = entry.catalog.as_ref().unwrap_or(&empty);
let fresh = entry.successful.is_some_and(|at| now.duration_since(at) < FRESH_FOR);
let target = model
.filter(|model| {
@@ -496,7 +470,7 @@ impl AgentCatalogs {
entry.flight_model = None;
let success = match result {
Ok(found) => {
let previous = entry.catalog.take().unwrap_or_else(|| Self::fallback(shared, &key.2));
let previous = entry.catalog.take().unwrap_or_default();
let mut cache = shared.known.lock();
let known = cache.entry(key.2.clone()).or_default();
let mut catalog = CatalogData {
@@ -510,13 +484,9 @@ impl AgentCatalogs {
catalog.thought_levels.insert(model, levels);
}
}
known.config = catalog.config.clone();
known.thought_levels = catalog.thought_levels.clone();
if let Some(commands) = found.commands {
known.commands.insert(shared.root_key(), commands);
}
known.authoritative = true;
known.refreshed_at_ms = catalog.refreshed_at_ms;
known.catalogs.insert(
shared.root_key(),
SavedCatalog { fingerprint: entry.context.fingerprint(), catalog: catalog.clone() },
+23 -12
Переглянути файл
@@ -230,11 +230,9 @@ async fn successful_refresh_replaces_models_and_efforts_and_old_sessions_cannot_
let manager = make_manager(tmp.path(), catalogs.clone(), &harness);
let mut events = events(&manager);
let old = config::options_of(&response(&["old", "retained"], &["low", "high"]));
manager.shared.remember(PROVIDER, Some(&old), None, Some("old"));
let cached = manager.refresh_models(PROVIDER, false, None).unwrap();
assert!(cached.refreshing);
assert_eq!(model_values(&cached), ["old", "retained"]);
assert!(cached.refreshed_at_ms.is_none(), "session reports are not fresh discovery");
assert!(model_values(&cached).is_empty(), "nothing is offered before the first discovery");
let pending = harness.next().await;
assert_eq!(pending.params["mcpServers"], json!([]));
pending.reply.send(Ok(response(&["retained", "new"], &["medium"]))).unwrap();
@@ -258,7 +256,10 @@ async fn successful_refresh_replaces_models_and_efforts_and_old_sessions_cannot_
assert_eq!(provider.config, fresh.config);
restored.shared.remember(PROVIDER, Some(&old), None, Some("old"));
assert_eq!(restored.shared.known_config(PROVIDER), fresh.config);
assert_eq!(restored.shared.known.lock()[PROVIDER].refreshed_at_ms, fresh.refreshed_at_ms);
assert_eq!(
restored.shared.paths.catalogs.cached(&restored.shared, PROVIDER).refreshed_at_ms,
fresh.refreshed_at_ms
);
assert!(!tmp.path().join("store").exists(), "refresh never creates tasks");
}
@@ -308,6 +309,11 @@ async fn discovered_model_reloads_the_same_session_on_the_next_message() {
switch_chat_model(ChatSwitch::Resume).await;
}
#[tokio::test]
async fn discovered_model_from_an_aged_catalog_can_still_be_selected() {
switch_chat_model(ChatSwitch::Aged).await;
}
#[tokio::test]
async fn discovered_model_leaves_the_original_session_intact_after_resume_failure() {
switch_chat_model(ChatSwitch::ResumeFails).await;
@@ -356,6 +362,7 @@ async fn discovered_model_lookup_does_not_overwrite_a_newer_selection() {
#[derive(Clone, Copy)]
enum ChatSwitch {
Live,
Aged,
Resume,
ResumeFails,
Unavailable,
@@ -376,7 +383,8 @@ async fn switch_chat_model(scenario: ChatSwitch) {
let mut harness = Harness::with_initialize(json!({
"protocolVersion": 1, "agentCapabilities": { "loadSession": true }
}));
let mut manager = make_manager(tmp.path(), Arc::default(), &harness);
let catalogs = Arc::new(AgentCatalogs::default());
let mut manager = make_manager(tmp.path(), catalogs.clone(), &harness);
let task = manager
.create(NewAgentTask {
prompt: AgentPrompt { text: "first".into(), ..Default::default() },
@@ -443,7 +451,11 @@ async fn switch_chat_model(scenario: ChatSwitch) {
}
assert_eq!(manager.task(&task.id).unwrap().state.lock().task.config, before_config);
let live = matches!(scenario, ChatSwitch::Live);
let live = matches!(scenario, ChatSwitch::Live | ChatSwitch::Aged);
if matches!(scenario, ChatSwitch::Aged) {
// The catalog stays what the picker offers however long ago it was read.
advance(&catalogs, 20 * 60);
}
let resumed_launch = if missing_settings { 3 } else { 2 };
let load_fails = matches!(scenario, ChatSwitch::ResumeFails);
let unavailable = matches!(scenario, ChatSwitch::Unavailable);
@@ -684,7 +696,7 @@ async fn next_chat_request(
}
#[tokio::test]
async fn legacy_cache_loads_without_claiming_authoritative_freshness() {
async fn a_cache_from_before_project_catalogs_offers_nothing_until_discovery_succeeds() {
let tmp = tempfile::tempdir().unwrap();
configure(tmp.path(), "one");
let options = config::options_of(&response(&["legacy"], &["low"]));
@@ -700,12 +712,11 @@ async fn legacy_cache_loads_without_claiming_authoritative_freshness() {
let manager = make_manager(tmp.path(), Arc::default(), &harness);
let mut events = events(&manager);
let cached = manager.refresh_models(PROVIDER, false, None).unwrap();
assert_eq!(model_values(&cached), ["legacy"]);
assert!(model_values(&cached).is_empty());
assert!(cached.refreshing && cached.refreshed_at_ms.is_none());
harness.next().await.reply.send(Err("Sign in required".into())).unwrap();
let failed = completed(&mut events).await;
assert_eq!(failed.config, cached.config);
assert!(failed.error.as_deref().unwrap().contains("Sign in required"));
harness.next().await.reply.send(Ok(response(&["current"], &["low"]))).unwrap();
let found = completed(&mut events).await;
assert_eq!(model_values(&found), ["current"]);
}
#[tokio::test]
+15 -46
Переглянути файл
@@ -174,23 +174,13 @@ struct Shared {
attention_seq: AtomicU64,
}
/// What an agent offered in its last session, for the New Task page.
/// What an agent offered, for the New Task page.
#[derive(Clone, Default, Serialize, Deserialize)]
struct Known {
#[serde(default)]
config: Vec<AgentConfigOption>,
/// Thinking levels reported for each model value, including its last choice.
#[serde(default, rename = "thoughtLevels")]
thought_levels: BTreeMap<String, Vec<AgentConfigOption>>,
/// By project root: skills and custom commands differ per project.
#[serde(default, rename = "projectCommands")]
commands: HashMap<String, Vec<AgentCommand>>,
/// Successful discovery, unlike a session report, owns availability.
#[serde(default)]
authoritative: bool,
#[serde(default, rename = "refreshedAtMs")]
refreshed_at_ms: Option<f64>,
/// Authoritative availability and freshness are scoped to project and launch context.
/// Model catalogs by project root, valid for the launch context they were read with.
#[serde(default, rename = "projectCatalogs")]
catalogs: HashMap<String, catalogs::SavedCatalog>,
}
@@ -308,7 +298,8 @@ impl Shared {
self.paths.project_root.to_string_lossy().into_owned()
}
/// Cache levels only when `model` confirms which model the session reported them for.
/// Keeps the commands a session offered and the effort levels it reported for `model`, the
/// only model whose levels it describes.
fn remember(
&self,
provider: &str,
@@ -317,43 +308,22 @@ impl Shared {
model: Option<&str>,
) {
let acp = self.spec(provider).is_some_and(|spec| spec.driver == provider::Driver::Acp);
let mut cache = self.known.lock();
let known = cache.entry(provider.to_owned()).or_default();
let mut changed = false;
// Running tasks retain their own reported settings. Once discovery has
// succeeded, a session's older list/defaults cannot change New Task choices.
if !known.authoritative
&& let Some(config) = config.filter(|c| !c.is_empty())
{
if let Some(model) = model {
let levels: Vec<_> = config.iter().filter(|o| config::is_per_model_option(o)).cloned().collect();
if known.thought_levels.get(model) != Some(&levels) {
known.thought_levels.insert(model.to_owned(), levels);
changed = true;
}
}
if known.config != config {
known.config = config.to_vec();
if let Some(commands) = commands.filter(|c| !c.is_empty()) {
let mut cache = self.known.lock();
let known = cache.entry(provider.to_owned()).or_default();
if known.commands.get(&self.root_key()).map(Vec::as_slice) != Some(commands) {
known.commands.insert(self.root_key(), commands.to_vec());
self.persist_known(&cache);
changed = true;
}
}
// Discovery reads one model's options; a session on another model reports that model's.
let learned = model.filter(|_| acp && known.authoritative).zip(config).map(|(model, config)| {
if acp && let Some((model, config)) = model.zip(config) {
let levels: Vec<_> = config.iter().filter(|o| config::is_per_model_option(o)).cloned().collect();
(model, levels)
});
if let Some(commands) = commands.filter(|c| !c.is_empty())
&& known.commands.get(&self.root_key()).map(Vec::as_slice) != Some(commands)
{
known.commands.insert(self.root_key(), commands.to_vec());
changed = true;
}
if changed {
self.persist_known(&cache);
}
drop(cache);
if let Some((model, levels)) = learned.filter(|(_, levels)| !levels.is_empty()) {
self.paths.catalogs.learn_levels(self, provider, model, levels);
if !levels.is_empty() {
self.paths.catalogs.learn_levels(self, provider, model, levels);
}
}
if changed {
self.emit(AgentEvent::Providers);
@@ -2537,8 +2507,7 @@ impl Task {
async fn switch_discovered_model(&self, target: AgentConfigOption, value: String) -> IdeResult<()> {
let provider = self.state.lock().task.provider.clone();
let spec = self.shared.spec(&provider).ok_or_else(|| IdeError::not_found("no such agent"))?;
let candidate = self.shared.paths.catalogs.fresh_model(&self.shared, &spec, &value).ok_or_else(|| {
let candidate = self.shared.paths.catalogs.listed_model(&self.shared, &provider, &value).ok_or_else(|| {
IdeError::invalid(format!("{} has no value {value} in the current model catalog", target.name))
})?;
let selection = {
+2
Переглянути файл
@@ -711,6 +711,8 @@ pub struct AgentChange {
pub removed: u32,
/// Path before a rename; the left side of its diff reads this path.
pub old_path: Option<String>,
/// The repository the file is in, when the task's project holds nested repositories.
pub repo: Option<IpcPath>,
}
/// A commit made while the task ran, with the files it changed against its first parent.
+120 -237
Переглянути файл
@@ -1010,7 +1010,6 @@ async fn commands_are_remembered_per_project_and_merged_with_skills_on_disk() {
// Another project shares the settings but not the commands.
let mgr_b = manager_at(&b, &models, Arc::new(FakeAgent::default()));
let claude = mgr_b.providers().into_iter().find(|p| p.id == "claude").unwrap();
assert_eq!(claude.config.len(), 2);
assert!(claude.commands.is_empty());
assert!(mgr_b.commands("claude", None).await.unwrap().is_empty());
let mgr_a = manager_at(&a, &models, Arc::new(FakeAgent::default()));
@@ -1197,7 +1196,6 @@ async fn a_task_runs_asks_for_permission_and_survives_a_restart() {
}
let providers = mgr.providers();
let claude = providers.iter().find(|p| p.id == "claude").unwrap();
assert_eq!(claude.config.iter().map(|o| o.id.as_str()).collect::<Vec<_>>(), ["model", "mode"]);
assert_eq!(claude.commands.len(), 1);
// A new manager (IDE restart) finds the task and resumes its session without duplicating history.
@@ -1206,7 +1204,6 @@ async fn a_task_runs_asks_for_permission_and_survives_a_restart() {
let mgr2 = manager(tmp.path(), agent2.clone());
assert_eq!(mgr2.entries(&task.id, None).unwrap().len(), 5);
assert_eq!(mgr2.task(&task.id).unwrap().state.lock().task.title, "Lexer fix");
assert_eq!(mgr2.providers().iter().find(|p| p.id == "claude").unwrap().config.len(), 2);
mgr2.prompt(&task.id, text("again"), false).await.unwrap();
tokio::time::sleep(Duration::from_millis(50)).await;
wait_for(&mgr2, &task.id, AgentStatus::Ready).await;
@@ -2167,52 +2164,6 @@ async fn usage_limits_and_late_settings() {
assert!(agent.calls.lock().iter().any(|c| c == "session/set_config_option \"high\""));
let config = mgr.task(&task.id).unwrap().state.lock().task.config.clone();
assert_eq!(config.iter().find(|o| o.id == "effort").unwrap().current.as_deref(), Some("high"));
for _ in 0..100 {
if mgr
.shared
.known
.lock()
.get("claude")
.and_then(|k| k.thought_levels.get("big"))
.and_then(|levels| levels.first())
.and_then(|o| o.current.as_deref())
== Some("high")
{
break;
}
tokio::time::sleep(Duration::from_millis(10)).await;
}
assert_eq!(mgr.shared.known.lock()["claude"].thought_levels["big"][0].current.as_deref(), Some("high"));
}
#[tokio::test(flavor = "multi_thread")]
async fn remembered_settings_drop_per_model_choices_for_the_next_task() {
let tmp = tempfile::tempdir().unwrap();
let agent = Arc::new(FakeAgent::default());
// The effort list depends on the model: what the last session ran means nothing once
// the user picks another model, so provider-wide defaults never include it.
*agent.extra_options.lock() = vec![json!({"id": "effort", "category": "thought_level",
"type": "select", "currentValue": "high",
"options": [{"value": "low", "name": "Low"}, {"value": "high", "name": "High"}]})];
let mgr = manager(tmp.path(), agent.clone());
let task = mgr
.create(NewAgentTask {
project_root: None,
prompt: text("again"),
provider: "claude".into(),
config: vec![],
isolation: Isolation::Local,
base: None,
..Default::default()
})
.await
.unwrap();
wait_for(&mgr, &task.id, AgentStatus::Ready).await;
let provider = mgr.providers().into_iter().find(|p| p.id == "claude").unwrap();
assert!(provider.config.iter().all(|o| o.id != "effort"), "a per-model option isn't offered stale");
let model = provider.config.iter().find(|o| o.id == "model").unwrap();
assert_eq!(model.current.as_deref(), Some("big"), "the model choice survives");
}
fn effort_options(levels: &[&str], current: &str) -> Vec<Value> {
@@ -2220,51 +2171,6 @@ fn effort_options(levels: &[&str], current: &str) -> Vec<Value> {
"options": levels.iter().map(|v| json!({"value": v, "name": v})).collect::<Vec<_>>()})]
}
#[tokio::test(flavor = "multi_thread")]
async fn thinking_levels_are_remembered_per_provider_and_model() {
let tmp = tempfile::tempdir().unwrap();
let agent = Arc::new(FakeAgent::default());
*agent.model_options.lock() = HashMap::from([
("big".into(), effort_options(&["low", "high"], "high")),
("small".into(), effort_options(&["minimal", "medium"], "minimal")),
("plain".into(), vec![]),
]);
let mgr = manager(tmp.path(), agent.clone());
let task = mgr
.create(NewAgentTask {
project_root: None,
prompt: text("again"),
provider: "claude".into(),
config: vec![],
isolation: Isolation::Local,
base: None,
..Default::default()
})
.await
.unwrap();
wait_for(&mgr, &task.id, AgentStatus::Ready).await;
mgr.set_config(&task.id, "model", "small".into()).await.unwrap();
mgr.set_config(&task.id, "effort", "medium".into()).await.unwrap();
mgr.set_config(&task.id, "model", "plain".into()).await.unwrap();
let p = mgr.providers().into_iter().find(|p| p.id == "claude").unwrap();
let big = &p.thought_levels["big"][0];
assert_eq!(big.current.as_deref(), Some("high"));
assert_eq!(big.values.iter().map(|v| v.value.as_str()).collect::<Vec<_>>(), ["low", "high"]);
let small = &p.thought_levels["small"][0];
assert_eq!(small.current.as_deref(), Some("medium"));
assert_eq!(small.values.iter().map(|v| v.value.as_str()).collect::<Vec<_>>(), ["minimal", "medium"]);
assert!(p.thought_levels["plain"].is_empty());
assert!(!p.thought_levels.contains_key("unknown"));
assert!(mgr.providers().iter().find(|p| p.id == "codex").unwrap().thought_levels.is_empty());
let saved: HashMap<String, Known> =
serde_json::from_slice(&std::fs::read(&mgr.shared.paths.models_file).unwrap()).unwrap();
assert_eq!(saved["claude"].thought_levels, p.thought_levels);
mgr.shutdown();
let restored = manager(tmp.path(), agent);
assert_eq!(restored.providers().into_iter().find(|p| p.id == "claude").unwrap().thought_levels, p.thought_levels);
restored.shutdown();
}
#[tokio::test(flavor = "multi_thread")]
async fn changing_an_idle_tasks_settings_keeps_its_models_effort_levels() {
// Idle selections use cached model controls or discover them before the next prompt.
@@ -2303,12 +2209,9 @@ async fn changing_an_idle_tasks_settings_keeps_its_models_effort_levels() {
}
restored.set_config(&task.id, "model", "big".into()).await.unwrap();
restored.set_config(&task.id, option, value.into()).await.unwrap();
let p = restored.providers().into_iter().find(|p| p.id == "claude-acp").unwrap();
let big = p.thought_levels.get("big").and_then(|levels| levels.first());
assert_eq!(big.map(|o| o.values.len()), Some(2), "{option}: {:?}", p.thought_levels);
let saved: HashMap<String, Known> =
serde_json::from_slice(&std::fs::read(&restored.shared.paths.models_file).unwrap()).unwrap();
assert_eq!(saved["claude-acp"].thought_levels, p.thought_levels, "{option}");
let levels = restored.shared.paths.catalogs.cached(&restored.shared, "claude-acp").thought_levels;
let big = levels.get("big").and_then(|levels| levels.first());
assert_eq!(big.map(|o| o.values.len()), Some(2), "{option}: {levels:?}");
restored.shutdown();
}
}
@@ -2541,100 +2444,6 @@ async fn upfront_effort_is_validated_after_changing_model_before_the_prompt() {
}
}
#[tokio::test(flavor = "multi_thread")]
async fn unreported_model_switch_does_not_cache_the_previous_models_levels() {
let tmp = tempfile::tempdir().unwrap();
let agent = Arc::new(FakeAgent::default());
*agent.extra_options.lock() = effort_options(&["low", "high"], "high");
let mgr = manager(tmp.path(), agent);
let task = mgr
.create(NewAgentTask {
project_root: None,
prompt: text("again"),
provider: "claude".into(),
config: vec![],
isolation: Isolation::Local,
base: None,
..Default::default()
})
.await
.unwrap();
wait_for(&mgr, &task.id, AgentStatus::Ready).await;
mgr.set_config(&task.id, "model", "small".into()).await.unwrap();
let p = mgr.providers().into_iter().find(|p| p.id == "claude").unwrap();
assert!(!p.thought_levels.contains_key("small"));
assert_eq!(p.thought_levels["big"][0].current.as_deref(), Some("high"));
mgr.shutdown();
}
#[tokio::test(flavor = "multi_thread")]
async fn cached_effort_is_not_sent_without_real_session_options() {
let tmp = tempfile::tempdir().unwrap();
let agent = Arc::new(FakeAgent::default());
*agent.extra_options.lock() = effort_options(&["low", "high"], "low");
let mgr = manager(tmp.path(), agent.clone());
let new = |config| NewAgentTask {
project_root: None,
prompt: text("again"),
provider: "claude".into(),
config,
isolation: Isolation::Local,
base: None,
..Default::default()
};
let warm = mgr.create(new(vec![])).await.unwrap();
wait_for(&mgr, &warm.id, AgentStatus::Ready).await;
agent.calls.lock().clear();
agent.empty_config.store(true, Ordering::Release);
let task = mgr
.create(new(vec![
AgentConfigChoice { id: "model".into(), value: "big".into() },
AgentConfigChoice { id: "effort".into(), value: "high".into() },
]))
.await
.unwrap();
wait_for(&mgr, &task.id, AgentStatus::Ready).await;
assert!(!agent.calls.lock().iter().any(|c| c == "session/set_config_option \"high\""));
assert!(
mgr.task(&task.id).unwrap().state.lock().task.config.iter().any(|o| o.id == "effort"),
"remembered session settings remain visible until the agent refreshes them"
);
mgr.shutdown();
}
#[tokio::test(flavor = "multi_thread")]
async fn reported_levels_refresh_even_without_a_model_option() {
let tmp = tempfile::tempdir().unwrap();
let agent = Arc::new(FakeAgent::default());
*agent.extra_options.lock() = effort_options(&["low", "high"], "high");
let mgr = manager(tmp.path(), agent.clone());
let task = mgr
.create(NewAgentTask {
project_root: None,
prompt: text("again"),
provider: "claude".into(),
config: vec![],
isolation: Isolation::Local,
base: None,
..Default::default()
})
.await
.unwrap();
wait_for(&mgr, &task.id, AgentStatus::Ready).await;
for levels in [effort_options(&["minimal", "medium"], "medium"), vec![]] {
agent.update("s1", json!({"sessionUpdate": "config_option_update", "configOptions": levels}));
let expected = config::parse_options(&json!(levels));
for _ in 0..100 {
if mgr.shared.known.lock()["claude"].thought_levels["big"] == expected {
break;
}
tokio::time::sleep(Duration::from_millis(10)).await;
}
assert_eq!(mgr.shared.known.lock()["claude"].thought_levels["big"], expected);
}
mgr.shutdown();
}
#[test]
fn retry_updates_become_a_countdown() {
let update =
@@ -3192,49 +3001,6 @@ async fn a_failed_probe_is_retried_instead_of_remembered() {
assert!(!mgr.shared.probes.lock().contains_key("claude"));
}
/// A session report that changes the cached provider config notifies subscribers,
/// so the composer re-lists models without waiting for the next task (#1490).
/// Reports that change nothing stay silent.
#[tokio::test(flavor = "multi_thread")]
async fn remembered_config_changes_notify_subscribers_once() {
let tmp = tempfile::tempdir().unwrap();
let mgr = manager(tmp.path(), Arc::new(FakeAgent::default()));
let events = Arc::new(Mutex::new(Vec::new()));
let sink = events.clone();
mgr.subscribe(Arc::new(move |e| sink.lock().push(e)));
events.lock().clear();
let reported = config::options_of(&json!({ "configOptions": [
{ "id": "model", "category": "model", "type": "select", "currentValue": "default",
"options": [{ "value": "default" }, { "value": "custom-opus" }] },
] }));
mgr.shared.remember("claude", Some(&reported), None, Some("default"));
assert!(
events.lock().iter().any(|ev| matches!(ev, AgentEvent::Providers)),
"a first report changing the cache notifies subscribers"
);
events.lock().clear();
// The same report again: the cache is unchanged, so subscribers hear nothing.
mgr.shared.remember("claude", Some(&reported), None, Some("default"));
assert!(events.lock().is_empty(), "an unchanged report must stay silent");
// A changed model list notifies again, and providers() serves the new list.
let updated = config::options_of(&json!({ "configOptions": [
{ "id": "model", "category": "model", "type": "select", "currentValue": "default",
"options": [{ "value": "default" }, { "value": "custom-opus" }, { "value": "custom-sonnet" }] },
] }));
mgr.shared.remember("claude", Some(&updated), None, Some("default"));
assert!(
events.lock().iter().any(|ev| matches!(ev, AgentEvent::Providers)),
"a changed model list notifies subscribers"
);
let claude = mgr.providers().into_iter().find(|p| p.id == "claude").unwrap();
let model = claude.config.iter().find(|o| o.category.as_deref() == Some("model")).unwrap();
let values: Vec<_> = model.values.iter().map(|v| v.value.as_str()).collect();
assert_eq!(values, ["default", "custom-opus", "custom-sonnet"]);
}
#[tokio::test(flavor = "multi_thread")]
async fn idle_agents_stop_and_resume_their_session_on_the_next_message() {
let new = || NewAgentTask {
@@ -3868,6 +3634,123 @@ async fn turn_changed(mgr: &AgentManager, id: &str) -> Vec<(String, ide_vcs::Cha
changes.into_iter().map(|c| (c.rel_path, c.kind, c.added, c.removed)).collect()
}
#[tokio::test(flavor = "multi_thread")]
async fn a_task_lists_what_it_changed_in_a_nested_repository() {
let tmp = tempfile::tempdir().unwrap();
let base = dunce::canonicalize(tmp.path()).unwrap();
let root = base.join("project");
for repo in [root.clone(), root.join("libs/validation")] {
std::fs::create_dir_all(&repo).unwrap();
std::fs::write(repo.join("a.txt"), "one\n").unwrap();
for args in [&["init", "-q", "-b", "main"][..], &["add", "a.txt"], &["commit", "-q", "-m", "init"]] {
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:?}");
}
}
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();
std::fs::write(root.join("libs/validation/b.txt"), "new\n").unwrap();
})
.await;
let changed: Vec<(String, Option<IpcPath>)> =
mgr.changes(&task.id).await.unwrap().into_iter().map(|c| (c.rel_path, c.repo)).collect();
assert_eq!(
changed,
[
("a.txt".to_owned(), Some(IpcPath(root.clone()))),
("libs/validation/b.txt".to_owned(), Some(IpcPath(root.join("libs/validation")))),
]
);
mgr.rollback_changes(&task.id, None, AgentChangesView::SinceStart).await.unwrap();
assert_eq!(std::fs::read_to_string(root.join("a.txt")).unwrap(), "one\n");
assert!(!root.join("libs/validation/b.txt").exists());
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};
+238 -30
Переглянути файл
@@ -25,6 +25,98 @@ fn discover(path: &Path) -> IdeResult<Option<Repo>> {
Ok(repo)
}
/// The repositories of a project with nested ones (an own `.git` under the project root, not a
/// submodule), with the folder their files are named from: the root of the repository holding
/// `cwd`, else `cwd`. `None` when only the repository holding `cwd` (if any) is there.
fn nested_repos(cwd: &Path) -> IdeResult<Option<(PathBuf, Vec<Repo>)>> {
let Ok(cwd) = dunce::canonicalize(cwd) else { return Ok(None) };
let found = ide_vcs::Repos::discover(&cwd, &|_| false)?;
if found.all().iter().all(|r| cwd.starts_with(r.root())) {
return Ok(None);
}
let base = found.all().iter().map(|r| r.root()).filter(|r| cwd.starts_with(r)).max().unwrap_or(&cwd).to_path_buf();
let mut repos = Vec::new();
for r in found.all() {
repos.extend(discover(r.root())?);
}
Ok(Some((base, repos)))
}
/// Whether the project at `cwd` holds repositories nested in it: its changes are each one's.
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> {
let rel = path.strip_prefix(base).ok()?;
if path.is_dir()
|| roots.iter().any(|n| n.as_path() != repo.root() && n.starts_with(repo.root()) && path.starts_with(n))
{
return None;
}
Some(rel.to_string_lossy().replace('\\', "/"))
}
/// The uncommitted changes in every repository of the project, against each one's `HEAD`.
fn nested_changes(cwd: &Path) -> IdeResult<Vec<AgentChange>> {
let Some((base, repos)) = nested_repos(cwd)? else { return Ok(Vec::new()) };
let roots: Vec<PathBuf> = repos.iter().map(|r| r.root().to_path_buf()).collect();
let mut out: Vec<AgentChange> = Vec::new();
for repo in &repos {
let listed = match repo.head()?.1 {
Some(head) => changes(repo.root(), &head)?,
None => {
repo.status()?.into_iter().filter(|s| s.path.is_file()).map(|s| added(s.path, s.rel_path)).collect()
}
};
for mut c in listed {
let Some(rel) = nested_rel(&base, repo, &roots, &c.path.0) else { continue };
if out.iter().any(|o| o.path == c.path) {
continue;
}
c.rel_path = rel;
c.old_path = None;
c.repo = Some(IpcPath(repo.root().to_path_buf()));
out.push(c);
}
}
out.sort_by(|a, b| a.rel_path.cmp(&b.rel_path));
Ok(out)
}
fn repo_at(path: &Path) -> IdeResult<Repo> {
discover(path)?.ok_or_else(|| IdeError::unavailable(format!("{} is not in a git repository", path.display())))
}
@@ -38,6 +130,9 @@ pub(crate) fn head_of(path: &Path) -> IdeResult<(String, String)> {
/// `HEAD`'s commit in `cwd`, `None` outside a repository or before its first commit.
pub(crate) fn head_commit(cwd: &Path) -> IdeResult<Option<String>> {
if spans_repos(cwd) {
return Ok(Some("HEAD".to_owned()));
}
match discover(cwd)? {
Some(repo) => Ok(repo.head()?.1),
None => Ok(None),
@@ -127,6 +222,7 @@ pub(crate) fn changes(cwd: &Path, base: &str) -> IdeResult<Vec<AgentChange>> {
added,
removed,
old_path: f.old_path,
repo: None,
}
})
.collect();
@@ -143,6 +239,9 @@ pub(crate) fn changes(cwd: &Path, base: &str) -> IdeResult<Vec<AgentChange>> {
/// Files renamed since `rev`, by their new repository-relative path: the old path, as a deletion
/// to roll back along with the rename.
pub(crate) fn rename_sources(cwd: &Path, rev: &str) -> IdeResult<BTreeMap<String, AgentChange>> {
if spans_repos(cwd) {
return Ok(BTreeMap::new());
}
let Some(repo) = discover(cwd)? else { return Ok(BTreeMap::new()) };
let root = repo.root().to_path_buf();
Ok(repo
@@ -157,6 +256,7 @@ pub(crate) fn rename_sources(cwd: &Path, rev: &str) -> IdeResult<BTreeMap<String
added: 0,
removed: 0,
old_path: None,
repo: None,
};
Some((f.path, source))
})
@@ -165,7 +265,7 @@ pub(crate) fn rename_sources(cwd: &Path, rev: &str) -> IdeResult<BTreeMap<String
fn added(path: IpcPath, rel_path: String) -> AgentChange {
let added = std::fs::read_to_string(&*path).map_or(0, |t| t.lines().count() as u32);
AgentChange { path, rel_path, kind: ChangeKind::Added, added, removed: 0, old_path: None }
AgentChange { path, rel_path, kind: ChangeKind::Added, added, removed: 0, old_path: None, repo: None }
}
/// The commits from `base` (exclusive) to `head` (inclusive) in `cwd`, newest first, each
@@ -201,6 +301,7 @@ pub(crate) fn commits(cwd: &Path, base: &str, head: &str) -> IdeResult<Vec<Agent
added,
removed,
old_path: f.old_path,
repo: None,
}
})
.collect();
@@ -266,6 +367,9 @@ impl TaskBase {
pub(crate) fn changes(&self, before: &BTreeMap<String, Stamp>) -> IdeResult<Vec<AgentChange>> {
let (cwd, start) = match self {
Self::Worktree { cwd, base } => return Ok(without_untouched(changes(cwd, base)?, before)),
Self::Local { cwd, .. } if spans_repos(cwd) => {
return Ok(without_untouched(nested_changes(cwd)?, before));
}
Self::Local { cwd, start } => (cwd, start.as_deref()),
};
let Some(repo) = discover(cwd)? else { return Ok(Vec::new()) };
@@ -324,6 +428,9 @@ impl TaskBase {
/// reads cannot put a file in both lists.
pub(crate) fn grouped_changes(&self, before: &BTreeMap<String, Stamp>) -> IdeResult<AgentChanges> {
let cwd = self.cwd();
if spans_repos(cwd) {
return Ok(AgentChanges { uncommitted: self.changes(before)?, commits: Vec::new() });
}
let Some(repo) = discover(cwd)? else { return Ok(AgentChanges::default()) };
let head = repo.head()?.1;
let uncommitted = match &head {
@@ -353,6 +460,8 @@ impl TaskBase {
pub(crate) fn rev(&self) -> IdeResult<Option<String>> {
let (cwd, start) = match self {
Self::Worktree { base, .. } => return Ok(Some(base.clone())),
// Each repository goes back to its own `HEAD`.
Self::Local { cwd, .. } if spans_repos(cwd) => return Ok(Some("HEAD".to_owned())),
Self::Local { cwd, start } => (cwd, start.as_deref()),
};
let Some(repo) = discover(cwd)? else { return Ok(None) };
@@ -545,6 +654,18 @@ pub(crate) fn stamp(path: &Path) -> Stamp {
pub(crate) fn snapshot(cwd: &Path) -> IdeResult<BTreeMap<String, Stamp>> {
// Paths and stamps only: no diff and no line counts, which read every untracked file
// and held up starting a task in a checkout with many of them.
if let Some((base, repos)) = nested_repos(cwd)? {
let roots: Vec<PathBuf> = repos.iter().map(|r| r.root().to_path_buf()).collect();
let mut out = BTreeMap::new();
for repo in &repos {
for s in repo.status()? {
if let Some(rel) = nested_rel(&base, repo, &roots, &s.path) {
out.insert(rel, stamp(&s.path));
}
}
}
return Ok(out);
}
let Some(repo) = Repo::discover(cwd)? else { return Ok(BTreeMap::new()) };
Ok(repo.status()?.into_iter().map(|s| (s.rel_path, stamp(&s.path))).collect())
}
@@ -587,10 +708,16 @@ fn saved_name(rel: &str) -> String {
/// into `dir`, so rolling back the task's changes to them restores the user's own edits.
/// Whether anything was saved.
pub(crate) fn save_before(cwd: &Path, before: &BTreeMap<String, Stamp>, dir: &Path) -> IdeResult<bool> {
let Some(repo) = Repo::discover(cwd)? else { return Ok(false) };
let root = match nested_repos(cwd)? {
Some((base, _)) => base,
None => match Repo::discover(cwd)? {
Some(repo) => repo.root().to_path_buf(),
None => return Ok(false),
},
};
let mut saved = false;
for (rel, stamp) in before {
let path = repo.root().join(rel);
let path = root.join(rel);
if stamp.is_none() || !std::fs::metadata(&path).is_ok_and(|m| m.is_file() && m.len() <= SAVED_MAX) {
continue;
}
@@ -625,7 +752,8 @@ pub(crate) fn restore(
}
None => match rev {
Some(rev) => {
let repo = Repo::discover(cwd)?.ok_or_else(|| IdeError::invalid("not in a git repository"))?;
let at = change.repo.as_ref().map_or(cwd, |r| r.0.as_path());
let repo = Repo::discover(at)?.ok_or_else(|| IdeError::invalid("not in a git repository"))?;
repo.file_bytes_at(&change.path.0, Some(rev))?
}
None => None,
@@ -665,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>,
@@ -680,8 +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> {
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();
@@ -702,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)
@@ -715,7 +854,7 @@ 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
@@ -724,20 +863,25 @@ pub(crate) fn changed_in_turn(cwd: &Path, start: &TurnStart) -> IdeResult<(Vec<S
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() {
@@ -746,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),
}
}
}
}
@@ -771,13 +918,13 @@ pub(crate) fn turn_changes(
dir: &Path,
changed: &BTreeSet<String>,
) -> IdeResult<Vec<AgentChange>> {
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) {
@@ -790,19 +937,29 @@ pub(crate) fn turn_changes(
// Its start wasn't saved: listed, without counts.
Err(_) => (ChangeKind::Modified, (0, 0)),
};
out.push(AgentChange { path: IpcPath(path), rel_path: rel.clone(), kind, added, removed, old_path: None });
out.push(AgentChange {
rel_path: rel.clone(),
kind,
added,
removed,
old_path: None,
repo: at.nested.then(|| at.owner(&path).map(|r| IpcPath(r.root().to_path_buf()))).flatten(),
path: IpcPath(path),
});
}
Ok(out)
}
/// 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>> {
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),
@@ -828,12 +985,15 @@ 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>> {
let Some(repo) = discover(cwd)? else { return Ok(None) };
// With nested repositories, the file's own one.
let at = if spans_repos(cwd) { path.parent().unwrap_or(cwd) } else { cwd };
let Some(repo) = discover(at)? 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(&repo.file_bytes_at(path, Some(rev))?.unwrap_or_default(), None),
@@ -962,6 +1122,54 @@ mod tests {
assert!(ok, "git {args:?}");
}
#[test]
fn a_project_with_nested_repositories_sees_changes_in_each_one() {
let tmp = tempfile::tempdir().unwrap();
let root = dunce::canonicalize(tmp.path()).unwrap();
let (nested, deeper) = (root.join("libs/validation"), root.join("libs/validation/pkg/sdk"));
for repo in [&root, &nested, &deeper] {
std::fs::create_dir_all(repo).unwrap();
git(repo, &["init", "-q", "-b", "main"]);
std::fs::write(repo.join("a.txt"), "one\n").unwrap();
git(repo, &["add", "a.txt"]);
git(repo, &["commit", "-q", "-m", "init"]);
}
assert!(spans_repos(&root));
std::fs::write(root.join("mine.txt"), "the user's\n").unwrap();
let before = snapshot(&root).unwrap();
assert_eq!(before.keys().collect::<Vec<_>>(), ["mine.txt"]);
std::fs::write(root.join("a.txt"), "two\n").unwrap();
std::fs::write(nested.join("a.txt"), "two\n").unwrap();
std::fs::write(nested.join("b.txt"), "new\n").unwrap();
std::fs::write(deeper.join("a.txt"), "two\n").unwrap();
let at = TaskBase::Local { cwd: root.clone(), start: None };
let changed = at.changes(&before).unwrap();
let listed: Vec<(&str, &Path)> =
changed.iter().map(|c| (c.rel_path.as_str(), c.repo.as_ref().unwrap().0.as_path())).collect();
assert_eq!(
listed,
[
("a.txt", root.as_path()),
("libs/validation/a.txt", nested.as_path()),
("libs/validation/b.txt", nested.as_path()),
("libs/validation/pkg/sdk/a.txt", deeper.as_path()),
]
);
assert_eq!(at.grouped_changes(&before).unwrap().uncommitted.len(), 4);
assert_eq!(file_at(&root, &nested.join("a.txt"), "HEAD").unwrap().as_deref(), Some("one\n"));
let rev = at.rev().unwrap();
for change in &changed {
restore(&root, rev.as_deref(), change, &before, None).unwrap();
}
for repo in [&root, &nested, &deeper] {
assert_eq!(std::fs::read_to_string(repo.join("a.txt")).unwrap(), "one\n");
}
assert!(!nested.join("b.txt").exists());
assert!(root.join("mine.txt").exists(), "the user's own change stays");
}
#[test]
fn worktree_changes_are_listed_against_the_base() {
let tmp = tempfile::tempdir().unwrap();
+17
Переглянути файл
@@ -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();
+4
Переглянути файл
@@ -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.
+18 -9
Переглянути файл
@@ -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
Переглянути файл
@@ -1 +1 @@
b59392bcc1999048f0ab922ec659bc21d9e825c696fa41d9f0a40c85627a5b2c
d442e600d82cab0f79ad6decf95ca9d06c89dcd3119c500a11f48cdc54a5d5f4
+1 -1
Переглянути файл
@@ -1 +1 @@
034b99891313c03eb2a6b8c3cb2e4784129e1936965be803512f1d869b1768c2
af048639f57e86262543c3dcd18bca27d384b6ad99a625af869f0812bf8ac93c
+1 -1
Переглянути файл
@@ -1 +1 @@
29ec0a96e2a0f6965915c7c25e35036743fc27a49037df588c217e8abfff93e3
95b7263ca584c6b1b035be4dde64c7ae57b407c6a86b5ab6fe2736134e1d7754
+1 -1
Переглянути файл
@@ -1 +1 @@
87b367cfdd65c360920eff7be4d6a8d6b939721f6398aa6a01e39a289590699e
1e5b10e8e77bdc7ed6bf002a415458caef7eee9a98123229dddf0d148af58f73
+1 -1
Переглянути файл
@@ -1 +1 @@
7d034ee1a4b99615642d5bf033802f8e4662216d45b209c4c7a24eb8f1338f48
5b3d4ad737cde32fc808bcd8c93d9cdd7d53961985db0428ab567b4e97ed4ffb
+1 -1
Переглянути файл
@@ -1 +1 @@
3fdf985273ec14ae623fa84602a9220cfbfb2e0e587ab192fc2bcb8d990ce9e3
04b1cbc2148cff8c0fa2d6a4f127a6a3c8ade5a7dc1541c1a16a656def299f33
+1 -1
Переглянути файл
@@ -1 +1 @@
8434e9271e27a6778bb3d5922e8925f3fd9f1d35377e5dddf5b5eb5416bd09bb
918c44ee3a58a073dd65e2f7e32501cf9e84a59f24452c166e75457f7c232c89
+1 -1
Переглянути файл
@@ -1 +1 @@
9fa7468ce385ff33c1f3b99c84711e0d11a84b10e8e4f95b358fcd2ccc96e255
c980260c235249186f754e16597de9d49663771d711ce6873bf83ebaf2a0fc34
+1 -1
Переглянути файл
@@ -1 +1 @@
5220a5bfb6ec0467a72e63e21d690e70b7d46b4f2eaff4116a8a79220a5eca8f
df5729d63b83fbc511e0ba8509f9d370c5124b5af4c70f286c8965d2b0d890ef
+1 -1
Переглянути файл
@@ -1 +1 @@
a962127d1c6e37e85b81973a272a5d6b383cc2884b41bb2d82e8640ef5f8f943
305965c6cbf2fd2b331bf9e2c473cfa9a543ab39ff0d47317ee9e28be9ea5b0f
+1 -1
Переглянути файл
@@ -1 +1 @@
92ad3e43e7f343004dcf26a51e282e97ed694cc9bd7325ff75aa5b18f1a2eeb6
a1bb95a8a23ddd2d55bf64c724f73debfb503f252f57d8ae46afda8a0717fc20
+1 -1
Переглянути файл
@@ -1 +1 @@
2200ed0d44dbafb70ad864cb9569b0b2c37cf9eec1582b05efa903a9e8ec89ee
b8be3120a468190aebb473c8f5d2e13889210241c9ab43c89cbf703c00366c8e
+1 -1
Переглянути файл
@@ -1 +1 @@
644612ee4228010f141042ea0eab5431b8386370f863a70b63cd3315f69d963a
9b345dec001bcb7c0d8e6e214099d597b02976f20c2449af9847e8b69d0a5ab7
+1 -1
Переглянути файл
@@ -1 +1 @@
2af5d46516bfc1d38ad1f24d6cf3c57e2d6db6b0d3225748f55c4f13110430fb
23e0c2ab39ba83aa332b57046b0b8c1bf236e3e61a14874ed82d20ce388873b6
+1 -1
Переглянути файл
@@ -1 +1 @@
0ee0773cefd61b8144d0550718e1988a1e60438bee826c3867350e28886a56f7
e2d2afeb53f0af478963cde0c97fb016b1a424bf97952c7474a18e38e9e9ed55
+1 -1
Переглянути файл
@@ -1 +1 @@
941cb9008aaab11464b193c37b91e2476d771ec526247713f291c6642caf5995
6bff7a7521a4a969aa8d9bd1363ef5efd544e079e77e55e51b19fff13b586b3a
+1 -1
Переглянути файл
@@ -1 +1 @@
06d70aae3152c88d1299a9b33f151b0baa4a77c3ca7145215c6f6e0aa40727b2
27bb4c06b18703c43155e1a45c9edfb249a19443a68e87441babeeb71cb127d9
+1 -1
Переглянути файл
@@ -1 +1 @@
86eb87758e4f7c0242a18f12a113c31d418da64d7198041120f19401a5707bfb
deb7995931cf8e344a486fbab275fd3ec7ddff73b05a841593e5521c4a514084
+1 -1
Переглянути файл
@@ -1 +1 @@
4442bb686fa18e8e8a52fd1cd8683b8767ec7908ffc1454dff476d9cb1711be9
dc6670ff6373d148430f5c9c13d1ec5407b2d94c74c2209562737076468ca79d
+1 -1
Переглянути файл
@@ -1 +1 @@
dd51f1b8634ff6305ba1a69c8457bd586996200a2b18e4a08d0cfa2fb60abaf6
9e111c4c541312dc231bac5a4fd1120b59191ecadce2dca73c77f4bff2a9d0e8
+1 -1
Переглянути файл
@@ -1 +1 @@
4319f2655ee1e240b33f4b96c23fff59c61aa62d6ccc628715e5ff9fe38c2717
caa4053cd7f0135ab14a8c5c56abe198394e370549fea6d9df4d4c11c38fcabf
+1 -1
Переглянути файл
@@ -1 +1 @@
50c4fd7e08a4187afae0e00c775a61578b82bbad056807ad063ee47e79e2cef1
8beb151f14b062438c4024b13bbdedbf5d65099415ad9d055fe63a4b1d64d010
+1 -1
Переглянути файл
@@ -1 +1 @@
220666302d814e6d8bde346954205c94c82320d5584d46f01672fd7d32400bf3
fa6a660890e0beee7599726e9c30142601fbcd6f82a519b1b5952ef30f450bfb
+1 -1
Переглянути файл
@@ -1 +1 @@
4ee484afaa1a1f71a9e544582d90db3260307fc89b8f514aaaff883df2761ba6
a7c1ec4814e4268fe185ae493413532528970264e84f717087b57a303ebe3591
+1 -1
Переглянути файл
@@ -1 +1 @@
3fba59ce802d88a2a1c026480a2cb8ce4d9539eb7b88f5a18bf6232f7adef147
450d1e698882257d6c75b16984a6086259acce2c66a92b96c76ed3d6e15a0b4d
+1 -1
Переглянути файл
@@ -1 +1 @@
73433da25d5304d0a3cb83d750d02feb5e270ee7e9f680c4ee9d923afa9aa066
738791aa00d63961fa7e8ed6ac7601f46848ecc0d25a498b6019eb151bf9169e
+1 -1
Переглянути файл
@@ -1 +1 @@
12df43f99eac93f4e1a070635780ad653932cf69a14595175d8ba6d4f0a4445c
957d02e3d72673ca4a9ca80eb7c3e63087a6d8377411fc820d3808f024326b2e
+1 -1
Переглянути файл
@@ -1 +1 @@
427b63c11188689262101cde971af0a92e54bd6c88a4e3cc8fdfa1a7c8c95fce
f0a57acc6ca29b0dc2803596a0a39ceb1e2185b59a44f5533e8f9b19bf214afd
+1 -1
Переглянути файл
@@ -1 +1 @@
07ae58fe39746b779b1e466d7bbbb666ba550f427c7bf8de97d7ede647c00bc0
7890cfd9a08b67b47ae098ce24e02551935337b8501636e29164ff4ca6244e7e
+1 -1
Переглянути файл
@@ -1 +1 @@
f9912644c28512e37299834123cd4c94f6ed11f29bd38ddbc1c92df168447494
769f873adfa7ed3752a059dac89e60f2203b8ce91b36fe0a7cb9c724e0cf895b
+1 -1
Переглянути файл
@@ -1 +1 @@
ea0eec8c07d6469d3ab63c3bb08c85b01208be1757edffe5eabcb7be79ccf537
ea31cbeefee7f219f86fc7e65315aea7efebe3b91c9cec6e12d4f551b9655d95
+1 -1
Переглянути файл
@@ -1 +1 @@
1ce55fabaa5ea1ddf770c8a1ad7f7b60a843c82c453d42289088c4b2fec61d84
bb30795e7d62b19b237759beeab9da6f6028fea7862d8fa83c6b3238a26f540d
+1 -1
Переглянути файл
@@ -1 +1 @@
3356b4ec918c668c4c249f84afb9bafcd06c073ba86235b6ceea7ef6220cdaf5
65725512c8a8d3ad6cb02a4f947541dd1688a3208e37fa4ed0474ca8197f2340
+4
Переглянути файл
@@ -1337,6 +1337,10 @@ pub fn configure_server(cfg: &mut LanguageServerConfig, root: &Path, server_root
cfg.args = vec!["--lsp".into(), "--stdio".into()];
cfg.display_name = Some("TypeScript 7".into());
cfg.initialization_options = None;
// Completing a JSX prop adds `=""` or `={}` by its type, as vtsls does by default;
// TypeScript 7 adds no value unless asked.
let jsx = json!({ "preferences": { "jsxAttributeCompletionStyle": "auto" } });
merge_init_options(cfg, json!({ "typescript": jsx, "javascript": jsx }));
cfg.tsserver_project = false;
return;
}
+9 -1
Переглянути файл
@@ -1725,7 +1725,15 @@ fn typescript_7_runs_its_own_language_server() {
assert_eq!(Path::new(&cfg.command), native, "{name}");
assert_eq!(cfg.args, ["--lsp", "--stdio"]);
assert_eq!(cfg.display_name.as_deref(), Some("TypeScript 7"));
assert!(cfg.initialization_options.is_none());
// The tsserver-based server's options don't apply; JSX prop completion adds a value.
let options = serde_json::to_value(cfg.initialization_options.as_ref().unwrap()).unwrap();
for language in ["typescript", "javascript"] {
assert_eq!(
options[language],
serde_json::json!({ "preferences": { "jsxAttributeCompletionStyle": "auto" } })
);
}
assert_eq!(options.as_object().unwrap().len(), 2, "{options}");
}
// Picked as a directory (its `lib`, as for older versions), too.
s.languages.typescript.version = modules.join("typescript/lib").to_string_lossy().into_owned();
+35
Переглянути файл
@@ -315,6 +315,41 @@ mod tests {
assert_eq!(skipped.all().len(), 2);
}
/// A workspace: members in repositories of their own (one with a nested repository, not a
/// submodule), a plain folder, and a member that is a subfolder of a bigger repository; the
/// container's agent folder links to each member and must not add a repository again.
#[cfg(unix)]
#[test]
fn workspace_members_bring_their_repositories_once() {
let tmp = tempfile::tempdir().unwrap();
let base = dunce::canonicalize(tmp.path()).unwrap();
let (api, web, plain, mono) = (base.join("api"), base.join("web"), base.join("plain"), base.join("mono"));
git_init(&api);
git_init(&api.join("libs/sdk"));
git_init(&web);
std::fs::create_dir_all(&plain).unwrap();
git_init(&mono);
let docs = mono.join("docs");
std::fs::create_dir_all(&docs).unwrap();
let container = base.join("ws");
let links = container.join(".openidea/agent-root");
std::fs::create_dir_all(&links).unwrap();
for (name, target) in [("api", &api), ("web", &web), ("plain", &plain), ("docs", &docs)] {
std::os::unix::fs::symlink(target, links.join(name)).unwrap();
// A link elsewhere in the container: never followed either.
std::os::unix::fs::symlink(target, container.join(name)).unwrap();
}
let roots = [container.clone(), api.clone(), web.clone(), plain.clone(), docs.clone()];
let repos = Repos::discover_roots(&roots, &|_| false).unwrap();
let found: Vec<&Path> = repos.all().iter().map(|r| r.root()).collect();
assert_eq!(found, [api.as_path(), &api.join("libs/sdk"), &mono, &web]);
let file = api.join("libs/sdk/lib.rs");
assert_eq!(repos.for_path(&file).unwrap().root(), api.join("libs/sdk"), "a nested file is its own repo's");
assert_eq!(repos.for_path(&docs.join("a.md")).unwrap().root(), mono, "a subfolder member is its repo's");
assert!(repos.for_path(&plain.join("x")).is_none());
}
#[test]
fn side_by_side_repositories_without_an_enclosing_one() {
let tmp = tempfile::tempdir().unwrap();
+42 -2
Переглянути файл
@@ -247,8 +247,8 @@ fn event_handler(state: Weak<DirState>, polled: bool) -> impl FnMut(notify::Resu
}
}
/// 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).
/// 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: &notify::Event) -> bool {
matches!(event.kind, EventKind::Modify(_)) && event.paths.iter().all(|p| p.is_dir())
}
@@ -728,6 +728,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,
@@ -1330,6 +1333,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();
+2
Переглянути файл
@@ -83,6 +83,8 @@ On your own messages you can **Edit** (the messages after it are replaced; files
In an existing chat, open **Model › Refresh models** to discover newly available models without sending a message or changing the selection. If the agent can't switch in place, the choice stays pending. You can choose an effort level as soon as the provider reports the new model's options. On your next message, OpenIDEA reopens the same session and applies the model and any effort you selected before sending. If the session can't be reopened or rejects either choice, OpenIDEA restores the previous selection and reports the error without sending the message.
The model picker of an existing chat offers the agent's current model list, the same one New Task uses, plus the model the chat runs. It doesn't depend on what that chat's session reported when it started, so a model found by a refresh in any chat or in New Task can be chosen in every chat of that agent.
**Focus Agent Input** defaults to `⌘L` on macOS and `Ctrl+L` on Windows / Linux in every built-in keymap. When focus is inside your writable task conversation, in either an editor tab or the tool window, it returns focus to the message input without changing your draft, caret position or selection—even when pressed repeatedly. It does not send a message or jump through message history.
With focus anywhere else, the same shortcut jumps to the message input of the task shown in an editor tab or the tool window (the one you used last, if several are shown), unless a panel claims the shortcut there: in a code editor `⌘L` / `Ctrl+L` keeps its editor meaning (for example Go to Line), and in a terminal on Windows / Linux `Ctrl+L` still reaches the shell. It does not apply to archived tasks, subagent conversations or the New Task page, and does not take focus from open popups or dialogs. To change or remove the binding, open **Settings › Keymap › Agents › Focus Agent Input**.
+1 -1
Переглянути файл
@@ -36,7 +36,7 @@ Enable or disable postfix completion, individual templates, `Tab` expansion and
## Emmet
In HTML, Vue and Svelte files, and in CSS, SCSS, Less and Sass, `⇥` / `Tab` expands Emmet abbreviations, for example `ul>li*3` or `m10`. In markup files, the editor context menu also has **Update Tag with Emmet**, which rewrites the tag at the caret from an abbreviation.
In HTML, Vue, Svelte, JSX and TSX files, and in CSS, SCSS, Less and Sass, `⇥` / `Tab` expands Emmet abbreviations, for example `ul>li*3` or `m10`. In markup files, the editor context menu also has **Update Tag with Emmet**, which rewrites the tag at the caret from an abbreviation.
## Write your own templates
+1 -2
Переглянути файл
@@ -96,7 +96,7 @@ With **Do not step into library scripts** (**Settings › Build, Execution, Depl
## Framework support
- **React**: JSX and TSX get their own highlighting modes and full TypeScript server support. There is no React-specific tooling beyond that.
- **React**: JSX and TSX get their own highlighting modes and full TypeScript server support. Typing `>` closes the tag, renaming an opening or closing tag renames its partner, and completing a prop name or typing `=` after one inserts `""` for string props or `{}` for others (from the prop's type). `⇥` / `Tab` expands Emmet abbreviations among an element's children or after `return` / `=>`: `.card` becomes `<div className="card"></div>`.
- **Vue**: `.vue` files are highlighted per block and served by Vue Language Server in hybrid mode. In a Vue CLI project without `tsconfig.json`, webpack's `resolve.alias` entries (such as `@/`) are read so imports resolve. Prettier formats `.vue` files. Emmet works in templates.
- **Svelte**: Svelte Language Server; highlighting uses the HTML mode (script as TypeScript, style as CSS). Emmet works in markup.
- **Astro**: Astro Language Server with its own highlighting mode. It needs Node.js; if it can't find one, select it in **Settings › Languages & Frameworks › JavaScript Runtime**.
@@ -109,4 +109,3 @@ With **Do not step into library scripts** (**Settings › Build, Execution, Depl
- Bun runs but can't be debugged: its inspector uses the WebKit protocol, which vscode-js-debug can't attach to.
- Deno has run and debug support but no Deno language server; Deno files use the TypeScript servers.
- Coverage of Deno tasks is not supported.
- Emmet expands in HTML, Vue and Svelte, not in JSX.
+2
Переглянути файл
@@ -83,6 +83,8 @@ Codex 有自己的项目信任设置。如果它禁用了当前项目的 `.codex
在已有对话中,打开**模型 › 刷新模型**即可查找新上线的模型,不会发送消息或更改当前选择。如果 agent 无法直接切换,所选模型会保持待应用状态。提供商返回新模型支持的思考强度后,你就可以选择强度。发送下一条消息时,OpenIDEA 会先恢复原会话并应用所选模型和思考强度,再发送消息。如果无法恢复会话,或原会话不接受其中任何一项,OpenIDEA 会还原之前的选择并提示错误,不会发送该消息。
已有对话的模型选择器会列出该 agent 当前的模型列表(与新任务使用的相同),外加该对话正在使用的模型。它不依赖该对话会话启动时报告的列表,因此在任一对话或新任务中通过刷新找到的模型,可在该 agent 的所有对话中选用。
所有内置按键映射中,**聚焦 Agent 输入框** 的默认快捷键都是 macOS 上的 `⌘L`、Windows / Linux 上的 `Ctrl+L`。焦点位于你自己的可输入任务对话中时,无论对话显示在编辑器标签页还是工具窗口中,它都会将焦点移回消息输入框,保留草稿、光标位置和选区;重复按下也不会改变这些内容。它不会发送消息,也不会跳转消息历史。
焦点位于其他位置时,同一快捷键会跳转到编辑器标签页或工具窗口中显示的任务的消息输入框(显示多个时,选择你最近使用的那个),除非该位置有面板占用此快捷键:在代码编辑器中,`⌘L` / `Ctrl+L` 保留编辑器含义(例如“转到行”);在 Windows / Linux 的终端中,`Ctrl+L` 仍会发送给 shell。此快捷键不适用于已归档任务、子 agent 对话或“新建任务”页面,也不会从打开的弹出窗口或对话框中抢走焦点。要修改或移除绑定,请打开 **设置 › 按键映射 › 智能体 › 聚焦 Agent 输入框**。
+1 -1
Переглянути файл
@@ -36,7 +36,7 @@ items.for → for (var item : items) { … }
## Emmet
在 HTML、Vue、Svelte 文件以及 CSS、SCSS、Less、Sass 中,`⇥` / `Tab` 会展开 Emmet 缩写,例如 `ul>li*3` 或 `m10`。在标记语言文件中,编辑器右键菜单还提供 **使用 Emmet 更新标签**,用一个缩写改写光标所在的标签。
在 HTML、Vue、Svelte、JSX、TSX 文件以及 CSS、SCSS、Less、Sass 中,`⇥` / `Tab` 会展开 Emmet 缩写,例如 `ul>li*3` 或 `m10`。在标记语言文件中,编辑器右键菜单还提供 **使用 Emmet 更新标签**,用一个缩写改写光标所在的标签。
## 编写自己的模板
+1 -2
Переглянути файл
@@ -96,7 +96,7 @@ Jest 和 Vitest 的输出会解析成测试树,支持 **重新运行失败的
## 框架支持
- **React**:JSX 和 TSX 有各自的高亮模式,并获得完整的 TypeScript 服务器支持;除此之外没有 React 专属功能。
- **React**:JSX 和 TSX 有各自的高亮模式,并获得完整的 TypeScript 服务器支持。输入 `>` 会自动闭合标签,修改开始或结束标签名会同步修改另一端,补全属性名或在属性名后输入 `=` 会按属性类型插入 `""`(字符串)或 `{}`(其他类型)。在元素的子内容中或 `return` / `=>` 之后,`⇥` / `Tab` 会展开 Emmet 缩写:`.card` 会变成 `<div className="card"></div>`。
- **Vue**:`.vue` 文件按块高亮,由 Vue Language Server 以 hybrid 模式提供支持。没有 `tsconfig.json` 的 Vue CLI 项目会读取 webpack 的 `resolve.alias`(如 `@/`),让 import 能正确解析。Prettier 可格式化 `.vue` 文件,模板中可用 Emmet。
- **Svelte**:使用 Svelte Language Server;高亮沿用 HTML 模式(script 按 TypeScript、style 按 CSS),标记部分可用 Emmet。
- **Astro**:使用 Astro Language Server,有专门的高亮模式。它需要 Node.js,找不到时请在 **设置 › 语言和框架 › JavaScript 运行时** 中选择。
@@ -109,4 +109,3 @@ Jest 和 Vitest 的输出会解析成测试树,支持 **重新运行失败的
- Bun 可以运行但无法调试:它的 inspector 使用 WebKit 协议,vscode-js-debug 无法附加。
- Deno 支持运行和调试,但没有 Deno 语言服务器,Deno 文件使用 TypeScript 服务器。
- 不支持 Deno task 的覆盖率。
- Emmet 只在 HTML、Vue 和 Svelte 中展开,JSX 中不可用。
+74
Переглянути файл
@@ -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();
});
+95
Переглянути файл
@@ -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 }]);
});
+113
Переглянути файл
@@ -0,0 +1,113 @@
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(), 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" });
await move.getByRole("radio", { name: "New changelist:" }).check();
await page.setViewportSize({ width: 400, height: 540 });
const newName = move.getByRole("textbox", { name: "Name:", exact: true });
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 move.getByRole("textbox", { name: "Comment:", exact: true }).fill("Move the reviewed change here.");
await move.getByRole("button", { name: "OK", exact: true }).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");
});
+1 -1
Переглянути файл
@@ -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])"],
+52
Переглянути файл
@@ -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();
});
}
+71
Переглянути файл
@@ -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");
});
+61
Переглянути файл
@@ -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");
});
+56
Переглянути файл
@@ -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([]);
});
+104
Переглянути файл
@@ -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();
});
+104
Переглянути файл
@@ -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",
});
});
+69
Переглянути файл
@@ -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);
});
+95
Переглянути файл
@@ -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");
});
+79
Переглянути файл
@@ -121,3 +121,82 @@ test("Git Log keeps filters and actions inside the commit pane at the minimum wi
await toolbar.getByRole("button", { name: "More Filters" }).click();
await expect(page.getByRole("menuitem", { name: "Paths" })).toBeVisible();
});
test("the Paths filter replaces the repository filter and can be cleared from overflow", async ({
workbench: page,
}) => {
await page.evaluate(async () => {
const storeModule = "/src/features/vcs/store.ts";
const { useVcs } = await import(/* @vite-ignore */ storeModule);
const root = "/dev/acme-api";
const other = "/dev/tools";
const branch = (name: string) => ({
name,
current: true,
remote: false,
upstream: null,
ahead: 0,
behind: 0,
lastCommitMs: 0,
commit: "",
});
const handlers = window.__ipc.handlers;
handlers.vcs_branches = ({ repo }) => [branch(repo === other ? "tools-main" : "api-main")];
useVcs.setState({ roots: [root, other], branches: [branch("api-main")] });
handlers.fs_read_dir = ({ path }) =>
path === root ? [{ name: "api.ts", path: root + "/api.ts", kind: "file", size: 0, mtimeMs: 0 }] : [];
const log = handlers.vcs_log!;
handlers.vcs_log = (args) => {
const { paths } = args.query as { paths?: string[] };
return log({ ...args, query: { ...(args.query as object), skip: paths?.includes(root + "/api.ts") ? 1 : 0 } });
};
});
await page.setViewportSize({ width: 600, height: 550 });
const toolbar = page.getByRole("toolbar", { name: "Log filters" });
const overflow = toolbar.getByRole("button", { name: "More Filters" });
await overflow.click();
await page.getByRole("menuitem", { name: "Paths", exact: true }).click();
const acme = page.getByRole("menuitemcheckbox", { name: "acme-api" });
await expect(acme).toHaveAttribute("aria-checked", "true");
await acme.click();
await overflow.click();
await page.getByRole("menuitem", { name: "Paths: tools", exact: true }).click();
await expect(acme).toHaveAttribute("aria-checked", "false");
await page.getByRole("menuitem", { name: "Select in Tree…" }).click();
const picker = page.getByRole("dialog", { name: "Filter by Paths" });
const pathTree = picker.getByRole("tree", { name: "Files and folders" });
const repo = pathTree.getByRole("checkbox", { name: "acme-api" });
await expect(repo).toBeVisible();
const tree = await pathTree.boundingBox();
const row = await repo.locator("xpath=ancestor::label").boundingBox();
expect(tree!.x + tree!.width).toBeGreaterThanOrEqual(row!.x + row!.width);
await repo.check();
await picker.getByRole("button", { name: "OK" }).click();
await page.setViewportSize({ width: 1100, height: 720 });
const branches = page.getByRole("tree", { name: "Branches", exact: true });
await expect(branches.getByText("api-main", { exact: true })).toBeVisible();
await expect(branches.getByText("tools-main", { exact: true })).toHaveCount(0);
await page.setViewportSize({ width: 600, height: 550 });
await overflow.click();
await page.getByRole("menuitem", { name: /^Paths:/ }).click();
await page.getByRole("menuitem", { name: "Select in Tree…" }).click();
await repo.uncheck();
await repo.locator("xpath=ancestor::*[@data-row]").locator("[data-tree-toggle]").click();
await picker.getByRole("checkbox", { name: "api.ts" }).check();
await picker.getByRole("button", { name: "OK" }).click();
const firstCommit = page.getByRole("listbox", { name: "Commits" }).getByRole("option").first();
await expect(firstCommit.getByText("Commit 1", { exact: true })).toBeVisible();
await overflow.click();
await page.getByRole("menuitem", { name: /^Paths:/ }).click();
await page.getByRole("menuitem", { name: "All" }).click();
await expect(firstCommit.getByText("Commit 0", { exact: true })).toBeVisible();
await overflow.click();
await page.getByRole("menuitem", { name: "Paths", exact: true }).click();
await expect(page.getByRole("menuitemcheckbox", { name: "api.ts" })).toBeVisible();
await page.getByRole("menuitem", { name: "Select…", exact: true }).click();
await picker.getByRole("textbox", { name: "Paths" }).fill("acme-api/api.ts");
await picker.getByRole("button", { name: "OK" }).click();
await expect(firstCommit.getByText("Commit 1", { exact: true })).toBeVisible();
});
+65
Переглянути файл
@@ -0,0 +1,65 @@
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
test("Git settings keep the executable and Test button together at narrow widths", async ({ workbench: page }) => {
await page.setViewportSize({ width: 560, height: 740 });
await stubDesktop(page);
const gitPath = "C:/Program Files/Git/cmd/git.exe";
const longPath = `C:/${"long-directory-name".repeat(20)}/git.exe`;
await page.evaluate(
({ gitPath, longPath }) => {
window.__ipc.handlers.vcs_detected_git = () => gitPath;
window.__ipc.handlers.vcs_git_version = ({ path }) => ({ path: path || longPath, version: "git version 2.49.0" });
window.__ipc.handlers.git_credentials = () => [];
},
{ gitPath, longPath },
);
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("Path to Git executable");
await dialog.getByRole("treeitem", { name: "Git", exact: true }).click();
await search.clear();
const path = dialog.getByRole("textbox", { name: /^Path to Git executable:?$/ });
const testButton = dialog.getByRole("button", { name: "Test", exact: true });
const branches = dialog.getByRole("textbox", { name: /^Protected branches:?$/ });
await expect(path).toHaveAttribute("placeholder", `Auto-detected: ${gitPath}`);
for (const width of [560, 580, 1120]) {
await page.setViewportSize({ width, height: 740 });
await path.scrollIntoViewIfNeeded();
const [field, button, patterns] = await Promise.all([
path.boundingBox(),
testButton.boundingBox(),
branches.boundingBox(),
]);
if (!field || !button || !patterns) throw new Error("Missing Git settings control bounds");
expect(field.y).toBeCloseTo(button.y, 0);
if (width <= 580) {
const label = await dialog.getByText("Path to Git executable", { exact: true }).boundingBox();
if (!label) throw new Error("Missing Git executable label bounds");
expect(label.y + label.height).toBeLessThan(field.y);
expect(field.width).toBeGreaterThan(150);
}
expect(field.x + field.width).toBeLessThan(button.x);
expect(button.x + button.width).toBeCloseTo(patterns.x + patterns.width, 0);
}
await page.setViewportSize({ width: 560, height: 740 });
await testButton.click();
const result = dialog.getByRole("status").filter({ hasText: "Git version is 2.49.0" });
await expect(result).toContainText(longPath);
await expect(result).toBeInViewport({ ratio: 1 });
await path.fill(gitPath);
await expect(result).toHaveCount(0);
await testButton.click();
await expect(result).toContainText(gitPath);
expect(await ipcCalls(page, "vcs_git_version")).toEqual([{ path: "" }, { path: gitPath }]);
expect(await ipcCalls(page, "settings_set")).toEqual([]);
const update = dialog.getByRole("radiogroup", { name: "Update method" });
const merge = update.getByRole("radio", { name: "Merge" });
const rebase = update.getByRole("radio", { name: "Rebase" });
await expect(merge).toBeChecked();
await merge.press("ArrowRight");
await expect(rebase).toBeChecked();
});
+79
Переглянути файл
@@ -0,0 +1,79 @@
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
test("the Tag form aligns its fields and follows the chosen repository", 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 handlers = window.__ipc.handlers;
handlers.vcs_tags = ({ repo }) => (repo === service ? ["v1.0"] : []);
handlers.vcs_create_tag = () => null;
const store = "/src/features/vcs/store.ts";
const { useVcs } = await import(/* @vite-ignore */ store);
useVcs.setState({
root,
roots: [root, service],
repo: root,
available: true,
heads: {
[root]: { head: "main", headCommit: "a1234567" },
[service]: { head: "release", headCommit: "b1234567" },
},
});
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.newTag");
});
const dialog = page.getByRole("dialog", { name: "Tag", exact: true });
const name = dialog.getByRole("textbox", { name: "Tag name:", exact: true });
const label = dialog.getByText("Tag name:", { exact: true });
const commit = dialog.getByRole("textbox", { name: "Commit:", exact: true });
const message = dialog.getByRole("textbox", { name: "Message:", exact: true });
const create = dialog.getByRole("button", { name: "Create Tag", exact: true });
await expect(name).toBeFocused();
const labelBox = (await label.boundingBox())!;
const fieldBox = (await name.boundingBox())!;
expect(labelBox.x + labelBox.width).toBeLessThan(fieldBox.x);
for (const field of [commit, message, dialog.getByRole("checkbox", { name: "Force" })]) {
expect(Math.abs((await field.boundingBox())!.x - fieldBox.x)).toBeLessThan(1);
}
await expect(label).toHaveCSS("font-size", await name.evaluate((el) => getComputedStyle(el).fontSize));
await expect(label).toHaveCSS("font-family", await name.evaluate((el) => getComputedStyle(el).fontFamily));
await expect(dialog.getByText("Current branch:", { exact: true })).toBeVisible();
await expect(dialog.getByText("main", { exact: true })).toBeVisible();
await name.fill("v1.0");
await expect(create).toBeEnabled();
await dialog.getByRole("button", { name: "Repository", exact: true }).click();
await page.getByRole("option", { name: "service", exact: true }).click();
await expect(dialog.getByText("release", { exact: true })).toBeVisible();
await expect(dialog.getByText("main", { exact: true })).toHaveCount(0);
await expect(name).toHaveAccessibleDescription(/already exists/);
await expect(create).toBeDisabled();
await page.setViewportSize({ width: 400, height: 620 });
const stackedLabel = (await label.boundingBox())!;
const stackedField = (await name.boundingBox())!;
expect(stackedLabel.y + stackedLabel.height).toBeLessThanOrEqual(stackedField.y);
expect(Math.abs(stackedLabel.x - stackedField.x)).toBeLessThan(1);
await name.fill("v2.0-rc1");
await commit.fill("HEAD~1");
await message.fill("Release candidate\nReviewed service changes.");
await create.click();
await expect
.poll(() => ipcCalls(page, "vcs_create_tag"))
.toEqual([
{
repo: "/dev/acme-api/service",
name: "v2.0-rc1",
commit: "HEAD~1",
message: "Release candidate\nReviewed service changes.",
force: false,
},
]);
});
+88
Переглянути файл
@@ -0,0 +1,88 @@
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
test("Gradle keeps the local installation with Distribution and saves edits in project scope", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1120, height: 760 });
await stubDesktop(page);
const gradleHome = "C:/Tools/Gradle 8.14";
await page.evaluate((path) => {
window.__ipc.handlers.settings_get_global = () => ({});
window.__ipc.handlers.settings_get = () => ({});
window.__ipc.handlers.settings_set = () => ({});
window.__ipc.handlers.sdk_detect = () => [];
window.__ipc.handlers["plugin:dialog|open"] = () => path;
}, gradleHome);
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("Gradle JVM");
await settings.getByRole("treeitem", { name: "Gradle", exact: true }).click();
await search.clear();
const userHome = settings.getByRole("textbox", { name: /^Gradle user home:?$/ });
const runUsing = settings.getByRole("button", { name: "Build and run using", exact: true });
const distribution = settings.getByRole("button", { name: "Distribution", exact: true });
const jvm = settings.getByRole("button", { name: "Gradle JVM", exact: true });
const installation = settings.getByRole("textbox", { name: "Gradle home", exact: true });
const [user, run, distro, sdk] = await Promise.all(
[userHome, runUsing, distribution, jvm].map((el) => el.boundingBox()),
);
if (!user || !run || !distro || !sdk) throw new Error("Missing Gradle settings fields");
expect(user.y).toBeLessThan(run.y);
expect(run.y).toBeLessThan(distro.y);
expect(distro.y).toBeLessThan(sdk.y);
await expect(
settings
.getByRole("region", { name: "Build and Run", exact: true })
.getByRole("button", { name: "Build and run using" }),
).toBeVisible();
const runtime = settings.getByRole("region", { name: "Gradle runtime", exact: true });
await expect(runtime.getByRole("button", { name: "Distribution", exact: true })).toBeVisible();
await expect(runtime.getByRole("button", { name: "Gradle JVM", exact: true })).toBeVisible();
await expect(distribution).toHaveText("Gradle wrapper");
await expect(installation).toHaveCount(0);
await distribution.click();
await page.getByRole("option", { name: "Local installation", exact: true }).click();
const browse = installation.locator("..").getByRole("button", { name: /^Browse/ });
for (const width of [1120, 580, 520]) {
await page.setViewportSize({ width, height: 760 });
await expect(browse).toBeInViewport({ ratio: 1 });
const [choice, path, button, java] = await Promise.all(
[distribution, installation, browse, jvm].map((el) => el.boundingBox()),
);
if (!choice || !path || !button || !java) throw new Error("Missing local installation controls");
expect(path.width).toBeGreaterThan(120);
expect(path.y + path.height / 2).toBeCloseTo(button.y + button.height / 2, 0);
expect(path.y + path.height).toBeLessThan(java.y);
if (width === 1120) {
expect(path.x).toBeGreaterThan(choice.x + choice.width);
expect(path.y).toBeCloseTo(choice.y, 0);
} else {
expect(path.x).toBeCloseTo(choice.x, 0);
expect(path.y).toBeGreaterThan(choice.y + choice.height);
}
}
await browse.click();
await expect(installation).toHaveValue(gradleHome);
await userHome.fill("C:/Build Cache/Gradle");
await distribution.click();
await page.getByRole("option", { name: "Gradle wrapper", exact: true }).click();
await expect(installation).toHaveCount(0);
await distribution.click();
await page.getByRole("option", { name: "Local installation", exact: true }).click();
await expect(installation).toHaveValue(gradleHome);
expect(await ipcCalls(page, "settings_set")).toEqual([]);
await settings.getByRole("button", { name: "Apply", exact: true }).click();
await expect
.poll(async () => (await ipcCalls(page, "settings_set")).sort((a, b) => String(a.key).localeCompare(String(b.key))))
.toEqual([
{ scope: "project", key: "languages.java.gradle.distribution", value: JSON.stringify("local") },
{ scope: "project", key: "languages.java.gradle.home", value: JSON.stringify(gradleHome) },
{ scope: "project", key: "languages.java.gradle.userHome", value: JSON.stringify("C:/Build Cache/Gradle") },
]);
});
+95
Переглянути файл
@@ -0,0 +1,95 @@
import type { Page } from "@playwright/test";
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
async function openProxySettings(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("HTTP Proxy");
await dialog.getByRole("treeitem", { name: "HTTP Proxy", exact: true }).click();
await search.clear();
return dialog;
}
test("HTTP Proxy keeps server and authentication fields aligned in narrow settings", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1120, height: 740 });
const dialog = await openProxySettings(page);
const auto = dialog.getByRole("radio", { name: "Auto-detect proxy settings", exact: true });
const manual = dialog.getByRole("radio", { name: "Manual proxy configuration", exact: true });
const host = dialog.getByRole("textbox", { name: "Host name:", exact: true });
const port = dialog.getByRole("textbox", { name: /^Port number:?$/ });
const exceptions = dialog.getByRole("textbox", { name: "No proxy for:", exact: true });
const auth = dialog.getByRole("checkbox", { name: "Proxy authentication", exact: true });
const login = dialog.getByRole("textbox", { name: "Login:", exact: true });
const password = dialog.getByLabel("Password", { exact: true });
await expect(auto).toBeChecked();
for (const control of [host, port, exceptions, auth, login, password]) await expect(control).toBeDisabled();
await auto.press("ArrowDown");
await expect(manual).toBeChecked();
await host.fill("127.0.0.1");
await expect(login).toBeDisabled();
await auth.check();
await login.fill("layout-user");
await password.fill("layout-password");
for (const width of [1120, 580, 520]) {
await page.setViewportSize({ width, height: 740 });
for (const control of [host, port, exceptions, login, password]) {
await expect(control).toBeInViewport({ ratio: 1 });
}
const [hostBox, portBox, exceptionsBox, loginBox, passwordBox] = await Promise.all(
[host, port, exceptions, login, password].map((control) => control.boundingBox()),
);
if (!hostBox || !portBox || !exceptionsBox || !loginBox || !passwordBox) {
throw new Error("Missing HTTP Proxy field bounds");
}
expect(hostBox.y).toBeLessThan(portBox.y);
expect(portBox.y).toBeLessThan(exceptionsBox.y);
expect(hostBox.x).toBeCloseTo(portBox.x, 0);
expect(hostBox.x).toBeCloseTo(exceptionsBox.x, 0);
expect(hostBox.width).toBeCloseTo(exceptionsBox.width, 0);
expect(loginBox.x).toBeCloseTo(passwordBox.x, 0);
expect(loginBox.width).toBeCloseTo(passwordBox.width, 0);
}
await auto.check();
await expect(password).toBeDisabled();
await manual.check();
await expect(host).toHaveValue("127.0.0.1");
await expect(login).toHaveValue("layout-user");
await expect(password).toHaveValue("layout-password");
});
test("HTTP Proxy checks a URL with the staged manual settings in a narrow window", async ({ workbench: page }) => {
await page.setViewportSize({ width: 540, height: 680 });
await stubDesktop(page);
await page.evaluate(() => {
window.__ipc.handlers.proxy_check_connection = () => "200 OK";
});
const dialog = await openProxySettings(page);
const check = dialog.getByRole("button", { name: "Check connection…", exact: true });
const manual = dialog.getByRole("radio", { name: "Manual proxy configuration", exact: true });
await manual.check();
await expect(check).toBeDisabled();
await dialog.getByRole("textbox", { name: "Host name:", exact: true }).fill("proxy.example.test");
const port = dialog.getByRole("textbox", { name: /^Port number:?$/ });
await port.fill("8079");
await port.press("ArrowUp");
await expect(port).toHaveValue("8080");
await check.click();
const target = page.getByRole("textbox", { name: "Enter any URL to check connection to:", exact: true });
const submit = page.getByRole("button", { name: "Check", exact: true });
await target.fill("http://example.test/health");
await expect(target).toBeInViewport({ ratio: 1 });
await expect(submit).toBeInViewport({ ratio: 1 });
await submit.click();
await expect(page.getByRole("status").filter({ hasText: "Connection successful: 200 OK" })).toBeVisible();
expect(await ipcCalls(page, "proxy_check_connection")).toEqual([
{
proxy: expect.objectContaining({ mode: "manual", kind: "http", host: "proxy.example.test", port: 8080 }),
url: "http://example.test/health",
},
]);
expect(await ipcCalls(page, "settings_set")).toEqual([]);
});
+87
Переглянути файл
@@ -0,0 +1,87 @@
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
test("Maven groups environment and runner settings while keeping paths and thread count editable", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1120, height: 900 });
await stubDesktop(page);
const settingsPath = "C:/Build Config/settings.xml";
const jdk = "C:/SDKs/jdk-21";
await page.evaluate(
({ settingsPath, jdk }) => {
window.__ipc.handlers.settings_get_global = () => ({});
window.__ipc.handlers.settings_get = () => ({});
window.__ipc.handlers.settings_set = () => ({});
window.__ipc.handlers.sdk_detect = ({ kind }) =>
kind === "jdk" ? [{ path: jdk, home: jdk, name: "JDK 21", version: "21", source: "system", extra: null }] : [];
window.__ipc.handlers["plugin:dialog|open"] = () => settingsPath;
},
{ settingsPath, jdk },
);
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("thread count");
await settings.getByRole("treeitem", { name: "Maven", exact: true }).click();
await search.clear();
const threads = settings.getByRole("textbox", { name: "Thread count", exact: true });
const maven = settings.getByRole("button", { name: "Maven home path", exact: true });
const user = settings.getByRole("textbox", { name: /^User settings file:?$/ });
const repository = settings.getByRole("textbox", { name: /^Local repository:?$/ });
const userBrowse = user.locator("..").getByRole("button", { name: /^Browse/ });
const repoBrowse = repository.locator("..").getByRole("button", { name: /^Browse/ });
const java = settings.getByRole("button", { name: "JRE", exact: true });
const download = settings.getByRole("checkbox", { name: "Automatically download sources", exact: true });
const [count, home] = await Promise.all([threads.boundingBox(), maven.boundingBox()]);
if (!count || !home) throw new Error("Missing Maven controls");
expect(count.y).toBeLessThan(home.y);
const environment = settings.getByRole("region", { name: "Environment", exact: true });
const importing = settings.getByRole("region", { name: "Importing", exact: true });
const runner = settings.getByRole("region", { name: "Runner", exact: true });
await expect(environment.getByRole("button", { name: "Maven home path", exact: true })).toBeVisible();
await expect(importing.getByRole("checkbox", { name: "Automatically download sources", exact: true })).toBeVisible();
await expect(runner.getByRole("button", { name: "JRE", exact: true })).toBeVisible();
for (const width of [1120, 580, 520]) {
await page.setViewportSize({ width, height: 900 });
await threads.scrollIntoViewIfNeeded();
const [threadBox, mavenBox, userBox, userButton, repoBox, repoButton, importBox, javaBox] = await Promise.all(
[threads, maven, user, userBrowse, repository, repoBrowse, download, java].map((control) =>
control.boundingBox(),
),
);
if (!threadBox || !mavenBox || !userBox || !userButton || !repoBox || !repoButton || !importBox || !javaBox)
throw new Error("Missing Maven layout bounds");
expect(threadBox.width).toBeLessThan(121);
expect(mavenBox.x).toBeCloseTo(userBox.x, 0);
expect(userBox.x).toBeCloseTo(repoBox.x, 0);
expect(userBox.width).toBeGreaterThan(120);
expect(userBox.y + userBox.height / 2).toBeCloseTo(userButton.y + userButton.height / 2, 0);
expect(userButton.x + userButton.width).toBeCloseTo(repoButton.x + repoButton.width, 0);
expect(repoBox.y + repoBox.height).toBeLessThan(importBox.y);
expect(importBox.y).toBeLessThan(javaBox.y);
await expect(userBrowse).toBeInViewport({ ratio: 1 });
}
await userBrowse.click();
await expect(user).toHaveValue(settingsPath);
await java.click();
await page.getByRole("option", { name: /JDK 21/ }).click();
await expect(java).toHaveText("JDK 21");
await threads.fill("2X");
await expect(threads).toHaveAttribute("aria-invalid", "true");
await expect(settings.getByRole("alert")).toContainText("Not a thread count Maven accepts");
await threads.fill("2.5C");
await expect(settings.getByRole("alert")).toHaveCount(0);
expect(await ipcCalls(page, "settings_set")).toEqual([]);
await settings.getByRole("button", { name: "Apply", exact: true }).click();
await expect
.poll(async () => (await ipcCalls(page, "settings_set")).sort((a, b) => String(a.key).localeCompare(String(b.key))))
.toEqual([
{ scope: "project", key: "languages.java.maven.runnerJre", value: JSON.stringify(jdk) },
{ scope: "project", key: "languages.java.maven.threads", value: JSON.stringify("2.5C") },
{ scope: "project", key: "languages.java.maven.userSettings", value: JSON.stringify(settingsPath) },
]);
});
+49 -4
Переглянути файл
@@ -7,10 +7,10 @@ import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
const ROOT = "/dev/acme-api";
async function openNewBranchDialog(page: Page, from?: string) {
async function openNewBranchDialog(page: Page, from?: string, withPrefix = false) {
await stubDesktop(page);
await page.evaluate(
async ({ root, from }) => {
async ({ root, from, withPrefix }) => {
const h = window.__ipc.handlers;
h.vcs_roots = () => [{ root, operation: null, head: "main", headCommit: "1111111" }];
h.vcs_branch_info = () => ({
@@ -33,6 +33,7 @@ async function openNewBranchDialog(page: Page, from?: string) {
lastCommitMs: null,
commit: "1111111",
},
...(withPrefix ? [{ name: "feature/weekly-totals", current: false, remote: false }] : []),
];
h.vcs_create_branch = () => null;
const vcsModule = "/src/features/vcs/store.ts";
@@ -45,10 +46,10 @@ async function openNewBranchDialog(page: Page, from?: string) {
if (from) void executeAction("vcs.log.newBranch", { id: from, summary: "Selected commit", repo: root });
else void executeAction("vcs.newBranch");
},
{ root: ROOT, from },
{ root: ROOT, from, withPrefix },
);
const dialog = page.getByRole("dialog", { name: from ? `Create New Branch from ${from}` : "Create New Branch" });
const input = dialog.getByRole("textbox", { name: "New branch name:" });
const input = dialog.getByRole(withPrefix ? "combobox" : "textbox", { name: "New branch name:" });
await expect(input).toBeVisible();
return { dialog, input };
}
@@ -108,3 +109,47 @@ test("pasted text has its spaces replaced", async ({ workbench: page }) => {
await expect(input).toHaveValue("feature/add-new-thing");
await expect(dialog.getByRole("button", { name: "Create", exact: true })).toBeEnabled();
});
test("the branch name and options line up, and prefix completion follows the field", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1100, height: 700 });
const { dialog, input } = await openNewBranchDialog(page, undefined, true);
const label = dialog.getByText("New branch name:", { exact: true });
const checkout = dialog.getByRole("checkbox", { name: "Checkout branch" });
const overwrite = dialog.getByRole("checkbox", { name: "Overwrite existing branch" });
const create = dialog.getByRole("button", { name: "Create", exact: true });
await expect(input).toHaveValue("main");
await expect(input).toHaveAttribute("aria-invalid", "true");
await expect(create).toBeDisabled();
await expect(checkout).toBeChecked();
await expect(overwrite).not.toBeChecked();
const labelBox = (await label.boundingBox())!;
const fieldBox = (await input.boundingBox())!;
expect(labelBox.x + labelBox.width).toBeLessThan(fieldBox.x);
expect(Math.abs(labelBox.y + labelBox.height / 2 - (fieldBox.y + fieldBox.height / 2))).toBeLessThan(1);
const checkoutBox = (await checkout.boundingBox())!;
expect(Math.abs(checkoutBox.x - fieldBox.x)).toBeLessThan(1);
expect(Math.abs(checkoutBox.y - (await overwrite.boundingBox())!.y)).toBeLessThan(1);
await expect(input).toHaveAccessibleDescription(/already exists/i);
await expect(label).toHaveCSS("font-size", await input.evaluate((el) => getComputedStyle(el).fontSize));
await expect(label).toHaveCSS("font-family", await input.evaluate((el) => getComputedStyle(el).fontFamily));
await input.fill("fea");
const prefixes = page.getByRole("listbox", { name: "Branch name prefixes" });
await expect(prefixes.getByRole("option", { name: "feature/" })).toBeVisible();
expect(Math.abs((await prefixes.boundingBox())!.x - (await input.boundingBox())!.x)).toBeLessThanOrEqual(8);
await input.press("ArrowDown");
await input.press("Enter");
await expect(input).toHaveValue("feature/");
await page.setViewportSize({ width: 400, height: 540 });
const stackedField = (await input.boundingBox())!;
const stackedLabel = (await label.boundingBox())!;
expect(stackedLabel.y + stackedLabel.height).toBeLessThanOrEqual(stackedField.y);
expect(Math.abs(stackedLabel.x - stackedField.x)).toBeLessThan(1);
await input.fill("feature/review-totals");
await checkout.uncheck();
await create.click();
await expect
.poll(() => ipcCalls(page, "vcs_create_branch"))
.toEqual([{ repo: ROOT, name: "feature/review-totals", start: null, checkout: false, overwrite: false }]);
});
+58
Переглянути файл
@@ -0,0 +1,58 @@
import { expect, openFromTree, test } from "./fixtures";
test("Quick Definition keeps the source font and toolbar while switching previews", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1120, height: 780 });
await openFromTree(page, "App.tsx");
await page.evaluate(async () => {
const path = "/src/editor/lsp/popupStore.ts";
const { openPopup } = await import(/* @vite-ignore */ path);
const editor = document.querySelector<HTMLElement>(".cm-editor")!;
const content = editor.querySelector<HTMLElement>(".cm-content")!;
content.style.fontSize = "19px";
content.style.lineHeight = "27px";
const { fontFamily, fontSize, fontWeight, lineHeight, tabSize } = getComputedStyle(content);
openPopup({
kind: "definition",
anchor: { x: 320, y: 160 },
targets: ["shipping", "billing"].map((group) => ({
name: "formatTotal",
firstLine: 2,
location: {
path: `/work/acme-api/src/${group}/totals.ts`,
range: { start: { line: 2, col: 0 }, end: { line: 2, col: 11 } },
},
text: `export const formatTotal = "${group}";`,
language: "typescript",
})),
index: 0,
themeClasses: editor.className,
codeStyle: { fontFamily, fontSize, fontWeight, lineHeight, tabSize },
});
});
const popup = page.getByRole("dialog", { name: "Definition", exact: true });
const code = popup.locator("pre");
await expect(code).toContainText("shipping");
await expect(code).toHaveCSS("font-size", "19px");
await expect(code).toHaveCSS("line-height", "27px");
await expect(popup).toHaveCSS("height", "400px");
const header = popup.locator("button").filter({ hasText: "formatTotal" });
await expect(header).toBeVisible();
await expect(popup.getByText(/shipping[/]totals\.ts:3/)).toBeVisible();
await popup.getByRole("button", { name: "Next Definition" }).click();
await expect(code).toContainText("billing");
await expect(popup.getByText(/billing[/]totals\.ts:3/)).toBeVisible();
await expect(popup.getByText("2/2")).toBeVisible();
await page.keyboard.press("ArrowRight");
await expect(code).toContainText("shipping");
const handle = popup.getByRole("separator", { name: "Resize" });
const bounds = (await handle.boundingBox())!;
await page.mouse.move(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
await page.mouse.down();
await page.mouse.move(bounds.x + 56, bounds.y + 50, { steps: 4 });
await page.mouse.up();
expect((await popup.boundingBox())!.height).toBeGreaterThan(430);
await expect(popup.getByRole("button", { name: "Edit Source" })).toBeInViewport({ ratio: 1 });
});
+41
Переглянути файл
@@ -0,0 +1,41 @@
import { expect, openFromTree, test } from "./fixtures";
test("Quick Switch Scheme stays centered and opens its numbered choices without leaving the editor", async ({
workbench: page,
}) => {
const editor = await openFromTree(page, "build.gradle.kts");
const content = editor.locator(".cm-content");
await content.focus();
const root = page.locator("html");
const theme = await root.getAttribute("data-theme");
const colorTheme = await root.getAttribute("data-color-theme");
await page.keyboard.press("Control+Backquote");
const menu = page.getByRole("menu", { name: /^(Switch Scheme|Context menu)$/ });
await expect(menu).toBeVisible();
for (const { width, height } of [
{ width: 1120, height: 680 },
{ width: 620, height: 540 },
]) {
await page.setViewportSize({ width, height });
await expect(async () => {
const bounds = await menu.locator("xpath=..").boundingBox();
expect(Math.abs(bounds!.x + bounds!.width / 2 - width / 2)).toBeLessThan(1);
expect(Math.abs(bounds!.y + bounds!.height / 2 - height / 2)).toBeLessThan(1);
}).toPass({ timeout: 3000 });
}
await expect(menu.getByText("Switch Scheme", { exact: true })).toBeVisible();
await expect(menu.getByRole("menuitem", { name: "Editor Color Scheme" })).toBeFocused();
await expect(menu.locator("[data-menu-number]")).toHaveText(["1", "2", "3", "4"]);
await page.keyboard.press("4");
const light = page.getByRole("menuitemcheckbox", { name: "Solarized Light" });
await light.hover();
await expect(root).toHaveAttribute("data-color-theme", "solarized-light");
await page.keyboard.press("Escape");
await expect(light).toBeHidden();
await expect(menu).toBeVisible();
await page.keyboard.press("Escape");
await expect(menu).toBeHidden();
await expect(content).toBeFocused();
await expect.poll(() => root.getAttribute("data-theme")).toBe(theme);
await expect.poll(() => root.getAttribute("data-color-theme")).toBe(colorTheme);
});
+75
Переглянути файл
@@ -0,0 +1,75 @@
import { expect, ipcCalls, openFromTree, stubDesktop, test } from "./fixtures";
test("Recent Changes puts aligned dates ahead of the changes and opens the chosen history", async ({
workbench: page,
}) => {
await openFromTree(page, "build.gradle.kts");
await page.setViewportSize({ width: 480, height: 300 });
await stubDesktop(page);
const { file, newest, older } = await page.evaluate(async () => {
const root = "/dev/acme-api";
const file = `${root}/build.gradle.kts`;
const saved = Date.now() - 120_000;
const earlier = saved - 300_000;
const entries = [
{ id: "checkpoint", path: root, timestampMs: saved, label: "Before refactor", size: 0, kind: "label" },
{ id: "build", path: file, timestampMs: earlier, label: "Saved", size: 9, kind: "snapshot" },
...Array.from({ length: 18 }, (_, i) => ({
id: `notes-${i}`,
path: `${root}/src/notes-${i}.txt`,
timestampMs: earlier - (i + 1) * 60_000,
label: "Saved",
size: 9,
kind: "snapshot",
})),
];
window.__ipc.handlers.history_list_dir = ({ path }) => ({
entries: path === root ? entries : entries.filter((entry) => entry.path === path),
deleted: [],
});
window.__ipc.handlers.history_content = () => "plugins {}\n";
window.__ipc.handlers.fs_probe = () => ({ size: 9, binary: false, tooLarge: false });
window.__ipc.handlers.vcs_file_mode = () => null;
const dateModule = "/src/platform/dateFormat.ts";
const { formatDateTime } = await import(/* @vite-ignore */ dateModule);
const actions = "/src/platform/actions.ts";
await (await import(/* @vite-ignore */ actions)).executeAction("localHistory.recentChanges");
return { file, newest: formatDateTime(new Date(saved)), older: formatDateTime(new Date(earlier)) };
});
const popup = page.getByRole("dialog", { name: "Recent Changes", exact: true });
const list = popup.getByRole("listbox", { name: "Recent Changes", exact: true });
const checkpoint = list.getByRole("option", { name: /Before refactor/ });
const build = list.getByRole("option", { name: /build\.gradle\.kts/ });
const firstTime = checkpoint.getByText(newest, { exact: true });
const secondTime = build.getByText(older, { exact: true });
const firstLabel = checkpoint.getByText("Before refactor", { exact: true });
const secondLabel = build.getByText(/build\.gradle\.kts/);
await expect(firstTime).toHaveCSS("font-size", "13px");
await expect(secondTime).toBeVisible();
const time = (await firstTime.boundingBox())!;
const label = (await firstLabel.boundingBox())!;
expect(time.x).toBeCloseTo((await secondTime.boundingBox())!.x);
expect(label.x).toBeCloseTo((await secondLabel.boundingBox())!.x);
expect(time.x + time.width).toBeLessThan(label.x);
await expect
.poll(async () => {
const box = (await popup.boundingBox())!;
return Math.max(Math.abs(box.x + box.width / 2 - 240), Math.abs(box.y + box.height / 2 - 150));
})
.toBeLessThan(2);
await page.keyboard.press("End");
const last = list.getByRole("option", { name: /notes-17\.txt/ });
await expect(last).toHaveAttribute("aria-selected", "true");
await expect(last).toBeInViewport({ ratio: 1 });
await expect(popup.getByText("Recent Changes", { exact: true })).toBeVisible();
await page.keyboard.type("build.gradle");
await expect(list.getByRole("option")).toHaveCount(1);
await expect(build).toHaveAttribute("aria-selected", "true");
await page.keyboard.press("Enter");
await expect(popup).toBeHidden();
await expect.poll(async () => ipcCalls(page, "history_list_dir")).toContainEqual({ path: file });
await expect(page.getByRole("listbox", { name: "Revisions", exact: true })).toBeVisible();
});
+71
Переглянути файл
@@ -0,0 +1,71 @@
import type { Page } from "@playwright/test";
import { expect, test } from "./fixtures";
async function openRefactorList(page: Page) {
await page.evaluate(async () => {
const path = "/src/editor/lsp/popupStore.ts";
const { openPopup } = await import(/* @vite-ignore */ path);
const run = (action: string) => () => {
document.body.dataset.selectedRefactoring = action;
};
openPopup({
kind: "list",
title: "Refactor This",
anchor: { x: 300, y: 140 },
compact: true,
numbered: true,
items: [
{ id: "rename", label: "Rename…", shortcut: "Shift+F6", run: run("rename") },
{
id: "extractVariable",
label: "Introduce Variable…",
shortcut: "Ctrl+Alt+V",
section: { id: "extract", label: "Extract/Introduce" },
run: run("extractVariable"),
},
{ id: "inline", label: "Inline…", section: { id: "inline" }, run: run("inline") },
],
});
});
}
test("the compact Refactor This list groups actions without numbering or selecting its captions", async ({
workbench: page,
}) => {
await openRefactorList(page);
const popup = page.getByRole("dialog", { name: "Refactor This", exact: true });
const group = popup.getByText("Extract/Introduce", { exact: true });
await expect(group).toBeVisible();
expect((await popup.boundingBox())!.width).toBeLessThan(360);
await expect(popup.getByRole("option")).toHaveCount(3);
const introduce = popup.getByRole("option", { name: /Introduce Variable/ });
await expect(introduce.getByText("2", { exact: true })).toBeVisible();
await page.keyboard.press("ArrowDown");
await expect(introduce).toHaveAttribute("aria-selected", "true");
await page.keyboard.press("2");
await expect(popup).toBeHidden();
await expect(page.locator("body")).toHaveAttribute("data-selected-refactoring", "extractVariable");
});
test("filtering keeps captions only for groups with a matching action", async ({ workbench: page }) => {
await openRefactorList(page);
const popup = page.getByRole("dialog", { name: "Refactor This", exact: true });
const list = popup.getByRole("listbox");
const group = popup.getByText("Extract/Introduce", { exact: true });
await expect(list).toBeFocused();
await expect(group).toBeVisible();
await page.keyboard.type("variable");
await expect(group).toBeVisible();
await expect(popup.getByRole("option")).toHaveCount(1);
await expect(popup.getByRole("option")).toHaveAttribute("aria-selected", "true");
await page.keyboard.press("Enter");
await expect(page.locator("body")).toHaveAttribute("data-selected-refactoring", "extractVariable");
await openRefactorList(page);
await expect(list).toBeFocused();
await page.keyboard.type("rename");
await expect(group).toBeHidden();
await expect(popup.getByRole("option", { name: /Rename/ })).toHaveAttribute("aria-selected", "true");
});
+77
Переглянути файл
@@ -0,0 +1,77 @@
import type { Page } from "@playwright/test";
import { expect, test } from "./fixtures";
const primary = "Prepare invoices for the payments staging environment";
async function seedConfigurations(page: Page, mode: "select" | "run") {
await page.evaluate(
async ({ name, mode }) => {
const path = "/src/features/run/store.ts";
const { useRun } = await import(/* @vite-ignore */ path);
const configs = [name, ...Array.from({ length: 19 }, (_, i) => `Payments check ${i + 1}`)].map((label, i) => ({
id: `user:chooser-${i}`,
name: label,
kind: "shell",
command: "node",
args: ["src/index.ts"],
cwd: null,
env: {},
detected: false,
isTest: false,
debugAdapter: null,
}));
useRun.setState({ configs, selectedId: configs[0]!.id, chooserMode: mode, chooserOpen: true, loaded: true });
},
{ name: primary, mode },
);
}
test("the run chooser fits a long name beside its inline actions and keeps its width while filtering", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1120, height: 680 });
await seedConfigurations(page, "select");
const chooser = page.getByRole("dialog", { name: "Run/Debug Configurations", exact: true });
const label = chooser.getByText(primary, { exact: true });
await expect(label).toBeVisible();
const width = (await chooser.boundingBox())!.width;
expect(width).toBeGreaterThan(340);
expect(width).toBeLessThanOrEqual(500);
await expect(chooser.getByRole("button", { name: `Run '${primary}'`, exact: true })).toBeVisible();
const nameOverflow = await label.evaluate(async (el) => {
await document.fonts.ready;
const text = document.createRange();
text.selectNodeContents(el);
return text.getBoundingClientRect().width - el.getBoundingClientRect().width;
});
expect(nameOverflow).toBeLessThanOrEqual(0);
const search = chooser.getByRole("textbox", { name: "Search configurations" });
await search.fill("Payments check 19");
await expect(chooser.getByText("Payments check 19", { exact: true })).toBeVisible();
expect((await chooser.boundingBox())!.width).toBeCloseTo(width);
await page.keyboard.press("Enter");
await expect(chooser).toBeHidden();
await expect(page.locator("[data-run-chooser]")).toContainText("Payments check 19");
});
test("in a short window only the list scrolls, leaving the search and shortcuts visible", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 780, height: 280 });
await seedConfigurations(page, "run");
const chooser = page.getByRole("dialog", { name: "Run/Debug Configurations", exact: true });
const list = chooser.getByRole("listbox", { name: "Configurations" });
const search = chooser.getByRole("textbox", { name: "Search configurations" });
const hint = chooser.getByText("Hold Shift to Debug, F4 to edit, Delete to remove", { exact: true });
await expect(search).toBeFocused();
await expect(hint).toBeInViewport({ ratio: 1 });
expect(await chooser.evaluate((el) => el.scrollHeight - el.clientHeight)).toBeLessThanOrEqual(1);
expect(await list.evaluate((el) => el.scrollHeight - el.clientHeight)).toBeGreaterThan(0);
await page.keyboard.press("End");
await expect(chooser.getByRole("option", { name: /Edit Configurations/ })).toBeInViewport({ ratio: 1 });
await expect.poll(() => list.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
await expect(search).toBeInViewport({ ratio: 1 });
await expect(hint).toBeInViewport({ ratio: 1 });
});
+50
Переглянути файл
@@ -0,0 +1,50 @@
import { expect, test } from "./fixtures";
test("Select In names the chooser and reveals the file in the requested project view", async ({ workbench: page }) => {
const tree = page.getByRole("tree", { name: "Project", exact: true });
await tree.getByRole("treeitem", { name: "settings.gradle.kts", exact: true }).dblclick();
await expect(page.locator(".cm-content")).toBeVisible();
const openChooser = () =>
page.evaluate(async () => {
const actions = "/src/platform/actions.ts";
await (await import(/* @vite-ignore */ actions)).executeAction("navigate.selectIn");
});
await openChooser();
const menu = page.getByRole("menu", { name: "Select In", exact: true });
await expect(menu.getByText("Select In", { exact: true })).toBeVisible();
const project = menu.getByRole("menuitem", { name: "Project View", exact: true });
await expect(project).toBeFocused();
await expect(project.locator('[data-menu-number="1"]')).toBeVisible();
await page.keyboard.press("ArrowRight");
const projectFiles = page.getByRole("menuitem", { name: "Project Files", exact: true });
await expect(project).toHaveAttribute("aria-expanded", "true");
await expect(projectFiles).toBeVisible();
await expect(page.getByRole("menuitem", { name: "Open Files", exact: true })).toBeEnabled();
await expect(page.getByRole("menuitem", { name: "All Changed Files", exact: true })).toBeDisabled();
await page.keyboard.press("ArrowLeft");
await expect(projectFiles).toBeHidden();
await expect(project).toBeFocused();
await page.keyboard.press("ArrowRight");
await page.keyboard.press("ArrowDown");
await expect(projectFiles).toBeFocused();
await page.keyboard.press("Enter");
await expect(menu).toBeHidden();
await expect(page.getByRole("button", { name: "Project Files", exact: true })).toBeVisible();
const file = tree.getByRole("treeitem", { name: "settings.gradle.kts", exact: true });
await expect(file).toHaveAttribute("aria-selected", "true");
await page.locator(".cm-content").focus();
await openChooser();
await expect(project).toBeFocused();
await project.locator("[data-menu-submenu-arrow]").click();
await expect(projectFiles).toBeVisible();
await page.keyboard.press("ArrowLeft");
await expect(project).toBeFocused();
await page.keyboard.press("1");
await expect(menu).toBeHidden();
await expect(page.getByRole("button", { name: "Project Files", exact: true })).toBeVisible();
await expect(file).toHaveAttribute("aria-selected", "true");
});
+97 -5
Переглянути файл
@@ -1,5 +1,59 @@
import { expect, stubDesktop, test } from "./fixtures";
test("System Settings groups file controls before caches and keeps the idle timeout unit beside its field", async ({
workbench: page,
}) => {
await page.keyboard.press("Meta+,");
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
const system = dialog.getByRole("treeitem", { name: "System Settings", exact: true });
const search = dialog.getByRole("textbox", { name: "Search settings" });
await search.fill("Autosave");
await expect(system).toBeVisible();
await search.clear();
await system.click();
const exit = dialog.getByRole("checkbox", { name: "Confirm before exiting the IDE" });
const reopen = dialog.getByRole("checkbox", { name: "Reopen projects on startup" });
const project = dialog.getByRole("region", { name: "Project", exact: true });
const directory = project.getByRole("textbox", { name: /^Default directory/ });
const browse = project.getByRole("button", { name: "Browse", exact: true });
const idle = dialog.getByRole("checkbox", { name: "Save files if the IDE is idle for" });
const timeout = dialog.getByRole("textbox", { name: "Idle seconds" });
const unit = dialog.getByText("seconds", { exact: true });
const caches = dialog.getByRole("region", { name: "Caches", exact: true });
for (const width of [1120, 580]) {
await page.setViewportSize({ width, height: 760 });
await expect(async () => {
const [exitBox, projectBox, idleBox, timeoutBox, unitBox, cacheBox] = await Promise.all(
[exit, reopen, idle, timeout, unit, caches].map((item) => item.boundingBox()),
);
expect(exitBox!.y).toBeLessThan(projectBox!.y);
expect(projectBox!.y).toBeLessThan(idleBox!.y);
expect(idleBox!.y).toBeLessThan(cacheBox!.y);
expect(unitBox!.x).toBeGreaterThanOrEqual(timeoutBox!.x + timeoutBox!.width);
expect(unitBox!.y).toBeGreaterThan(timeoutBox!.y);
expect(unitBox!.y + unitBox!.height).toBeLessThanOrEqual(timeoutBox!.y + timeoutBox!.height + 1);
const [directoryBox, browseBox] = await Promise.all([directory.boundingBox(), browse.boundingBox()]);
expect(browseBox!.x).toBeGreaterThanOrEqual(directoryBox!.x + directoryBox!.width);
expect(browseBox!.y).toBeGreaterThanOrEqual(directoryBox!.y);
expect(browseBox!.y + browseBox!.height).toBeLessThanOrEqual(directoryBox!.y + directoryBox!.height + 1);
}).toPass({ timeout: 3000 });
}
const files = dialog.getByRole("region", { name: "Files", exact: true });
const sync = files
.getByRole("group", { name: "Synchronization", exact: true })
.getByRole("checkbox", { name: "Synchronize external changes when switching to the IDE window" });
await idle.check();
await timeout.fill("22");
await sync.uncheck();
await dialog.getByRole("button", { name: "OK", exact: true }).click();
await page.keyboard.press("Meta+,");
await system.click();
await expect(idle).toBeChecked();
await expect(timeout).toHaveValue("22");
await expect(sync).not.toBeChecked();
});
test("Add Python Interpreter keeps environment labels and fields inside their rows", async ({ workbench: page }) => {
await page.keyboard.press("Meta+,");
const settings = page.getByRole("dialog", { name: "Settings", exact: true });
@@ -120,15 +174,53 @@ test("Directory Mappings keeps the controls and headers visible while scrolling
name: "VCS of integrations/finance-and-order-reconciliation/ledger-adapter-32",
exact: true,
});
await vcs.click();
await page.getByRole("option", { name: "<none>", exact: true }).click();
await expect(vcs).toHaveText("<none>");
await name.click();
const remove = toolbar.getByRole("button", { name: "Remove", exact: true });
await expect(remove).toBeEnabled();
await remove.click();
const unregistered = table.getByRole("rowgroup", { name: "Unregistered roots" });
await expect(unregistered.getByRole("row").last()).toContainText("ledger-adapter-32");
await expect(repo).toHaveAttribute("aria-selected", "true");
await expect(repo.getByRole("cell", { name: "Git", exact: true })).toBeVisible();
await expect(remove).toBeDisabled();
await toolbar.getByRole("button", { name: "Add", exact: true }).click();
const add = toolbar.getByRole("button", { name: "Add", exact: true });
await add.click();
await expect(vcs).toHaveText("Git");
await expect(unregistered).toHaveCount(0);
await expect(table.getByText("billing-audit-adapter", { exact: true })).toHaveCount(0);
const ledger = (n: number) => table.getByText(`ledger-adapter-${n}`, { exact: true });
const selectedNames = () => table.locator("tr[aria-selected=true] td:first-child").allTextContents();
await ledger(29).click();
await ledger(31).click({ modifiers: ["Meta"] });
expect(await selectedNames()).toEqual([
"integrations/finance-and-order-reconciliation/ledger-adapter-29",
"integrations/finance-and-order-reconciliation/ledger-adapter-31",
]);
await ledger(29).click();
await ledger(31).click({ modifiers: ["Shift"] });
await expect(table.locator("tr[aria-selected=true]")).toHaveCount(3);
expect(await page.evaluate(() => window.getSelection()?.toString())).toBe("");
await remove.click();
await expect(unregistered.getByRole("row")).toHaveCount(4);
await expect(unregistered.locator("tr[aria-selected=true]")).toHaveCount(3);
await expect(unregistered.getByText("ledger-adapter-29", { exact: true })).toBeVisible();
await expect(unregistered.getByText("ledger-adapter-30", { exact: true })).toBeVisible();
await expect(unregistered.getByText("ledger-adapter-31", { exact: true })).toBeVisible();
await ledger(32).click({ modifiers: ["Meta"] });
await expect(remove).toBeDisabled();
await expect(add).toBeDisabled();
await ledger(32).click({ modifiers: ["Meta"] });
await add.click();
await expect(unregistered).toHaveCount(0);
await expect(table.locator("tr[aria-selected=true]")).toHaveCount(3);
await add.click();
const added = table.getByRole("row").filter({ hasText: "billing-audit-adapter" });
await expect(added.getByText("billing-audit-adapter", { exact: true })).toBeInViewport({ ratio: 1 });
await expect(added).toHaveAttribute("aria-selected", "true");
await toolbar.getByRole("button", { name: "Remove", exact: true }).click();
await remove.click();
await expect(added).toHaveCount(0);
await settings.getByRole("button", { name: "Cancel", exact: true }).click();
+54
Переглянути файл
@@ -1,5 +1,59 @@
import { expect, test } from "./fixtures";
test("External Tools pairs metadata and separates command fields from advanced options", async ({
workbench: page,
}) => {
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("External Tools");
await dialog.getByRole("treeitem", { name: "External Tools", exact: true }).click();
await search.clear();
};
await openPage();
await dialog.getByRole("toolbar", { name: "External tools actions" }).getByRole("button", { name: "Add" }).click();
const name = dialog.getByRole("textbox", { name: /^Name/ });
const group = dialog.getByRole("textbox", { name: /^Group/ });
const description = dialog.getByRole("textbox", { name: /^Description/ });
for (const width of [1120, 580, 520]) {
await page.setViewportSize({ width, height: 760 });
await expect(async () => {
const [nameBox, groupBox, descriptionBox] = await Promise.all(
[name, group, description].map((field) => field.boundingBox()),
);
if (width === 1120) {
expect(groupBox!.y).toBe(nameBox!.y);
expect(groupBox!.x).toBeGreaterThan(nameBox!.x + nameBox!.width);
} else {
expect(groupBox!.y).toBeGreaterThan(nameBox!.y);
}
expect(descriptionBox!.x).toBe(nameBox!.x);
expect(descriptionBox!.y).toBeGreaterThan(groupBox!.y);
}).toPass({ timeout: 3000 });
}
const command = dialog.getByRole("region", { name: "Tool Settings", exact: true });
await expect(command.getByRole("textbox", { name: /^Program/ })).toBeVisible();
await expect(command.getByRole("textbox", { name: /^Arguments/ })).toBeVisible();
await expect(command.getByRole("textbox", { name: /^Working directory/ })).toBeVisible();
const sync = dialog.getByRole("checkbox", { name: "Synchronize files after execution" });
await expect(sync).toBeHidden();
await search.fill("Synchronize files after execution");
await expect(sync).toBeVisible();
await search.clear();
await expect(sync).toBeHidden();
await dialog.getByText("Advanced options", { exact: true }).click();
await name.fill("Validate project");
await sync.setChecked(!(await sync.isChecked()));
const enabled = await sync.isChecked();
await dialog.getByRole("button", { name: "OK", exact: true }).click();
await page.keyboard.press("Meta+,");
await openPage();
await expect(name).toHaveValue("Validate project");
await dialog.getByText("Advanced options", { exact: true }).click();
await expect(sync).toBeChecked({ checked: enabled });
});
for (const kind of ["external", "ssh", "target"] as const) {
test(`${kind} settings keep long names and details inside their selection row`, async ({ workbench: page }) => {
await page.keyboard.press("Meta+,");
+76
Переглянути файл
@@ -0,0 +1,76 @@
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
test("Spelling puts dictionary files first and keeps accepted words in separate scopes", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1120, height: 820 });
await stubDesktop(page);
await page.evaluate(() => {
window.__ipc.handlers.settings_get_global = () => ({});
window.__ipc.handlers.settings_get = () => ({});
window.__ipc.handlers.settings_set = () => ({});
});
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("Spelling");
await settings.getByRole("treeitem", { name: "Spelling", exact: true }).click();
await search.clear();
const files = settings.getByRole("region", { name: "Custom dictionaries", exact: true });
const words = settings.getByRole("region", { name: "Accepted words", exact: true });
const filesList = files.getByRole("listbox", { name: "Custom dictionaries", exact: true });
const project = words.getByRole("tab", { name: "Project dictionary", exact: true });
const application = words.getByRole("tab", { name: "Application dictionary", exact: true });
for (const width of [1120, 580, 520]) {
await page.setViewportSize({ width, height: 820 });
const [filesBox, wordsBox] = await Promise.all([files.boundingBox(), words.boundingBox()]);
if (!filesBox || !wordsBox) throw new Error("Missing Spelling sections");
expect(filesBox.y + filesBox.height).toBeLessThan(wordsBox.y);
const [paths, accepted] = await Promise.all([filesList.boundingBox(), words.getByRole("listbox").boundingBox()]);
if (!paths || !accepted) throw new Error("Missing dictionary lists");
expect(paths.width).toBeCloseTo(accepted.width, 0);
if (width === 1120) expect(paths.width).toBeGreaterThan(480);
await expect(project).toBeInViewport({ ratio: 1 });
await expect(application).toBeInViewport({ ratio: 1 });
}
await files.getByRole("button", { name: "Add", exact: true }).click();
await files.getByRole("textbox", { name: "Dictionary path" }).fill("dictionaries/team.dic");
await files.getByRole("textbox", { name: "Dictionary path" }).press("Enter");
await expect(filesList.getByRole("option", { name: "dictionaries/team.dic" })).toBeVisible();
await expect(project).toHaveAttribute("aria-selected", "true");
await words.getByRole("button", { name: "Add", exact: true }).click();
await words.getByRole("textbox", { name: "Word", exact: true }).fill("checkoutable");
await words.getByRole("textbox", { name: "Word", exact: true }).press("Enter");
await project.press("ArrowRight");
await expect(application).toHaveAttribute("aria-selected", "true");
await expect(words.getByRole("option", { name: "checkoutable" })).toHaveCount(0);
await words.getByRole("button", { name: "Add", exact: true }).click();
await words.getByRole("textbox", { name: "Word", exact: true }).fill("worktree");
await words.getByRole("textbox", { name: "Word", exact: true }).press("Enter");
await project.click();
await expect(words.getByRole("option", { name: "checkoutable" })).toBeVisible();
await expect(words.getByRole("option", { name: "worktree" })).toHaveCount(0);
expect(await ipcCalls(page, "settings_set")).toEqual([]);
await settings.getByRole("button", { name: "Apply", exact: true }).click();
await expect
.poll(async () => (await ipcCalls(page, "settings_set")).sort((a, b) => String(a.key).localeCompare(String(b.key))))
.toEqual([
{ scope: "global", key: "spelling.customDictionaries", value: JSON.stringify(["dictionaries/team.dic"]) },
{ scope: "global", key: "spelling.ideWords", value: JSON.stringify(["worktree"]) },
{ scope: "project", key: "spelling.projectWords", value: JSON.stringify(["checkoutable"]) },
]);
await settings.getByRole("button", { name: "Cancel", exact: true }).click();
await page.evaluate(async () => {
const actionModule = "/src/platform/actions.ts";
const { executeAction } = await import(/* @vite-ignore */ actionModule);
await executeAction("file.newProjectsSettings", "editor.naturalLanguages.spelling");
});
const defaults = page.getByRole("dialog", { name: "Settings for New Projects", exact: true });
await expect(defaults.getByRole("listbox", { name: "Application dictionary", exact: true })).toBeVisible();
await expect(defaults.getByRole("tablist", { name: "Accepted words" })).toHaveCount(0);
await expect(defaults.getByRole("listbox", { name: "Project dictionary", exact: true })).toHaveCount(0);
});
+92
Переглянути файл
@@ -0,0 +1,92 @@
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
test("Terminal settings keep shell controls and font groups readable as the window narrows", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1120, height: 900 });
await stubDesktop(page);
const shellPath = "C:/Program Files/Shell/bin/bash.exe";
await page.evaluate((path) => {
window.__ipc.handlers.settings_get_global = () => ({});
window.__ipc.handlers.term_default_shell = () => "/bin/zsh";
window.__ipc.handlers.term_available_shells = () => ["/bin/zsh", path];
}, shellPath);
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("Shell path");
await dialog.getByRole("treeitem", { name: "Terminal", exact: true }).click();
await search.clear();
const directory = dialog.getByRole("textbox", { name: /^Start directory:?$/ });
const shell = dialog.getByRole("textbox", { name: /^Shell path:?$/ });
const tab = dialog.getByRole("textbox", { name: /^Default Tab name:?$/ });
const shells = dialog.getByRole("button", { name: "Installed Shells", exact: true });
const browse = dialog.getByRole("button", { name: "Browse", exact: true });
const font = dialog.getByRole("combobox", { name: "Terminal font", exact: true });
const fallback = dialog.getByRole("combobox", { name: "Terminal fallback font", exact: true });
const size = dialog.getByRole("textbox", { name: "Terminal font size", exact: true });
const lineHeight = dialog.getByRole("textbox", { name: "Terminal line height", exact: true });
const column = dialog.getByRole("textbox", { name: "Terminal column width", exact: true });
const bell = dialog.getByRole("checkbox", { name: "Audible bell", exact: true });
const shortcuts = dialog.getByRole("checkbox", { name: "Override IDE shortcuts", exact: true });
await expect(shell).toHaveAttribute("placeholder", "/bin/zsh");
for (const width of [1120, 580, 520]) {
await page.setViewportSize({ width, height: 900 });
await shell.scrollIntoViewIfNeeded();
await expect(shells).toBeInViewport({ ratio: 1 });
await expect(browse).toBeInViewport({ ratio: 1 });
const [dir, command, name, menu, chooseFile, main, secondary, fontSize, line, col, left, right] = await Promise.all(
[directory, shell, tab, shells, browse, font, fallback, size, lineHeight, column, bell, shortcuts].map(
(control) => control.boundingBox(),
),
);
if (
!dir ||
!command ||
!name ||
!menu ||
!chooseFile ||
!main ||
!secondary ||
!fontSize ||
!line ||
!col ||
!left ||
!right
)
throw new Error("Missing Terminal settings bounds");
expect(command.y + command.height / 2).toBeCloseTo(menu.y + menu.height / 2, 0);
expect(menu.y).toBeCloseTo(chooseFile.y, 0);
expect(command.width).toBeGreaterThan(100);
expect(command.x).toBeCloseTo(name.x, 0);
expect(chooseFile.x + chooseFile.width).toBeCloseTo(name.x + name.width, 0);
expect(dir.x + dir.width).toBeCloseTo(name.x + name.width, 0);
expect(main.y).toBeLessThan(command.y);
if (width === 1120) {
expect(main.y).toBeCloseTo(secondary.y, 0);
expect(fontSize.y).toBeCloseTo(line.y, 0);
expect(fontSize.y).toBeCloseTo(col.y, 0);
expect(right.x).toBeGreaterThan(left.x);
} else {
expect(command.x).toBeCloseTo(dir.x, 0);
expect(secondary.y).toBeGreaterThan(main.y);
expect(right.x).toBeCloseTo(left.x, 0);
expect(right.y).toBeGreaterThan(left.y);
}
}
await shells.click();
await page.getByRole("menuitemcheckbox", { name: shellPath, exact: true }).click();
await expect(shell).toHaveValue(`"${shellPath}"`);
await expect(font).toBeDisabled();
await dialog.getByRole("checkbox", { name: "Use editor font", exact: true }).uncheck();
await font.fill("Cascadia Mono");
await size.fill("15");
await expect(font).toHaveValue("Cascadia Mono");
await expect(size).toHaveValue("15");
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
await expect(dialog).toBeHidden();
expect(await ipcCalls(page, "settings_set")).toEqual([]);
});
+61
Переглянути файл
@@ -0,0 +1,61 @@
import { expect, test } from "./fixtures";
test("Customize Main Toolbar keeps layout actions above the groups and stacks them in a narrow window", async ({
workbench: page,
}) => {
const open = () =>
page.evaluate(async () => {
const path = "/src/platform/actions.ts";
await (await import(/* @vite-ignore */ path)).executeAction("toolbar.customize");
});
await open();
const dialog = page.getByRole("dialog", { name: "Customize Main Toolbar", exact: true });
const left = dialog.getByRole("listbox", { name: "Left group" });
const right = dialog.getByRole("listbox", { name: "Right group" });
const add = dialog.getByRole("button", { name: "Add…", exact: true });
const restore = dialog.getByRole("button", { name: "Restore Defaults", exact: true });
await expect(left).toBeFocused();
for (const width of [1120, 460]) {
await page.setViewportSize({ width, height: 620 });
await expect(async () => {
const [addBox, restoreBox, leftBox, rightBox] = await Promise.all(
[add, restore, left, right].map((el) => el.boundingBox()),
);
expect(addBox!.y + addBox!.height).toBeLessThan(leftBox!.y);
expect(restoreBox!.y).toBe(addBox!.y);
if (width === 1120) {
expect(rightBox!.y).toBe(leftBox!.y);
expect(rightBox!.x).toBeGreaterThan(leftBox!.x + leftBox!.width);
} else {
expect(rightBox!.y).toBeGreaterThan(leftBox!.y + leftBox!.height);
expect(rightBox!.width).toBe(leftBox!.width);
}
}).toPass({ timeout: 3000 });
}
const actions = dialog.getByRole("toolbar", { name: "Toolbar actions" });
const project = (group: typeof left) => group.getByRole("option", { name: "Project Widget", exact: true });
await expect(project(left)).toHaveAttribute("aria-selected", "true");
await actions.getByRole("button", { name: "Move Down" }).click();
await expect(left.getByRole("option").nth(1)).toHaveText("Project Widget");
await actions.getByRole("button", { name: "Move to Right" }).click();
await expect(project(right)).toBeVisible();
await actions.getByRole("button", { name: "Remove", exact: true }).click();
await expect(project(right)).toHaveCount(0);
await add.click();
const search = dialog.getByRole("textbox", { name: "Search actions" });
await expect(search).toBeFocused();
await search.fill("Project Widget");
const available = dialog.getByRole("listbox", { name: "Actions and widgets to add" });
await available.getByRole("option", { name: /Project Widget/ }).click();
await expect(project(right)).toBeVisible();
await expect(search).toHaveCount(0);
await restore.click();
await expect(left.getByRole("option").first()).toHaveText("Project Widget");
await expect(project(right)).toHaveCount(0);
await dialog.getByRole("button", { name: "Cancel", exact: true }).click();
await expect(dialog).toBeHidden();
});
+24 -1
Переглянути файл
@@ -39,6 +39,7 @@ for (const windowKind of ["project", "welcome", "lightEdit"]) {
test("Updates shows check status and keeps manual checks available when automatic checks are off", async ({
workbench: page,
}) => {
await page.setViewportSize({ width: 1120, height: 680 });
await page.evaluate(async () => {
const ipcPath = "/src/platform/ipc.ts";
const actionsPath = "/src/platform/actions.ts";
@@ -62,11 +63,33 @@ test("Updates shows check status and keeps manual checks available when automati
await expect(dialog.getByText("0.1.39", { exact: true })).toBeVisible();
await expect(dialog.getByText("Never", { exact: true })).toBeVisible();
const automatic = dialog.getByRole("checkbox", { name: "Check for updates automatically" });
const source = dialog.getByRole("button", { name: "Update source", exact: true });
const check = dialog.getByRole("button", { name: "Check Now", exact: true });
const checked = dialog.getByText("Never", { exact: true });
const whatsNew = dialog.getByRole("checkbox", { name: "Show What's New after an update", exact: true });
for (const width of [1120, 580, 520]) {
await page.setViewportSize({ width, height: 680 });
const [automaticBox, sourceBox, checkBox, statusBox, whatsNewBox] = await Promise.all(
[automatic, source, check, checked, whatsNew].map((item) => item.boundingBox()),
);
if (!automaticBox || !sourceBox || !checkBox || !statusBox || !whatsNewBox)
throw new Error("Missing Updates controls");
expect(checkBox.y).toBeGreaterThan(sourceBox.y + sourceBox.height);
expect(sourceBox.y).toBeGreaterThan(automaticBox.y + automaticBox.height);
expect(whatsNewBox.y).toBeGreaterThan(checkBox.y + checkBox.height);
expect(statusBox.x).toBeGreaterThan(checkBox.x + checkBox.width);
expect(Math.abs(statusBox.y + statusBox.height / 2 - checkBox.y - checkBox.height / 2)).toBeLessThan(1.5);
await expect(check).toBeInViewport({ ratio: 1 });
}
await expect(automatic).toBeChecked();
await automatic.uncheck();
await expect(source).toBeEnabled();
await source.click();
await page.getByRole("option", { name: "CNB (China mirror)", exact: true }).click();
await dialog.getByRole("button", { name: "Apply", exact: true }).click();
await expect(automatic).not.toBeChecked();
await dialog.getByRole("button", { name: "Check Now", exact: true }).click();
await expect(source).toHaveText("CNB (China mirror)");
await check.click();
await expect(page.locator("body")).toHaveAttribute("data-update-checked", "true");
});
+95
Переглянути файл
@@ -0,0 +1,95 @@
import type { Page } from "@playwright/test";
import { expect, ipcCalls, stubDesktop, test } from "./fixtures";
async function openConfirmation(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("Remove silently");
await dialog.getByRole("treeitem", { name: "Confirmation", exact: true }).click();
await search.clear();
return dialog;
}
test("VCS confirmation aligns the file policy selectors and keeps edits scoped", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1120, height: 740 });
await stubDesktop(page);
await page.evaluate(() => {
const global = { onCreate: "ask", onDelete: "ask" };
const project: Partial<typeof global> = {};
const effective = () => ({ vcs: { confirmation: { ...global, ...project } } });
const handlers = window.__ipc.handlers;
handlers.settings_get_global = () => ({ vcs: { confirmation: global } });
handlers.settings_get = effective;
handlers.settings_set = ({ scope, key, value }) => {
const policy = String(key).split(".").at(-1);
if (policy !== "onCreate" && policy !== "onDelete") throw new Error("Unexpected confirmation setting");
const layer = scope === "project" ? project : global;
layer[policy] = JSON.parse(String(value));
return effective();
};
});
const dialog = await openConfirmation(page);
const create = dialog.getByRole("button", { name: "When files are created", exact: true });
const remove = dialog.getByRole("button", { name: "When files are deleted", exact: true });
const global = dialog.getByRole("radio", { name: "Global", exact: true });
const project = dialog.getByRole("radio", { name: "This project", exact: true });
const apply = dialog.getByRole("button", { name: "Apply", exact: true });
const cancel = dialog.getByRole("button", { name: "Cancel", exact: true });
await expect(create).toHaveText("Ask");
await expect(remove).toHaveText("Ask");
for (const width of [1120, 580, 520]) {
await page.setViewportSize({ width, height: 740 });
await expect(create).toBeInViewport({ ratio: 1 });
await expect(remove).toBeInViewport({ ratio: 1 });
const [createBox, removeBox] = await Promise.all([create.boundingBox(), remove.boundingBox()]);
if (!createBox || !removeBox) throw new Error("Missing confirmation selector bounds");
expect(createBox.y).toBeLessThan(removeBox.y);
expect(createBox.x).toBeCloseTo(removeBox.x, 0);
expect(createBox.width).toBeCloseTo(removeBox.width, 0);
}
await create.press("Enter");
await expect(page.getByRole("listbox", { name: "When files are created", exact: true })).toBeVisible();
await page.keyboard.press("ArrowDown");
await page.keyboard.press("Enter");
await expect(create).toHaveText("Add silently");
await remove.click();
await page.getByRole("option", { name: "Remove silently", exact: true }).click();
await expect(remove).toHaveText("Remove silently");
await project.click();
await create.click();
await page.getByRole("option", { name: "Do not add", exact: true }).click();
await remove.click();
await page.getByRole("option", { name: "Do not remove", exact: true }).click();
await expect(create).toHaveText("Do not add");
await expect(remove).toHaveText("Do not remove");
await global.click();
await expect(create).toHaveText("Add silently");
await expect(remove).toHaveText("Remove silently");
expect(await ipcCalls(page, "settings_set")).toEqual([]);
await apply.click();
await expect(apply).toBeDisabled();
expect(await ipcCalls(page, "settings_set")).toEqual([
{ scope: "global", key: "vcs.confirmation.onCreate", value: '"silently"' },
{ scope: "global", key: "vcs.confirmation.onDelete", value: '"silently"' },
{ scope: "project", key: "vcs.confirmation.onCreate", value: '"never"' },
{ scope: "project", key: "vcs.confirmation.onDelete", value: '"never"' },
]);
await cancel.click();
await openConfirmation(page);
await global.click();
await expect(create).toHaveText("Add silently");
await expect(remove).toHaveText("Remove silently");
await project.click();
await expect(create).toHaveText("Do not add");
await expect(remove).toHaveText("Do not remove");
await remove.click();
await page.getByRole("option", { name: "Ask", exact: true }).click();
await cancel.click();
await openConfirmation(page);
await project.click();
await expect(remove).toHaveText("Do not remove");
});
+67
Переглянути файл
@@ -0,0 +1,67 @@
import { expect, openFromTree, test } from "./fixtures";
test("VCS Operations keeps its centered title visible in a short window", async ({ workbench: page }) => {
await page.setViewportSize({ width: 640, height: 320 });
const editor = await openFromTree(page, "README.md");
const content = editor.locator(".cm-content");
await content.focus();
await page.evaluate(async () => {
const actions = "/src/platform/actions.ts";
await (await import(/* @vite-ignore */ actions)).executeAction("vcs.operations");
});
const menu = page.getByRole("menu", { name: "VCS Operations", exact: true });
const popup = menu.locator("..");
const title = popup.getByText("VCS Operations", { exact: true });
await expect(title).toHaveCSS("font-size", "13px");
await expect(title).toHaveCSS("font-weight", "600");
await expect
.poll(async () => {
const box = (await popup.boundingBox())!;
return Math.max(Math.abs(box.x + box.width / 2 - 320), Math.abs(box.y + box.height / 2 - 160));
})
.toBeLessThan(2);
const commit = menu.getByRole("menuitem", { name: /^Commit…/ });
await expect(commit).toBeFocused();
await expect(commit.locator('[data-menu-number="1"]')).toBeVisible();
await page.keyboard.press("End");
const history = menu.getByRole("menuitem", { name: /^Show Local History/ });
await expect(history).toBeFocused();
await expect(history).toBeInViewport({ ratio: 1 });
await expect.poll(() => popup.evaluate((el) => el.scrollTop)).toBeGreaterThan(0);
expect((await title.boundingBox())!.y).toBeGreaterThanOrEqual((await popup.boundingBox())!.y);
await page.keyboard.press("Escape");
await expect(menu).toBeHidden();
await expect(content).toBeFocused();
await page.evaluate(async () => {
const actions = "/src/platform/actions.ts";
await (await import(/* @vite-ignore */ actions)).executeAction("vcs.operations");
});
await expect(commit).toBeFocused();
await page.keyboard.press("1");
await expect(menu).toBeHidden();
const commitWindow = page.getByRole("region", { name: "Commit", exact: true });
await expect(commitWindow).toBeVisible();
const message = commitWindow.getByRole("textbox", { name: "Commit message" });
await expect(message).toBeFocused();
expect(await message.evaluate((el) => (el instanceof HTMLTextAreaElement ? el.value : el.textContent))).toBe("");
});
test("VCS Operations offers repository setup and Local History outside Git", async ({ workbench: page }) => {
const editor = await openFromTree(page, "README.md");
await editor.locator(".cm-content").focus();
await page.evaluate(async () => {
const project = "/src/platform/project.ts";
const { useProject } = await import(/* @vite-ignore */ project);
useProject.setState((s: { project: object }) => ({ project: { ...s.project, isGit: false } }));
const context = "/src/platform/context.ts";
(await import(/* @vite-ignore */ context)).setContext("vcsAvailable", false);
const actions = "/src/platform/actions.ts";
await (await import(/* @vite-ignore */ actions)).executeAction("vcs.operations");
});
const menu = page.getByRole("menu", { name: "VCS Operations", exact: true });
await expect(menu.getByRole("menuitem")).toHaveText([/Create Git Repository…/, /Show Local History/]);
await expect(menu.getByRole("menuitem", { name: /^Create Git Repository…/ })).toBeFocused();
});
+10 -4
Переглянути файл
@@ -772,7 +772,7 @@ then run `openidea-plugin check`.
| `host::mcp_stdio_command()` | `mcp.stdio-command` | API 1.4: invoking project bridge argv, `None` while off. No URL/token. |
| `McpProvider::call(tool, arguments, ctx)` | export `mcp-provider.call` | API 1.4: declared tools under plugin grants and command budget. See _Plugin MCP tools_. |
| `host::open_editors()` | `editor.open-editors` | API 1.4: invoking window's path/language/dirty/active snapshots; requires `editor.read`. Commands/events of a window only. |
| `host::open_editor(path, selection)` | `editor.open` | API 1.4: open/select a project file (`project.read`) or plugin-dir file; same path rules as `views.open-location`. Commands/events of a window only. |
| `host::open_editor(path, selection)` | `editor.open` | API 1.4: open/select a project file (`project.read`), plugin-dir file, or install-directory file (read-only); same path rules as `views.open-location`. Commands/events of a window only. |
| `TextEditor::set_selections(ranges)`, `reveal(range)` | `editor.text-editor` | API 1.4: selections or scrolling in this window's already open editor; no capability. Commands/events only, UTF-16 coordinates. |
| `host::set_decorations`, `clear_decorations` | `decorations.{set,clear}` | API 1.4: project-scoped editor annotations cleared on plugin stop. Requires `project.read`. |
| `host::set_file_decoration`, `clear_file_decorations` | `decorations.{set-file,clear-file}` | API 1.4: project-tree badges/styles. Requires `project.read`. |
@@ -1878,15 +1878,21 @@ leaves out a field type it doesn't know.
Showing a view activates the plugin (`on-view:<id>`). `views` become tool
windows; a `customEditors` file (`priority = "default"`) opens in the
plugin's editor, or through _Open With_ for `option`. For a custom editor
`ctx.editor()` is its document: read it with `document()` and change it with
`apply_edits(version, …)` — the text editor of the same file follows,
plugin's editor (ahead of **Settings › Editor › File Types › Files opened in
associated applications**), or through _Open With_ for `option`. For a custom
editor `ctx.editor()` is its document: read it with `document()` and change it
with `apply_edits(version, …)` — the text editor of the same file follows,
Undo / Redo are one history with it, and Save, the dirty mark and the close
prompts are the document's. _Open as Text_ opens the text editor. For a
tool window `ctx.editor()` is the window's active text editor, as for a
command, so a view's buttons can act on what the user is editing (a click in
the tool window doesn't change which editor that is).
`editor.open` / `open_location` and `fs.read-*` may use absolute paths under the
plugin's install directory (the package folder) read-only, without `project.read`
— the same as `fs.plugin-dir()`. Writing the install directory still needs an
`fs.write:` grant.
API 1.3 adds optional `group`, `when` and `secondary` fields to `[[contributes.views]]`;
using any of them requires `engines.openidea = "^1.3"`. `secondary = true`
places a `left`, `right` or `bottom` tool window in the secondary split of its
+1 -1
Переглянути файл
@@ -1 +1 @@
dd2064150ef1e9a70c4f7c33e8f4396f131db951d9818eab5f854a7e9ce71e11
082de817ea3f4ac93211e9a7037fff343273dba95614e3e3e47b81d8b5e76dcd
+1 -1
Переглянути файл
@@ -1 +1 @@
d7233de85619c0a9479f4d6fbd87bc6105b9f72b7daacf701f2e1212a01b2768
798d887c3e402e7b0a5b294bd02ccf5e32dbfd36e2c6d5c7112ebb3293a7f2be
+1 -1
Переглянути файл
@@ -1 +1 @@
396b7103d40247c6d1b489d0003a934374f27d9dffb9bcb33e7ae2811829ac31
ecbbea952492daa420edac41df6c00b0a047a3305b3bb01efa343d74995877fa
+1 -1
Переглянути файл
@@ -1 +1 @@
2324da549433c9c88d67cfae6a0207716c5a61e41bb06648cc3b233a5fb7a41a
ea26a7799501388a86943cd24bb688b4c505ae0c4e0a260192bacc0783a054fb
+1 -1
Переглянути файл
@@ -1 +1 @@
8cd17db5f028d4c211f00af52ebc4408e0dd41d75f20e7cc5a6dcaec0b888c89
71a2d22e152e9d8847ba5bef1c502503f97aa618a1f22ce5e611ee764c83581c
+1 -1
Переглянути файл
@@ -1 +1 @@
862dfc0bbaa9ecb954727ba5586e083d6ae0aeae4f71af54df0675f3d8a2db29
3529ef0977449831af11617b33d9f5164b237369abd525680eaa9671fa687e6d
+1 -1
Переглянути файл
@@ -1 +1 @@
c84b047226c6bed4ba0a0c851e16a37813945eb46fd4a5028c97a64d2a81411d
dcc8a85683452b2f15048e61d8968bb23e8ebe82cea6e150fad47f98ce0e35c7
+1 -1
Переглянути файл
@@ -1 +1 @@
400458a210f3d794787dece4d5c178bddf7af04a9bca141fa574d532ab669bc0
5ada04c6b22c23c745dc4c4b2a3af322a4d3578116eb8cb034c996a32d02426d
+1 -1
Переглянути файл
@@ -1 +1 @@
a1aa1d621b40c30b1252a7506a8c74e1eabd90abd40fff5a7b04028c7ac6811e
9627276127b128e59f92589bffafb539230d3ef13cbabd28858b26f7d3dcf029
+1 -1
Переглянути файл
@@ -1 +1 @@
841c9840b33a780ee29e04cf4fa79ed4dd7b30d428d3b90841fcd7eb059223ba
7bf9377c6ac97f40b34b688e8760a21be4a61ac85f7270f67915a5bbb6d624fe
+1 -1
Переглянути файл
@@ -1 +1 @@
31394076ed408e043633604e5ae46b519d259d3317b849f8a0f1d774935815ad
c9eae6e19847a92f7a6be9d2dc82c04accf815184f4e3bed4662f765840c58a6
+1 -1
Переглянути файл
@@ -1 +1 @@
1d5d4bb8502dec07b7ec420d57f627ffdb4f7126b6a5e5d2bcda77e222a8a680
747d70f0e3880a83c74ad8ca0de57ab2383fbbdd25113a8d16dfbec038579fa5
+1 -1
Переглянути файл
@@ -1 +1 @@
939e477e32de648ed96d634f040be546207504ea2d58a14cc480a0038f1f5c46
6de0fb69a58fa5bd45ed623d8095495aaff448b352a5d58ea07c006907f96e12
+1 -1
Переглянути файл
@@ -1 +1 @@
aa71bdd8d76b43cc103e61b870504ab4ebab9f4235b84736a8a63e26a962d527
7e3d939e2b1832abec8965cdc97a12faa045fe0b9ade21a9e13561881b8bbec2
Loaded 100 of 227 files, more files were not shown because too many files have changed in this diff. Show more