MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / parseMentionContext

Function parseMentionContext

cli/src/hooks/use-suggestion-engine.ts:146–164  ·  view source on GitHub ↗
(
  input: string,
  cursorPosition: number,
)

Source from the content-addressed store, hash-verified

144}
145
146const parseMentionContext = (
147 input: string,
148 cursorPosition: number,
149): TriggerContext => {
150 if (!input) {
151 return { active: false, query: '', startIndex: -1 }
152 }
153
154 const { lineStart, line } = getCurrentLineInfo(input, cursorPosition)
155 const { active, query, atIndex } = parseAtInLine(line)
156
157 if (!active) {
158 return { active: false, query: '', startIndex: -1 }
159 }
160
161 const startIndex = lineStart + atIndex
162
163 return { active: true, query, startIndex }
164}
165
166export type MatchedSlashCommand = Prettify<
167 SlashCommand &

Callers 1

useSuggestionEngineFunction · 0.85

Calls 2

getCurrentLineInfoFunction · 0.85
parseAtInLineFunction · 0.85

Tested by

no test coverage detected