Open SX91 opened 5 years ago
Here is another instance where Unicode characters cause problems:
/**
* �
*/
#define foo 0 // Some comments
#define BAR 1 // Yet another comment
#define BAZ_foo 2 // Even more comments
Select all of it, right click, Reformat current Statement with clang format:
/**
* �
#define foo 0 Some comments
#define BAR 1 Yet another comment
#define BAZ_foo 2 Even more comments
Another example:
/**
* �
*/
#define FOO 0 // Comments
#define BAR 1 // More comments
#define BAZ 2 // Even more
becomes:
/**
* �
*/
#define FOO Comments
#define BAR More comments
#define BAZ Even more
edit: CLion 2018.3.2, plugin v1.1.0
Same problem here:
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this
// in one cpp file
#include "catch.hpp"
SCENARIO("Artikel können in Lager geliefert werden", "[Lagerverwaltung]") {
GIVEN("eine leere Lagerverwaltung") {
//Lagerverwaltung lager;
//REQUIRE( lager.lagerbestand().empty() );
REQUIRE(true);
// lager.anlieferung_buchen({"test", 42});
// lager.anlieferung_buchen({"test", 42});
// auto const lieferbar = lager.ist_lieferbar({"test", -1});
}
}
becomes
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this
// in one cpp file
#include "catch.hpp"
SCENARIO("Artikel können in Lager geliefert werden", "[Lagerverwaltung]") {
GIVEN("eine leere Lagerverwaltung") {
/L agerverwaltung lager;
//R EQUIRE( lager.lagerbestand().empty() );
REQUIRE(true);
// lager.anlieferung_buchen({"test", 42});
/ lager.anlieferung_buchen({"test", 42});
/ auto const lieferbar = lager.ist_lieferbar({"test", -1});
}
}
I'm using CLion 2018.3.4 on macOS. The plugin version is v1.1.0.
The root cause is that clang-format accept BYTE offset as input, but the plugin pass in char offset.
If you'd try to format the above code with the plugin, you'll see the file content gets destroyed.
CLion 2018.3.2, latest plugin from marketplace.