@@ -98,16 +98,20 @@ class LanguageService : DisposingComObject,
98
98
{
99
99
// mPackage = pkg;
100
100
mUpdateSolutionEvents = newCom! UpdateSolutionEvents(this );
101
- mVDServerClient = new VDServerClient;
102
101
}
103
102
104
103
~this ()
105
104
{
106
105
}
107
106
108
- void startVDServer ()
107
+ @property VDServerClient vdServerClient ()
109
108
{
110
- mVDServerClient.start();
109
+ if (! mVDServerClient)
110
+ {
111
+ mVDServerClient = new VDServerClient;
112
+ mVDServerClient.start();
113
+ }
114
+ return mVDServerClient;
111
115
}
112
116
113
117
override HRESULT QueryInterface (in IID * riid, void ** pvObject)
@@ -162,7 +166,8 @@ class LanguageService : DisposingComObject,
162
166
mgr.Release();
163
167
mCodeWinMgrs = mCodeWinMgrs.init;
164
168
165
- mVDServerClient.shutDown();
169
+ if (mVDServerClient)
170
+ mVDServerClient.shutDown();
166
171
167
172
if (mUpdateSolutionEventsCookie != VSCOOKIE_NIL )
168
173
{
@@ -612,7 +617,8 @@ class LanguageService : DisposingComObject,
612
617
// ////////////////////////////////////////////////////////////
613
618
bool OnIdle ()
614
619
{
615
- mVDServerClient.onIdle();
620
+ if (mVDServerClient)
621
+ mVDServerClient.onIdle();
616
622
617
623
CheckGC(false );
618
624
for (int i = 0 ; i < mSources.length; i++ )
@@ -712,25 +718,25 @@ class LanguageService : DisposingComObject,
712
718
uint GetTip (Source src, TextSpan* pSpan, GetTipCallBack cb)
713
719
{
714
720
ConfigureSemanticProject(src);
715
- return mVDServerClient .GetTip(src.GetFileName(), pSpan, cb);
721
+ return vdServerClient .GetTip(src.GetFileName(), pSpan, cb);
716
722
}
717
723
uint GetDefinition (Source src, TextSpan* pSpan, GetDefinitionCallBack cb)
718
724
{
719
725
ConfigureSemanticProject(src);
720
- return mVDServerClient .GetDefinition(src.GetFileName(), pSpan, cb);
726
+ return vdServerClient .GetDefinition(src.GetFileName(), pSpan, cb);
721
727
}
722
728
uint GetSemanticExpansions (Source src, string tok, int line, int idx, GetExpansionsCallBack cb)
723
729
{
724
730
ConfigureSemanticProject(src);
725
731
wstring expr = src.FindExpressionBefore(line, idx);
726
- return mVDServerClient .GetSemanticExpansions(src.GetFileName(), tok, line, idx, expr, cb);
732
+ return vdServerClient .GetSemanticExpansions(src.GetFileName(), tok, line, idx, expr, cb);
727
733
}
728
734
void UpdateSemanticModule (Source src)
729
735
{
730
736
}
731
737
void ClearSemanticProject ()
732
738
{
733
- mVDServerClient .ClearSemanticProject();
739
+ vdServerClient .ClearSemanticProject();
734
740
}
735
741
736
742
void ConfigureSemanticProject (Source src)
@@ -765,14 +771,14 @@ class LanguageService : DisposingComObject,
765
771
version ids = tokenizeArgs(cfgopts.versionids);
766
772
debugids = tokenizeArgs(cfgopts.debugids);
767
773
}
768
- mVDServerClient .ConfigureSemanticProject(file, assumeUnique (imp), assumeUnique(stringImp), assumeUnique(versionids), assumeUnique(debugids), flags);
774
+ vdServerClient .ConfigureSemanticProject(file, assumeUnique (imp), assumeUnique(stringImp), assumeUnique(versionids), assumeUnique(debugids), flags);
769
775
}
770
776
771
777
bool isBinaryOperator (Source src, int startLine, int startIndex, int endLine, int endIndex)
772
778
{
773
779
auto pos = vdc.util.TextPos(startIndex, startLine);
774
780
return src.mBinaryIsIn.contains(pos) ! is null ;
775
- // return mVDServerClient .isBinaryOperator(src.GetFileName(), startLine, startIndex, endLine, endIndex);
781
+ // return vdServerClient .isBinaryOperator(src.GetFileName(), startLine, startIndex, endLine, endIndex);
776
782
}
777
783
778
784
private :
@@ -3262,7 +3268,7 @@ else
3262
3268
if (Package.GetGlobalOptions().parseSource)
3263
3269
{
3264
3270
auto langsvc = Package.GetLanguageService();
3265
- langsvc.mVDServerClient .UpdateModule(GetFileName(), mParseText, verbose, &OnUpdateModule);
3271
+ langsvc.vdServerClient .UpdateModule(GetFileName(), mParseText, verbose, &OnUpdateModule);
3266
3272
}
3267
3273
3268
3274
return true ;
0 commit comments