Skip to content

Commit d2c6fda

Browse files
author
Denis Peshkov
committed
#5 added an Option.EOLType
1 parent d5f27c4 commit d2c6fda

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CRLF/@EntryIndexedValue">CRLF</s:String>
3+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EOL/@EntryIndexedValue">EOL</s:String>
4+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LF/@EntryIndexedValue">LF</s:String>
25
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TS/@EntryIndexedValue">TS</s:String></wpf:ResourceDictionary>

src/TypeScriptDefinitionGenerator/Generator/IntellisenseWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public static string WriteTypeScript(IEnumerable<IntellisenseObject> objects)
7171
}
7272
}
7373

74+
if (Options.EOLType == EOLType.LF)
75+
sb.Replace("\r\n", "\n");
76+
7477
return sb.ToString();
7578
}
7679

src/TypeScriptDefinitionGenerator/Options.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77

88
namespace TypeScriptDefinitionGenerator
99
{
10+
public enum EOLType
11+
{
12+
/// <summary>Unix</summary>
13+
LF,
14+
15+
/// <summary>Windows</summary>
16+
CRLF
17+
}
18+
1019
public class OptionsDialogPage : DialogPage
1120
{
1221
internal const bool _defCamelCaseEnumerationValues = false;
@@ -20,6 +29,7 @@ public class OptionsDialogPage : DialogPage
2029
internal const bool _defUseNamespace = true;
2130
internal const bool _defDeclareModule = true;
2231
internal const bool _defIgnoreIntellisense = true;
32+
internal const EOLType _defEOLType = EOLType.LF;
2333

2434
[Category("Casing")]
2535
[DisplayName("Camel case enum values")]
@@ -69,6 +79,12 @@ public class OptionsDialogPage : DialogPage
6979
[Description("Ignore intellisense for client side reference names")]
7080
[DefaultValue(_defIgnoreIntellisense)]
7181
public bool IgnoreIntellisense { get; set; } = _defIgnoreIntellisense;
82+
83+
[Category("Settings")]
84+
[DisplayName("End Of Line (EOL)")]
85+
[Description("Choose the EOL type Unix/Windows")]
86+
[DefaultValue(_defEOLType)]
87+
public EOLType EOLType { get; set; } = _defEOLType;
7288
}
7389

7490
public class Options
@@ -93,6 +109,8 @@ public class Options
93109

94110
public static bool IgnoreIntellisense => overrides?.IgnoreIntellisense ?? DtsPackage.Options.IgnoreIntellisense;
95111

112+
public static EOLType EOLType => overrides?.EOLType ?? DtsPackage.Options.EOLType;
113+
96114
public static bool WebEssentials2015 => overrides?.WebEssentials2015 ?? DtsPackage.Options.WebEssentials2015;
97115

98116
public static void ReadOptionOverrides(ProjectItem sourceItem, bool display = true)
@@ -180,8 +198,9 @@ internal class OptionsOverride
180198
public bool IgnoreIntellisense { get; set; } = OptionsDialogPage._defIgnoreIntellisense;
181199

182200
// [JsonRequired]
183-
public bool WebEssentials2015 { get; set; } = OptionsDialogPage._defWebEssentials2015;
201+
public EOLType EOLType { get; set; } = OptionsDialogPage._defEOLType;
184202

203+
// [JsonRequired]
204+
public bool WebEssentials2015 { get; set; } = OptionsDialogPage._defWebEssentials2015;
185205
}
186-
187-
}
206+
}

0 commit comments

Comments
 (0)