% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/editor.R
\name{extract_comment_at_cursor}
\alias{extract_comment_at_cursor}
\title{Extract the comment text at the current cursor position}
\usage{
extract_comment_at_cursor(ctx)
}
\arguments{
\item{ctx}{An \code{rstudio_editor_context} object from
\code{\link[rstudioapi:rstudio-editors]{rstudioapi::getSourceEditorContext()}}.}
}
\value{
A named list with four components:
\describe{
\item{\code{comment}}{Character.  The comment text with the leading \verb{#}
character(s) and optional space stripped.}
\item{\code{row}}{Integer.  1-based row index of the comment line in the
document.}
\item{\code{full_line}}{Character.  The raw full-line text as it appears in
the editor.}
\item{\code{indent}}{Character.  The leading whitespace of the line
(used to preserve indentation when inserting generated code).}
}
}
\description{
Reads the line at the cursor position from the active editor context and
returns its components.  Throws an informative error if the cursor is not
positioned on a comment line (i.e., a line starting with \verb{#}, possibly
preceded by whitespace).
}
\keyword{internal}
