Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/InitEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public static function addToFunction(string $functionName, string $instructionSt

// agregar indentation
$indentation = self::getCurrentIndentation($body, mb_strlen($body) - 2);
if ($indentation === '') {
// función vacía: no hay línea previa de la que copiar la indentación
$indentation = $endIndents . ' ';
}
$body .= self::formatTextWithIndentation($instructionStr, $indentation) . "\n" . $endIndents;

return mb_substr($info['initContent'], 0, $info['functionStart']) . $body . mb_substr($info['initContent'], $info['functionEnd']);
Expand Down