Skip to content

Commit d85543b

Browse files
authored
Merge branch 'next' into parserCancellationBug
2 parents 7788cc6 + 5442afe commit d85543b

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

RetailCoder.VBE/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("2.0.2.*")]
35-
[assembly: AssemblyFileVersion("2.0.2.0")]
34+
[assembly: AssemblyVersion("2.0.4.*")]
35+
[assembly: AssemblyFileVersion("2.0.4.0")]

Rubberduck.VBEEditor/Extensions/VBComponentsExtensions.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,20 @@ public static void ImportSourceFile(this VBComponents components, string filePat
5454
component.CodeModule.AddFromString(codeString);
5555
}
5656
}
57-
else if(ext != VBComponentExtensions.FormBinaryExtension)
57+
else if (ext == VBComponentExtensions.FormExtension)
5858
{
59-
components.Import(filePath);
60-
}
59+
VBComponent component;
60+
try
61+
{
62+
component = components.Item(name);
63+
}
64+
catch (IndexOutOfRangeException)
65+
{
66+
component = components.Add(vbext_ComponentType.vbext_ct_MSForm);
67+
component.Properties.Item("Caption").Value = name;
68+
component.Name = name;
69+
}
6170

62-
if (ext == VBComponentExtensions.FormExtension)
63-
{
64-
var component = components.Item(name);
65-
// note: vbeCode contains an extraneous line here:
66-
//var vbeCode = component.CodeModule.Lines().Split(new []{Environment.NewLine}, StringSplitOptions.None);
67-
6871
var nonAttributeLines = codeLines.TakeWhile(line => !line.StartsWith("Attribute")).Count();
6972
var attributeLines = codeLines.Skip(nonAttributeLines).TakeWhile(line => line.StartsWith("Attribute")).Count();
7073
var declarationsStartLine = nonAttributeLines + attributeLines + 1;
@@ -73,6 +76,10 @@ public static void ImportSourceFile(this VBComponents components, string filePat
7376
component.CodeModule.Clear();
7477
component.CodeModule.AddFromString(correctCodeString);
7578
}
79+
else if(ext != VBComponentExtensions.FormBinaryExtension)
80+
{
81+
components.Import(filePath);
82+
}
7683
}
7784
}
7885
}

0 commit comments

Comments
 (0)