Valloric/YouCompleteMe — pull request #752 by nharraud (2014-01-01 21:38:51+00:00)
Title: Improve detailed diagnostic

The messages printed by the command YcmShowDetailedDiagnostic are quite different from the one generated by clang.
1. format can be improved: there are no new lines between messages.
2. content can be improved: only the diagnostic messages are shown. No context is displayed like the ones clang display with the option "-fcaret-diagnostics"

This patch:
1. adds new lines between messages
2. adds context messages a la clang. It displays even more information than clang. It shows all the ranges of code in all the files corresponding to a diagnostic. I added this because we show only one diagnostic at a time so there are less messages than a full compilation would generate.

For example:
with files main.hpp and main.cpp like this:
```
#ifndef _TMP_MAIN_HPP_
#define _TMP_MAIN_HPP_

#include

#define TEST t

namespace nam {
int test(char c, int a)
{
return a;
}

int test(std::string s, int i)
{
return std::stoi(s);
}
}
class Test {
};

#endif /* _TMP_MAIN_HPP_ */
```
```
#include
#include

#include

int main()
{
Test t;
if (TEST

(1) == std::string("a"))
return 0;
(2) if (nam::test)
return 32;
(3) nam::test('s', t);
return 42;
}
```

we would display the diagnostics:
diagnostic 1
```
/.../projects/programming/tmp/src/main.cpp:14:11: error: invalid operands to binary expression ('Test' and 'std::string' (aka 'basic_string, allocator >')
)
10: if (TEST
~~~~
14: == std::string("a"))
^ ~~~~~~~~~~~~~~~~
```
diagnostic 2
```
/.../projects/programming/tmp/src/main.cpp:16:7: error: reference to overloaded function could not be resolved; did you mean to call it?
16: if (nam::test)
^~~~~~~~~
/.../projects/programming/tmp/./src/main.hpp:9:5: note: possible target for call
9: int test(char c, int a)
^
/.../projects/programming/tmp/./src/main.hpp:14:5: note: possible target for call
14: int test(std::string s, int i)
^
```

diagnostic 3
```
/.../projects/programming/tmp/src/main.cpp:18:3: error: no matching function for call to 'test'
18: nam::test('s', t);
^~~~~~~~~
/.../projects/programming/tmp/./src/main.hpp:9:5: note: candidate function not viable: no known conversion from 'Test' to 'int' for 2nd argument
9: int test(char c, int a)
^
/.../projects/programming/tmp/src/main.cpp: context:
18: nam::test('s', t);
~
/.../projects/programming/tmp/./src/main.hpp:14:5: note: candidate function not viable: no known conversion from 'char' to 'std::string' (aka 'basic_string, all
ocator >') for 1st argument
14: int test(std::string s, int i)
^
/.../projects/programming/tmp/src/main.cpp: context:
18: nam::test('s', t);
~~~
```