mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-19 12:05:50 +00:00
Run ./format.sh
This commit is contained in:
parent
066166ba40
commit
9b44bf7901
@ -1578,8 +1578,8 @@ bool QueryDbMainLoop(Config* config,
|
||||
|
||||
// Open up / load the project.
|
||||
project->Load(config->extraClangArguments,
|
||||
config->compilationDatabaseDirectory,
|
||||
project_path, config->resourceDirectory);
|
||||
config->compilationDatabaseDirectory, project_path,
|
||||
config->resourceDirectory);
|
||||
time.ResetAndPrint("[perf] Loaded compilation entries (" +
|
||||
std::to_string(project->entries.size()) +
|
||||
" files)");
|
||||
@ -2027,7 +2027,6 @@ bool QueryDbMainLoop(Config* config,
|
||||
is_global_completion, existing_completion,
|
||||
msg](const NonElidedVector<lsCompletionItem>& results,
|
||||
bool is_cached_result) {
|
||||
|
||||
Out_TextDocumentComplete complete_response;
|
||||
complete_response.id = msg->id;
|
||||
complete_response.result.items = results;
|
||||
@ -2070,7 +2069,6 @@ bool QueryDbMainLoop(Config* config,
|
||||
[global_code_complete_cache](
|
||||
NonElidedVector<lsCompletionItem> results,
|
||||
bool is_cached_result) {
|
||||
|
||||
assert(!is_cached_result);
|
||||
|
||||
// note: path is updated in the normal completion handler.
|
||||
|
@ -1188,8 +1188,10 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
||||
if (!is_template_specialization) {
|
||||
func->def.short_name = decl->entityInfo->name;
|
||||
|
||||
// Set the |is_operator| flag to true if the function name starts with "operator"
|
||||
func->def.is_operator = func->def.short_name.compare(0, 8, "operator") == 0;
|
||||
// Set the |is_operator| flag to true if the function name starts with
|
||||
// "operator"
|
||||
func->def.is_operator =
|
||||
func->def.short_name.compare(0, 8, "operator") == 0;
|
||||
|
||||
// Build detailed name. The type desc looks like void (void *). We
|
||||
// insert the qualified name before the first '('.
|
||||
|
@ -471,12 +471,7 @@ struct IndexInclude {
|
||||
// Used to identify the language at a file level. The ordering is important, as
|
||||
// a file previously identified as `C`, will be changed to `Cpp` if it
|
||||
// encounters a c++ declaration.
|
||||
enum class LanguageId {
|
||||
Unknown = 0,
|
||||
C = 1,
|
||||
Cpp = 2,
|
||||
ObjC = 3
|
||||
};
|
||||
enum class LanguageId { Unknown = 0, C = 1, Cpp = 2, ObjC = 3 };
|
||||
MAKE_REFLECT_TYPE_PROXY(LanguageId, std::underlying_type<LanguageId>::type);
|
||||
|
||||
struct IndexFile {
|
||||
|
@ -1180,17 +1180,19 @@ MAKE_REFLECT_STRUCT(lsSignatureHelp,
|
||||
activeSignature,
|
||||
activeParameter);
|
||||
|
||||
// MarkedString can be used to render human readable text. It is either a markdown string
|
||||
// or a code-block that provides a language and a code snippet. The language identifier
|
||||
// is sematically equal to the optional language identifier in fenced code blocks in GitHub
|
||||
// issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
|
||||
// MarkedString can be used to render human readable text. It is either a
|
||||
// markdown string or a code-block that provides a language and a code snippet.
|
||||
// The language identifier is sematically equal to the optional language
|
||||
// identifier in fenced code blocks in GitHub issues. See
|
||||
// https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
|
||||
//
|
||||
// The pair of a language and a value is an equivalent to markdown:
|
||||
// ```${language}
|
||||
// ${value}
|
||||
// ```
|
||||
//
|
||||
// Note that markdown strings will be sanitized - that means html will be escaped.
|
||||
// Note that markdown strings will be sanitized - that means html will be
|
||||
// escaped.
|
||||
struct lsMarkedString {
|
||||
std::string language;
|
||||
std::string value;
|
||||
|
@ -42,8 +42,8 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// Returns the canonicalized absolute pathname, without expanding symbolic links.
|
||||
// This is a variant of realpath(2), C++ rewrite of
|
||||
// Returns the canonicalized absolute pathname, without expanding symbolic
|
||||
// links. This is a variant of realpath(2), C++ rewrite of
|
||||
// https://github.com/freebsd/freebsd/blob/master/lib/libc/stdlib/realpath.c
|
||||
optional<std::string> RealPathNotExpandSymlink(std::string path) {
|
||||
if (path.empty()) {
|
||||
|
@ -202,8 +202,7 @@ std::vector<Project::Entry> LoadFromDirectoryListing(ProjectConfig* config) {
|
||||
|
||||
std::vector<std::string> args;
|
||||
std::cerr << "Using arguments: ";
|
||||
for (const std::string& line :
|
||||
ReadLines(config->project_dir + "/.cquery")) {
|
||||
for (const std::string& line : ReadLines(config->project_dir + "/.cquery")) {
|
||||
if (line.empty() || StartsWith(line, "#"))
|
||||
continue;
|
||||
if (!args.empty())
|
||||
@ -241,8 +240,7 @@ std::vector<Project::Entry> LoadCompilationEntriesFromDirectory(
|
||||
compilation_db_dir.c_str(), &cx_db_load_error);
|
||||
if (cx_db_load_error == CXCompilationDatabase_CanNotLoadDatabase) {
|
||||
LOG_S(INFO) << "Unable to load compile_commands.json located at \""
|
||||
<< compilation_db_dir
|
||||
<< "\"; using directory listing instead.";
|
||||
<< compilation_db_dir << "\"; using directory listing instead.";
|
||||
return LoadFromDirectoryListing(config);
|
||||
}
|
||||
|
||||
@ -351,8 +349,8 @@ void Project::Load(const std::vector<std::string>& extra_flags,
|
||||
config.extra_flags = extra_flags;
|
||||
config.project_dir = root_directory;
|
||||
config.resource_dir = resource_directory;
|
||||
entries = LoadCompilationEntriesFromDirectory(&config,
|
||||
opt_compilation_db_dir);
|
||||
entries =
|
||||
LoadCompilationEntriesFromDirectory(&config, opt_compilation_db_dir);
|
||||
|
||||
// Cleanup / postprocess include directories.
|
||||
quote_include_directories.assign(config.quote_dirs.begin(),
|
||||
|
@ -33,9 +33,9 @@ struct Project {
|
||||
//
|
||||
// If |opt_compilation_db_dir| is not empty, the compile_commands.json
|
||||
// file in it will be used to discover all files and args. If it's empty and
|
||||
// |root_directory| contains a compile_commands.json file, that one will be used
|
||||
// instead. Otherwise, a recursive directory listing of all *.cpp, *.cc, *.h,
|
||||
// and *.hpp files will be used. clang arguments can be specified in a
|
||||
// |root_directory| contains a compile_commands.json file, that one will be
|
||||
// used instead. Otherwise, a recursive directory listing of all *.cpp, *.cc,
|
||||
// *.h, and *.hpp files will be used. clang arguments can be specified in a
|
||||
// .cquery file located inside of |root_directory|.
|
||||
void Load(const std::vector<std::string>& extra_flags,
|
||||
const std::string& opt_compilation_db_dir,
|
||||
|
@ -329,14 +329,17 @@ void WorkingFiles::OnChange(const Ipc_TextDocumentDidChange::Params& change) {
|
||||
// std::cerr << "|" << file->buffer_content << "|" << std::endl;
|
||||
// Per the spec replace everything if the rangeLength and range are not set.
|
||||
// See https://github.com/Microsoft/language-server-protocol/issues/9.
|
||||
if (diff.rangeLength == -1 && diff.range.start == lsPosition::kZeroPosition
|
||||
&& diff.range.end == lsPosition::kZeroPosition) {
|
||||
if (diff.rangeLength == -1 &&
|
||||
diff.range.start == lsPosition::kZeroPosition &&
|
||||
diff.range.end == lsPosition::kZeroPosition) {
|
||||
file->buffer_content = diff.text;
|
||||
file->OnBufferContentUpdated();
|
||||
// std::cerr << "-> Replacing entire content";
|
||||
} else {
|
||||
int start_offset = GetOffsetForPosition(diff.range.start, file->buffer_content);
|
||||
int end_offset = GetOffsetForPosition(diff.range.end, file->buffer_content);
|
||||
int start_offset =
|
||||
GetOffsetForPosition(diff.range.start, file->buffer_content);
|
||||
int end_offset =
|
||||
GetOffsetForPosition(diff.range.end, file->buffer_content);
|
||||
int length = diff.rangeLength;
|
||||
if (length == -1) {
|
||||
length = end_offset - start_offset;
|
||||
@ -346,8 +349,7 @@ void WorkingFiles::OnChange(const Ipc_TextDocumentDidChange::Params& change) {
|
||||
// start_offset << std::endl;
|
||||
file->buffer_content.replace(
|
||||
file->buffer_content.begin() + start_offset,
|
||||
file->buffer_content.begin() + start_offset + length,
|
||||
diff.text);
|
||||
file->buffer_content.begin() + start_offset + length, diff.text);
|
||||
file->OnBufferContentUpdated();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user