Files
openidea/src/workbench/stopBackground.test.ts
T
l0ng-ai 0c9c51b0f5 feat(editor): Add folding, navigation, editing and window shortcuts (#153)
Editing and folding
- Move Caret to Code Block Start / End with Selection, Auto-Indent Lines,
  Move Element Left / Right (swaps call arguments, parameters and list
  entries).
- Fold Code Block folds the {...} block around the caret; Expand to Level
  and Expand All to Level 1-5.
- Custom folding regions (//region, #region, <editor-fold>) fold to their
  description; Navigate > Custom Folding lists them.
- Error Description shows the problems at the caret; Next / Previous
  Highlighted Usage steps through usage highlights.
- Editor tooltips stay below the editor's top edge, so hints on the first
  lines no longer hide under the tab bar.

Navigation, project and run
- Navigate > File Path lists the file and its folders to reveal in the file
  manager.
- Copy... (F5) opens the Copy dialog for the selection or the open file; the
  project view's Refactor submenu gets Copy File.
- Debug... chooses a configuration to debug; Quick Evaluate Expression shows
  the selection's value in an expandable hint.
- Inspect Current File runs the inspection without the scope dialog.
- Surround with Live Template lists only $SELECTION$ templates; Java gets
  Callable, read / write lock and iterate templates.

Windows
- Stretch the active tool window left / right / up / down, Restore Default
  Layout, Go to Next / Previous Splitter, Close Active Tab on a second key,
  Stop Background Processes.

All actions have default shortcuts in both keymaps, VS Code preset entries,
main menu items and Chinese translations.

Project view and Keymap settings
- Project view Options: Sort by Name / Type / Modification Time (also in
  Find Action).
- Settings > Keymap: Add Mouse Shortcut records a side-button click with
  modifiers and checks conflicts like keyboard shortcuts.
- Folding: Expand to Level / Expand All to Level 1-5.
2026-10-29 00:39:37 +08:00

27 lines
753 B
TypeScript

import { afterEach, describe, expect, it, vi } from "vitest";
import { useTasks } from "./tasks";
import { stopBackgroundProcesses } from "./shellActions";
const task = (id: number, cancel?: () => void, done = false) => ({
id,
title: `Task ${id}`,
message: null,
fraction: null,
done,
startedAt: 0,
cancel,
});
afterEach(() => useTasks.setState({ tasks: [] }));
describe("stopBackgroundProcesses", () => {
it("stops the only running cancellable task", () => {
const cancel = vi.fn();
const finished = vi.fn();
useTasks.setState({ tasks: [task(1, cancel), task(2), task(3, finished, true)] });
stopBackgroundProcesses();
expect(cancel).toHaveBeenCalledOnce();
expect(finished).not.toHaveBeenCalled();
});
});