internal TextViewTracker(IWpfTextView textView, IProjectTracker projectTracker, VSTextProperties vsTextProperties) : base() { Contract.Requires(textView != null); Contract.Requires(projectTracker != null); ContractsPackageAccessor.Current.ExtensionFailed += OnFailed; this.TextView = textView; if (textView.TextBuffer != null) { textView.TextBuffer.Changed += OnTextBufferChanged; } TextView.Closed += OnClosed; this._projectTracker = projectTracker; projectTracker.BuildDone += OnBuildDone; // ContractsPackageAccessor.Current.NewSourceFile += OnNewSourceFile; ContractsPackageAccessor.Current.NewCompilation += OnNewComilation; //Timer _textBufferChangedTimer = new System.Timers.Timer(); _textBufferChangedTimer.AutoReset = false; _textBufferChangedTimer.Elapsed += OnTextViewSettled; _textBufferChangedTimer.Interval = DelayOnTextViewOpened; //Wait two seconds before attempting to fetch any syntactic/semantic information. This gives VS a chance to properly initialize everything. _textBufferChangedTimer.Start(); //Set the text properties VSTextProperties = vsTextProperties; ContractsPackageAccessor.Current.QueueWorkItem((() => { VSTextProperties.LineHeight = TextView.LineHeight; })); //Set the file name Document document = TextView.TextSnapshot.GetOpenDocumentInCurrentContextWithChanges(); FileName = document.Id; }
internal TextViewTracker(IWpfTextView textView, IProjectTracker projectTracker, VSTextProperties vsTextProperties) : base() { Contract.Requires(textView != null); Contract.Requires(projectTracker != null); ContractsPackageAccessor.Current.ExtensionFailed += OnFailed; this.TextView = textView; if (textView.TextBuffer != null) { textView.TextBuffer.Changed += OnTextBufferChanged; } TextView.Closed += OnClosed; this._projectTracker = projectTracker; projectTracker.BuildDone += OnBuildDone; // ContractsPackageAccessor.Current.NewSourceFile += OnNewSourceFile; ContractsPackageAccessor.Current.NewCompilation += OnNewComilation; //Timer _textBufferChangedTimer = new System.Timers.Timer(); _textBufferChangedTimer.AutoReset = false; _textBufferChangedTimer.Elapsed += OnTextViewSettled; _textBufferChangedTimer.Interval = DelayOnTextViewOpened; //Wait two seconds before attempting to fetch any syntactic/semantic information. This gives VS a chance to properly initialize everything. _textBufferChangedTimer.Start(); //Set the text properties VSTextProperties = vsTextProperties; ContractsPackageAccessor.Current.QueueWorkItem((() => { VSTextProperties.LineHeight = TextView.LineHeight; })); //Set the file name Document document = TextView.TextSnapshot.GetOpenDocumentInCurrentContextWithChanges(); FileName = document.Id; }
public static ITextViewTracker GetOrCreateTextViewTracker(IWpfTextView textView, IProjectTracker projectTracker, VSTextProperties vsTextProperties) { Contract.Requires(textView != null); Contract.Requires(projectTracker != null); Contract.Ensures(Contract.Result<ITextViewTracker>() != null); return textView.TextBuffer.Properties.GetOrCreateSingletonProperty<ITextViewTracker>(TextViewTrackerAccessor.TextViewTrackerKey, delegate { return ContractsPackageAccessor.Current.GetVersionedServicesFactory().CreateTextViewTracker(textView, projectTracker, vsTextProperties); }); }
public ContractsProvider(IProjectTracker projectTracker) { Contract.Requires(projectTracker != null); //Grab a pointer back to our project tracker _projectTracker = projectTracker; //Initialize our caches _semanticMembersToCCIMethods = new Dictionary<ISymbol, IMethodReference>(); _semanticTypesToCCITypes = new Dictionary<ITypeSymbol, ITypeReference>(); _semanticAssemblysToCCIAssemblys = new Dictionary<IAssemblySymbol, IAssemblyReference>(); _semanticPropertiesToCCIAccessorMethods = new Dictionary<ISymbol, Tuple<IMethodReference, IMethodReference>>(); }
public ContractsProvider(IProjectTracker projectTracker) { Contract.Requires(projectTracker != null); //Grab a pointer back to our project tracker _projectTracker = projectTracker; //Initialize our caches _semanticMembersToCCIMethods = new Dictionary <CSharpMember, IMethodReference>(); _semanticTypesToCCITypes = new Dictionary <CSharpType, ITypeReference>(); _semanticAssemblysToCCIAssemblys = new Dictionary <CSharpAssembly, IAssemblyReference>(); _semanticPropertiesToCCIAccessorMethods = new Dictionary <CSharpMember, Tuple <IMethodReference, IMethodReference> >(); }
public IContractsProvider CreateContractsProvider(IProjectTracker projectTracker) { return new ContractsProvider(projectTracker); }
public ITextViewTracker CreateTextViewTracker(IWpfTextView textView, IProjectTracker projectTracker, VSTextProperties vsTextProperties) { return new TextViewTracker(textView, projectTracker, vsTextProperties); }
public IContractsProvider CreateContractsProvider(IProjectTracker projectTracker) { return(new ContractsProvider(projectTracker)); }
public ITextViewTracker CreateTextViewTracker(IWpfTextView textView, IProjectTracker projectTracker, VSTextProperties vsTextProperties) { return(new TextViewTracker(textView, projectTracker, vsTextProperties)); }
public static ITextViewTracker GetOrCreateTextViewTracker(IWpfTextView textView, IProjectTracker projectTracker, VSTextProperties vsTextProperties) { Contract.Requires(textView != null); Contract.Requires(projectTracker != null); Contract.Ensures(Contract.Result <ITextViewTracker>() != null); return(textView.TextBuffer.Properties.GetOrCreateSingletonProperty <ITextViewTracker>(TextViewTrackerAccessor.TextViewTrackerKey, delegate { return ContractsPackageAccessor.Current.GetVersionedServicesFactory().CreateTextViewTracker(textView, projectTracker, vsTextProperties); })); }