Reformat code

This commit is contained in:
Jacob Dufault 2017-11-19 14:11:54 -08:00
parent 297ed1d13e
commit 97417ecc93
9 changed files with 537 additions and 529 deletions

View File

@ -146,7 +146,8 @@ void BuildDetailString(CXCompletionString completion_string,
case CXCompletionChunk_Optional: {
CXCompletionString nested =
clang_getCompletionChunkCompletionString(completion_string, i);
BuildDetailString(nested, label, detail, insert, parameters, include_snippets);
BuildDetailString(nested, label, detail, insert, parameters,
include_snippets);
break;
}
@ -156,7 +157,10 @@ void BuildDetailString(CXCompletionString completion_string,
parameters->push_back(text);
detail += text;
// Add parameter declarations as snippets if enabled
if (include_snippets) { insert += "${" + std::to_string(parameters->size()) + ":" + text + "}"; }
if (include_snippets) {
insert +=
"${" + std::to_string(parameters->size()) + ":" + text + "}";
}
break;
}
@ -198,7 +202,9 @@ void BuildDetailString(CXCompletionString completion_string,
detail += "(";
insert += "(";
// Put cursor between parentheses if snippets are not enabled
if (!include_snippets) { insert += "$1"; }
if (!include_snippets) {
insert += "$1";
}
break;
case CXCompletionChunk_RightParen:
detail += ")";
@ -231,7 +237,9 @@ void BuildDetailString(CXCompletionString completion_string,
case CXCompletionChunk_Comma:
detail += ", ";
// Only put comma's between parentheses if snippets are enabled
if (include_snippets) { insert += ", "; }
if (include_snippets) {
insert += ", ";
}
break;
case CXCompletionChunk_Colon:
detail += ":";
@ -409,9 +417,9 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
// kind/label/detail/docs/sortText
ls_completion_item.kind = GetCompletionKind(result.CursorKind);
BuildDetailString(result.CompletionString, ls_completion_item.label,
ls_completion_item.detail,
ls_completion_item.insertText,
BuildDetailString(
result.CompletionString, ls_completion_item.label,
ls_completion_item.detail, ls_completion_item.insertText,
&ls_completion_item.parameters_,
completion_manager->config_->enableSnippetInsertion);

View File

@ -65,7 +65,8 @@ struct Config {
// Version of the client.
int clientVersion = 0;
// If true parameter declarations are included in code completion when calling a function or method
// If true parameter declarations are included in code completion when calling
// a function or method
bool enableSnippetInsertion = true;
};
MAKE_REFLECT_STRUCT(Config,

View File

@ -114,7 +114,8 @@ TEST_SUITE("FindIncludeLine") {
REQUIRE(parse_correct("Content-Length: 4\r\n\r\nabcd") == "abcd");
REQUIRE(parse_incorrect("ggg") == optional<std::string>());
REQUIRE(parse_incorrect("Content-Length: 0\r\n") == optional<std::string>());
REQUIRE(parse_incorrect("Content-Length: 0\r\n") ==
optional<std::string>());
REQUIRE(parse_incorrect("Content-Length: 5\r\n\r\nab") ==
optional<std::string>());
}
@ -217,7 +218,7 @@ void lsDocumentUri::SetPath(const std::string& path) {
raw_uri = ReplaceAll(raw_uri, "(", "%28");
raw_uri = ReplaceAll(raw_uri, ")", "%29");
// TODO: proper fix
// TODO: proper fix
#if defined(_WIN32)
raw_uri = "file:///" + raw_uri;
#else
@ -255,7 +256,7 @@ std::string lsDocumentUri::GetPath() const {
std::replace(result.begin(), result.end(), '\\', '/');
#if defined(_WIN32)
// std::transform(result.begin(), result.end(), result.begin(), ::tolower);
// std::transform(result.begin(), result.end(), result.begin(), ::tolower);
#endif
return result;

View File

@ -28,7 +28,8 @@ std::vector<std::string> Split(const std::string& s, char delim) {
return elems;
}
std::string Join(const std::vector<std::string>& entries, char delim,
std::string Join(const std::vector<std::string>& entries,
char delim,
size_t end) {
std::string result;
bool first = true;

View File

@ -157,7 +157,7 @@ std::string GetWorkingDirectory() {
std::string NormalizePath(const std::string& path) {
errno = 0;
char name[PATH_MAX + 1];
(void) realpath(path.c_str(), name);
(void)realpath(path.c_str(), name);
if (errno)
return path;
return name;

View File

@ -52,15 +52,10 @@ static std::vector<std::string> kBlacklistMulti = {
// Blacklisted flags which are always removed from the command line.
static std::vector<std::string> kBlacklist = {
"-c",
"-MP",
"-MD",
"-MMD",
"--fcolor-diagnostics",
"-c", "-MP", "-MD", "-MMD", "--fcolor-diagnostics",
// This strips path-like args but is a bit hacky.
"/",
"..",
"/", "..",
};
// Arguments which are followed by a potentially relative path. We need to make
@ -412,8 +407,7 @@ void Project::ForAllFilteredFiles(
}
TEST_SUITE("Project") {
void CheckFlags(const std::string& directory,
const std::string& file,
void CheckFlags(const std::string& directory, const std::string& file,
std::vector<std::string> raw,
std::vector<std::string> expected) {
g_disable_normalize_path_for_test = true;
@ -795,7 +789,8 @@ TEST_SUITE("Project") {
"-std=gnu++14",
"-fno-rtti",
"-nostdinc++",
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++/trunk/"
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++/"
"trunk/"
"include",
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++abi/"
"trunk/"
@ -1113,7 +1108,8 @@ TEST_SUITE("Project") {
"-std=gnu++14",
"-fno-rtti",
"-nostdinc++",
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++/trunk/"
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++/"
"trunk/"
"include",
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++abi/"
"trunk/"

View File

@ -603,7 +603,7 @@ IndexUpdate::IndexUpdate(const IdMap& previous_id_map,
}
void IndexUpdate::Merge(const IndexUpdate& update) {
// This function runs on an indexer thread.
// This function runs on an indexer thread.
#define INDEX_UPDATE_APPEND(name) AddRange(&name, update.name);
#define INDEX_UPDATE_MERGE(name) AddMergeableRange(&name, update.name);
@ -890,7 +890,8 @@ TEST_SUITE("query") {
REQUIRE(update.funcs_callers[0].to_remove[0].loc.range ==
Range(Position(1, 0)));
REQUIRE(update.funcs_callers[0].to_add.size() == 1);
REQUIRE(update.funcs_callers[0].to_add[0].loc.range == Range(Position(2, 0)));
REQUIRE(update.funcs_callers[0].to_add[0].loc.range ==
Range(Position(2, 0)));
}
TEST_CASE("type usages") {