@@ -69,26 +69,39 @@ private void StateOnStateChanged(object sender, EventArgs e)
69
69
}
70
70
}
71
71
72
- private void ReparseRequested ( object sender , EventArgs e )
72
+ private void ReparseRequested ( object sender , ParseRequestEventArgs e )
73
73
{
74
- var args = e as ParseRequestEventArgs ;
75
- if ( args . IsFullReparseRequest )
74
+ if ( e . IsFullReparseRequest )
76
75
{
77
76
Cancel ( ) ;
78
77
ParseAll ( ) ;
79
78
}
80
79
else
81
80
{
82
- Cancel ( args . Component ) ;
83
- ParseAsync ( args . Component , CancellationToken . None ) ;
81
+ Cancel ( e . Component ) ;
82
+ ParseAsync ( e . Component , CancellationToken . None ) ;
84
83
}
85
84
}
86
85
87
86
public void Parse ( )
88
87
{
89
88
var projects = _vbe . VBProjects
90
89
. Cast < VBProject > ( )
91
- . Where ( project => project . Protection == vbext_ProjectProtection . vbext_pp_none ) ;
90
+ . Where ( project => project . Protection == vbext_ProjectProtection . vbext_pp_none )
91
+ . ToList ( ) ;
92
+
93
+ if ( ! _state . AllDeclarations . Any ( item => item . IsBuiltIn ) )
94
+ {
95
+ var references = projects . SelectMany ( p => p . References . Cast < Reference > ( ) ) . ToList ( ) ;
96
+ foreach ( var reference in references )
97
+ {
98
+ var items = _comReflector . GetDeclarationsForReference ( reference ) ;
99
+ foreach ( var declaration in items )
100
+ {
101
+ _state . AddDeclaration ( declaration ) ;
102
+ }
103
+ }
104
+ }
92
105
93
106
var components = projects . SelectMany ( p => p . VBComponents . Cast < VBComponent > ( ) ) . ToList ( ) ;
94
107
foreach ( var component in components )
@@ -118,7 +131,21 @@ private void ParseAll()
118
131
{
119
132
var projects = _vbe . VBProjects
120
133
. Cast < VBProject > ( )
121
- . Where ( project => project . Protection == vbext_ProjectProtection . vbext_pp_none ) ;
134
+ . Where ( project => project . Protection == vbext_ProjectProtection . vbext_pp_none )
135
+ . ToList ( ) ;
136
+
137
+ if ( ! _state . AllDeclarations . Any ( item => item . IsBuiltIn ) )
138
+ {
139
+ var references = projects . SelectMany ( p => p . References . Cast < Reference > ( ) ) . ToList ( ) ;
140
+ foreach ( var reference in references )
141
+ {
142
+ var items = _comReflector . GetDeclarationsForReference ( reference ) ;
143
+ foreach ( var declaration in items )
144
+ {
145
+ _state . AddDeclaration ( declaration ) ;
146
+ }
147
+ }
148
+ }
122
149
123
150
var components = projects . SelectMany ( p => p . VBComponents . Cast < VBComponent > ( ) ) . ToList ( ) ;
124
151
foreach ( var component in components )
0 commit comments