mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 17:41:58 +00:00
Reformat code
This commit is contained in:
parent
297ed1d13e
commit
97417ecc93
@ -146,7 +146,8 @@ void BuildDetailString(CXCompletionString completion_string,
|
|||||||
case CXCompletionChunk_Optional: {
|
case CXCompletionChunk_Optional: {
|
||||||
CXCompletionString nested =
|
CXCompletionString nested =
|
||||||
clang_getCompletionChunkCompletionString(completion_string, i);
|
clang_getCompletionChunkCompletionString(completion_string, i);
|
||||||
BuildDetailString(nested, label, detail, insert, parameters, include_snippets);
|
BuildDetailString(nested, label, detail, insert, parameters,
|
||||||
|
include_snippets);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +157,10 @@ void BuildDetailString(CXCompletionString completion_string,
|
|||||||
parameters->push_back(text);
|
parameters->push_back(text);
|
||||||
detail += text;
|
detail += text;
|
||||||
// Add parameter declarations as snippets if enabled
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +202,9 @@ void BuildDetailString(CXCompletionString completion_string,
|
|||||||
detail += "(";
|
detail += "(";
|
||||||
insert += "(";
|
insert += "(";
|
||||||
// Put cursor between parentheses if snippets are not enabled
|
// Put cursor between parentheses if snippets are not enabled
|
||||||
if (!include_snippets) { insert += "$1"; }
|
if (!include_snippets) {
|
||||||
|
insert += "$1";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CXCompletionChunk_RightParen:
|
case CXCompletionChunk_RightParen:
|
||||||
detail += ")";
|
detail += ")";
|
||||||
@ -231,7 +237,9 @@ void BuildDetailString(CXCompletionString completion_string,
|
|||||||
case CXCompletionChunk_Comma:
|
case CXCompletionChunk_Comma:
|
||||||
detail += ", ";
|
detail += ", ";
|
||||||
// Only put comma's between parentheses if snippets are enabled
|
// Only put comma's between parentheses if snippets are enabled
|
||||||
if (include_snippets) { insert += ", "; }
|
if (include_snippets) {
|
||||||
|
insert += ", ";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CXCompletionChunk_Colon:
|
case CXCompletionChunk_Colon:
|
||||||
detail += ":";
|
detail += ":";
|
||||||
@ -409,9 +417,9 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
|
|||||||
|
|
||||||
// kind/label/detail/docs/sortText
|
// kind/label/detail/docs/sortText
|
||||||
ls_completion_item.kind = GetCompletionKind(result.CursorKind);
|
ls_completion_item.kind = GetCompletionKind(result.CursorKind);
|
||||||
BuildDetailString(result.CompletionString, ls_completion_item.label,
|
BuildDetailString(
|
||||||
ls_completion_item.detail,
|
result.CompletionString, ls_completion_item.label,
|
||||||
ls_completion_item.insertText,
|
ls_completion_item.detail, ls_completion_item.insertText,
|
||||||
&ls_completion_item.parameters_,
|
&ls_completion_item.parameters_,
|
||||||
completion_manager->config_->enableSnippetInsertion);
|
completion_manager->config_->enableSnippetInsertion);
|
||||||
|
|
||||||
|
@ -65,7 +65,8 @@ struct Config {
|
|||||||
// Version of the client.
|
// Version of the client.
|
||||||
int clientVersion = 0;
|
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;
|
bool enableSnippetInsertion = true;
|
||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(Config,
|
MAKE_REFLECT_STRUCT(Config,
|
||||||
|
@ -114,7 +114,8 @@ TEST_SUITE("FindIncludeLine") {
|
|||||||
REQUIRE(parse_correct("Content-Length: 4\r\n\r\nabcd") == "abcd");
|
REQUIRE(parse_correct("Content-Length: 4\r\n\r\nabcd") == "abcd");
|
||||||
|
|
||||||
REQUIRE(parse_incorrect("ggg") == optional<std::string>());
|
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") ==
|
REQUIRE(parse_incorrect("Content-Length: 5\r\n\r\nab") ==
|
||||||
optional<std::string>());
|
optional<std::string>());
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ std::vector<std::string> Split(const std::string& s, char delim) {
|
|||||||
return elems;
|
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) {
|
size_t end) {
|
||||||
std::string result;
|
std::string result;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
@ -52,15 +52,10 @@ static std::vector<std::string> kBlacklistMulti = {
|
|||||||
|
|
||||||
// Blacklisted flags which are always removed from the command line.
|
// Blacklisted flags which are always removed from the command line.
|
||||||
static std::vector<std::string> kBlacklist = {
|
static std::vector<std::string> kBlacklist = {
|
||||||
"-c",
|
"-c", "-MP", "-MD", "-MMD", "--fcolor-diagnostics",
|
||||||
"-MP",
|
|
||||||
"-MD",
|
|
||||||
"-MMD",
|
|
||||||
"--fcolor-diagnostics",
|
|
||||||
|
|
||||||
// This strips path-like args but is a bit hacky.
|
// This strips path-like args but is a bit hacky.
|
||||||
"/",
|
"/", "..",
|
||||||
"..",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Arguments which are followed by a potentially relative path. We need to make
|
// Arguments which are followed by a potentially relative path. We need to make
|
||||||
@ -412,8 +407,7 @@ void Project::ForAllFilteredFiles(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_SUITE("Project") {
|
TEST_SUITE("Project") {
|
||||||
void CheckFlags(const std::string& directory,
|
void CheckFlags(const std::string& directory, const std::string& file,
|
||||||
const std::string& file,
|
|
||||||
std::vector<std::string> raw,
|
std::vector<std::string> raw,
|
||||||
std::vector<std::string> expected) {
|
std::vector<std::string> expected) {
|
||||||
g_disable_normalize_path_for_test = true;
|
g_disable_normalize_path_for_test = true;
|
||||||
@ -795,7 +789,8 @@ TEST_SUITE("Project") {
|
|||||||
"-std=gnu++14",
|
"-std=gnu++14",
|
||||||
"-fno-rtti",
|
"-fno-rtti",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++/trunk/"
|
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++/"
|
||||||
|
"trunk/"
|
||||||
"include",
|
"include",
|
||||||
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++abi/"
|
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++abi/"
|
||||||
"trunk/"
|
"trunk/"
|
||||||
@ -1113,7 +1108,8 @@ TEST_SUITE("Project") {
|
|||||||
"-std=gnu++14",
|
"-std=gnu++14",
|
||||||
"-fno-rtti",
|
"-fno-rtti",
|
||||||
"-nostdinc++",
|
"-nostdinc++",
|
||||||
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++/trunk/"
|
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++/"
|
||||||
|
"trunk/"
|
||||||
"include",
|
"include",
|
||||||
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++abi/"
|
"-isystem&/w/c/s/out/Release/../../buildtools/third_party/libc++abi/"
|
||||||
"trunk/"
|
"trunk/"
|
||||||
|
@ -890,7 +890,8 @@ TEST_SUITE("query") {
|
|||||||
REQUIRE(update.funcs_callers[0].to_remove[0].loc.range ==
|
REQUIRE(update.funcs_callers[0].to_remove[0].loc.range ==
|
||||||
Range(Position(1, 0)));
|
Range(Position(1, 0)));
|
||||||
REQUIRE(update.funcs_callers[0].to_add.size() == 1);
|
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") {
|
TEST_CASE("type usages") {
|
||||||
|
Loading…
Reference in New Issue
Block a user