From 951acba1aa14265afb844e910d34601813db1b0a Mon Sep 17 00:00:00 2001 From: gentoo90 Date: Mon, 28 Mar 2016 23:39:12 +0300 Subject: [PATCH] Add lessc error message parsing Tries to find the line and the column in *.less file where error has occurred and shows it in Visual Studio's Error List. --- LessMsbuildTasks/NodelessCompile.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/LessMsbuildTasks/NodelessCompile.cs b/LessMsbuildTasks/NodelessCompile.cs index db03641..960938b 100644 --- a/LessMsbuildTasks/NodelessCompile.cs +++ b/LessMsbuildTasks/NodelessCompile.cs @@ -259,7 +259,18 @@ private bool CompileLessFile( string inputFilePath, string outputFilePath, strin if (!_Errors.Contains( errorStr )) { result = false; - Log.LogError( errorStr ); + try + { + var groups = Regex.Match(errorStr, @"(\w+):.*?on line (\d+), column (\d+):").Groups; + var errorClass = groups[1].Value; + var line = Int32.Parse(groups[2].Value); + var column = Int32.Parse(groups[3].Value); + Log.LogError("CompileLessFile", "", errorClass, inputFilePath, line, column, line, column, errorStr); + } + catch + { + Log.LogError(errorStr); + } _Errors.Add( errorStr ); } }