Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit08c0f88

Browse files
drivehappyKevinRansom
authored andcommitted
Fixed the insertion of an open declaration that assumed the document had Environment.NewLine line breaks. This would cause a unix-line ending source file to incorrectly be populated with CRLF when working under Windows. (#4487)
1 parent3846384 commit08c0f88

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,15 @@ module internal OpenDeclarationHelper =
171171
let mutableminPos= None
172172

173173
letinsert line lineStr(sourceText:SourceText):SourceText=
174-
letpos= sourceText.Lines.[line].Start
174+
letln= sourceText.Lines.[line]
175+
letpos= ln.Start
175176
minPos<-match minPoswith None-> Some pos| Some oldPos-> Some(min oldPos pos)
176-
sourceText.WithChanges(TextChange(TextSpan(pos,0), lineStr+ Environment.NewLine))
177+
178+
// find the line break characters on the previous line to use, Environment.NewLine should not be used
179+
// as it makes assumptions on the line endings in the source.
180+
letlineBreak= ln.Text.ToString(TextSpan(ln.End, ln.EndIncludingLineBreak- ln.End))
181+
182+
sourceText.WithChanges(TextChange(TextSpan(pos,0), lineStr+ lineBreak))
177183

178184
letgetLineStr line= sourceText.Lines.[line].ToString().Trim()
179185
letpos= ParsedInput.adjustInsertionPoint getLineStr ctx

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp