Skip to content

Commit 491191f

Browse files
ulugbeknaCopilot
andcommitted
update jsdoc
Co-authored-by: Copilot <copilot@github.com>
1 parent 4c4a822 commit 491191f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

extensions/copilot/src/extension/inlineEdits/vscode-node/isInlineSuggestion.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ export function toInlineSuggestion(cursorPos: Position, doc: TextDocument, range
3939

4040
/**
4141
* If the cursor is at the end of a line and the edit is an empty-range insertion
42-
* at column 0 of the next line (with no leftover content after the insertion),
43-
* rewrite it as a pure insertion at the cursor position.
42+
* at column 0 of the next line, rewrite it as a pure insertion at the cursor
43+
* position. This is allowed when either:
44+
* - `newText` ends with a newline (any existing content on the target line is
45+
* pushed onto the following line), or
46+
* - `newText` contains a newline and the target line is fully consumed by the
47+
* insertion (no leftover content after the insertion).
4448
*/
4549
function tryAdjustNextLineInsertion(cursorPos: Position, doc: TextDocument, range: Range, newText: string): InlineSuggestionEdit | undefined {
4650
if (!range.isEmpty) {

0 commit comments

Comments
 (0)