chatRequestParser.ts ×6

Frontier kind: Code frontier

unlabeled · c_19970317f644

32 tests · 41564 LOC · 185 files · introduces 0 tests · 17 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges17 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3780 ranges41564 lines · 185 files · Browse complete extent
All tests (intent)
32 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: 17 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/requestParser/chatRequestParser.ts 17 introduced LOC · 6 ranges

Open complete file

74 newPart = this.tryToParseAgent(message.slice(i), message, i, new Position(lineNumber, column), parts, location, context);
75 } else if (char === chatSubcommandLeader) {
76 > newPart = this.tryToParseSlashCommand(message.slice(i), message, i, new Position(lineNumber, column), parts, location, context); chatRequestParser.ts
77 > }
78
79 if (!newPart) {
197
198 private tryToParseSlashCommand(remainingMessage: string, fullMessage: string, offset: number, position: IPosition, parts: ReadonlyArray<IParsedChatRequestPart>, location: ChatAgentLocation, context?: IChatParserContext): ChatRequestSlashCommandPart | ChatRequestAgentSubcommandPart | ChatRequestSlashPromptPart | undefined {
199 > const nextSlashMatch = remainingMessage.match(slashReg); chatRequestParser.ts
200 > if (!nextSlashMatch) {
201 return;
202 }
209 // only whitespace after the last part
210 const previousPart = parts.at(-1);
211 > const previousPartEnd = previousPart?.range.endExclusive ?? 0; chatRequestParser.ts
212 > const textSincePreviousPart = fullMessage.slice(previousPartEnd, offset);
213 > if (textSincePreviousPart.trim() !== '') {
214 return;
215 }
221 const usedAgent = parts.find((p): p is ChatRequestAgentPart => p instanceof ChatRequestAgentPart)?.agent ??
222 (context?.forcedAgent ? context.forcedAgent : undefined);
223 > if (usedAgent) { chatRequestParser.ts
224 const subCommand = usedAgent.slashCommands.find(c => c.name === command);
225 if (subCommand) {
229 }
230
231 > const capabilities = context?.attachmentCapabilities ?? usedAgent?.capabilities; chatRequestParser.ts
232 > const slashCommands = this.slashCommandService.getCommands(location, context?.mode ?? ChatModeKind.Ask);
233 > const slashCommand = slashCommands.find(c => c.command === command && matchesSessionType(c.sessionTypes, context?.sessionType));
234 > // If there is no agent, we allow any slash command.
235 > // If there is an agent, we let
236 > // * silent ones go through since they are only UI-facing and don't influence chat history
237 > // * slash commands that support prompt attachments, since those are meant to be used in conjunction with an agent and we can assume the agent can handle them.
238 > if (!usedAgent || slashCommand?.silent || capabilities?.supportsPromptAttachments) {
239 if (slashCommand) {
240 // Valid standalone slash command
275 }
276 return;
278
279 private tryToParseDynamicVariable(message: string, offset: number, position: IPosition, references: ReadonlyArray<IDynamicVariable>): ChatRequestDynamicVariablePart | undefined {