Log initialization options, reactivate working file asserts.

This commit is contained in:
Jacob Dufault 2017-04-25 18:32:45 -07:00
parent f3719de08c
commit c77531a432
2 changed files with 14 additions and 8 deletions

View File

@ -967,7 +967,7 @@ void ParseFile(IndexerConfig* config,
std::vector<std::unique_ptr<IndexedFile>> indexes = Parse(
config, file_consumer_shared,
tu_path, tu_args);
time.ResetAndPrint("Parsing/indexing " + tu_path + " with args " + StringJoin(tu_args));
time.ResetAndPrint("Parsing/indexing " + tu_path);
for (std::unique_ptr<IndexedFile>& new_index : indexes) {
std::cerr << "Got index for " << new_index->path << std::endl;
@ -1240,6 +1240,13 @@ bool QueryDbMainLoop(
switch (message->method_id) {
case IpcId::Initialize: {
auto request = static_cast<Ipc_InitializeRequest*>(message.get());
// Log initialization parameters.
rapidjson::StringBuffer output;
Writer writer(output);
Reflect(writer, request->params.initializationOptions);
std::cerr << output.GetString() << std::endl;
if (request->params.rootUri) {
std::string project_path = request->params.rootUri->GetPath();
std::cerr << "[querydb] Initialize in directory " << project_path

View File

@ -74,9 +74,9 @@ optional<int> WorkingFile::GetBufferLineFromIndexLine(int index_line) const {
// Note: |index_line| and |buffer_line| are 1-based.
// TODO: reenable this assert once we are using the real indexed file.
//assert(index_line >= 1 && index_line <= index_lines.size());
if (index_line < 1 || index_line > index_lines.size())
return nullopt;
assert(index_line >= 1 && index_line <= index_lines.size());
//if (index_line < 1 || index_line > index_lines.size())
// return nullopt;
// Find the line in the cached index file. We'll try to find the most similar line
// in the buffer and return the index for that.
@ -108,10 +108,9 @@ optional<int> WorkingFile::GetIndexLineFromBufferLine(int buffer_line) const {
// See GetBufferLineFromIndexLine for additional comments.
// Note: |index_line| and |buffer_line| are 1-based.
// TODO: Consider making this an assert.
if (buffer_line < 1 || buffer_line > all_buffer_lines.size())
return nullopt;
assert(buffer_line >= 1 && buffer_line < all_buffer_lines.size());
//if (buffer_line < 1 || buffer_line > all_buffer_lines.size())
// return nullopt;
// Find the line in the index file. We'll try to find the most similar line
// in the index file and return the index for that.