M2.4: Find tool window in a new bottom panel

- Bottom panel under editor and project tree (resizable, collapsible,
  closable) for Find and later tool windows.
- Find store: search.find with options and include/exclude globs, results
  streamed and sorted by file, events held until the searchId answer, a
  new search cancels the running one, refused queries shown in place.
- Find tool window: toggles, counts, cancel, truncated hint, highlighted
  previews, keyboard navigation, Enter or click runs editor.reveal.
- UI command find.open (Mod+Alt+F) with prefill from the selection or the
  word at the cursor; find.open {query} from agents searches at once.
- 26 Vitest tests; progress docs and architecture updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-17 12:42:53 +02:00
parent 864a468b34
commit 097bbd9409
16 changed files with 1923 additions and 25 deletions

View file

@ -1,41 +1,60 @@
<script setup lang="ts">
/**
* Layout of the main window: the Project tool window on the left, the
* editor area in the middle and the status bar along the bottom.
* editor area in the middle, the bottom panel under both (M2.4) and the
* status bar along the bottom.
*
* The editor area is a slot so the editor (M1.6) can replace the
* placeholder without touching the layout. The layout supplies the UI
* command `view.toggleProjectTree` (`Mod+1`), which shows or hides the
* Project tool window.
*
* The bottom panel ({@link BottomPanel}) holds the Find tool window. It
* appears with the UI command `find.open` (`Mod+Alt+F`, supplied here so it
* works before the panel exists), collapses to its header and closes from
* its header; the Find store keeps the results while it is closed.
*/
import { onBeforeUnmount, onMounted, ref } from "vue";
import { useCommandsStore } from "../../commands/store";
import { t } from "../../i18n";
import { useFindStore } from "../../stores/find";
import FindToolWindow from "../find/FindToolWindow.vue";
import ProjectToolWindow from "../project/ProjectToolWindow.vue";
import StatusBar from "../StatusBar.vue";
import BottomPanel from "./BottomPanel.vue";
import ToolWindow from "./ToolWindow.vue";
/** Width of the left tool window in CSS pixels. */
const leftWidth = ref(260);
/** Whether the left tool window is shown. */
const leftOpen = ref(true);
/** Height of the bottom panel's content in CSS pixels. */
const bottomHeight = ref(240);
const commands = useCommandsStore();
const find = useFindStore();
/** Withdraws the command handler; set while mounted. */
let withdraw: (() => void) | null = null;
/** Withdraws the command handlers; filled while mounted. */
let withdraw: (() => void)[] = [];
onMounted(() => {
withdraw = commands.provide("view.toggleProjectTree", {
run: () => {
leftOpen.value = !leftOpen.value;
},
});
find.start();
withdraw = [
commands.provide("view.toggleProjectTree", {
run: () => {
leftOpen.value = !leftOpen.value;
},
}),
commands.provide("find.open", { run: (params) => find.open(params) }),
];
});
onBeforeUnmount(() => {
withdraw?.();
withdraw = null;
for (const fn of withdraw) {
fn();
}
withdraw = [];
find.stop();
});
</script>
@ -56,6 +75,15 @@ onBeforeUnmount(() => {
<slot />
</main>
</div>
<BottomPanel
v-if="find.visible"
v-model:height="bottomHeight"
v-model:open="find.expanded"
:title="t('find.toolWindow.title')"
@close="find.hide()"
>
<FindToolWindow />
</BottomPanel>
<StatusBar />
</div>
</template>