Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 7 additions & 3 deletions src/FSharp.Formatting.Common/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ module FSharp.Formatting.Common.Utils
#if NETSTANDARD_2_1_OR_GREATER
#else
type System.String with
member x.StartsWith(c: char) = string c |> x.StartsWith
member x.EndsWith(c: char) = string c |> x.EndsWith
member x.Contains(c: char) = string c |> x.Contains
member x.StartsWith c =
x.StartsWith(string<char> c, false, System.Globalization.CultureInfo.InvariantCulture)

member x.EndsWith c =
x.EndsWith(string<char> c, false, System.Globalization.CultureInfo.InvariantCulture)

member x.Contains c = x.Contains(string<char> c)
#endif
18 changes: 15 additions & 3 deletions src/FSharp.Formatting.Literate/Formatting.fs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,21 @@ module internal Formatting =
Path.GetRelativePath(rootInputFolder, doc.SourceFile)
#else
if
doc.SourceFile.StartsWith(rootInputFolder + string Path.DirectorySeparatorChar)
|| doc.SourceFile.StartsWith(rootInputFolder + "/")
|| doc.SourceFile.StartsWith(rootInputFolder + "\\")
doc.SourceFile.StartsWith(
rootInputFolder + string<char> Path.DirectorySeparatorChar,
false,
System.Globalization.CultureInfo.InvariantCulture
)
|| doc.SourceFile.StartsWith(
rootInputFolder + "/",
false,
System.Globalization.CultureInfo.InvariantCulture
)
|| doc.SourceFile.StartsWith(
rootInputFolder + "\\",
false,
System.Globalization.CultureInfo.InvariantCulture
)
then
doc.SourceFile.Substring(rootInputFolder.Length + 1)
else
Expand Down