Exemple #1
0
        /// <summary>
        /// Calculates the hash code of the <see cref="ITableEntry"/> as if it was already mapped to a diagnostic info instance.
        /// </summary>
        /// <param name="entry">The <see cref="ITableEntry"/>.</param>
        /// <returns>The calculated hash code.</returns>
        public static int DiagnosticInfoHashCode(this ITableEntry entry)
        {
            if (!entry.TryGetValue(StandardTableKeyNames.ErrorSeverity, out __VSERRORCATEGORY errorCategory))
            {
                errorCategory = __VSERRORCATEGORY.EC_MESSAGE;
            }

            entry.TryGetValue(StandardTableKeyNames.DocumentName, out string path);
            entry.TryGetValue(StandardTableKeyNames.Text, out string text);
            entry.TryGetValue(StandardTableKeyNames.FullText, out string fullText);
            entry.TryGetValue(StandardTableKeyNames.ErrorCode, out string errorCode);
            entry.TryGetValue(StandardTableKeyNames.HelpLink, out string helpLink);
            entry.TryGetValue(StandardTableKeyNames.Line, out int line);
            entry.TryGetValue(StandardTableKeyNames.Column, out int column);
            entry.TryGetValue(StandardTableKeyNames.SuppressionState, out SuppressionState suppressionState);

            var isActive = SuppressionStateToIsActive(suppressionState);

            if (string.IsNullOrWhiteSpace(fullText))
            {
                fullText = text;
            }

            return(DiagnosticInfo.GetHashCode(path, line, (int)MapErrorCategoryToSeverity(errorCategory), column, errorCode, fullText, isActive));
        }