@@ -98,16 +98,20 @@ class LanguageService : DisposingComObject,
9898 {
9999 // mPackage = pkg;
100100 mUpdateSolutionEvents = newCom! UpdateSolutionEvents(this );
101- mVDServerClient = new VDServerClient;
102101 }
103102
104103 ~this ()
105104 {
106105 }
107106
108- void startVDServer ()
107+ @property VDServerClient vdServerClient ()
109108 {
110- mVDServerClient.start();
109+ if (! mVDServerClient)
110+ {
111+ mVDServerClient = new VDServerClient;
112+ mVDServerClient.start();
113+ }
114+ return mVDServerClient;
111115 }
112116
113117 override HRESULT QueryInterface (in IID * riid, void ** pvObject)
@@ -162,7 +166,8 @@ class LanguageService : DisposingComObject,
162166 mgr.Release();
163167 mCodeWinMgrs = mCodeWinMgrs.init;
164168
165- mVDServerClient.shutDown();
169+ if (mVDServerClient)
170+ mVDServerClient.shutDown();
166171
167172 if (mUpdateSolutionEventsCookie != VSCOOKIE_NIL )
168173 {
@@ -612,7 +617,8 @@ class LanguageService : DisposingComObject,
612617 // ////////////////////////////////////////////////////////////
613618 bool OnIdle ()
614619 {
615- mVDServerClient.onIdle();
620+ if (mVDServerClient)
621+ mVDServerClient.onIdle();
616622
617623 CheckGC(false );
618624 for (int i = 0 ; i < mSources.length; i++ )
@@ -712,25 +718,25 @@ class LanguageService : DisposingComObject,
712718 uint GetTip (Source src, TextSpan* pSpan, GetTipCallBack cb)
713719 {
714720 ConfigureSemanticProject(src);
715- return mVDServerClient .GetTip(src.GetFileName(), pSpan, cb);
721+ return vdServerClient .GetTip(src.GetFileName(), pSpan, cb);
716722 }
717723 uint GetDefinition (Source src, TextSpan* pSpan, GetDefinitionCallBack cb)
718724 {
719725 ConfigureSemanticProject(src);
720- return mVDServerClient .GetDefinition(src.GetFileName(), pSpan, cb);
726+ return vdServerClient .GetDefinition(src.GetFileName(), pSpan, cb);
721727 }
722728 uint GetSemanticExpansions (Source src, string tok, int line, int idx, GetExpansionsCallBack cb)
723729 {
724730 ConfigureSemanticProject(src);
725731 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);
727733 }
728734 void UpdateSemanticModule (Source src)
729735 {
730736 }
731737 void ClearSemanticProject ()
732738 {
733- mVDServerClient .ClearSemanticProject();
739+ vdServerClient .ClearSemanticProject();
734740 }
735741
736742 void ConfigureSemanticProject (Source src)
@@ -765,14 +771,14 @@ class LanguageService : DisposingComObject,
765771 version ids = tokenizeArgs(cfgopts.versionids);
766772 debugids = tokenizeArgs(cfgopts.debugids);
767773 }
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);
769775 }
770776
771777 bool isBinaryOperator (Source src, int startLine, int startIndex, int endLine, int endIndex)
772778 {
773779 auto pos = vdc.util.TextPos(startIndex, startLine);
774780 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);
776782 }
777783
778784private :
@@ -3262,7 +3268,7 @@ else
32623268 if (Package.GetGlobalOptions().parseSource)
32633269 {
32643270 auto langsvc = Package.GetLanguageService();
3265- langsvc.mVDServerClient .UpdateModule(GetFileName(), mParseText, verbose, &OnUpdateModule);
3271+ langsvc.vdServerClient .UpdateModule(GetFileName(), mParseText, verbose, &OnUpdateModule);
32663272 }
32673273
32683274 return true ;
0 commit comments