Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support netstandard2.0 #890

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
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)
smoothdeveloper marked this conversation as resolved.
Show resolved Hide resolved

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