Skip to content
This repository was archived by the owner on May 21, 2018. It is now read-only.

Pull request of my last version #50

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
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
Prev Previous commit
Next Next commit
Add DefaultEnumNamePrefix to the settings
  • Loading branch information
lionsoft committed Oct 26, 2014
commit 245a304f40ad6d12bd2eb539933f21bcee8277bf
2 changes: 1 addition & 1 deletion T4TS/CodeTraverser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ private TypeScriptEnumAttributeValues GetEnumValues(CodeEnum codeEnum, CodeAttri
{
Name = values.ContainsKey("Name") ? values["Name"] : codeEnum.Name,
Module = values.ContainsKey("Module") ? values["Module"] : Settings.DefaultModule ?? "T4TS",
NamePrefix = values.ContainsKey("NamePrefix") ? values["NamePrefix"] : Settings.DefaultInterfaceNamePrefix ?? string.Empty
NamePrefix = values.ContainsKey("NamePrefix") ? values["NamePrefix"] : Settings.DefaultEnumNamePrefix ?? string.Empty
};
}

Expand Down
5 changes: 5 additions & 0 deletions T4TS/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public class Settings
/// </summary>
public string DefaultInterfaceNamePrefix { get; set; }

/// <summary>
/// The default string to prefix enum names with. For instance, you might want to prefix the names with an "E" to get conventional enum names.
/// </summary>
public string DefaultEnumNamePrefix { get; set; }

/// <summary>
/// The version of Typescript that is targeted
/// </summary>
Expand Down
Binary file modified build/T4TS.Attributes.dll
Binary file not shown.
7 changes: 6 additions & 1 deletion build/T4TS.tt
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ Project GetProjectContainingT4File(DTE dte) {
{
Name = values.ContainsKey("Name") ? values["Name"] : codeEnum.Name,
Module = values.ContainsKey("Module") ? values["Module"] : Settings.DefaultModule ?? "T4TS",
NamePrefix = values.ContainsKey("NamePrefix") ? values["NamePrefix"] : Settings.DefaultInterfaceNamePrefix ?? string.Empty
NamePrefix = values.ContainsKey("NamePrefix") ? values["NamePrefix"] : Settings.DefaultEnumNamePrefix ?? string.Empty
};
}

Expand Down Expand Up @@ -786,6 +786,11 @@ Project GetProjectContainingT4File(DTE dte) {
/// </summary>
public string DefaultInterfaceNamePrefix { get; set; }

/// <summary>
/// The default string to prefix enum names with. For instance, you might want to prefix the names with an "E" to get conventional enum names.
/// </summary>
public string DefaultEnumNamePrefix { get; set; }

/// <summary>
/// The version of Typescript that is targeted
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions build/T4TS.tt.settings.t4
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ readonly Dictionary<string, object> SettingsValues = new Dictionary<string, obje
// Type: string, defaults to "" if not specified.
{ "DefaultInterfaceNamePrefix", null },

// The default string to prefix enum names with. For instance, you
// might want to prefix the names with an "E" to get conventional
// enum names.
// Type: string, defaults to "" if not specified.
{ "DefaultEnumNamePrefix", null },

// The version of Typescript that is targeted. This is required to handle
// breaking changes in the language grammar and/or compiler.
// Type: System.Version
Expand Down