Пример #1
0
        public override NewOutlineRegion[] GetCollapsibleRegions(string text, string fname)
        {
            Cci.ParseReason reason = Cci.ParseReason.CollapsibleRegions;
            Microsoft.VisualStudio.Package.AuthoringSink aSink = new Microsoft.VisualStudio.Package.AuthoringSink(0, 0, 0);
            AuthoringSink scAsink = new AuthoringSink(aSink);

            this.scLanguageService.ParseSource(text, 0, 0, fname, scAsink, reason);
            if (scAsink.CollapsibleRegions == null)
            {
                return(null);
            }
            int n = scAsink.CollapsibleRegions.Count;

            NewOutlineRegion[] result = new NewOutlineRegion[n];
            for (int i = 0; i < n; i++)
            {
                CollapsibleRegion cr = (CollapsibleRegion)scAsink.CollapsibleRegions[i];
                if (cr == null)
                {
                    continue;
                }
                TextSpan span = new TextSpan();
                span.iStartIndex = cr.SourceContext.StartColumn - 1;
                span.iStartLine  = cr.SourceContext.StartLine - 1;
                span.iEndIndex   = cr.SourceContext.EndColumn - 1;
                span.iEndLine    = cr.SourceContext.EndLine - 1;
                NewOutlineRegion region = new NewOutlineRegion();
                region.tsHiddenText = span;
                region.dwState      = (uint)(cr.Collapsed ? HIDDEN_REGION_STATE.hrsDefault : HIDDEN_REGION_STATE.hrsExpanded);
                result[i]           = region;
            }
            return(result);
        }
Пример #2
0
 public override Microsoft.VisualStudio.Package.AuthoringScope ParseSource(string text, int line, int col, string fname,
                                                                           Microsoft.VisualStudio.Package.AuthoringSink aSink, Microsoft.VisualStudio.Package.ParseReason reason)
 {
     lock (ProjectManager.BuildLock){
         Cci.AuthoringSink  scAsink     = new AuthoringSink(aSink);
         Cci.AuthoringScope scAuthScope =
             this.scLanguageService.ParseSource(text, line, col, fname, scAsink, (Cci.ParseReason)reason);
         return(new AuthoringScope(scAuthScope, this.glyphProvider));
     }
 }