Пример #1
0
        private static string GetMessage(ITableEntryHandle item)
        {
            var source    = item.GetBuildTool();
            var document  = Path.GetFileName(item.GetPath() ?? item.GetDocumentName()) ?? "<unknown>";
            var line      = item.GetLine() ?? -1;
            var column    = item.GetColumn() ?? -1;
            var errorCode = item.GetErrorCode() ?? "<unknown>";
            var text      = item.GetText() ?? "<unknown>";
            var severity  = item.GetCategory() switch
            {
                __VSERRORCATEGORY.EC_ERROR => "error",
                __VSERRORCATEGORY.EC_WARNING => "warning",
                __VSERRORCATEGORY.EC_MESSAGE => "info",
                var unknown => unknown.ToString(),
            };

            var message = $"({source}) {document}({line + 1}, {column + 1}): {severity} {errorCode}: {text}";

            return(message);
        }