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

Function getCurrentLineInfo

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

Source from the content-addressed store, hash-verified

31}
32
33const getCurrentLineInfo = (
34 input: string,
35 cursorPosition?: number,
36): LineInfo => {
37 const upto = cursorPosition ?? input.length
38 const textUpTo = input.slice(0, upto)
39 const lastNewline = textUpTo.lastIndexOf('\n')
40 const lineStart = lastNewline === -1 ? 0 : lastNewline + 1
41 const line = textUpTo.slice(lineStart)
42 return { lineStart, line }
43}
44
45const parseSlashContext = (input: string): TriggerContext => {
46 if (!input) {

Callers 2

parseSlashContextFunction · 0.85
parseMentionContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected