MCPcopy Create free account
hub / github.com/continuedev/continue / addCodeToContextFromRange

Function addCodeToContextFromRange

extensions/vscode/src/util/addCode.ts:155–187  ·  view source on GitHub ↗
(
  range: vscode.Range,
  webviewProtocol: VsCodeWebviewProtocol,
  prompt?: string,
)

Source from the content-addressed store, hash-verified

153}
154
155export function addCodeToContextFromRange(
156 range: vscode.Range,
157 webviewProtocol: VsCodeWebviewProtocol,
158 prompt?: string,
159) {
160 const document = vscode.window.activeTextEditor?.document;
161
162 if (!document) {
163 return;
164 }
165
166 const rangeInFileWithContents = {
167 filepath: document.uri.toString(),
168 contents: document.getText(range),
169 range: {
170 start: {
171 line: range.start.line,
172 character: range.start.character,
173 },
174 end: {
175 line: range.end.line,
176 character: range.end.character,
177 },
178 },
179 };
180
181 webviewProtocol?.request("highlightedCode", {
182 rangeInFileWithContents,
183 prompt,
184 // Assume `true` since range selection is currently only used for quick actions/fixes
185 shouldRun: true,
186 });
187}

Callers 1

getCommandsMapFunction · 0.90

Calls 2

getTextMethod · 0.80
requestMethod · 0.65

Tested by

no test coverage detected