message: textDocument/didOpen: add args to override project entry
diff: @@ -14,10 +14,15 @@ struct Ipc_TextDocumentDidOpen
  const static IpcId kIpcId = IpcId::TextDocumentDidOpen;
  struct Params {
  lsTextDocumentItem textDocument;
  +
  + // cquery extension
  + // If specified (e.g. ["clang++", "-DM", "a.cc"]), it overrides the project
  + // entry (e.g. loaded from compile_commands.json or .cquery).
  + std::vector<std::string> args;
  };
  Params params;
  };
  -MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidOpen::Params, textDocument);
  +MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidOpen::Params, textDocument, args);
  MAKE_REFLECT_STRUCT(Ipc_TextDocumentDidOpen, params);
  REGISTER_IPC_MESSAGE(Ipc_TextDocumentDidOpen);
  @@ -26,15 +31,14 @@ struct TextDocumentDidOpenHandler
  void Run(Ipc_TextDocumentDidOpen* request) override {
  // NOTE: This function blocks code lens. If it starts taking a long time
  // we will need to find a way to unblock the code lens request.
  -
  + const auto& params = request->params;
  Timer time;
  - std::string path = request->params.textDocument.uri.GetPath();
  + std::string path = params.textDocument.uri.GetPath();
  if (ShouldIgnoreFileForIndexing(path))
  return;
  std::shared_ptr<ICacheManager> cache_manager = ICacheManager::Make(config);
  - WorkingFile* working_file =
  - working_files->OnOpen(request->params.textDocument);
  + WorkingFile* working_file = working_files->OnOpen(params.textDocument);
  optional<std::string> cached_file_contents =
  cache_manager->LoadCachedFileContents(path);
  if (cached_file_contents)
  @@ -57,8 +61,9 @@ struct TextDocumentDidOpenHandler
  // Submit new index request.
  const Project::Entry& entry = project->FindCompilationEntryForFile(path);
  QueueManager::instance()->index_request.PushBack(
  - Index_Request(entry.filename, entry.args, true /*is_interactive*/,
  - request->params.textDocument.text, cache_manager),
  + Index_Request(
  + entry.filename, params.args.size() ? params.args : entry.args,
  + true /*is_interactive*/, params.textDocument.text, cache_manager),
  true /* priority */);
  }
  };
  