Skip to content

Commit af311a8

Browse files
authored
Merge pull request #3524 from IvenBach/FolderAnnotationScope
Folder annotation scope
2 parents a401984 + a634245 commit af311a8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

RetailCoder.VBE/UI/CodeExplorer/Commands/AddComponentCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void AddComponent(CodeExplorerItemViewModel node, ComponentType type)
3737
var folderAnnotation = $"'@Folder(\"{GetFolder(node)}\")";
3838

3939
var newComponent = components.Add(type);
40-
newComponent.CodeModule.AddFromString(folderAnnotation);
40+
newComponent.CodeModule.InsertLines(1, folderAnnotation);
4141
}
4242

4343
private Declaration GetDeclaration(CodeExplorerItemViewModel node)

Rubberduck.VBEEditor/SafeComWrappers/Abstract/ICodeModule.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ public interface ICodeModule : ISafeComWrapper, IEquatable<ICodeModule>
1818
string Content();
1919
void Clear();
2020
string ContentHash();
21+
22+
/// <summary>
23+
/// Adds the specified code to the module. If "require variable declaration" is on, code is added under Option Explicit and an extraneous empty line.
24+
/// </summary>
2125
void AddFromString(string content);
2226
void AddFromFile(string path);
2327
void InsertLines(int line, string content);
@@ -28,4 +32,4 @@ public interface ICodeModule : ISafeComWrapper, IEquatable<ICodeModule>
2832
string GetProcOfLine(int line);
2933
ProcKind GetProcKindOfLine(int line);
3034
}
31-
}
35+
}

0 commit comments

Comments
 (0)