Skip to content

Commit 89b2aa4

Browse files
makes the VBETypeLibsAPI_Object only available in debug builds
1 parent 240f19e commit 89b2aa4

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

RetailCoder.VBE/Extension.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ public void OnConnection(object Application, ext_ConnectMode ConnectMode, object
6363
var addin = (AddIn)AddInInst;
6464
_addin = new VBEditor.SafeComWrappers.VBA.AddIn(addin) { Object = this };
6565

66-
// DEBUG TEMPORARY TO ALLOW ACCESS TO TypeLibsAPI from VBA
67-
_addin.Object = new Rubberduck.VBEditor.ComManagement.TypeLibsAPI.TypeLibsAPI_Object(_ide);
66+
#if DEBUG
67+
// FOR DEBUGGING/DEVELOPMENT PURPOSES, ALLOW ACCESS TO SOME VBETypeLibsAPI FEATURES FROM VBA
68+
_addin.Object = new Rubberduck.VBEditor.ComManagement.TypeLibsAPI.VBETypeLibsAPI_Object(_ide);
69+
#endif
6870
}
6971
else if (Application is Microsoft.VB6.Interop.VBIDE.VBE vbe2)
7072
{

Rubberduck.VBEEditor/ComManagement/TypeLibs/TypeLibsAPI.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@
88

99
namespace Rubberduck.VBEditor.ComManagement.TypeLibsAPI
1010
{
11-
// TEMPORARY DEBUG CLASS TO ALLOW ACCESS TO TypeLibsAPI from VBA
11+
#if DEBUG
12+
// FOR DEBUGGING/DEVELOPMENT PURPOSES, ALLOW ACCESS TO SOME VBETypeLibsAPI FEATURES FROM VBA
13+
/*
14+
VBA Usage example:
15+
16+
With Application.VBE.Addins("Rubberduck.Extension").Object
17+
.ExecuteCode("ProjectName", "ModuleName", "ProcedureName")
18+
End With
19+
*/
1220
[System.Runtime.InteropServices.ComVisible(true)]
13-
public class TypeLibsAPI_Object
21+
public class VBETypeLibsAPI_Object
1422
{
1523
IVBE _ide;
16-
public TypeLibsAPI_Object(IVBE ide)
24+
public VBETypeLibsAPI_Object(IVBE ide)
1725
=> _ide = ide;
1826

1927
public bool CompileProject(string projectName)
@@ -37,6 +45,7 @@ public DocClassType DetermineDocumentClassType(string projectName, string classN
3745
public string DocumentAll()
3846
=> VBETypeLibsAPI.DocumentAll(_ide);
3947
}
48+
#endif
4049

4150
/// <summary>
4251
/// Top level API for accessing live type information from the VBE

0 commit comments

Comments
 (0)