Skip to content

Commit 92fa92d

Browse files
Luke Owlclaw2Luke Owlclaw2
authored andcommitted
Fixed merge conflict
Added comments
1 parent 9d2445f commit 92fa92d

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/TypeScriptDefinitionGenerator/Generator/IntellisenseWriter.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ internal static class IntellisenseWriter
1212
{
1313
private static readonly Regex _whitespaceTrimmer = new Regex(@"^\s+|\s+$|\s*[\r\n]+\s*", RegexOptions.Compiled);
1414

15+
/// <summary>
16+
/// Generates TypeScript file for given C# class/enum (IntellisenseObject).
17+
/// </summary>
18+
/// <param name="objects">IntellisenseObject of class/enum</param>
19+
/// <param name="sourceItemPath">Path to C# source file</param>
20+
/// <returns>TypeScript file content as string</returns>
1521
public static string WriteTypeScript(IEnumerable<IntellisenseObject> objects, string sourceItemPath)
1622
{
1723
var sb = new StringBuilder();
@@ -121,7 +127,8 @@ public static string WriteTypeScript(IEnumerable<IntellisenseObject> objects, st
121127
var notImportedNeededImports = neededImports.Except(imports);
122128
if (notImportedNeededImports.Any())
123129
{
124-
throw new ExceptionForUser($"Sorry, needed imports missing: {string.Join(", ", notImportedNeededImports)}");
130+
throw new ExceptionForUser($"Sorry, needed imports missing: {string.Join(", ", notImportedNeededImports)}." +
131+
$"Make sure file names match contained class/enum name.");
125132
}
126133
}
127134

tests/TypeScriptDefinitionGenerator.Tests/IntellisenseParserTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public void _ShouldWorkProperly()
6565
IgnoreIntellisense = true,
6666
});
6767
var list = IntellisenseParser.ProcessFile(item).ToList();
68-
var tsFile = IntellisenseWriter.WriteTypeScript(list);
68+
var sourceItemPath = item.Properties.Item("FullPath").Value as string;
69+
var tsFile = IntellisenseWriter.WriteTypeScript(list, sourceItemPath);
6970

7071
//Assert
7172
Assert.IsNotNull(list);
@@ -179,7 +180,8 @@ public void _ShouldWorkProperly2()
179180
UseNamespace = true,
180181
});
181182
var list = IntellisenseParser.ProcessFile(item).ToList();
182-
var tsFile = IntellisenseWriter.WriteTypeScript(list);
183+
var sourceItemPath = item.Properties.Item("FullPath").Value as string;
184+
var tsFile = IntellisenseWriter.WriteTypeScript(list, sourceItemPath);
183185

184186
//Assert
185187
Assert.IsNotNull(list);

0 commit comments

Comments
 (0)