@@ -183,20 +183,21 @@ function update_inline_manifest!(path::AbstractString, toml::String)
183183 manifest_section = _find_inline_section (source, :manifest )
184184
185185 if manifest_section === nothing
186- # No existing manifest section, add one after project section
186+ # No existing manifest section, add one at the bottom
187187 if project_section === nothing
188- # No project section either, add both
188+ # No project section either, add project at top and manifest at bottom
189189 newline = contains (source, " \r\n " ) ? " \r\n " : " \n "
190190 project_block = _render_inline_block (:project , " " , newline, :line )
191191 manifest_block = _render_inline_block (:manifest , toml, newline, :line )
192- new_source = isempty (source) ? project_block * newline * manifest_block : project_block * newline * manifest_block * newline * source
192+ if isempty (source)
193+ new_source = project_block * newline * manifest_block
194+ else
195+ new_source = project_block * newline * source * newline * manifest_block
196+ end
193197 else
194- # Add manifest after project
198+ # Add manifest at the bottom of the file
195199 replacement = _render_inline_block (:manifest , toml, project_section. newline, project_section. format)
196- insertion_point = project_section. span_end
197- prefix = source[firstindex (source): insertion_point]
198- suffix = insertion_point == lastindex (source) ? " " : source[nextind (source, insertion_point): lastindex (source)]
199- new_source = prefix * project_section. newline * replacement * suffix
200+ new_source = source * project_section. newline * replacement
200201 end
201202 else
202203 # Replace existing manifest section
0 commit comments