@@ -604,13 +604,13 @@ void mainLoop() {
604
604
605
605
SemaManager manager (
606
606
&project, &wfiles,
607
- [&]( std::string path, std::vector<Diagnostic> diagnostics) {
607
+ []( const std::string & path, std::vector<Diagnostic> diagnostics) {
608
608
PublishDiagnosticParam params;
609
609
params.uri = DocumentUri::fromPath (path);
610
- params.diagnostics = diagnostics;
610
+ params.diagnostics = std::move ( diagnostics) ;
611
611
notify (" textDocument/publishDiagnostics" , params);
612
612
},
613
- [](RequestId id) {
613
+ [](const RequestId & id) {
614
614
if (id.valid ()) {
615
615
ResponseError err;
616
616
err.code = ErrorCode::InternalError;
@@ -705,8 +705,9 @@ void standalone(const std::string &root) {
705
705
WorkingFiles wfiles;
706
706
VFS vfs;
707
707
SemaManager manager (
708
- nullptr , nullptr , [&](std::string, std::vector<Diagnostic>) {},
709
- [](RequestId id) {});
708
+ nullptr , nullptr ,
709
+ [](const std::string &, const std::vector<Diagnostic> &) {},
710
+ [](const RequestId &id) {});
710
711
IncludeComplete complete (&project);
711
712
712
713
MessageHandler handler;
@@ -744,7 +745,7 @@ void standalone(const std::string &root) {
744
745
void index (const std::string &path, const std::vector<const char *> &args,
745
746
IndexMode mode, bool must_exist, RequestId id) {
746
747
pending_index_requests++;
747
- index_request->pushBack ({path, args, mode, must_exist, id },
748
+ index_request->pushBack ({path, args, mode, must_exist, std::move (id) },
748
749
mode != IndexMode::Background);
749
750
}
750
751
@@ -788,7 +789,7 @@ void notifyOrRequest(const char *method, bool request,
788
789
for_stdout->pushBack (output.GetString ());
789
790
}
790
791
791
- static void reply (RequestId id, const char *key,
792
+ static void reply (const RequestId & id, const char *key,
792
793
const std::function<void (JsonWriter &)> &fn) {
793
794
rapidjson::StringBuffer output;
794
795
rapidjson::Writer<rapidjson::StringBuffer> w (output);
@@ -801,7 +802,7 @@ static void reply(RequestId id, const char *key,
801
802
w.Null ();
802
803
break ;
803
804
case RequestId::kInt :
804
- w.Int (atoll (id.value .c_str ()));
805
+ w.Int64 (atoll (id.value .c_str ()));
805
806
break ;
806
807
case RequestId::kString :
807
808
w.String (id.value .c_str (), id.value .size ());
@@ -816,11 +817,12 @@ static void reply(RequestId id, const char *key,
816
817
for_stdout->pushBack (output.GetString ());
817
818
}
818
819
819
- void reply (RequestId id, const std::function<void (JsonWriter &)> &fn) {
820
+ void reply (const RequestId & id, const std::function<void (JsonWriter &)> &fn) {
820
821
reply (id, " result" , fn);
821
822
}
822
823
823
- void replyError (RequestId id, const std::function<void (JsonWriter &)> &fn) {
824
+ void replyError (const RequestId &id,
825
+ const std::function<void (JsonWriter &)> &fn) {
824
826
reply (id, " error" , fn);
825
827
}
826
828
} // namespace pipeline
0 commit comments