Example #1
0
            public TaskItemInfo(IVsTaskItem taskItem)
            {
                ErrorHandler.ThrowOnFailure(taskItem.Document(out Document));
                ErrorHandler.ThrowOnFailure(taskItem.get_Text(out Message));
                ErrorHandler.ThrowOnFailure(taskItem.Line(out Line));
                ErrorHandler.ThrowOnFailure(taskItem.Column(out Column));

                // TODO: get_Priority and Category are not implemented by VS LSC (returns E_FAIL)
                Priority      = VSTASKPRIORITY.TP_HIGH;
                Category      = VSTASKCATEGORY.CAT_CODESENSE;
                ErrorCategory = null;

                //var priority = new VSTASKPRIORITY[1];
                //ErrorHandler.ThrowOnFailure(taskItem.get_Priority(priority));
                //Priority = priority[0];

                //var category = new VSTASKCATEGORY[1];
                //ErrorHandler.ThrowOnFailure(taskItem.Category(category));
                //Category = category[0];

                //var errorItem = taskItem as IVsErrorItem;
                //if (errorItem != null) {
                //    uint errorCategory;
                //    try {
                //        ErrorHandler.ThrowOnFailure(errorItem.GetCategory(out errorCategory));
                //        ErrorCategory = (__VSERRORCATEGORY)errorCategory;
                //    } catch (NotImplementedException) {
                //        ErrorCategory = null;
                //    }
                //} else {
                //    ErrorCategory = null;
                //}
            }
Example #2
0
        internal TaskProviderItem FromDiagnostic(
            IServiceProvider site,
            Diagnostic diagnostic,
            VSTASKCATEGORY category,
            bool squiggle
            )
        {
            var priority = VSTASKPRIORITY.TP_LOW;

            switch (diagnostic.severity)
            {
            case DiagnosticSeverity.Error:
                priority = VSTASKPRIORITY.TP_HIGH;
                break;

            case DiagnosticSeverity.Warning:
                priority = VSTASKPRIORITY.TP_NORMAL;
                break;
            }

            return(new TaskProviderItem(
                       site,
                       diagnostic.source,
                       diagnostic.message,
                       diagnostic.range,
                       priority,
                       category,
                       squiggle,
                       _spanTranslator,
                       _fromVersion
                       ));
        }
Example #3
0
            public TaskItemInfo(IVsTaskItem taskItem)
            {
                ErrorHandler.ThrowOnFailure(taskItem.Document(out Document));
                ErrorHandler.ThrowOnFailure(taskItem.get_Text(out Message));
                ErrorHandler.ThrowOnFailure(taskItem.Line(out Line));
                ErrorHandler.ThrowOnFailure(taskItem.Column(out Column));

                var priority = new VSTASKPRIORITY[1];

                ErrorHandler.ThrowOnFailure(taskItem.get_Priority(priority));
                Priority = priority[0];

                var category = new VSTASKCATEGORY[1];

                ErrorHandler.ThrowOnFailure(taskItem.Category(category));
                Category = category[0];

                var errorItem = taskItem as IVsErrorItem;

                if (errorItem != null)
                {
                    uint errorCategory;
                    try {
                        ErrorHandler.ThrowOnFailure(errorItem.GetCategory(out errorCategory));
                        ErrorCategory = (__VSERRORCATEGORY)errorCategory;
                    } catch (NotImplementedException) {
                        ErrorCategory = null;
                    }
                }
                else
                {
                    ErrorCategory = null;
                }
            }
Example #4
0
        internal TaskProviderItem(
            IServiceProvider serviceProvider,
            string message,
            SourceSpan rawSpan,
            VSTASKPRIORITY priority,
            VSTASKCATEGORY category,
            bool squiggle,
            ITextSnapshot snapshot,
            TaskLevel level,
            ErrorType errorType
            )
        {
            _serviceProvider = serviceProvider;
            _message         = message;
            _rawSpan         = rawSpan;
            _snapshot        = snapshot;
            _span            = snapshot != null?CreateSpan(snapshot, rawSpan) : null;

            _rawSpan   = rawSpan;
            _priority  = priority;
            _category  = category;
            _squiggle  = squiggle;
            _level     = level;
            _errorType = errorType;
        }
Example #5
0
 public TaskItemInfo(string document, int line, int column, VSTASKPRIORITY priority, VSTASKCATEGORY category, __VSERRORCATEGORY? errorCategory, string message) {
     Document = document;
     Line = line;
     Column = column;
     Priority = priority;
     Category = category;
     ErrorCategory = errorCategory;
     Message = message;
 }
Example #6
0
 public TaskItemInfo(string document, int line, int column, VSTASKPRIORITY priority, VSTASKCATEGORY category, __VSERRORCATEGORY?errorCategory, string message)
 {
     Document      = document;
     Line          = line;
     Column        = column;
     Priority      = priority;
     Category      = category;
     ErrorCategory = errorCategory;
     Message       = message;
 }
Example #7
0
 public TaskItem(ServiceProvider site, IVsTextLineMarker textLineMarker, string fileName, string text, bool readOnly, VSTASKCATEGORY cat, VSTASKPRIORITY pri, _vstaskbitmap bitmap, string helpKeyword)
 {
     this.site           = site;
     this.text           = text;
     this.fileName       = fileName;
     this.textLineMarker = textLineMarker;
     this.helpKeyword    = helpKeyword;
     this.category       = cat;
     this.priority       = pri;
     this.bitmap         = bitmap;
     this.readOnly       = readOnly;
 }
Example #8
0
        /// <summary>
        /// Creates new task item in the task list
        /// </summary>
        public void WriteTaskItem(string text, VSTASKPRIORITY priority, VSTASKCATEGORY category, string subcategory,
                                  int bitmap, string filename, uint linenum, string taskItemText, string lookupKwd)
        {
            if (pane == null)
            {
                return;
            }

            int hr = pane.OutputTaskItemStringEx(text, priority, category, subcategory, bitmap, filename, linenum, taskItemText, lookupKwd);

            Marshal.ThrowExceptionForHR(hr);
        }
        public CommentTaskProvider(MainPackage package)
            : base(package.ServiceProvider)
        {
            this.ServiceProvider     = package.ServiceProvider;
            package.Options.Applied += this.Options_Applied;

            // In some cases the task list may not be available (e.g., during devenv.exe /build).
            IVsTaskList taskList = this.ServiceProvider.GetService(typeof(SVsTaskList)) as IVsTaskList;

            if (taskList == null)
            {
                this.disposed = true;
            }
            else
            {
                // Register a custom category so Visual Studio will invoke our IVsTaskListEvents callbacks.
                VSTASKCATEGORY[] assignedCategory = new VSTASKCATEGORY[1];
                int hr = this.VsTaskList.RegisterCustomCategory(CategoryId, (uint)TaskCategory.Comments + 1, assignedCategory);
                ErrorHandler.ThrowOnFailure(hr);
                this.CustomCategory = (TaskCategory)assignedCategory[0];

                // The TaskProvider.ProviderGuid Property help says:
                // "The task list groups all tasks from multiple providers with the same GUID into a single list."
                // So the ProviderGuid is really just the group we're providing tasks for and not unique to us.
                this.ProviderGuid = ProviderId;
                this.ProviderName = "Tasks (" + MainPackage.Title + ")";

                // Hide this provider since we're using our own Tasks tool window.
                this.AlwaysVisible            = false;
                this.DisableAutoRoute         = false;
                this.MaintainInitialTaskOrder = false;

                this.foregroundTimer          = new System.Windows.Forms.Timer();
                this.foregroundTimer.Interval = (int)TimeSpan.FromSeconds(1).TotalMilliseconds;
                this.foregroundTimer.Tick    += this.ForegroundTimer_Tick;
                this.ScanDelay = TimeSpan.FromSeconds(2);

                this.CacheCommentTokens();
                this.solutionMonitor = new SolutionMonitor(this);
                this.documentMonitor = new DocumentMonitor(this);
                this.fileMonitor     = new FileMonitor(this);
                this.manager         = new FileItemManager(this, this.fileMonitor, package.Options);

                // Enable the timers last.  The BackgroundTimerCallback will fire after ScanDelay (on a worker thread),
                // so we have to ensure that everything is initialized before its first callback.
                this.foregroundTimer.Enabled = true;
                this.backgroundTimer         = new System.Threading.Timer(this.BackgroundTimerCallback, null, this.ScanDelay, this.ScanDelay);
            }
        }
Example #10
0
 internal TaskProviderItem(
     IServiceProvider serviceProvider,
     string message,
     SourceSpan rawSpan,
     VSTASKPRIORITY priority,
     VSTASKCATEGORY category,
     bool squiggle,
     LocationTracker spanTranslator
     )
 {
     _serviceProvider = serviceProvider;
     _message         = message;
     _rawSpan         = rawSpan;
     _spanTranslator  = spanTranslator;
     _rawSpan         = rawSpan;
     _priority        = priority;
     _category        = category;
     _squiggle        = squiggle;
 }
Example #11
0
        public MyTaskItem(IVsTaskProvider3 provider,
                          string document = "", int line = 0, int column = 0, string text = "", VSTASKCATEGORY category = VSTASKCATEGORY.CAT_USER, __VSERRORCATEGORY errorCategory = __VSERRORCATEGORY.EC_ERROR,
                          IEnumerable <string> customColumnText = null,
                          bool canDelete          = false, bool isChecked   = false, bool isReadOnly = false, bool hasHelp = false, bool customColumnsReadOnly = false,
                          int imageListIndex      = 0, int subcategoryIndex = 0,
                          VSTASKPRIORITY priority = VSTASKPRIORITY.TP_NORMAL)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            this.Provider  = provider;
            _document      = document;
            _line          = line;
            _column        = column;
            _text          = text;
            _category      = category;
            _errorCategory = errorCategory;

            if (customColumnText != null)
            {
                uint index = 0;
                foreach (var s in customColumnText)
                {
                    _customColumnText.Add(index++, s);
                }
            }

            _canDelete             = canDelete;
            _isChecked             = isChecked;
            _isReadOnly            = isReadOnly;
            _hasHelp               = hasHelp;
            _customColumnsReadOnly = customColumnsReadOnly;

            _imageListIndex   = imageListIndex;
            _subcategoryIndex = subcategoryIndex;

            _priority = priority;
        }
Example #12
0
            public TaskItemInfo(IVsTaskItem taskItem) {
                ErrorHandler.ThrowOnFailure(taskItem.Document(out Document));
                ErrorHandler.ThrowOnFailure(taskItem.get_Text(out Message));
                ErrorHandler.ThrowOnFailure(taskItem.Line(out Line));
                ErrorHandler.ThrowOnFailure(taskItem.Column(out Column));

                var priority = new VSTASKPRIORITY[1];
                ErrorHandler.ThrowOnFailure(taskItem.get_Priority(priority));
                Priority = priority[0];

                var category = new VSTASKCATEGORY[1];
                ErrorHandler.ThrowOnFailure(taskItem.Category(category));
                Category = category[0];

                var errorItem = taskItem as IVsErrorItem;
                if (errorItem != null) {
                    uint errorCategory;
                    ErrorHandler.ThrowOnFailure(errorItem.GetCategory(out errorCategory));
                    ErrorCategory = (__VSERRORCATEGORY)errorCategory;
                } else {
                    ErrorCategory = null;
                }
            }
 int IVsOutputWindowPane.OutputTaskItemStringEx(string pszOutputString, VSTASKPRIORITY nPriority, VSTASKCATEGORY nCategory, string pszSubcategory, int nBitmap, string pszFilename, uint nLineNum, string pszTaskItemText, string pszLookupKwd)
 {
     return(m_pane.Value.OutputTaskItemStringEx(pszOutputString, nPriority, nCategory, pszSubcategory, nBitmap, pszFilename, nLineNum, pszTaskItemText, pszLookupKwd));
 }
Example #14
0
 public TaskItem(ServiceProvider site, IVsTextLineMarker textLineMarker, string fileName, string text, bool readOnly, VSTASKCATEGORY cat, VSTASKPRIORITY pri, _vstaskbitmap bitmap, string helpKeyword) {
   this.site = site;
   this.text = text;
   this.fileName = fileName;
   this.textLineMarker = textLineMarker;
   this.helpKeyword = helpKeyword;
   this.category = cat;
   this.priority = pri;
   this.bitmap = bitmap;
   this.readOnly = readOnly;
 }
Example #15
0
 /// <include file='doc\Task.uex' path='docs/doc[@for="Task.IVsTaskItem.Category"]/*' />
 /// <internalonly/>
 int IVsTaskItem.Category(VSTASKCATEGORY[] cat)
 {
     if (cat != null) {
         cat[0] = (VSTASKCATEGORY)(uint)Category;
     }
     return NativeMethods.S_OK;
 }
Example #16
0
 public int Category(VSTASKCATEGORY[] pCat)
 {
     return VSConstants.E_NOTIMPL;
 }
 /// <summary>
 /// The auto filter.
 /// </summary>
 /// <param name="cat">
 /// The cat.
 /// </param>
 /// <returns>
 /// The auto filter.
 /// </returns>
 /// <exception cref="Exception">
 /// </exception>
 public int AutoFilter(VSTASKCATEGORY cat)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Example #18
0
 public TaskProviderItem FromErrorResult(IServiceProvider serviceProvider, AP.Error result, VSTASKPRIORITY priority, VSTASKCATEGORY category)
 {
     return(new TaskProviderItem(
                serviceProvider,
                result.message,
                GetSpan
                    (result),
                priority,
                category,
                true,
                _spanTranslator
                ));
 }
 public int OutputTaskItemStringEx(string pszOutputString, VSTASKPRIORITY nPriority, VSTASKCATEGORY nCategory, string pszSubcategory, int nBitmap, string pszFilename, uint nLineNum, string pszTaskItemText, string pszLookupKwd) {
     throw new NotImplementedException();
 }
 public int OutputTaskItemString(string pszOutputString, VSTASKPRIORITY nPriority, VSTASKCATEGORY nCategory, string pszSubcategory, int nBitmap, string pszFilename, uint nLineNum, string pszTaskItemText)
 {
     throw new NotImplementedException();
 }
 int IVsOutputWindowPane.OutputTaskItemString(string pszOutputString, VSTASKPRIORITY nPriority, VSTASKCATEGORY nCategory, string pszSubcategory, int nBitmap, string pszFilename, uint nLineNum, string pszTaskItemText)
 {
     throw new NotImplementedException();
 }
Example #22
0
 public int OutputTaskItemStringEx(string pszOutputString, VSTASKPRIORITY nPriority, VSTASKCATEGORY nCategory, string pszSubcategory, int nBitmap, string pszFilename, uint nLineNum, string pszTaskItemText, string pszLookupKwd)
 {
     return(VSConstants.S_OK);
 }
 /// <summary>
 /// The unregister custom category.
 /// </summary>
 /// <param name="catAssigned">
 /// The cat assigned.
 /// </param>
 /// <returns>
 /// The unregister custom category.
 /// </returns>
 /// <exception cref="Exception">
 /// </exception>
 public int UnregisterCustomCategory(VSTASKCATEGORY catAssigned)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 /// <summary>
 /// The register custom category.
 /// </summary>
 /// <param name="guidCat">
 /// The guid cat.
 /// </param>
 /// <param name="dwSortOrder">
 /// The dw sort order.
 /// </param>
 /// <param name="pCat">
 /// The p cat.
 /// </param>
 /// <returns>
 /// The register custom category.
 /// </returns>
 /// <exception cref="Exception">
 /// </exception>
 public int RegisterCustomCategory(ref Guid guidCat, uint dwSortOrder, VSTASKCATEGORY[] pCat)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 /// <summary>
 /// The dump output.
 /// </summary>
 /// <param name="dwReserved">
 /// The dw reserved.
 /// </param>
 /// <param name="cat">
 /// The cat.
 /// </param>
 /// <param name="pstmOutput">
 /// The pstm output.
 /// </param>
 /// <param name="pfOutputWritten">
 /// The pf output written.
 /// </param>
 /// <returns>
 /// The dump output.
 /// </returns>
 /// <exception cref="Exception">
 /// </exception>
 public int DumpOutput(uint dwReserved, VSTASKCATEGORY cat, IStream pstmOutput, out int pfOutputWritten)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Example #26
0
 public virtual void Category(VSTASKCATEGORY[] pCat){
   pCat[0] = this.category;
 }
Example #27
0
 /// <summary>
 /// The auto filter.
 /// </summary>
 /// <param name="cat">
 /// The cat.
 /// </param>
 /// <returns>
 /// The auto filter.
 /// </returns>
 /// <exception cref="Exception">
 /// </exception>
 public int AutoFilter(VSTASKCATEGORY cat)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Example #28
0
 public int DumpOutput(uint dwReserved, VSTASKCATEGORY cat, Microsoft.VisualStudio.OLE.Interop.IStream pstmOutput, out int pfOutputWritten)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Example #29
0
 /// <summary>
 /// The unregister custom category.
 /// </summary>
 /// <param name="catAssigned">
 /// The cat assigned.
 /// </param>
 /// <returns>
 /// The unregister custom category.
 /// </returns>
 /// <exception cref="Exception">
 /// </exception>
 public int UnregisterCustomCategory(VSTASKCATEGORY catAssigned)
 {
     throw new Exception("The method or operation is not implemented.");
 }
 int IVsOutputWindowPane.OutputTaskItemString(string pszOutputString, VSTASKPRIORITY priority, VSTASKCATEGORY category, string pszSubcategory, int bitmap, string pszFilename, uint lineNum, string pszTaskItemText)
 {
     throw new NotImplementedException();
 }
		public int OutputTaskItemStringEx(string pszOutputString, VSTASKPRIORITY nPriority, VSTASKCATEGORY nCategory, string pszSubcategory, int nBitmap, string pszFilename, uint nLineNum, string pszTaskItemText, string pszLookupKwd)
		{
			return VSConstants.S_OK;
		}
Example #32
0
 /// <summary>
 /// The dump output.
 /// </summary>
 /// <param name="dwReserved">
 /// The dw reserved.
 /// </param>
 /// <param name="cat">
 /// The cat.
 /// </param>
 /// <param name="pstmOutput">
 /// The pstm output.
 /// </param>
 /// <param name="pfOutputWritten">
 /// The pf output written.
 /// </param>
 /// <returns>
 /// The dump output.
 /// </returns>
 /// <exception cref="Exception">
 /// </exception>
 public int DumpOutput(uint dwReserved, VSTASKCATEGORY cat, IStream pstmOutput, out int pfOutputWritten)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Example #33
0
 public TaskProviderItem FromErrorResult(IServiceProvider serviceProvider, ErrorResult result, VSTASKPRIORITY priority, VSTASKCATEGORY category)
 {
     return(new TaskProviderItem(
                serviceProvider,
                result.Message,
                result.Span,
                priority,
                category,
                true,
                _snapshot
                ));
 }
Example #34
0
 protected VisualStudioTaskItemBase(VSTASKCATEGORY category, T taskItem)
 {
     this.ItemCategory = category;
     this.Info         = taskItem;
 }
Example #35
0
        public int OutputTaskItemStringEx(string pszOutputString, VSTASKPRIORITY nPriority, VSTASKCATEGORY nCategory, string pszSubcategory, int nBitmap, string pszFilename, uint nLineNum, string pszTaskItemText, string pszLookupKwd)
        {
            var result = target.OutputTaskItemStringEx(pszOutputString, nPriority, nCategory, pszSubcategory, nBitmap, pszFilename, nLineNum, pszTaskItemText, pszLookupKwd);

            if (ErrorHandler.Failed(result))
            {
                throw new Win32Exception(result);
            }

            return(result);
        }
Example #36
0
 public int Category(VSTASKCATEGORY[] pCat)
 {
   // Common.Trace("Task.Category");
   if (pCat != null) {
     switch (category) {
       case TaskCategory.Comment: pCat[0] = VSTASKCATEGORY.CAT_COMMENTS; break;
       case TaskCategory.User: pCat[0] = VSTASKCATEGORY.CAT_USER; break;
       case TaskCategory.Other: pCat[0] = VSTASKCATEGORY.CAT_MISC; break;
       case TaskCategory.Shortcut: pCat[0] = VSTASKCATEGORY.CAT_SHORTCUTS; break;
       default: {
           if (markerType == TaskMarker.CodeSense)
             pCat[0] = VSTASKCATEGORY.CAT_CODESENSE;
           else
             pCat[0] = VSTASKCATEGORY.CAT_BUILDCOMPILE;
           break;
         }
     }
   }
   return 0;
 }
 int IVsOutputWindowPane.OutputTaskItemStringEx(string pszOutputString, VSTASKPRIORITY priority, VSTASKCATEGORY category, string pszSubcategory, int bitmap, string pszFilename, uint lineNum, string pszTaskItemText, string pszLookupKwd)
 {
     throw new NotImplementedException();
 }
 int IVsOutputWindowPane.OutputTaskItemStringEx(string pszOutputString, VSTASKPRIORITY nPriority, VSTASKCATEGORY nCategory,
     string pszSubcategory, int nBitmap, string pszFilename, uint nLineNum, string pszTaskItemText, string pszLookupKwd)
 {
     throw new NotImplementedException();
 }
Example #39
0
 public virtual int Category(VSTASKCATEGORY[] pCat){
   pCat[0] = this.category;
   return 0;
 }