diff --git a/src/features/search/__tests__/everywhereModel.test.ts b/src/features/search/__tests__/everywhereModel.test.ts index be116b345e..cf9e8ee901 100644 --- a/src/features/search/__tests__/everywhereModel.test.ts +++ b/src/features/search/__tests__/everywhereModel.test.ts @@ -394,6 +394,7 @@ describe("parseCommand", () => { "/classes", "/files", "/symbols", + "/endpoints", "/actions", "/text", ]); diff --git a/src/features/search/__tests__/searchCategoryActions.test.ts b/src/features/search/__tests__/searchCategoryActions.test.ts index d5eba925eb..ae17046037 100644 --- a/src/features/search/__tests__/searchCategoryActions.test.ts +++ b/src/features/search/__tests__/searchCategoryActions.test.ts @@ -47,3 +47,10 @@ describe("plugin search categories", () => { expect(getAction("navigate.searchEverywhere")).toBeDefined(); }); }); + +describe("Go to Endpoint", () => { + it("opens Search Everywhere on the indexed request mappings", async () => { + await executeAction("navigate.gotoEndpoint"); + expect(useSearchEverywhere.getState()).toMatchObject({ open: true, tab: "endpoints" }); + }); +}); diff --git a/src/features/search/everywhere/model.ts b/src/features/search/everywhere/model.ts index 58c363ccef..f65c907b21 100644 --- a/src/features/search/everywhere/model.ts +++ b/src/features/search/everywhere/model.ts @@ -10,7 +10,7 @@ import { basename, isTypeKind, relDir, symbolDisplayName } from "../common/open" import { byScore, matchText } from "../common/rank"; import { wordMatch } from "@/ui"; -export type SeTab = "all" | "classes" | "files" | "symbols" | "actions" | "text" | SearchCategoryId; +export type SeTab = "all" | "classes" | "files" | "symbols" | "endpoints" | "actions" | "text" | SearchCategoryId; export const isCustomTab = (tab: string): tab is SearchCategoryId => tab.startsWith("plugin:"); export function searchTabs(): ReadonlyArray<{ id: SeTab; label: string }> { return [...TABS, ...searchCategories().map((c) => ({ id: c.id, label: c.title }))]; @@ -34,6 +34,7 @@ export const TABS: ReadonlyArray<{ id: SeTab; label: string }> = [ { id: "classes", label: "Classes" }, { id: "files", label: "Files" }, { id: "symbols", label: "Symbols" }, + { id: "endpoints", label: "Endpoints" }, { id: "actions", label: "Actions" }, { id: "text", label: "Text" }, ]; diff --git a/src/features/search/index.ts b/src/features/search/index.ts index 05da518414..4d9e98f835 100644 --- a/src/features/search/index.ts +++ b/src/features/search/index.ts @@ -377,6 +377,16 @@ export function activate(): void | (() => void) { when: "projectOpen", run: se("symbols"), }, + { + // The request mappings the IDE indexed (Search Everywhere's Endpoints): type a URL, open its + // handler. No default shortcut; RestfulToolkit users bind `Ctrl+\` in Settings › Keymap. + id: "navigate.gotoEndpoint", + title: "Go to Endpoint…", + category: "Navigate", + keywords: ["url", "route", "request mapping", "service url"], + when: "projectOpen", + run: se("endpoints"), + }, { id: "navigate.findAction", title: "Find Action…", diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json index c03786e99d..7f63cfb213 100644 --- a/src/platform/locales/text/zh.json +++ b/src/platform/locales/text/zh.json @@ -455,6 +455,7 @@ "Also show the other platform's shortcut": "同时显示另一平台的快捷键", "macOS shortcuts on Windows and Linux, Windows/Linux shortcuts on macOS.": "在 Windows 和 Linux 上显示 macOS 快捷键,在 macOS 上显示 Windows/Linux 快捷键。", "Trust Project in Codex": "在 Codex 中信任项目", + "Go to Endpoint…": "转到端点…", "Go to Feign Endpoint": "跳转到 Feign 端点", "Find Feign Clients": "查找 Feign 客户端", "Feign Clients": "Feign 客户端",