copilotSlashCommandProvider.ts ×12

Frontier kind: Code frontier

unlabeled · c_1e3a046e354c

10 tests · 43699 LOC · 243 files · introduces 0 tests · 37 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges37 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3990 ranges43699 lines · 243 files · Browse complete extent
All tests (intent)
10 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 37 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/copilot/copilotSlashCommandProvider.ts 37 introduced LOC · 12 ranges

Open complete file

40
41 public async resolveSlashCommand(command: string, maxWaitMs: number | undefined = undefined): Promise<RuntimeSlashCommandInfo | undefined> {
42 > const key = this._normalizeSlashCommandKey(command); copilotSlashCommandProvider.ts
43 > if (!key) {
44 return undefined;
45 }
46 > const catalog = await this._getRuntimeSlashCommandCatalog(maxWaitMs); copilotSlashCommandProvider.ts
47 > return catalog.byName.get(key) ?? catalog.byAlias.get(key);
48 > }
49
50 public clearCache(): void {
56
57 private async _getRuntimeSlashCommandCatalog(maxWaitMs: number | undefined = undefined): Promise<RuntimeSlashCommandCatalog> {
58 > const cache = this._runtimeSlashCommandCache ??= {}; copilotSlashCommandProvider.ts
59 > if (cache.value) {
60 return cache.value;
61 }
63 > const inFlight = this._refreshRuntimeSlashCommandCatalog(cache);
64 > if (maxWaitMs === undefined) {
65 > return inFlight;
66 > }
67 const settled = await raceTimeout(inFlight, maxWaitMs);
68 if (settled) {
77 byAlias: new Map(),
78 };
80
81 private async _refreshRuntimeSlashCommandCatalog(cache: RuntimeSlashCommandCache): Promise<RuntimeSlashCommandCatalog> {
82 > if (cache.inFlight) { copilotSlashCommandProvider.ts
83 return cache.inFlight;
84 }
85 > const inFlight = this.listCommands() copilotSlashCommandProvider.ts
86 > .then(result => this._toRuntimeSlashCommandCatalog(result));
87 > cache.inFlight = inFlight;
88 > inFlight.then(catalog => {
89 > if (this._runtimeSlashCommandCache === cache) {
90 > cache.value = catalog;
91 > cache.inFlight = undefined;
92 > }
93 > }, () => {
94 if (this._runtimeSlashCommandCache === cache) {
95 cache.inFlight = undefined;
98 }
99 }
101 > return inFlight;
102 > }
103
104 private _toRuntimeSlashCommandCatalog(commands: readonly RuntimeSlashCommandInfo[]): RuntimeSlashCommandCatalog {
105 > const byName = new Map<string, RuntimeSlashCommandInfo>(); copilotSlashCommandProvider.ts
106 > const byAlias = new Map<string, RuntimeSlashCommandInfo>();
107 > const deduped: RuntimeSlashCommandInfo[] = [];
108 > for (const command of commands) {
109 const nameKey = this._normalizeSlashCommandKey(command.name);
110 if (!nameKey) {
125 }
126 }
127 > return { commands: deduped, byName, byAlias }; copilotSlashCommandProvider.ts
128 > }
129
130 private _normalizeSlashCommandKey(command: string): string | undefined {
131 > const trimmed = command.trim(); copilotSlashCommandProvider.ts
132 > if (!trimmed) {
133 return undefined;
134 }
135 > const slashStripped = trimmed.charCodeAt(0) === 0x2f /* / */ ? trimmed.slice(1) : trimmed; copilotSlashCommandProvider.ts
136 > return slashStripped.toLowerCase();
137 > }
138 }