Exemple #1
0
        public XSharpSource( XSharpLanguageService service,
                        IVsTextLines textLines,
                        Colorizer colorizer)
            : base(service, textLines, colorizer)
        {

        }
Exemple #2
0
 public BooSource(BooLanguageService service, IVsTextLines buffer, Microsoft.VisualStudio.Package.Colorizer colorizer)
     : base(service, buffer, colorizer)
 {
     projectManager = GlobalServices.GetProjectManagerForFile(GetFilePath());
     fileNode       = projectManager.GetFileNode(GetFilePath());
     fileNode.ShowMessages();
     fileNode.Recompiled +=
         (sender, eventArgs) => service.Invoke(
             new Action <BooLanguageService>(SynchronizeDropDowns),
             new object[] { service }
             );
 }
Exemple #3
0
        public NSSource(NSLangServ service, IVsTextLines textLines, Colorizer colorizer)
            : base(service, textLines, colorizer)
        {
            string path = GetFilePath();
            Service = service;

            this.m_scanner = colorizer.Scanner as NSScanner;
            if (m_scanner != null)
                m_scanner.m_nssource = this;

            //Scanner = colorizer.Scanner as NSScanner;
            LastParseTime = 0;
            DirtyTime = DateTime.Now;
            FullScanTime = 0;
        }
Exemple #4
0
    public Source(LanguageService service, IVsTextLines textLines, Colorizer colorizer) {
      this.service = service;
      this.textLines = textLines;
      this.colorizer = colorizer;
      this.taskProvider = new TaskProvider(service.site); // task list
      this.completionSet = this.GetCompletionSet();      
      this.methodData = this.GetMethodData();
      this.colorState = (IVsTextColorState)textLines;

      Guid statusBarGuid = typeof(VsShellInterop.IVsStatusbar).GUID;
      this.statusBar = (VsShellInterop.IVsStatusbar)service.site.QueryService(statusBarGuid, typeof(VsShellInterop.IVsStatusbar));

      service.GetCommentFormat(ref commentInfo);

      // track source changes
      if (service.Preferences.EnableCodeSenseFastOnLineChange) {
        textChangeCommitEventsCookie = VsShell.Connect( textLines, (IVsFinalTextChangeCommitEvents)this, ref VsConstants.IID_IVsFinalTextChangeCommitEvents);
      }
      this.textLinesEventsCookie = VsShell.Connect( textLines, (IVsTextLinesEvents)this, ref VsConstants.IID_IVsTextLinesEvents);

    }
Exemple #5
0
 internal virtual void OnCloseColorizer(Colorizer c) {
     if (this.colorizers != null) {
         if (this.colorizers.Contains(c)) {
             this.colorizers.Remove(c);
         }
     }
 }
Exemple #6
0
		public BeeSource( BeeService service, IVsTextLines textLines, Colorizer colorizer )
			: base( service, textLines, colorizer )
		{
			LastParseTime = 0;
		}//.ctor
Exemple #7
0
 public NShaderSource(LanguageService service, IVsTextLines textLines, Colorizer colorizer) : base(service, textLines, colorizer)
 {
 }
Exemple #8
0
 // Override this method to plug in your own custom colorizer.
 // You shouldn't need to do this since the colorizer simply
 // uses your Scanner to get the color information.
 // This method returns the same colorizer for each unique buffer,
 // which you must do also.
 /// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.GetColorizer"]/*' />
 public virtual Colorizer GetColorizer(IVsTextLines buffer) {
     foreach (Colorizer c in this.colorizers) {
         if (c.buffer == buffer) {
             return c; 
         }
     }
     Colorizer result = new Colorizer(this, buffer, this.GetScanner(buffer));
     this.colorizers.Add(result);
     return result;
 }
 public AsmHighlighterSource(LanguageService service, IVsTextLines textLines, Colorizer colorizer)
     : base(service, textLines, colorizer)
 {
 }
Exemple #10
0
    public void Close(){
      if (this.textLinesEventsCookie != 0) 
        VsShell.DisConnect(this.textLines, ref VsConstants.IID_IVsTextLinesEvents, this.textLinesEventsCookie );
      if (this.textChangeCommitEventsCookie != 0) 
        VsShell.DisConnect(this.textLines, ref VsConstants.IID_IVsFinalTextChangeCommitEvents, this.textChangeCommitEventsCookie );

#if WHIDBEY
      // release the task manager
      if (this.taskManager != null) {
        ITaskManagerFactory taskManagerFactory = (ITaskManagerFactory)service.site.GetService(typeof(ITaskManagerFactory));
        if (taskManagerFactory != null) {
          taskManagerFactory.ReleaseSharedTaskManager(this.taskManager);
        }
      }
      this.taskManager = null;
#endif

      this.statusBar = null;
      this.methodData.Close();
      this.methodData = null;
      this.completionSet.Close();
      this.completionSet = null;
      this.taskProvider.Dispose();
      this.taskProvider = null;
      this.service = null;
      this.colorizer = null;      
    }
Exemple #11
0
 public CMakeSource(LanguageService service, IVsTextLines textLines,
     Colorizer colorizer) : base(service, textLines, colorizer)
 {
     _includeCache = new Dictionary<string, IncludeCacheEntry>();
 }
Exemple #12
0
 public Source(BabelLanguageService service, IVsTextLines textLines, Colorizer colorizer)
     : base(service, textLines, colorizer)
 {
 }
Exemple #13
0
 /// <include file='doc\Source.uex' path='docs/doc[@for="CompoundAction.CompoundAction2"]/*' />
 public CompoundAction(Source src, string description)
     : base()
 {
     this.opened = false;
     this.src = src;
     this.action = (IVsCompoundAction)src.GetTextLines();
     if (this.action == null) {
         throw new ArgumentNullException("(IVsCompoundAction)src.GetTextLines()");
     }
     NativeMethods.ThrowOnFailure(action.OpenCompoundAction(description));
     this.opened = true;
     this.colorizer = src.GetColorizer();
     if (colorizer != null) colorizer.Suspend(); // batch colorization
 }
Exemple #14
0
 void ResumeColorization()
 {
     if (colorizer != null) {
         colorizer.Resume(); // batch colorization
         TextSpan span = src.DirtySpan;
         int start = span.iStartLine;
         int end = span.iEndLine;
         src.Recolorize(start, end);
         colorizer = null;
     }
 }
Exemple #15
0
        /// <include file='doc\LanguageService.uex' path='docs/doc[@for="Source.Dispose"]/*' />
        public virtual void Dispose()
        {
            #if LANGTRACE
            Trace.WriteLine("Source::Cleanup");
            #endif
            try {
                if (this.textLinesEvents != null) {
                    this.textLinesEvents.Dispose();
                    this.textLinesEvents = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.userDataEvents != null) {
                    this.userDataEvents.Dispose();
                    this.userDataEvents = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.hiddenTextSession != null) {
                    // We can't throw or exit here because we need to call Dispose on the
                    // other members that need to be disposed.
                    this.hiddenTextSession.UnadviseClient();
                    this.hiddenTextSession = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.methodData != null) {
                    this.methodData.Dispose();
                    this.methodData = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.completionSet != null) {
                    this.completionSet.Dispose();
                    this.completionSet = null;
                }
            } catch (COMException) {
            }
            try {

                if (this.taskProvider != null) {
                    this.taskProvider.Dispose();
                    this.taskProvider = null;
                }
            } catch (COMException) {
            }
            try {
                this.service = null;
                if (this.colorizer != null) {
                    // The colorizer is owned by the core text editor, so we don't close it, the core text editor
                    // does that for us when it is ready to do so.
                    //colorizer.CloseColorizer();
                    this.colorizer = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.colorState != null) {
                    this.colorState = null;
                }
            } catch (COMException) {
            }
            try {
                if (this.expansionProvider != null) {
                    this.expansionProvider.Dispose();
                    this.expansionProvider = null;
                }

            } catch (COMException) {
            }
            try {

                // Sometimes OnCloseSource is called when language service is changed, (for example
                // when you save the file with a different file extension) in which case we cannot
                // null out the site because that will cause a crash inside msenv.dll.
                //            if (this.textLines != null) {
                //                ((IObjectWithSite)this.textLines).SetSite(null);
                //            }
                if (this.textLines != null) {
                    this.textLines = null; //rely on GC rather control lifetime through ReleaseCOMObject
                    Marshal.Release(pUnkTextLines);
                }
            } catch (COMException) {
            }
        }
Exemple #16
0
        /// <include file='doc\Source.uex' path='docs/doc[@for="Source.Source"]/*' />
        public Source(LanguageService service, IVsTextLines textLines, Colorizer colorizer)
        {
            #if LANGTRACE
            Tracing.TraceRef(textLines, "Source.textLines");
            #endif
            this.service = service;
            this.textLines = textLines;
            pUnkTextLines = Marshal.GetIUnknownForObject(this.textLines); //so it can't get disposed on us
            this.colorizer = colorizer;
            this.dirty = true;
            this.completionSet = this.CreateCompletionSet();
            this.methodData = this.CreateMethodData();
            this.colorState = (IVsTextColorState)textLines;

            // Register text buffer (IVsTextLines) event handlers
            // Delegate to virtual/overridable method
            RegisterTextBufferEventHandlers(textLines);

            this.doOutlining = this.service.Preferences.AutoOutlining;
            if (this.doOutlining) {
                GetHiddenTextSession();
            }
            this.expansionProvider = GetExpansionProvider();

            this.lastParseTime = Int32.MaxValue;
        }
 public MetaModelLanguageSource(LanguageService service, IVsTextLines textLines, Colorizer colorizer)
     : base(service, textLines, colorizer)
 {
 }
Exemple #18
0
    public void Close() {
      if (this.textLinesEventsCookie != 0) 
        VsShell.DisConnect(this.textLines, ref VsConstants.IID_IVsTextLinesEvents, this.textLinesEventsCookie );
      if (this.textChangeCommitEventsCookie != 0) 
        VsShell.DisConnect( this.textLines, ref VsConstants.IID_IVsFinalTextChangeCommitEvents, this.textChangeCommitEventsCookie );

      this.statusBar = null;
      this.methodData.Close();
      this.methodData = null;
      this.completionSet.Close();
      this.completionSet = null;
      this.taskProvider.Close();
      this.taskProvider = null;
      this.service = null;
      this.colorizer = null;      
    }
Exemple #19
0
    public Source(LanguageService service, IVsTextLines textLines, Colorizer colorizer){
      this.service = service;
      this.textLines = textLines;
      this.colorizer = colorizer;
      this.taskProvider = new TaskProvider(service.site); // task list
      this.completionSet = this.GetCompletionSet();      
      this.methodData = this.GetMethodData();
      this.colorState = (IVsTextColorState)textLines;

      Guid statusBarGuid = typeof(VsShellInterop.IVsStatusbar).GUID;
      this.statusBar = (VsShellInterop.IVsStatusbar)service.site.QueryService(statusBarGuid, typeof(VsShellInterop.IVsStatusbar));
      
      this.commentInfo = new CommentInfo();
      service.GetCommentFormat(this.commentInfo);

      // track source changes
      if (service.Preferences.EnableCodeSenseFastOnLineChange){
        textChangeCommitEventsCookie = VsShell.Connect(textLines, (IVsFinalTextChangeCommitEvents)this, ref VsConstants.IID_IVsFinalTextChangeCommitEvents);
      }
      this.textLinesEventsCookie = VsShell.Connect(textLines, (IVsTextLinesEvents)this, ref VsConstants.IID_IVsTextLinesEvents);
      this.SetDirty();

#if WHIDBEY
      // create a task manager
      if (taskManager == null) {
        ITaskManagerFactory taskManagerFactory = (ITaskManagerFactory)(service.site).GetService(typeof(ITaskManagerFactory));
        if (taskManagerFactory != null) {
          taskManager = taskManagerFactory.QuerySharedTaskManager("SpecSharp", true);
        }
      }
#endif
    }
 public HLSLSource(HLSLLanguageService service, IVsTextLines textLines, Colorizer colorizer)
     : base(service, textLines, colorizer)
 {
 }
 public OsloCodeGeneratorSource(LanguageService service, IVsTextLines textLines, Colorizer colorizer)
     : base(service, textLines, colorizer)
 {
 }