mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 01:24:47 +08:00
[vcpkg] Emit parse errors to match '<file>:<line>:<col>: error: <text>' for better IDE compatibility (#15926)
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
parent
0c32fc522d
commit
5f05aa2b6e
@ -234,7 +234,7 @@ TEST_CASE ("JSON track newlines", "[json]")
|
||||
auto res = Json::parse("{\n,", fs::u8path("filename"));
|
||||
REQUIRE(!res);
|
||||
REQUIRE(res.error()->format() ==
|
||||
R"(Error: filename:2:1: Unexpected character; expected property name
|
||||
R"(filename:2:1: error: Unexpected character; expected property name
|
||||
on expression: ,
|
||||
^
|
||||
)");
|
||||
|
@ -1062,7 +1062,7 @@ namespace vcpkg::Json
|
||||
ExpectedT<std::pair<Value, JsonStyle>, std::unique_ptr<Parse::IParseError>> parse(StringView json,
|
||||
const fs::path& filepath) noexcept
|
||||
{
|
||||
return Parser::parse(json, fs::generic_u8string(filepath));
|
||||
return Parser::parse(json, fs::u8string(filepath));
|
||||
}
|
||||
ExpectedT<std::pair<Value, JsonStyle>, std::unique_ptr<Parse::IParseError>> parse(StringView json,
|
||||
StringView origin) noexcept
|
||||
|
@ -34,13 +34,12 @@ namespace vcpkg::Parse
|
||||
caret_spacing.push_back(cp == '\t' ? '\t' : ' ');
|
||||
}
|
||||
|
||||
return Strings::concat("Error: ",
|
||||
origin,
|
||||
return Strings::concat(origin,
|
||||
":",
|
||||
row,
|
||||
":",
|
||||
column,
|
||||
": ",
|
||||
": error: ",
|
||||
message,
|
||||
"\n"
|
||||
" on expression: ", // 18 columns
|
||||
|
Loading…
Reference in New Issue
Block a user