import type { RangeData } from '../common/range'; import { type ContextMentionProviderID, type ContextMentionProviderMetadata } from './api'; /** * The parsed representation of a user's (partial or complete) input of an @-mention query. */ export interface MentionQuery { /** * The type of context item to search for, or null to find suggested items across (possibly) all * providers. */ provider: ContextMentionProviderID | null; /** * The user's text input, to be interpreted as a fuzzy-matched query. */ text: string; /** * The line range in the query, if any. */ range?: RangeData; /** * If the query suffix resembles a partially typed range suffix (such as `foo.txt:`, * `foo.txt:1`, or `foo.txt:12-`). */ maybeHasRangeSuffix?: boolean; /** * To control source of mention suggestions, if it's set to true * search logic will try to find suggestions across remote repositories * user has on their instance. (Cody Web use case) */ includeRemoteRepositories?: boolean; } /** * Parse an @-mention query. The {@link query} value is whatever the UI determines is the query * based on the current text input; it is not the full value of a message that may or may not * contain an @-mention. * * The {@link query} MUST be stripped of the trigger character (usually `@`). The only valid case * where {@link query} may begin with `@` is if the user is searching for context items that contain * `@`, such as if the user typed `@@foo` to mention a file that is literally named `@foo.js`. */ export declare function parseMentionQuery(query: string, provider: Pick | null): MentionQuery; /** * Parses the line range (if any) at the end of a string like `foo.txt:1-2`. Because this means "all * of lines 1 and 2", the returned range actually goes to the start of line 3 to ensure all of line * 2 is included. Also, lines in mentions are 1-indexed while `RangeData` is 0-indexed. */ export declare function extractRangeFromFileMention(query: string): { textWithoutRange: string; maybeHasRangeSuffix: boolean; range?: RangeData; }; /** * The location and content of a mention in free-form user text input. */ export interface MentionTrigger { /** The number of characters from the start of the text to the mention trigger (`@`). */ leadOffset: number; /** * The string that is used to query for the context item to mention (to be passed to * {@link parseMentionQuery}). */ matchingString: string; /** * Equal to `@` + {@link matchingString}. The entire string that should be replaced with the * context item when the at-mention reference is chosen. */ replaceableString: string; } interface ScanForMentionsParams { textBeforeCursor: string; includeWhitespace: boolean; } /** * Scans free-form user text input (in a chat message editor, for example) for possible mentions * with the `@` trigger character. * * The {@link textBeforeCursor} is all of the text in the input field before the text insertion * point cursor. For example, if the input field looks like `hello * @foo█bar`, then {@link textBeforeCursor} should be `hello @foo`. */ export declare function scanForMentionTriggerInUserTextInput(params: ScanForMentionsParams): MentionTrigger | null; export {}; //# sourceMappingURL=query.d.ts.map