Skip to content

Commit

Permalink
[vcpkg] Emit parse errors to match '<file>:<line>:<col>: error: <text…
Browse files Browse the repository at this point in the history
…>' for better IDE compatibility (microsoft#15926)

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
  • Loading branch information
ras0219 and ras0219-msft authored Feb 3, 2021
1 parent 0c32fc5 commit 5f05aa2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion toolsrc/src/vcpkg-test/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: ,
^
)");
Expand Down
2 changes: 1 addition & 1 deletion toolsrc/src/vcpkg/base/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions toolsrc/src/vcpkg/base/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f05aa2

Please sign in to comment.