mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 05:29:11 -06:00
fix(36102): fix extra new line in Organize Imports (#36911)
Organize Imports was inserting extra newline. Fixes #36102
This commit is contained in:
parent
3d76c37cbe
commit
bff0ddc941
@ -889,7 +889,9 @@ namespace ts.textChanges {
|
||||
: format(change.node);
|
||||
// strip initial indentation (spaces or tabs) if text will be inserted in the middle of the line
|
||||
const noIndent = (options.preserveLeadingWhitespace || options.indentation !== undefined || getLineStartPositionForPosition(pos, sourceFile) === pos) ? text : text.replace(/^\s+/, "");
|
||||
return (options.prefix || "") + noIndent + (options.suffix || "");
|
||||
return (options.prefix || "") + noIndent
|
||||
+ ((!options.suffix || endsWith(noIndent, options.suffix))
|
||||
? "" : options.suffix);
|
||||
}
|
||||
|
||||
function getFormatCodeSettingsForWriting({ options }: formatting.FormatContext, sourceFile: SourceFile): FormatCodeSettings {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user