agentHostSlashCompletion.ts ×4

Frontier kind: Code frontier

unlabeled · c_60a0c3f052c0

765 tests · 14041 LOC · 55 files · introduces 0 tests · 39 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
4 ranges39 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1332 ranges14041 lines · 55 files · Browse complete extent
All tests (intent)
765 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: 39 introduced LOC across 4 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentHostSlashCompletion.ts 39 introduced LOC · 4 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- agentHostSlashCompletion.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { matchesFuzzy2 } from '../../../base/common/filters.js';
7 >
8 > /**
9 > * A leading slash token in a user-message input.
10 > */
11 > export interface ILeadingSlashToken {
12 > /** The token including the leading slash. */
13 > readonly token: string;
14 > /** The typed token text after the slash. */
15 > readonly typed: string;
16 > /** The start offset of the token range to replace. */
17 > readonly rangeStart: number;
18 > /** The end offset of the token range to replace. */
19 > readonly rangeEnd: number;
20 > }
21 >
22 > /**
23 > * Extracts the leading `/word` token from the input, where the token is the
24 > * run of non-whitespace characters starting at offset 0. Returns `undefined`
25 > * if the input does not start with `/` or the cursor is past the token.
26 > */
27 > export function extractLeadingSlashToken(text: string, offset: number): ILeadingSlashToken | undefined {
28 if (text.length === 0 || text.charCodeAt(0) !== 0x2f /* / */) {
29 return undefined;
42 return { token, typed: token.slice(1), rangeStart: 0, rangeEnd: end };
43 }
45 > /**
46 > * Extracts the slash token containing the cursor when the slash is either at
47 > * the start of the input or immediately follows whitespace.
48 > */
49 > export function extractWhitespaceDelimitedSlashToken(text: string, offset: number): ILeadingSlashToken | undefined {
50 if (text.length === 0 || offset < 0 || offset > text.length) {
51 return undefined;
71 return { token, typed: token.slice(1), rangeStart: start, rangeEnd: end };
72 }
74 > /**
75 > * Tests whether a slash completion name fuzzy matches the typed token text.
76 > */
77 > export function matchesSlashCompletion(typed: string, name: string): boolean {
78 if (typed.length === 0 || name.toLowerCase().startsWith(typed.toLowerCase())) {
79 return true;
81 return typed.length > 1 && matchesFuzzy2(typed, name) !== null;
82 }
84 function isSlashTokenWhitespace(ch: number): boolean {
85 return ch === 0x20 /* space */ || ch === 0x09 /* tab */ || ch === 0x0a /* \n */ || ch === 0x0d /* \r */;