% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/document-api.R
\name{showEditSuggestion}
\alias{showEditSuggestion}
\title{Show an Edit Suggestion in RStudio}
\usage{
showEditSuggestion(range, text, id = NULL)
}
\arguments{
\item{range}{A document range (or object coercible to a range) indicating
where the suggestion applies. Can be a \code{\link{document_range}} object or
a numeric vector of the form \code{c(start_row, start_col, end_row, end_col)}.}

\item{text}{Character string containing the suggested replacement text for
the specified range.}

\item{id}{The document id. When \code{NULL} or blank, the suggestion will
be shown in the currently open, or last focused, RStudio document.}
}
\value{
Invisibly returns \code{TRUE} if the suggestion was successfully shown,
\code{FALSE} otherwise.
}
\description{
Displays an edit suggestion for a specified range in the active document.
The suggestion shows what text would replace the given range. RStudio
computes and displays the necessary insertions and deletions.
}
\details{
The edit suggestion appears in the RStudio editor, showing what would change
if the suggestion were accepted. Users can accept or dismiss the suggestion
through RStudio's UI.

The \code{range} parameter specifies the region of text that would be replaced.
RStudio automatically computes the minimal diff between the current text in
that range and the suggested \code{text}.
}
\note{
The \code{showEditSuggestion} function was added in version 2026.01.0
of RStudio.
}
\examples{
\dontrun{
# Suggest replacing a word
range <- document_range(c(5, 1), c(5, 10))
showEditSuggestion(range, "corrected_text")

# Using vector notation
showEditSuggestion(c(5, 1, 5, 10), "corrected_text")

# Suggest for current selection
context <- getActiveDocumentContext()
selection <- primary_selection(context)
showEditSuggestion(selection$range, "improved code")
}

}
\seealso{
\code{\link{setGhostText}} for inline completion suggestions,
\code{\link{insertText}} for direct text insertion,
\code{\link{modifyRange}} for programmatic range modification.
}
