chatSlashCommands.ts ×6

Frontier kind: Code frontier

unlabeled · c_ecb37a962f99

3 tests · 69932 LOC · 309 files · introduces 0 tests · 19 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges19 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5613 ranges69932 lines · 309 files · Browse complete extent
All tests (intent)
3 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: 19 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.ts 19 introduced LOC · 6 ranges

Open complete file

95
96 private getSessionScopedCommands(id: string): RegisteredSlashCommand[] {
97 > return this._commands.get(id) ?? []; chatSlashCommands.ts
98 > }
99
100 private commandsOverlap(dataA: IChatSlashData, dataB: IChatSlashData): boolean {
101 > if (dataA.sessionTypes === undefined || dataB.sessionTypes === undefined) { chatSlashCommands.ts
102 return true;
103 }
104
105 return dataA.sessionTypes.some(sessionType => dataB.sessionTypes?.includes(sessionType));
107
108 private getCommand(id: string, sessionType: string | undefined): RegisteredSlashCommand | undefined {
111
112 registerSlashCommand(data: IChatSlashData, command: IChatSlashCallback): IDisposable {
113 > const commandsForId = this.getSessionScopedCommands(data.command); chatSlashCommands.ts
114 > if (commandsForId.some(candidate => this.commandsOverlap(candidate.data, data))) {
115 throw new Error(`Already registered a command with id ${data.command}`);
116 }
118 > const entry = { data, command };
119 > commandsForId.push(entry);
120 > this._commands.set(data.command, commandsForId);
121 > this._onDidChangeCommands.fire();
122 >
123 > return toDisposable(() => {
124 > const commandsForId = this._commands.get(data.command);
125 > if (!commandsForId) {
126 > return;
127 > }
128
129 const entryIndex = commandsForId.indexOf(entry);
138
139 this._onDidChangeCommands.fire();
141 > }
142
143 getCommands(location: ChatAgentLocation, mode: ChatModeKind): Array<IChatSlashData> {